Skip to content

Commit 32e6c21

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: HFP_AG: Indicators Activation and Deactivation
Improve the process of AT command `AT+BIA` to mask the activated/ deactivated indicators. Only notify the activated indicator if the value of it is updated. Signed-off-by: Lyle Zhu <[email protected]>
1 parent 2011dcb commit 32e6c21

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

subsys/bluetooth/host/classic/hfp_ag.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@ static int hfp_ag_update_indicator(struct bt_hfp_ag *ag, enum bt_hfp_ag_indicato
401401

402402
LOG_DBG("indicator %d, old %d -> new %d", index, old_value, value);
403403

404+
if (!(ag->indicator & BIT(index))) {
405+
LOG_INF("The indicator %d is deactivated", index);
406+
/* If the indicator is deactivated, consider it a successful set. */
407+
return 0;
408+
}
409+
404410
err = hfp_ag_send_data(ag, cb, user_data, "\r\n+CIEV:%d,%d\r\n", (uint8_t)index + 1, value);
405411
if (err) {
406412
hfp_ag_lock(ag);
@@ -1923,7 +1929,7 @@ static int bt_hfp_ag_bia_handler(struct bt_hfp_ag *ag, struct net_buf *buf)
19231929
}
19241930

19251931
/* Force call, call setup and held call indicators are enabled. */
1926-
indicator = BIT(BT_HFP_AG_CALL_IND) | BIT(BT_HFP_AG_CALL_SETUP_IND) |
1932+
indicator |= BIT(BT_HFP_AG_CALL_IND) | BIT(BT_HFP_AG_CALL_SETUP_IND) |
19271933
BIT(BT_HFP_AG_CALL_HELD_IND);
19281934

19291935
hfp_ag_lock(ag);

0 commit comments

Comments
 (0)