Skip to content

Commit 2b4de08

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: Classic: HFP_AG: Support ongoing calls before SLC
Support the case that there are some calls existed before SLC established. Add a callback to get the ongoing calls one by one from upper layer when the response of the AT command `AT+CIND=?` from HF has been sent. And set the Call, Call Setup, and Held Call indicators and report the values int the response of AT command `AT+CIND?`. Then report all ongoing calls in the `+CLCC` response. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
1 parent dc20d44 commit 2b4de08

File tree

4 files changed

+653
-264
lines changed

4 files changed

+653
-264
lines changed

include/zephyr/bluetooth/classic/hfp_ag.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,37 @@ enum hfp_ag_hf_indicators {
7777
HFP_AG_BATTERY_LEVEL_IND = 2, /* Remaining level of Battery */
7878
};
7979

80+
/* The status of the call */
81+
enum __packed bt_hfp_ag_call_status {
82+
BT_HFP_AG_CALL_STATUS_ACTIVE = 0, /* Call is active */
83+
BT_HFP_AG_CALL_STATUS_HELD = 1, /* Call is on hold */
84+
BT_HFP_AG_CALL_STATUS_DIALING = 2, /* Outgoing call is being dialed */
85+
BT_HFP_AG_CALL_STATUS_ALERTING = 3, /* Outgoing call is being alerted */
86+
BT_HFP_AG_CALL_STATUS_INCOMING = 4, /* Incoming call is came */
87+
BT_HFP_AG_CALL_STATUS_WAITING = 5, /* Incoming call is waiting */
88+
BT_HFP_AG_CALL_STATUS_INCOMING_HELD = 6 /* Call held by Response and Hold */
89+
};
90+
91+
/* The direction of the call */
92+
enum __packed bt_hfp_ag_call_dir {
93+
BT_HFP_AG_CALL_DIR_OUTGOING = 0, /* It is a outgoing call */
94+
BT_HFP_AG_CALL_DIR_INCOMING = 1, /* It is a incoming call */
95+
};
96+
97+
/** @brief The ongoing call
98+
*
99+
* @param number Phone number terminated with '\0' of the call.
100+
* @param type Specify the format of the phone number.
101+
* @param dir Call direction.
102+
* @param status The status of the call.
103+
*/
104+
struct bt_hfp_ag_ongoing_call {
105+
char number[CONFIG_BT_HFP_AG_PHONE_NUMBER_MAX_LEN + 1];
106+
uint8_t type;
107+
enum bt_hfp_ag_call_dir dir;
108+
enum bt_hfp_ag_call_status status;
109+
};
110+
80111
/** @brief HFP profile AG application callback */
81112
struct bt_hfp_ag_cb {
82113
/** HF AG connected callback to application
@@ -116,6 +147,22 @@ struct bt_hfp_ag_cb {
116147
*/
117148
void (*sco_disconnected)(struct bt_conn *sco_conn, uint8_t reason);
118149

150+
/** Get ongoing call information Callback
151+
*
152+
* If this callback is provided it will be called whenever the response
153+
* of the AT command `AT+CIND=?` from HF has been sent. It is used to get all
154+
* ongoing calls one bye one from the upper layer.
155+
* Then set the `Call`, `Call Setup`, and `Held Call` indicators and report the
156+
* values int the response of AT command `AT+CIND?`. Then report all ongoing
157+
* calls in the `+CLCC` response.
158+
*
159+
* @param ag HFP AG object.
160+
* @param call Pointer to store the ongoing call information.
161+
*
162+
* @return 0 in case of success and will get next one or negative value in case of error.
163+
*/
164+
int (*get_ongoing_call)(struct bt_hfp_ag *ag, struct bt_hfp_ag_ongoing_call *call);
165+
119166
/** HF memory dialing request Callback
120167
*
121168
* If this callback is provided it will be called whenever a

0 commit comments

Comments
 (0)