Document the Bluetooth ACL layer. Remove unneeded parameters from the signalling...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / BluetoothHost.c
index d2bd075..df9f663 100644 (file)
@@ -241,18 +241,25 @@ void Bluetooth_DisconnectionComplete(void)
 /** Bluetooth stack callback event for a non-signal ACL packet reception. This callback fires once a connection\r
  *  to a remote Bluetooth device has been made, and the remote device has sent a non-signalling ACL packet.\r
  *\r
- *  \param PacketLength  Length of the packet data, in bytes - this must be decremented as data is read\r
- *  \param Channel       Bluetooth ACL data channel information structure for the packet's destination channel\r
+ *  \param Data    Pointer to a buffer where the received data is stored\r
+ *  \param DataLen Length of the packet data, in bytes\r
+ *  \param Channel Bluetooth ACL data channel information structure for the packet's destination channel\r
  */\r
-void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel)\r
+void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel)\r
 {\r
-       uint8_t DataPayload[*PacketLength];\r
-\r
-       Pipe_Read_Stream_LE(&DataPayload, *PacketLength);\r
-       *PacketLength = 0;\r
-\r
-       printf_P(PSTR("Packet Received (Channel 0x%04X, PSM: 0x%02x):\r\n"), Channel->LocalNumber, Channel->PSM);\r
-       for (uint16_t Byte = 0; Byte < sizeof(DataPayload); Byte++)\r
-         printf_P(PSTR("0x%02X "), DataPayload[Byte]);\r
-       puts_P(PSTR("\r\n"));\r
+       switch (Channel->PSM)\r
+       {\r
+               case CHANNEL_PSM_SDP:\r
+                       /* Service Discovery Protocol packet */\r
+                       ServiceDiscovery_ProcessPacket(Data, DataLen, Channel);\r
+                       break;\r
+               default:\r
+                       /* Unknown Protocol packet */\r
+                       printf_P(PSTR("Packet Received (Channel 0x%04X, PSM: 0x%02x):\r\n"), Channel->LocalNumber, Channel->PSM);\r
+                       for (uint16_t Byte = 0; Byte < DataLen; Byte++)\r
+                         printf_P(PSTR("0x%02X "), ((uint8_t*)Data)[Byte]);\r
+                       puts_P(PSTR("\r\n"));\r
+                       \r
+                       break;\r
+       }\r
 }\r