hfp_hf: call hfp_hf_run for all events from hfp_handle_hci_event

This commit is contained in:
Matthias Ringwald 2020-11-25 16:32:50 +01:00
parent 1c6a0fc0fa
commit 46f073f23a
3 changed files with 1 additions and 16 deletions

View File

@ -160,8 +160,6 @@ static btstack_packet_handler_t hfp_ag_callback;
static btstack_packet_handler_t hfp_hf_rfcomm_packet_handler; static btstack_packet_handler_t hfp_hf_rfcomm_packet_handler;
static btstack_packet_handler_t hfp_ag_rfcomm_packet_handler; static btstack_packet_handler_t hfp_ag_rfcomm_packet_handler;
static void (*hfp_hf_run_for_context_fn)(hfp_connection_t * hfp_connection);
static hfp_connection_t * sco_establishment_active; static hfp_connection_t * sco_establishment_active;
// HFP_SCO_PACKET_TYPES_NONE == no choice/override // HFP_SCO_PACKET_TYPES_NONE == no choice/override
@ -694,8 +692,6 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
} }
log_info("hf accept sco %u\n", hfp_connection->hf_accept_sco); log_info("hf accept sco %u\n", hfp_connection->hf_accept_sco);
sco_establishment_active = hfp_connection; sco_establishment_active = hfp_connection;
if (!hfp_hf_run_for_context_fn) break;
(*hfp_hf_run_for_context_fn)(hfp_connection);
break; break;
default: default:
break; break;
@ -1618,10 +1614,6 @@ void hfp_set_hf_rfcomm_packet_handler(btstack_packet_handler_t handler){
hfp_hf_rfcomm_packet_handler = handler; hfp_hf_rfcomm_packet_handler = handler;
} }
void hfp_set_hf_run_for_context(void (*callback)(hfp_connection_t * hfp_connection)){
hfp_hf_run_for_context_fn = callback;
}
void hfp_init(void){ void hfp_init(void){
hfp_allowed_sco_packet_types = SCO_PACKET_TYPES_ALL; hfp_allowed_sco_packet_types = SCO_PACKET_TYPES_ALL;
} }

View File

@ -660,7 +660,6 @@ void hfp_set_ag_rfcomm_packet_handler(btstack_packet_handler_t handler);
void hfp_set_hf_callback(btstack_packet_handler_t callback); void hfp_set_hf_callback(btstack_packet_handler_t callback);
void hfp_set_hf_rfcomm_packet_handler(btstack_packet_handler_t handler); void hfp_set_hf_rfcomm_packet_handler(btstack_packet_handler_t handler);
void hfp_set_hf_run_for_context(void (*callbcack)(hfp_connection_t * hfp_connection));
void hfp_init(void); void hfp_init(void);

View File

@ -1141,10 +1141,6 @@ static void hfp_hf_rfcomm_packet_handler(uint8_t packet_type, uint16_t channel,
static void hfp_hf_hci_event_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ static void hfp_hf_hci_event_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
hfp_handle_hci_event(packet_type, channel, packet, size, HFP_ROLE_HF); hfp_handle_hci_event(packet_type, channel, packet, size, HFP_ROLE_HF);
// allow for sco established -> ring transition and sco retry
if (packet_type != HCI_EVENT_PACKET) return;
if (hci_event_packet_get_type(packet) != HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE) return;
hfp_hf_run(); hfp_hf_run();
} }
@ -1159,8 +1155,6 @@ void hfp_hf_init(uint16_t rfcomm_channel_nr){
// used to set packet handler for outgoing rfcomm connections - could be handled by emitting an event to us // used to set packet handler for outgoing rfcomm connections - could be handled by emitting an event to us
hfp_set_hf_rfcomm_packet_handler(&hfp_hf_rfcomm_packet_handler); hfp_set_hf_rfcomm_packet_handler(&hfp_hf_rfcomm_packet_handler);
hfp_set_hf_run_for_context(hfp_hf_run_for_context);
hfp_supported_features = HFP_DEFAULT_HF_SUPPORTED_FEATURES; hfp_supported_features = HFP_DEFAULT_HF_SUPPORTED_FEATURES;
hfp_codecs_nr = 0; hfp_codecs_nr = 0;
hfp_indicators_nr = 0; hfp_indicators_nr = 0;