aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-06-23 07:17:47 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-06-23 07:17:47 +0000
commit2eff731ecfbcfec4f3152992e5ae5602a3694424 (patch)
treee730c05882a027ce2cbed2ac57fa05b888e6946c /Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
parent559af022041942be21d7cabd398639f4d6db52ea (diff)
downloadlufa-2eff731ecfbcfec4f3152992e5ae5602a3694424.tar.gz
lufa-2eff731ecfbcfec4f3152992e5ae5602a3694424.tar.bz2
lufa-2eff731ecfbcfec4f3152992e5ae5602a3694424.zip
Add TEST RFCOMM command handler. Remove the RFCOMM channel UseUIFrame element, as the Bluetooth adaptions to RFCOMM only allow UIH frames to be used.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
index 3a6bf67c5..1d1863348 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
@@ -47,7 +47,7 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* c
switch (CommandHeader->Command)
{
case RFCOMM_Control_Test:
- RFCOMM_ProcessTestCommand(CommandHeader, CommandData, Channel);
+ RFCOMM_ProcessTestCommand(CommandHeader, CommandDataLen, CommandData, Channel);
break;
case RFCOMM_Control_FlowControlEnable:
RFCOMM_ProcessFCECommand(CommandHeader, CommandData, Channel);
@@ -73,10 +73,29 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* c
}
}
-static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
- Bluetooth_Channel_t* const Channel)
+static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,
+ const uint8_t* CommandData, Bluetooth_Channel_t* const Channel)
{
+ const uint8_t* Params = (const uint8_t*)CommandData;
+
BT_RFCOMM_DEBUG(1, "<< TEST Command");
+
+ struct
+ {
+ RFCOMM_Command_t CommandHeader;
+ uint8_t Length;
+ uint8_t TestData[CommandDataLen];
+ } TestResponse;
+
+ /* Fill out the Test response data */
+ TestResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_Test, .EA = true};
+ TestResponse.Length = (CommandDataLen << 1) | 0x01;
+ memcpy(TestResponse.TestData, Params, CommandDataLen);
+
+ BT_RFCOMM_DEBUG(1, ">> TEST Response");
+
+ /* Send the PDN response to acknowledge the command */
+ RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(TestResponse), &TestResponse, Channel);
}
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,
@@ -190,7 +209,6 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
/* Save the new channel configuration */
RFCOMMChannel->State = RFCOMM_Channel_Open;
RFCOMMChannel->Priority = Params->Priority;
- RFCOMMChannel->UseUIFrames = (Params->FrameType != 0);
RFCOMMChannel->MTU = Params->MaximumFrameSize;
struct