aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-06-03 07:45:09 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-06-03 07:45:09 +0000
commit480da5aab642eb7e5b87e604a55a91bf872b3607 (patch)
tree248f6f1790322000fb872ae1f6a6e6da70c00799 /Demos/Host/Incomplete
parent008e0e2e0a13e64e03f27f1c9a008ef201560878 (diff)
downloadlufa-480da5aab642eb7e5b87e604a55a91bf872b3607.tar.gz
lufa-480da5aab642eb7e5b87e604a55a91bf872b3607.tar.bz2
lufa-480da5aab642eb7e5b87e604a55a91bf872b3607.zip
Add PSM value to the RFCOMM service so that the host knows what PSM to use on channels when trying to access it.
Diffstat (limited to 'Demos/Host/Incomplete')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c6
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h2
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c69
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c11
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h6
6 files changed, 57 insertions, 56 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index 737932cdb..102867933 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -291,11 +291,7 @@ void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t*
break;
default:
/* Unknown Protocol packet */
- printf_P(PSTR("Packet Received (Channel 0x%04X, PSM: 0x%02x):\r\n"), Channel->LocalNumber, Channel->PSM);
- for (uint16_t Byte = 0; Byte < DataLen; Byte++)
- printf_P(PSTR("0x%02X "), ((uint8_t*)Data)[Byte]);
- puts_P(PSTR("\r\n"));
-
+ printf_P(PSTR("Unknown Packet Received (Channel 0x%04X, PSM: 0x%02X):\r\n"), Channel->LocalNumber, Channel->PSM);
break;
}
}
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
index 3dd9d70c9..c4690f4a8 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
@@ -78,7 +78,7 @@
#define DEVICE_CLASS_MINOR_LAN_50_TO_67_PC_UTILIZED (0x04 << 5)
#define DEVICE_CLASS_MINOR_LAN_67_TO_83_PC_UTILIZED (0x05 << 5)
#define DEVICE_CLASS_MINOR_LAN_83_TO_99_PC_UTILIZED (0x06 << 5)
- #define DEVICE_CLASS_MINOR_NO_SERVICE_AVAILABLE (0x07 << 5)
+ #define DEVICE_CLASS_MINOR_LAN_NO_SERVICE_AVAILABLE (0x07 << 5)
#define DEVICE_CLASS_MINOR_AV_UNCATEGORIZED (0x00 << 2)
#define DEVICE_CLASS_MINOR_AV_HEADSET (0x01 << 2)
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
index d812252b1..cf3267325 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
@@ -43,57 +43,57 @@ const struct
const struct
{
uint8_t Header;
- uint16_t Size;
+ uint8_t Size;
ItemUUID_t UUIDList[];
} PROGMEM SerialPort_Attribute_ServiceClassIDs =
{
- (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
- SWAPENDIAN_16(sizeof(ItemUUID_t) * 1),
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ (sizeof(ItemUUID_t) * 1),
{
- {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), SP_CLASS_UUID}
- }
+ {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), SP_CLASS_UUID},
+ },
};
const struct
{
- uint8_t Header;
- uint16_t Size;
+ uint8_t Header;
+ uint8_t Size;
- ItemProtocol_t ProtocolList[];
+ ItemProtocol_t L2CAP;
+ ItemProtocolPSM_t RFCOMM;
} PROGMEM SerialPort_Attribute_ProtocolDescriptor =
{
- (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
- SWAPENDIAN_16(sizeof(ItemProtocol_t) * 2),
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ (sizeof(ItemProtocol_t) + sizeof(ItemProtocolPSM_t)),
{
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ sizeof(ItemUUID_t),
{
- (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
- sizeof(ItemUUID_t),
- {
- {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), L2CAP_UUID},
- }
+ {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), L2CAP_UUID},
},
+ },
+ {
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ (sizeof(ItemUUID_t) + sizeof(Item16Bit_t)),
{
- (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
- sizeof(ItemUUID_t),
- {
- {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), RFCOMM_UUID},
- }
+ {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), RFCOMM_UUID},
+ {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(CHANNEL_PSM_RFCOMM)},
},
- }
+ },
};
const struct
{
uint8_t Header;
- uint16_t Size;
+ uint8_t Size;
ItemUUID_t UUIDList[];
} PROGMEM SerialPort_Attribute_BrowseGroupList =
{
- (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable16Bit),
- SWAPENDIAN_16(sizeof(ItemUUID_t) * 1),
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ (sizeof(ItemUUID_t) * 1),
{
- {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), PUBLICBROWSEGROUP_CLASS_UUID}
- }
+ {(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), PUBLICBROWSEGROUP_CLASS_UUID},
+ },
};
const struct
@@ -103,16 +103,15 @@ const struct
ItemLangEncoding_t LanguageEncodings[];
} PROGMEM SerialPort_Attribute_LanguageBaseIDOffset =
{
- .Header = (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
- .Size = (sizeof(ItemLangEncoding_t) * 1),
- .LanguageEncodings =
+ (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
+ (sizeof(ItemLangEncoding_t) * 1),
+ {
{
- {
- {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x454E)},
- {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x006A)},
- {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)},
- }
- }
+ {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x454E)},
+ {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x006A)},
+ {(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(0x0100)},
+ },
+ },
};
const struct
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
index 738cc063d..1cfc2b2c0 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
@@ -136,14 +136,29 @@
*/
typedef struct
{
- uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
- uint8_t Size; /**< Size of the inner Data Element sequence */
+ uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
+ uint8_t Size; /**< Size of the inner Data Element sequence */
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
} Protocol;
} ItemProtocol_t;
+
+ /** Structure for a list of Data Elements Sequences containing UUID Data Elements and 16-bit PSM values, for service
+ * attributes requiring extended protocol lists.
+ */
+ typedef struct
+ {
+ uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
+ uint8_t Size; /**< Size of the inner Data Element sequence */
+
+ struct
+ {
+ ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
+ Item16Bit_t PSM; /**< PSM that is to be used to access the service on created channels */
+ } Protocol;
+ } ItemProtocolPSM_t;
/** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and
* Attribute base offset.
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
index 0ee0784c5..62d4c5e39 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
@@ -486,16 +486,7 @@ 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]);
-
+ /* Check if the current unmatched UUID is identical to the search UUID */
if (!(UUIDMatch[i]) && !(memcmp_P(UUIDList[i], (CurrAttribute + 1), UUID_SIZE_BYTES)))
{
/* Indicate match found for the current attribute UUID and early-abort */
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h
index dd5182c34..0010cf1ff 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h
@@ -213,9 +213,9 @@
void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel);
#if defined(INCLUDE_FROM_SERVICEDISCOVERYPROTOCOL_C)
- static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
- static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
- static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
+ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
+ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
+ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHeader, Bluetooth_Channel_t* const Channel);
static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t* AttributeTable, uint16_t AttributeList[][2],
const uint8_t TotalAttributes, void** const BufferPos);