Skip to content

Commit 507c2e7

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: HFP_AG: Ability to reject call
Add a configuration `CONFIG_BT_HFP_AG_REJECT_CALL` for feature `Ability to reject a call`. Signed-off-by: Lyle Zhu <[email protected]>
1 parent d7cdadc commit 507c2e7

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

subsys/bluetooth/host/classic/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,12 @@ config BT_HFP_AG_HF_INDICATOR_BATTERY
413413
help
414414
This option enables HF Indicator Battery level for HFP AG
415415

416+
config BT_HFP_AG_REJECT_CALL
417+
bool "Ability to reject a call for HFP AG [EXPERIMENTAL]"
418+
default y
419+
help
420+
This option enables ability to reject a call for HFP AG
421+
416422
endif # BT_HFP_AG
417423

418424
config BT_AVDTP

subsys/bluetooth/host/classic/hfp_ag.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3817,6 +3817,7 @@ int bt_hfp_ag_reject(struct bt_hfp_ag_call *call)
38173817
int err = 0;
38183818
struct bt_hfp_ag *ag;
38193819
bt_hfp_call_state_t call_state;
3820+
uint32_t ag_features;
38203821

38213822
LOG_DBG("");
38223823

@@ -3837,12 +3838,18 @@ int bt_hfp_ag_reject(struct bt_hfp_ag_call *call)
38373838
}
38383839

38393840
call_state = call->call_state;
3841+
ag_features = ag->ag_features;
38403842
hfp_ag_unlock(ag);
38413843

38423844
if (!atomic_test_bit(call->flags, BT_HFP_AG_CALL_INCOMING)) {
38433845
return -EINVAL;
38443846
}
38453847

3848+
if (!(ag_features & BT_HFP_AG_FEATURE_REJECT_CALL)) {
3849+
LOG_ERR("AG has not ability to reject call");
3850+
return -ENOTSUP;
3851+
}
3852+
38463853
if (atomic_test_bit(call->flags, BT_HFP_AG_CALL_INCOMING_3WAY)) {
38473854
if ((call_state == BT_HFP_CALL_ALERTING) || (call_state == BT_HFP_CALL_INCOMING)) {
38483855
uint8_t call_setup;

subsys/bluetooth/host/classic/hfp_ag_internal.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@
9898
#define BT_HFP_AG_FEATURE_HF_IND_ENABLE 0
9999
#endif /* CONFIG_BT_HFP_HF_HF_INDICATORS */
100100

101+
#if defined(CONFIG_BT_HFP_AG_REJECT_CALL)
102+
#define BT_HFP_AG_FEATURE_REJECT_CALL_ENABLE BT_HFP_AG_FEATURE_REJECT_CALL
103+
#else
104+
#define BT_HFP_AG_FEATURE_REJECT_CALL_ENABLE 0
105+
#endif /* CONFIG_BT_HFP_AG_REJECT_CALL */
106+
101107
/* HFP AG Supported features */
102108
#define BT_HFP_AG_SUPPORTED_FEATURES (\
103109
BT_HFP_AG_FEATURE_3WAY_CALL_ENABLE | \
@@ -111,7 +117,8 @@
111117
BT_HFP_AG_FEATURE_ENH_VOICE_RECG_ENABLE | \
112118
BT_HFP_AG_FEATURE_VOICE_RECG_TEXT_ENABLE | \
113119
BT_HFP_AG_FEATURE_VOICE_TAG_ENABLE | \
114-
BT_HFP_AG_FEATURE_HF_IND_ENABLE)
120+
BT_HFP_AG_FEATURE_HF_IND_ENABLE | \
121+
BT_HFP_AG_FEATURE_REJECT_CALL_ENABLE)
115122

116123
/* HFP AG Supported features in SDP */
117124
#define BT_HFP_AG_SDP_SUPPORTED_FEATURES (\

0 commit comments

Comments
 (0)