1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-23 10:21:12 +00:00

sdp_rfcom_query: add sdp_client_query_rfcomm_channel_and_name_for_uuid128, use sdp_service_search_pattern_for_uuid16 and sdp_service_search_pattern_for_uuid128 instead of creating search pattern manually

This commit is contained in:
Matthias Ringwald 2017-04-06 11:14:58 +02:00
parent 6959beff72
commit 09ac355c8a
2 changed files with 23 additions and 7 deletions

@ -70,9 +70,8 @@ typedef enum {
// higher layer query - get rfcomm channel and name
const uint8_t des_attributeIDList[] = { 0x35, 0x05, 0x0A, 0x00, 0x01, 0x01, 0x00}; // Arribute: 0x0001 - 0x0100
static uint8_t des_service_search_pattern[5] = {0x35, 0x03, 0x19, 0x00, 0x00};
// All attributes: 0x0001 - 0x0100
static const uint8_t des_attributeIDList[] = { 0x35, 0x05, 0x0A, 0x00, 0x01, 0x01, 0x00};
static uint8_t sdp_service_name[SDP_SERVICE_NAME_LEN+1];
static uint8_t sdp_service_name_len = 0;
@ -315,11 +314,20 @@ uint8_t sdp_client_query_rfcomm_channel_and_name_for_search_pattern(btstack_pack
return 0;
}
uint8_t sdp_client_query_rfcomm_channel_and_name_for_uuid(btstack_packet_handler_t callback, bd_addr_t remote, uint16_t uuid){
uint8_t sdp_client_query_rfcomm_channel_and_name_for_uuid(btstack_packet_handler_t callback, bd_addr_t remote, uint16_t uuid16){
if (!sdp_client_ready()) return SDP_QUERY_BUSY;
big_endian_store_16(des_service_search_pattern, 3, uuid);
sdp_client_query_rfcomm_channel_and_name_for_search_pattern(callback, remote, (uint8_t*)des_service_search_pattern);
uint8_t * service_search_pattern = sdp_service_search_pattern_for_uuid16(uuid16);
sdp_client_query_rfcomm_channel_and_name_for_search_pattern(callback, remote, service_search_pattern);
return 0;
}
uint8_t sdp_client_query_rfcomm_channel_and_name_for_uuid128(btstack_packet_handler_t callback, bd_addr_t remote, uint8_t * uuid128){
if (!sdp_client_ready()) return SDP_QUERY_BUSY;
uint8_t * service_search_pattern = sdp_service_search_pattern_for_uuid128(uuid128);
sdp_client_query_rfcomm_channel_and_name_for_search_pattern(callback, remote, service_search_pattern);
return 0;
}

@ -53,14 +53,22 @@ extern "C" {
/* API_START */
/**
* @brief Searches SDP records on a remote device for RFCOMM services with a given UUID.
* @brief Searches SDP records on a remote device for RFCOMM services with a given 16-bit UUID.
* @note calls sdp_service_search_pattern_for_uuid16 that uses global buffer
*/
uint8_t sdp_client_query_rfcomm_channel_and_name_for_uuid(btstack_packet_handler_t callback, bd_addr_t remote, uint16_t uuid);
/**
* @brief Searches SDP records on a remote device for RFCOMM services with a given 128-bit UUID.
* @note calls sdp_service_search_pattern_for_uuid128 that uses global buffer
*/
uint8_t sdp_client_query_rfcomm_channel_and_name_for_uuid128(btstack_packet_handler_t callback, bd_addr_t remote, uint8_t * uuid128);
/**
* @brief Searches SDP records on a remote device for RFCOMM services with a given service search pattern.
*/
uint8_t sdp_client_query_rfcomm_channel_and_name_for_search_pattern(btstack_packet_handler_t callback, bd_addr_t remote, uint8_t * des_serviceSearchPattern);
/* API_END */
#if defined __cplusplus