From 98318a97126808b3aace178f1874477300a2f136 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 9 May 2022 14:46:20 +0200 Subject: [PATCH] example: avoid HCI_EVENT_IS_COMMAND_COMPLETE macro --- example/hfp_ag_demo.c | 10 +++------- example/hfp_hf_demo.c | 13 ++++++------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/example/hfp_ag_demo.c b/example/hfp_ag_demo.c index bcd9eb2c2..8a4e238b8 100644 --- a/example/hfp_ag_demo.c +++ b/example/hfp_ag_demo.c @@ -463,13 +463,14 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even switch (packet_type){ case HCI_EVENT_PACKET: switch(hci_event_packet_get_type(event)){ -#ifndef HAVE_BTSTACK_STDIN case BTSTACK_EVENT_STATE: if (btstack_event_state_get_state(event) != HCI_STATE_WORKING) break; + dump_supported_codecs(); +#ifndef HAVE_BTSTACK_STDIN printf("Establish HFP AG service level connection to %s...\n", bd_addr_to_str(device_addr)); hfp_ag_establish_service_level_connection(device_addr); - break; #endif + break; case GAP_EVENT_INQUIRY_RESULT: gap_event_inquiry_result_get_bd_addr(event, addr); // print info @@ -493,11 +494,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even case HCI_EVENT_SCO_CAN_SEND_NOW: sco_demo_send(sco_handle); break; - case HCI_EVENT_COMMAND_COMPLETE: - if (HCI_EVENT_IS_COMMAND_COMPLETE(event, hci_read_local_supported_features)){ - dump_supported_codecs(); - } - break; default: break; } diff --git a/example/hfp_hf_demo.c b/example/hfp_hf_demo.c index 2905c28fb..80d2ea609 100644 --- a/example/hfp_hf_demo.c +++ b/example/hfp_hf_demo.c @@ -462,16 +462,15 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even case HCI_EVENT_PACKET: switch (hci_event_packet_get_type(event)){ + case BTSTACK_EVENT_STATE: + if (btstack_event_state_get_state(event) != HCI_STATE_WORKING) break; + dump_supported_codecs(); + break; + case HCI_EVENT_SCO_CAN_SEND_NOW: sco_demo_send(sco_handle); break; - - case HCI_EVENT_COMMAND_COMPLETE: - if (HCI_EVENT_IS_COMMAND_COMPLETE(event, hci_read_local_supported_features)){ - dump_supported_codecs(); - } - break; - + case HCI_EVENT_HFP_META: switch (hci_event_hfp_meta_get_subevent_code(event)) { case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED: