From 4431fb7a03a1045388efa00a89ccbb6cf203fec4 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 18 Jul 2024 14:57:12 +0200 Subject: [PATCH] hfp_hf: send HF Indicator update only if enabled by AG --- CHANGELOG.md | 1 + src/classic/hfp.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 965b3c9df..856ac55da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - HIOS Client: emit disconnected event on HCI disconnect and free connection struct - Scan Parameter Service Client: emit disconnected event on HCI disconnect and free connection struct - PBAP Client: fix PBAP_SUBEVENT_OPERATION_COMPLETED with OBEX_DISCONNECTED for pbap_disconnect +- HFP HF: send HF Indicator update only if enabled by AG ### Changed - GAP: return command disallowed if disconnect already requested diff --git a/src/classic/hfp.c b/src/classic/hfp.c index de07f273c..149f719f7 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -1116,6 +1116,15 @@ void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *pac bd_addr_copy(hfp_connection->remote_addr, event_addr); hfp_connection->state = HFP_EXCHANGE_SUPPORTED_FEATURES; + if (local_role == HFP_ROLE_HF) { + // setup HF Indicators + uint8_t i; + for (i=0; i < hfp_hf_indicators_nr; i++){ + hfp_connection->generic_status_indicators[i].uuid = hfp_hf_indicators[i]; + hfp_connection->generic_status_indicators[i].state = 0; + } + } + rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid); break; @@ -1893,15 +1902,6 @@ uint8_t hfp_establish_service_level_connection(bd_addr_t bd_addr, uint16_t servi bd_addr_copy(connection->remote_addr, bd_addr); connection->service_uuid = service_uuid; - if (local_role == HFP_ROLE_HF) { - // setup HF Indicators - uint8_t i; - for (i=0; i < hfp_hf_indicators_nr; i++){ - connection->generic_status_indicators[i].uuid = hfp_hf_indicators[i]; - connection->generic_status_indicators[i].state = 0; - } - } - hfp_sdp_query_request.callback = &hfp_handle_start_sdp_client_query; // ignore ERROR_CODE_COMMAND_DISALLOWED because in that case, we already have requested an SDP callback (void) sdp_client_register_query_callback(&hfp_sdp_query_request);