Commit 480da5aa authored by Dean Camera's avatar Dean Camera
Browse files

Add PSM value to the RFCOMM service so that the host knows what PSM to use on...

Add PSM value to the RFCOMM service so that the host knows what PSM to use on channels when trying to access it.
parent 008e0e2e
......@@ -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;
}
}
......@@ -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)
......
......@@ -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
......
......@@ -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.
......
......@@ -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 */
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment