Add library maintenance scripts.
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / BluetoothACLPackets.c
index ed5db00..a02a66b 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2012.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -207,7 +207,7 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
 /** Retrieves the channel information structure with the given local or remote channel number from the channel list.
  *
  *  \param[in] SearchValue  Value to search for in the channel structure list
 /** Retrieves the channel information structure with the given local or remote channel number from the channel list.
  *
  *  \param[in] SearchValue  Value to search for in the channel structure list
- *  \param[in] SearchKey    Key to search within the channel structure, a CHANNEL_SEARCH_* mask
+ *  \param[in] SearchKey    Key to search within the channel structure, a \c CHANNEL_SEARCH_* mask
  *
  *  \return Pointer to the matching channel information structure in the channel table if found, NULL otherwise
  */
  *
  *  \return Pointer to the matching channel information structure in the channel table if found, NULL otherwise
  */
@@ -473,8 +473,8 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
        ResponsePacket.SignalCommandHeader.Length            = sizeof(ResponsePacket.ConnectionResponse);
 
        /* Fill out the Connection Response in the response packet */
        ResponsePacket.SignalCommandHeader.Length            = sizeof(ResponsePacket.ConnectionResponse);
 
        /* Fill out the Connection Response in the response packet */
-       ResponsePacket.ConnectionResponse.DestinationChannel = ChannelData->LocalNumber;
-       ResponsePacket.ConnectionResponse.SourceChannel      = ChannelData->RemoteNumber;
+       ResponsePacket.ConnectionResponse.DestinationChannel = (ChannelData != NULL) ? ChannelData->LocalNumber  : 0;
+       ResponsePacket.ConnectionResponse.SourceChannel      = (ChannelData != NULL) ? ChannelData->RemoteNumber : 0;
        ResponsePacket.ConnectionResponse.Result             = ChannelStatus;
        ResponsePacket.ConnectionResponse.Status             = 0x00;
 
        ResponsePacket.ConnectionResponse.Result             = ChannelStatus;
        ResponsePacket.ConnectionResponse.Status             = 0x00;
 
@@ -576,7 +576,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
        ResponsePacket.SignalCommandHeader.Length            = sizeof(ResponsePacket.ConfigurationResponse);
 
        /* Fill out the Configuration Response in the response packet */
        ResponsePacket.SignalCommandHeader.Length            = sizeof(ResponsePacket.ConfigurationResponse);
 
        /* Fill out the Configuration Response in the response packet */
-       ResponsePacket.ConfigurationResponse.SourceChannel   = ChannelData->RemoteNumber;
+       ResponsePacket.ConfigurationResponse.SourceChannel   = (ChannelData != NULL) ? ChannelData->RemoteNumber   : 0;
        ResponsePacket.ConfigurationResponse.Flags           = 0x00;
        ResponsePacket.ConfigurationResponse.Result          = (ChannelData != NULL) ? BT_CONFIGURATION_SUCCESSFUL : BT_CONFIGURATION_REJECTED;
 
        ResponsePacket.ConfigurationResponse.Flags           = 0x00;
        ResponsePacket.ConfigurationResponse.Result          = (ChannelData != NULL) ? BT_CONFIGURATION_SUCCESSFUL : BT_CONFIGURATION_REJECTED;
 
@@ -681,8 +681,8 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
        ResponsePacket.SignalCommandHeader.Length               = sizeof(ResponsePacket.DisconnectionResponse);
 
        /* Fill out the Disconnection Response in the response packet */
        ResponsePacket.SignalCommandHeader.Length               = sizeof(ResponsePacket.DisconnectionResponse);
 
        /* Fill out the Disconnection Response in the response packet */
-       ResponsePacket.DisconnectionResponse.DestinationChannel = ChannelData->RemoteNumber;
-       ResponsePacket.DisconnectionResponse.SourceChannel      = ChannelData->LocalNumber;
+       ResponsePacket.DisconnectionResponse.DestinationChannel = (ChannelData != NULL) ? ChannelData->RemoteNumber : 0;
+       ResponsePacket.DisconnectionResponse.SourceChannel      = (ChannelData != NULL) ? ChannelData->LocalNumber  : 0;
 
        Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
 
 
        Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);