aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-04-06 03:56:45 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-04-06 03:56:45 +0000
commitb9c7d196152652df918a822522061c3fe193d273 (patch)
tree97129bb84caeb4c0342f5c9cffce09f680f02490 /Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
parentee74b4948f5911de678886890d991db2b3267b06 (diff)
downloadlufa-b9c7d196152652df918a822522061c3fe193d273.tar.gz
lufa-b9c7d196152652df918a822522061c3fe193d273.tar.bz2
lufa-b9c7d196152652df918a822522061c3fe193d273.zip
Add packet reception and send routines to the ACL layer of the incomplete Bluetooth Host demo.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
index 17503ea54..c2c990214 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
@@ -91,21 +91,35 @@ void Bluetooth_ProcessACLPackets(void)
}
else
{
- uint8_t DataPayload[DataHeader.PayloadLength];
- Pipe_Read_Stream_LE(&DataPayload, sizeof(DataPayload));
- DataHeader.PayloadLength = 0;
+ Bluetooth_PacketReceived(&DataHeader.PayloadLength, Bluetooth_GetChannelData(DataHeader.DestinationChannel, true));
- BT_ACL_DEBUG("-- Data Payload: ", NULL);
- for (uint16_t B = 0; B < sizeof(DataPayload); B++)
- printf("0x%02X ", DataPayload[B]);
- printf("\r\n");
-
- Pipe_Discard_Stream(ACLPacketHeader.DataLength);
- Pipe_ClearIN();
+ Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
+ Pipe_Discard_Stream(DataHeader.PayloadLength);
+ Pipe_ClearIN();
Pipe_Freeze();
}
}
+void Bluetooth_SendPacket(uint8_t* Data, uint16_t DataLen, Bluetooth_Channel_t* Channel)
+{
+ Bluetooth_ACL_Header_t ACLPacketHeader;
+ Bluetooth_DataPacket_Header_t DataHeader;
+
+ ACLPacketHeader.ConnectionHandle = Bluetooth_Connection.ConnectionHandle;
+ ACLPacketHeader.DataLength = sizeof(DataHeader) + DataLen;
+ DataHeader.PayloadLength = DataLen;
+ DataHeader.DestinationChannel = Channel->RemoteNumber;
+
+ Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
+ Pipe_Unfreeze();
+
+ Pipe_Write_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
+ Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
+ Pipe_Write_Stream_LE(Data, DataLen);
+
+ Pipe_Freeze();
+}
+
static inline void Bluetooth_SignalPacket_ConnectionRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,
Bluetooth_DataPacket_Header_t* DataHeader,
Bluetooth_SignalCommand_Header_t* SignalCommandHeader)