From b522e35965ab19206ab76f83026fb42f052a2d92 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 13 Jun 2010 12:44:20 +0000 Subject: [PATCH] Rename the incomplete Bluetooth Host demo's ServiceDiscoveryProtocol.c/.h files to SDP.c/.h. Fix compile errors in RFCOMM.c/.h. --- .../Host/Incomplete/BluetoothHost/BluetoothHost.h | 4 ++-- Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c | 15 ++++++++------- Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h | 4 ++-- .../Lib/{ServiceDiscoveryProtocol.c => SDP.c} | 2 +- .../Lib/{ServiceDiscoveryProtocol.h => SDP.h} | 0 .../Incomplete/BluetoothHost/Lib/SDPServices.h | 2 +- Demos/Host/Incomplete/BluetoothHost/makefile | 2 +- LUFA.pnproj | 2 +- 8 files changed, 16 insertions(+), 15 deletions(-) rename Demos/Host/Incomplete/BluetoothHost/Lib/{ServiceDiscoveryProtocol.c => SDP.c} (99%) rename Demos/Host/Incomplete/BluetoothHost/Lib/{ServiceDiscoveryProtocol.h => SDP.h} (100%) diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h index b628f8b898..893b9466c3 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h @@ -44,9 +44,9 @@ #include #include - #include "Lib/ServiceDiscoveryProtocol.h" - #include "Lib/RFCOMM.h" #include "Lib/BluetoothStack.h" + #include "Lib/SDP.h" + #include "Lib/RFCOMM.h" #include "DeviceDescriptor.h" #include "ConfigDescriptor.h" diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c index 8e533ac72a..60cce84846 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c @@ -131,7 +131,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress, Bluet /* Find a free entry in the RFCOMM channel multiplexer state array */ for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++) { - RFCOMM_Channel_t* CurrRFCOMMChannel = RFCOMM_Channels[i]; + RFCOMM_Channel_t* CurrRFCOMMChannel = &RFCOMM_Channels[i]; /* If the channel's DLCI is zero, the channel state entry is free */ if (!(CurrRFCOMMChannel->DLCI)) @@ -166,16 +166,17 @@ static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress, const if (FrameAddress->DLCI == RFCOMM_CONTROL_DLCI) { - RFCOMM_ProcessControlCommand((const RFCOMM_Command_t*)FrameData, Channel); + RFCOMM_ProcessControlCommand(FrameData, Channel); return; } // TODO: Handle regular channel data here } -static void RFCOMM_ProcessControlCommand(const RFCOMM_Command_t* CommandHeader, Bluetooth_Channel_t* const Channel) +static void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel) { - const uint8_t* CommandData = (const uint8_t*)Data + sizeof(RFCOMM_Command_t); + const RFCOMM_Command_t* CommandHeader = (const RFCOMM_Command_t*)Command; + const uint8_t* CommandData = (const uint8_t*)Command + sizeof(RFCOMM_Command_t); switch (CommandHeader->Command) { @@ -202,7 +203,7 @@ static void RFCOMM_ProcessControlCommand(const RFCOMM_Command_t* CommandHeader, // TODO - Set channel state // RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData( - RFCOMMChannel->Configured = true; +// RFCOMMChannel->Configured = true; // TODO - send ACK/NAK response break; @@ -297,11 +298,11 @@ static uint16_t RFCOMM_GetFrameDataLength(const uint8_t* const BufferPos) return (((uint16_t)SecondOctet << 7) | FirstOctet >> 1); } -RFCOMM_Channel_t RFCOMM_GetChannelData(const uint8_t DLCI) +RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI) { for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++) { - RFCOMM_Channel_t* CurrRFCOMMChannel = RFCOMM_Channels[i]; + RFCOMM_Channel_t* CurrRFCOMMChannel = &RFCOMM_Channels[i]; if (CurrRFCOMMChannel->DLCI == DLCI) return CurrRFCOMMChannel; diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h index 69cab49445..355331ae80 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h @@ -120,7 +120,7 @@ static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress, const uint16_t FrameLength, const uint8_t* FrameData, Bluetooth_Channel_t* const Channel); - static void RFCOMM_ProcessControlCommand(const RFCOMM_Command_t* CommandHeader, Bluetooth_Channel_t* const Channel); + static void RFCOMM_ProcessControlCommand(const uint8_t* Command, Bluetooth_Channel_t* const Channel); static void RFCOMM_SendFrame(const uint8_t DLCI, const bool CommandResponse, const uint8_t Control, const uint16_t DataLen, const void* Data, Bluetooth_Channel_t* const Channel); @@ -128,7 +128,7 @@ static uint8_t RFCOMM_GetFCSValue(const void* FrameStart, uint8_t Length); static uint16_t RFCOMM_GetFrameDataLength(const uint8_t* const BufferPos); - RFCOMM_Channel_t RFCOMM_GetChannelData(const uint8_t DLCI); + RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI); #endif #endif diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c similarity index 99% rename from Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c rename to Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c index 5223d29b18..0daf8e24e8 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c @@ -41,7 +41,7 @@ */ #define INCLUDE_FROM_SERVICEDISCOVERYPROTOCOL_C -#include "ServiceDiscoveryProtocol.h" +#include "SDP.h" /** Service attribute table list, containing a pointer to each service attribute table the device contains */ const ServiceAttributeTable_t* SDP_Services_Table[] PROGMEM = diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h similarity index 100% rename from Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h rename to Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h index b0a78e686a..cc3ae32ef3 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h @@ -37,7 +37,7 @@ #define _SDPSERVICES_H_ /* Includes: */ - #include "ServiceDiscoveryProtocol.h" + #include "SDP.h" /* Macros: */ /** Size of a full 128 bit UUID, in bytes. */ diff --git a/Demos/Host/Incomplete/BluetoothHost/makefile b/Demos/Host/Incomplete/BluetoothHost/makefile index 8e3c55a7bd..6f448fa64b 100644 --- a/Demos/Host/Incomplete/BluetoothHost/makefile +++ b/Demos/Host/Incomplete/BluetoothHost/makefile @@ -135,7 +135,7 @@ SRC = $(TARGET).c \ Lib/BluetoothStack.c \ Lib/BluetoothHCICommands.c \ Lib/BluetoothACLPackets.c \ - Lib/ServiceDiscoveryProtocol.c \ + Lib/SDP.c \ Lib/SDPServices.c \ Lib/RFCOMM.c \ $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \ diff --git a/LUFA.pnproj b/LUFA.pnproj index 6b4402eb16..f951e033c4 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file