Added ability to search by Channel PSM to the GetChannelData() function in the Blueto...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / Lib / BluetoothACLPackets.c
index 1a8cf06..8c417ff 100644 (file)
   this software.\r
 */\r
 \r
+/*\r
+       TODO: Make SendPacket respect receiver's MTU\r
+       TODO: Make ReceivePacket stitch together MTU fragments (?)\r
+       TODO: Add channel opened/closed callbacks\r
+ */\r
+\r
 #define  INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C\r
 #include "BluetoothACLPackets.h"\r
 \r
@@ -187,7 +193,8 @@ static void Bluetooth_ProcessIncommingACLPackets(void)
                Pipe_ClearIN();\r
                Pipe_Freeze();\r
 \r
-               Bluetooth_PacketReceived(PacketData, DataHeader.PayloadLength, Bluetooth_GetChannelData(DataHeader.DestinationChannel, false));\r
+               Bluetooth_PacketReceived(PacketData, DataHeader.PayloadLength,\r
+                                        Bluetooth_GetChannelData(DataHeader.DestinationChannel, CHANNEL_SEARCH_LOCALNUMBER));\r
        }\r
 }\r
 \r
@@ -362,7 +369,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);\r
        \r
        /* Try to retrieve the existing channel's information structure if it exists */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionRequest.SourceChannel, true);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);\r
 \r
        /* If an existing channel item with the correct remote channel number was not found, find a free channel entry */\r
        if (ChannelData == NULL)\r
@@ -447,7 +454,7 @@ static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* con
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);       \r
 \r
        /* Search for the referenced channel in the channel information list */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionResponse.SourceChannel, false);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionResponse.SourceChannel, CHANNEL_SEARCH_LOCALNUMBER);\r
 \r
        /* Only progress if the referenced channel data was found */\r
        if (ChannelData != NULL)\r
@@ -478,7 +485,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
        Pipe_Freeze();\r
 \r
        /* Search for the referenced channel in the channel information list */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationRequest.DestinationChannel, false);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationRequest.DestinationChannel, CHANNEL_SEARCH_LOCALNUMBER);\r
 \r
        BT_ACL_DEBUG(1, "<< L2CAP Configuration Request");\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);\r
@@ -564,7 +571,7 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConfigurationResponse.Result);\r
 \r
        /* Search for the referenced channel in the channel information list */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationResponse.SourceChannel, true);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);\r
        \r
        /* Only update the channel's state if it was found in the channel list */\r
        if (ChannelData != NULL)\r
@@ -608,7 +615,7 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
        Pipe_Freeze();\r
        \r
        /* Search for the referenced channel in the channel information list */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, true);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);\r
 \r
        struct\r
        {\r
@@ -654,7 +661,7 @@ static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t*
        Pipe_Freeze();\r
        \r
        /* Search for the referenced channel in the channel information list */\r
-       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionResponse.SourceChannel, true);\r
+       Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);\r
        \r
        /* If the channel was found in the channel list, close it */    \r
        if (ChannelData != NULL)\r