mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-03 01:20:35 +00:00
gatt_browser: support query over classic
This commit is contained in:
parent
377951890c
commit
80e334cf49
@ -109,6 +109,7 @@ static void gatt_client_setup(void){
|
|||||||
|
|
||||||
// Initialize L2CAP and register HCI event handler
|
// Initialize L2CAP and register HCI event handler
|
||||||
l2cap_init();
|
l2cap_init();
|
||||||
|
sdp_client_init();
|
||||||
|
|
||||||
// Initialize GATT client
|
// Initialize GATT client
|
||||||
gatt_client_init();
|
gatt_client_init();
|
||||||
@ -185,7 +186,8 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
|||||||
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) break;
|
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) break;
|
||||||
if (cmdline_addr_found){
|
if (cmdline_addr_found){
|
||||||
printf("Trying to connect to %s\n", bd_addr_to_str(cmdline_addr));
|
printf("Trying to connect to %s\n", bd_addr_to_str(cmdline_addr));
|
||||||
gap_connect(cmdline_addr, 0);
|
// gap_connect(cmdline_addr, 0);
|
||||||
|
gatt_client_classic_connect(&handle_hci_event, cmdline_addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("BTstack activated, start scanning!\n");
|
printf("BTstack activated, start scanning!\n");
|
||||||
@ -208,6 +210,11 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
|||||||
// query primary services
|
// query primary services
|
||||||
gatt_client_discover_primary_services(handle_gatt_client_event, connection_handle);
|
gatt_client_discover_primary_services(handle_gatt_client_event, connection_handle);
|
||||||
break;
|
break;
|
||||||
|
case GATT_EVENT_CONNECTED:
|
||||||
|
connection_handle = gatt_event_connected_get_handle(packet);
|
||||||
|
// query primary services
|
||||||
|
gatt_client_discover_primary_services(handle_gatt_client_event, connection_handle);
|
||||||
|
break;
|
||||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||||
printf("\nGATT browser - DISCONNECTED\n");
|
printf("\nGATT browser - DISCONNECTED\n");
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user