aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-06-02 14:49:06 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-06-02 14:49:06 +0000
commit23a94a7181a0773431b3ea5dbcddab9e06010391 (patch)
tree916a61f17a3a1f67278dbbe4d1bfe29571f6e247 /Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
parentc362709a1e2b0252cffbf1633f7cce41fea4d769 (diff)
downloadlufa-23a94a7181a0773431b3ea5dbcddab9e06010391.tar.gz
lufa-23a94a7181a0773431b3ea5dbcddab9e06010391.tar.bz2
lufa-23a94a7181a0773431b3ea5dbcddab9e06010391.zip
Fix byte ordering of UUIDs in the SDP server - host can now successfully pair to the Bluetooth device and discover the exposed Serial Port Profile RFCOMM service.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
index ffe2be0b7..df0db3bed 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
@@ -34,11 +34,11 @@
/** Service attribute table list, containing a pointer to each service attribute table the device contains */
const ServiceAttributeTable_t* SDP_Services_Table[] PROGMEM =
{
- RFCOMM_Attribute_Table,
+ SerialPort_Attribute_Table,
};
/** Base UUID value common to all standardized Bluetooth services */
-const UUID_t BaseUUID PROGMEM = {BASE_80BIT_UUID, {0, 0, 0, 0, 0, 0}};
+const UUID_t BaseUUID PROGMEM = {0x00000000, BASE_80BIT_UUID};
/** Main Service Discovery Protocol packet processing routine. This function processes incomming SDP packets from
* a connected Bluetooth device, and sends back appropriate responses to allow other devices to determine the
@@ -487,6 +487,16 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES], const uint8_
/* Look for matches in the UUID list against the current attribute UUID value */
for (uint8_t i = 0; i < TotalUUIDs; i++)
{
+ uint8_t CurrentUUID[16];
+ memcpy_P(CurrentUUID, (CurrAttribute + 1), 16);
+
+ BT_SDP_DEBUG(2, "-- TEST UUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ CurrentUUID[0], CurrentUUID[1], CurrentUUID[2], CurrentUUID[3],
+ CurrentUUID[4], CurrentUUID[5],
+ CurrentUUID[6], CurrentUUID[7],
+ CurrentUUID[8], CurrentUUID[9],
+ CurrentUUID[10], CurrentUUID[11], CurrentUUID[12], CurrentUUID[13], CurrentUUID[14], CurrentUUID[15]);
+
if (!(UUIDMatch[i]) && !(memcmp_P(UUIDList[i], (CurrAttribute + 1), UUID_SIZE_BYTES)))
{
/* Indicate match found for the current attribute UUID and early-abort */
@@ -580,19 +590,28 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES], const void**
uint8_t* CurrentUUID = UUIDList[TotalUUIDs++];
uint8_t UUIDLength = SDP_GetDataElementSize(CurrentParameter, &ElementHeaderSize);
- /* Copy over the base UUID value to the free UUID slot in the list */
- memcpy_P(CurrentUUID, &BaseUUID, sizeof(BaseUUID));
-
/* Copy over UUID from the container to the free slot */
- memcpy(&CurrentUUID[UUID_SIZE_BYTES - UUIDLength], *CurrentParameter, UUIDLength);
+ if (UUIDLength <= 4)
+ {
+ /* Copy over the base UUID value to the free UUID slot in the list */
+ memcpy_P(CurrentUUID, &BaseUUID, sizeof(BaseUUID));
+
+ /* Copy over short UUID */
+ memcpy(CurrentUUID + (4 - UUIDLength), *CurrentParameter, UUIDLength);
+ }
+ else
+ {
+ /* Copy over full UUID */
+ memcpy(CurrentUUID, *CurrentParameter, UUIDLength);
+ }
BT_SDP_DEBUG(2, "-- UUID (%d): %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
UUIDLength,
CurrentUUID[0], CurrentUUID[1], CurrentUUID[2], CurrentUUID[3],
CurrentUUID[4], CurrentUUID[5],
- CurrentUUID[6], CurrentUUID[7],
- CurrentUUID[8], CurrentUUID[9],
- CurrentUUID[10], CurrentUUID[11], CurrentUUID[12], CurrentUUID[13], CurrentUUID[14], CurrentUUID[15]);
+ CurrentUUID[6], CurrentUUID[7],
+ CurrentUUID[8], CurrentUUID[9],
+ CurrentUUID[10], CurrentUUID[11], CurrentUUID[12], CurrentUUID[13], CurrentUUID[14], CurrentUUID[15]);
ServicePatternLength -= (UUIDLength + ElementHeaderSize);
*CurrentParameter += UUIDLength;