Add TEST RFCOMM command handler. Remove the RFCOMM channel UseUIFrame element, as...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Jun 2010 07:17:47 +0000 (07:17 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Jun 2010 07:17:47 +0000 (07:17 +0000)
Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
LUFA/ManPages/LUFAPoweredProjects.txt

index 6634863..994a24b 100644 (file)
@@ -235,7 +235,6 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress, Bluet
                        CurrRFCOMMChannel->DLCI         = FrameAddress->DLCI;
                        CurrRFCOMMChannel->State        = RFCOMM_Channel_Open;
                        CurrRFCOMMChannel->Priority     = 7 + (CurrRFCOMMChannel->DLCI >> 3) + ((CurrRFCOMMChannel->DLCI >> 3) * 7);
                        CurrRFCOMMChannel->DLCI         = FrameAddress->DLCI;
                        CurrRFCOMMChannel->State        = RFCOMM_Channel_Open;
                        CurrRFCOMMChannel->Priority     = 7 + (CurrRFCOMMChannel->DLCI >> 3) + ((CurrRFCOMMChannel->DLCI >> 3) * 7);
-                       CurrRFCOMMChannel->UseUIFrames  = false;
                        CurrRFCOMMChannel->MTU          = 0xFFFF;
                        CurrRFCOMMChannel->Signals      = 0;
                        CurrRFCOMMChannel->BreakSignals = 0;
                        CurrRFCOMMChannel->MTU          = 0xFFFF;
                        CurrRFCOMMChannel->Signals      = 0;
                        CurrRFCOMMChannel->BreakSignals = 0;
index 78e9b54..d37c068 100644 (file)
@@ -85,7 +85,6 @@
                        uint8_t  DLCI;
                        uint8_t  State;
                        uint8_t  Priority;
                        uint8_t  DLCI;
                        uint8_t  State;
                        uint8_t  Priority;
-                       bool     UseUIFrames;
                        uint16_t MTU;
                        uint8_t  StatusFlags;
                        uint8_t  Signals;
                        uint16_t MTU;
                        uint8_t  StatusFlags;
                        uint8_t  Signals;
index 3a6bf67..1d18633 100644 (file)
@@ -47,7 +47,7 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* c
        switch (CommandHeader->Command)\r
        {\r
                case RFCOMM_Control_Test:\r
        switch (CommandHeader->Command)\r
        {\r
                case RFCOMM_Control_Test:\r
-                       RFCOMM_ProcessTestCommand(CommandHeader, CommandData, Channel);\r
+                       RFCOMM_ProcessTestCommand(CommandHeader, CommandDataLen, CommandData, Channel);\r
                        break;\r
                case RFCOMM_Control_FlowControlEnable:\r
                        RFCOMM_ProcessFCECommand(CommandHeader, CommandData, Channel);\r
                        break;\r
                case RFCOMM_Control_FlowControlEnable:\r
                        RFCOMM_ProcessFCECommand(CommandHeader, CommandData, Channel);\r
@@ -73,10 +73,29 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* c
        }\r
 }\r
 \r
        }\r
 }\r
 \r
-static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
-                                                 Bluetooth_Channel_t* const Channel)\r
+static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen,\r
+                                      const uint8_t* CommandData, Bluetooth_Channel_t* const Channel)\r
 {\r
 {\r
+       const uint8_t* Params = (const uint8_t*)CommandData;\r
+\r
        BT_RFCOMM_DEBUG(1, "<< TEST Command");\r
        BT_RFCOMM_DEBUG(1, "<< TEST Command");\r
+       \r
+       struct\r
+       {\r
+               RFCOMM_Command_t CommandHeader;\r
+               uint8_t          Length;\r
+               uint8_t          TestData[CommandDataLen];\r
+       } TestResponse;\r
+\r
+       /* Fill out the Test response data */\r
+       TestResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_Test, .EA = true};\r
+       TestResponse.Length        = (CommandDataLen << 1) | 0x01;\r
+       memcpy(TestResponse.TestData, Params, CommandDataLen);\r
+       \r
+       BT_RFCOMM_DEBUG(1, ">> TEST Response");\r
+\r
+       /* Send the PDN response to acknowledge the command */\r
+       RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(TestResponse), &TestResponse, Channel);\r
 }\r
 \r
 static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
 }\r
 \r
 static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
@@ -190,7 +209,6 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
        /* Save the new channel configuration */\r
        RFCOMMChannel->State       = RFCOMM_Channel_Open;\r
        RFCOMMChannel->Priority    = Params->Priority;\r
        /* Save the new channel configuration */\r
        RFCOMMChannel->State       = RFCOMM_Channel_Open;\r
        RFCOMMChannel->Priority    = Params->Priority;\r
-       RFCOMMChannel->UseUIFrames = (Params->FrameType != 0);\r
        RFCOMMChannel->MTU         = Params->MaximumFrameSize;\r
        \r
        struct\r
        RFCOMMChannel->MTU         = Params->MaximumFrameSize;\r
        \r
        struct\r
index 8cefa51..b992c27 100644 (file)
                void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel);\r
 \r
                #if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)\r
                void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel);\r
 \r
                #if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)\r
-                       static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
-                                                             Bluetooth_Channel_t* const Channel);\r
+                       static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t CommandDataLen, \r
+                                                             const uint8_t* CommandData, Bluetooth_Channel_t* const Channel);\r
                        static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
                                                             Bluetooth_Channel_t* const Channel);\r
                        static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
                        static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
                                                             Bluetooth_Channel_t* const Channel);\r
                        static void RFCOMM_ProcessFCDCommand(const RFCOMM_Command_t* const CommandHeader, const uint8_t* CommandData,\r
index d012251..c5c490e 100644 (file)
@@ -487,8 +487,8 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const ui
  *
  *  \return True if all the UUIDs given in the UUID list appear in the given attribute table, false otherwise
  */
  *
  *  \return True if all the UUIDs given in the UUID list appear in the given attribute table, false otherwise
  */
-static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs, uint16_t* UUIDMatchFlags,
-                               const void* CurrAttribute)
+static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
+                               uint16_t* const UUIDMatchFlags, const void* CurrAttribute)
 {
        uint8_t CurrAttributeType = (pgm_read_byte(CurrAttribute) & ~0x07);
 
 {
        uint8_t CurrAttributeType = (pgm_read_byte(CurrAttribute) & ~0x07);
 
index e7d02b0..5310b6f 100644 (file)
 
                        static bool     SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
                                                               const ServiceAttributeTable_t* CurrAttributeTable);
 
                        static bool     SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
                                                               const ServiceAttributeTable_t* CurrAttributeTable);
-                       static void     SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs, uint16_t* UUIDMatchFlags,
-                                                          const void* CurrAttribute);
+                       static void     SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_t TotalUUIDs,
+                                                          uint16_t* const UUIDMatchFlags, const void* CurrAttribute);
 
                        static uint8_t  SDP_GetAttributeList(uint16_t AttributeList[][2], const void** const CurrentParameter);
                        static uint8_t  SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void** const CurrentParameter);
 
                        static uint8_t  SDP_GetAttributeList(uint16_t AttributeList[][2], const void** const CurrentParameter);
                        static uint8_t  SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void** const CurrentParameter);
index bf445bc..0cc1d8e 100644 (file)
@@ -27,6 +27,7 @@
  *  - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
  *  - U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/
  *  - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com
  *  - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
  *  - U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/
  *  - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com
+ *  - USBFOO 2, AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
  * 
  *  \section Sec_LUFAProjects Projects Using LUFA (Hobbyist)
  *
  * 
  *  \section Sec_LUFAProjects Projects Using LUFA (Hobbyist)
  *