diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-04-13 11:19:04 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-04-13 11:19:04 +0000 |
| commit | dab91d1b2ffdd5b315b3e42a91afb9207e6e35c0 (patch) | |
| tree | 35ee822c10f6453d4c162190e2a2488a9cc253e2 /Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c | |
| parent | b24e7335a68dc840b475f1566f21ab239a299620 (diff) | |
Document the Bluetooth ACL layer. Remove unneeded parameters from the signalling command processing routines.
Change over the code so that the bluetooth packet data is read in by the stack rather than the user application, to make it more unform for sending/receiving, and so the library can handle incomming fragmentation in the future.
Start Service Discovery Protocol decoding and processing.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1205 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c')
| -rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c index d2bd0758..df9f663e 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c @@ -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
* to a remote Bluetooth device has been made, and the remote device has sent a non-signalling ACL packet.
*
- * \param PacketLength Length of the packet data, in bytes - this must be decremented as data is read
- * \param Channel Bluetooth ACL data channel information structure for the packet's destination channel
+ * \param Data Pointer to a buffer where the received data is stored
+ * \param DataLen Length of the packet data, in bytes
+ * \param Channel Bluetooth ACL data channel information structure for the packet's destination channel
*/
-void Bluetooth_PacketReceived(uint16_t* PacketLength, Bluetooth_Channel_t* Channel)
+void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel)
{
- uint8_t DataPayload[*PacketLength];
-
- Pipe_Read_Stream_LE(&DataPayload, *PacketLength);
- *PacketLength = 0;
-
- printf_P(PSTR("Packet Received (Channel 0x%04X, PSM: 0x%02x):\r\n"), Channel->LocalNumber, Channel->PSM);
- for (uint16_t Byte = 0; Byte < sizeof(DataPayload); Byte++)
- printf_P(PSTR("0x%02X "), DataPayload[Byte]);
- puts_P(PSTR("\r\n"));
+ switch (Channel->PSM)
+ {
+ case CHANNEL_PSM_SDP:
+ /* Service Discovery Protocol packet */
+ ServiceDiscovery_ProcessPacket(Data, DataLen, Channel);
+ break;
+ default:
+ /* Unknown Protocol packet */
+ printf_P(PSTR("Packet Received (Channel 0x%04X, PSM: 0x%02x):\r\n"), Channel->LocalNumber, Channel->PSM);
+ for (uint16_t Byte = 0; Byte < DataLen; Byte++)
+ printf_P(PSTR("0x%02X "), ((uint8_t*)Data)[Byte]);
+ puts_P(PSTR("\r\n"));
+
+ break;
+ }
}
|
