goep_client: use l2cap psm from protocol descriptor if provided

This commit is contained in:
Matthias Ringwald 2018-09-28 15:10:14 +02:00
parent d8bcc2be3b
commit fcdd1a56e9

View File

@ -256,6 +256,9 @@ static void goep_client_handle_sdp_query_event(uint8_t packet_type, uint16_t cha
uint8_t *des_element;
uint8_t *element;
uint32_t uuid;
#ifdef ENABLE_GOEP_L2CAP
uint16_t l2cap_psm;
#endif
if (des_iterator_get_type(&des_list_it) != DE_DES) continue;
@ -267,6 +270,16 @@ static void goep_client_handle_sdp_query_event(uint8_t packet_type, uint16_t cha
uuid = de_get_uuid32(element);
switch (uuid){
#ifdef ENABLE_GOEP_L2CAP
case BLUETOOTH_PROTOCOL_L2CAP:
if (!des_iterator_has_more(&prot_it)) continue;
des_iterator_next(&prot_it);
element = des_iterator_get_element(&prot_it);
if (de_element_get_uint16(element, &l2cap_psm)){
context->l2cap_psm = l2cap_psm;
}
break;
#endif
case BLUETOOTH_PROTOCOL_RFCOMM:
if (!des_iterator_has_more(&prot_it)) continue;
des_iterator_next(&prot_it);