sdp_rfcomm_query: register for SDP query, and handle it in a callback

This commit is contained in:
Milanka Ringwald 2020-09-07 11:36:34 +02:00
parent acb6281e01
commit ef24a2f712

View File

@ -71,7 +71,12 @@ static struct {
static uint8_t service_index = 0;
static btstack_packet_callback_registration_t hci_event_callback_registration;
static btstack_context_callback_registration_t handle_sdp_client_query_request;
static void handle_start_sdp_client_query(void * context){
UNUSED(context);
sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, BLUETOOTH_ATTRIBUTE_PUBLIC_BROWSE_ROOT);
}
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel);
@ -84,7 +89,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
case BTSTACK_EVENT_STATE:
// BTstack activated, get started
if (btstack_event_state_get_state(packet) == HCI_STATE_WORKING){
sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, BLUETOOTH_ATTRIBUTE_PUBLIC_BROWSE_ROOT);
handle_sdp_client_query_request.callback = &handle_start_sdp_client_query;
(void) sdp_client_register_query_callback(&handle_start_sdp_client_query);
}
break;
default: