From 32ab52a2987f086d34d8ac691eaed5e1af085719 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 1 Jun 2010 13:11:55 +0000 Subject: [PATCH] Remove incorrect Language ID offset attribute from the SDP server - client assumes 0x0100 offset for primary language anyway, and the format of the offset was incorrect anyway. --- .../Incomplete/BluetoothHost/Lib/SDPServices.c | 17 ----------------- .../Incomplete/BluetoothHost/Lib/SDPServices.h | 1 - .../Lib/ServiceDiscoveryProtocol.c | 4 ++-- .../Lib/ServiceDiscoveryProtocol.h | 16 +++++++--------- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c index 2530231aeb..0ad8c013e9 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c @@ -50,21 +50,6 @@ const struct {.Header = (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), .UUID = {BASE_80BIT_UUID, {0x00, 0x00, 0x00, 0x00, 0x10, 0x00}},} } }; - -const struct -{ - uint8_t Header; - uint8_t Size; - Item16Bit_t OffsetList[]; -} PROGMEM SDP_Attribute_LangOffset = - { - .Header = (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit), - .Size = (sizeof(Item16Bit_t) * 1), - .OffsetList = - { - {.Header = (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), .Value = SWAPENDIAN_16(0x0100)} - } - }; const struct { @@ -110,7 +95,6 @@ const ServiceAttributeTable_t SDP_Attribute_Table[] PROGMEM = { {.AttributeID = SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE, .Data = &SDP_Attribute_ServiceHandle }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICECLASSIDS, .Data = &SDP_Attribute_ServiceClassIDs }, - {.AttributeID = SDP_ATTRIBUTE_ID_LANGIDOFFSET, .Data = &SDP_Attribute_LangOffset }, {.AttributeID = SDP_ATTRIBUTE_ID_VERSION, .Data = &SDP_Attribute_Version }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICENAME, .Data = &SDP_Attribute_ServiceName }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION, .Data = &SDP_Attribute_ServiceDescription }, @@ -182,7 +166,6 @@ const ServiceAttributeTable_t RFCOMM_Attribute_Table[] PROGMEM = { {.AttributeID = SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE, .Data = &RFCOMM_Attribute_ServiceHandle }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICECLASSIDS, .Data = &RFCOMM_Attribute_ServiceClassIDs }, - {.AttributeID = SDP_ATTRIBUTE_ID_LANGIDOFFSET, .Data = &RFCOMM_Attribute_LangOffset }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICENAME, .Data = &RFCOMM_Attribute_ServiceName }, {.AttributeID = SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION, .Data = &RFCOMM_Attribute_ServiceDescription }, diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h index 0fd0aa4eda..5ca010c525 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h @@ -48,7 +48,6 @@ #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE 0x0000 #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS 0x0001 - #define SDP_ATTRIBUTE_ID_LANGIDOFFSET 0x0006 #define SDP_ATTRIBUTE_ID_VERSION 0x0200 #define SDP_ATTRIBUTE_ID_SERVICENAME 0x0100 #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION 0x0101 diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c index 66189c0e51..6bb35f65de 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c @@ -291,7 +291,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe MaxAttributeSize = sizeof(ResponsePacket.ResponseData); /* Add the outer Data Element Sequence header for all of the retrieved Attributes */ - uint16_t* TotalResponseSize = SDP_AddDataElementHeader16(&CurrResponsePos, SDP_DATATYPE_Sequence); + uint16_t* TotalResponseSize = SDP_AddSequence16(&CurrResponsePos); /* Search through the list of UUIDs one at a time looking for matching search Attributes */ for (uint8_t CurrUUIDItem = 0; CurrUUIDItem < TotalUUIDs; CurrUUIDItem++) @@ -351,7 +351,7 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t* uint16_t TotalResponseSize; /* Add an inner Data Element Sequence header for the current services's found Attributes */ - uint16_t* AttributeListSize = SDP_AddDataElementHeader16(BufferPos, SDP_DATATYPE_Sequence); + uint16_t* AttributeListSize = SDP_AddSequence16(BufferPos); /* Search through the list of Attributes one at a time looking for values in the current UUID's Attribute table */ for (uint8_t CurrAttribute = 0; CurrAttribute < TotalAttributes; CurrAttribute++) diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h index c9ce9511de..ec55b2fb1c 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h @@ -179,25 +179,23 @@ return Data; } - /** Adds a new Data Element container of the given type with a 16-bit size header to the buffer. The - * buffer pointer's position is advanced past the added header once the element has been added. The - * returned size header value is pre-zeroed out so that it can be incremented as data is placed into - * the Data Element container. + /** Adds a new Data Element Sequence container with a 16-bit size header to the buffer. The buffer + * pointer's position is advanced past the added header once the element has been added. The returned + * size header value is pre-zeroed out so that it can be incremented as data is placed into the Data + * Element Sequence container. * * The total added size of the container header is three bytes, regardless of the size of its contents * as long as the contents' size in bytes fits into a 16-bit integer. * * \param[in, out] BufferPos Pointer to a buffer where the container header is to be placed - * \param[in] Type Type of data the container is to store, a value from the \ref ServiceDiscovery_DataTypes_t enum * * \return Pointer to the 16-bit size value of the contaner header, which has been pre-zeroed */ - static inline uint16_t* SDP_AddDataElementHeader16(void** BufferPos, const uint8_t Type) + static inline uint16_t* SDP_AddSequence16(void** BufferPos) { - SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | Type)); + SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | SDP_DATATYPE_Sequence)); - uint16_t* SizePos = (uint16_t*)*BufferPos; - + uint16_t* SizePos = *BufferPos; SDP_WriteData16(BufferPos, 0); return SizePos;