diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-06-01 11:07:29 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-06-01 11:07:29 +0000 |
| commit | 8319574fa643303b29acb73ecbd955bb2341cb89 (patch) | |
| tree | f3de5f246bc245a81b01508176d919638d62bcb1 /Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c | |
| parent | 4d79533e7326c9e7014139702e75aaaf75bd2567 (diff) | |
Much faster attribute range lookup - look through short list of attributes and compare to range, rather than looking up by each possible value within the range.
Cleanups to SDP code. Add missing RFCOMM language base ID offset attribute. Fix incorrect definition of the SWAPENDIAN_32() macro.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1297 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c')
| -rw-r--r-- | Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c index 537c81f0..2530231a 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c @@ -38,8 +38,8 @@ const struct const struct
{
- uint8_t Header;
- uint16_t Size;
+ uint8_t Header;
+ uint16_t Size;
ItemUUID_t UUIDList[];
} PROGMEM SDP_Attribute_ServiceClassIDs =
{
@@ -50,32 +50,32 @@ 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 VersionList[];
-} PROGMEM SDP_Attribute_Version =
+ Item16Bit_t OffsetList[];
+} PROGMEM SDP_Attribute_LangOffset =
{
.Header = (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
.Size = (sizeof(Item16Bit_t) * 1),
- .VersionList =
+ .OffsetList =
{
{.Header = (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), .Value = SWAPENDIAN_16(0x0100)}
}
- };
+ };
const struct
{
uint8_t Header;
uint8_t Size;
- Item16Bit_t OffsetList[];
-} PROGMEM SDP_Attribute_LangOffset =
+ Item16Bit_t VersionList[];
+} PROGMEM SDP_Attribute_Version =
{
.Header = (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
.Size = (sizeof(Item16Bit_t) * 1),
- .OffsetList =
+ .VersionList =
{
{.Header = (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), .Value = SWAPENDIAN_16(0x0100)}
}
@@ -83,9 +83,9 @@ const struct const struct
{
- uint8_t Header;
- uint8_t Size;
- char Text[];
+ uint8_t Header;
+ uint8_t Size;
+ char Text[];
} PROGMEM SDP_Attribute_ServiceName =
{
.Header = (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
@@ -95,9 +95,9 @@ const struct const struct
{
- uint8_t Header;
- uint8_t Size;
- char Text[];
+ uint8_t Header;
+ uint8_t Size;
+ char Text[];
} PROGMEM SDP_Attribute_ServiceDescription =
{
.Header = (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
@@ -110,8 +110,8 @@ 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_VERSION, .Data = &SDP_Attribute_Version },
{.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 },
@@ -126,8 +126,8 @@ const struct const struct
{
- uint8_t Header;
- uint16_t Size;
+ uint8_t Header;
+ uint16_t Size;
ItemUUID_t UUIDList[];
} PROGMEM RFCOMM_Attribute_ServiceClassIDs =
{
@@ -143,7 +143,22 @@ const struct {
uint8_t Header;
uint8_t Size;
- char Text[];
+ Item16Bit_t OffsetList[];
+} PROGMEM RFCOMM_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
+{
+ uint8_t Header;
+ uint8_t Size;
+ char Text[];
} PROGMEM RFCOMM_Attribute_ServiceName =
{
.Header = (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
@@ -153,9 +168,9 @@ const struct const struct
{
- uint8_t Header;
- uint8_t Size;
- char Text[];
+ uint8_t Header;
+ uint8_t Size;
+ char Text[];
} PROGMEM RFCOMM_Attribute_ServiceDescription =
{
.Header = (SDP_DATATYPE_String | SDP_DATASIZE_Variable8Bit),
@@ -167,6 +182,7 @@ 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 },
|
