Skip to content

Commit 04c4abd

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: HFP_AG: Set roaming status
Add a function `bt_hfp_ag_roaming_status` to set the roaming status. Signed-off-by: Lyle Zhu <[email protected]>
1 parent afa0906 commit 04c4abd

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

include/zephyr/bluetooth/classic/hfp_ag.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,17 @@ int bt_hfp_ag_vre_textual_representation(struct bt_hfp_ag *ag, uint8_t state, co
714714
*/
715715
int bt_hfp_ag_signal_strength(struct bt_hfp_ag *ag, uint8_t strength);
716716

717+
/** @brief Set roaming status
718+
*
719+
* Set roaming status.
720+
*
721+
* @param ag HFP AG object.
722+
* @param status Roaming status.
723+
*
724+
* @return 0 in case of success or negative value in case of error.
725+
*/
726+
int bt_hfp_ag_roaming_status(struct bt_hfp_ag *ag, uint8_t status);
727+
717728
#ifdef __cplusplus
718729
}
719730
#endif

subsys/bluetooth/host/classic/hfp_ag.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4646,3 +4646,29 @@ int bt_hfp_ag_signal_strength(struct bt_hfp_ag *ag, uint8_t strength)
46464646

46474647
return err;
46484648
}
4649+
4650+
int bt_hfp_ag_roaming_status(struct bt_hfp_ag *ag, uint8_t status)
4651+
{
4652+
int err;
4653+
4654+
LOG_DBG("");
4655+
4656+
if (ag == NULL) {
4657+
return -EINVAL;
4658+
}
4659+
4660+
hfp_ag_lock(ag);
4661+
if (ag->state != BT_HFP_CONNECTED) {
4662+
hfp_ag_unlock(ag);
4663+
return -ENOTCONN;
4664+
}
4665+
hfp_ag_unlock(ag);
4666+
4667+
err = hfp_ag_update_indicator(ag, BT_HFP_AG_ROAM_IND, status,
4668+
NULL, NULL);
4669+
if (err) {
4670+
LOG_ERR("Fail to set roaming status err :(%d)", err);
4671+
}
4672+
4673+
return err;
4674+
}

0 commit comments

Comments
 (0)