From 94af8b0e57b661351183827a66b50bb889944b7e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 8 Jan 2024 15:43:48 +0100 Subject: [PATCH] hfp_hf: send HF Indicator update only if enabled by AG --- CHANGELOG.md | 1 + src/classic/hfp.c | 9 +++++++++ src/classic/hfp_hf.c | 5 ----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bf141e53..5affbb4df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased ### Added ### Fixed +- HFP HF: send HF Indicator update only if enabled by AG ### Changed diff --git a/src/classic/hfp.c b/src/classic/hfp.c index a9d7903bc..b25a8ada6 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -1887,6 +1887,15 @@ 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); diff --git a/src/classic/hfp_hf.c b/src/classic/hfp_hf.c index 78bf92530..cde94f099 100644 --- a/src/classic/hfp_hf.c +++ b/src/classic/hfp_hf.c @@ -1122,11 +1122,6 @@ static void hfp_hf_slc_established(hfp_connection_t * hfp_connection){ hfp_connection->microphone_gain = hfp_hf_microphone_gain; hfp_connection->send_microphone_gain = 1; hfp_emit_event(hfp_connection, HFP_SUBEVENT_MICROPHONE_VOLUME, hfp_hf_microphone_gain); - // enable all indicators - 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 = 1; - } } static void hfp_hf_handle_suggested_codec(hfp_connection_t * hfp_connection){