Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c4e756b
Bluetooth: HFP_HF: Improve the feature configuration
lylezhu2012 Jul 25, 2024
0fb1830
Bluetooth: BR: at: add function at_get_string
lylezhu2012 Jul 25, 2024
f2bd690
Bluetooth: HFP_HF: Support unsolicited result code +CLIP
lylezhu2012 Jul 25, 2024
8a4a5ec
Bluetooth: HFP_HF: Add function bt_hfp_hf_cli
lylezhu2012 Jul 25, 2024
2754d4d
Bluetooth: HFP_HF: Only send AT+CMEE=1 if AG supports
lylezhu2012 Jul 26, 2024
2dad6d4
Bluetooth: HFP_HF: handle unsolicited result code +VGS/+VGM
lylezhu2012 Sep 2, 2024
968e106
Bluetooth: HFP_HF: Add function to set vgm and vgs
lylezhu2012 Jul 25, 2024
5ce5353
Bluetooth: HFP_AG: Fix AT+CLIP parse issue
lylezhu2012 Jul 26, 2024
5bb64b2
Bluetooth: HFP_AG: Change log message to LOG_DBG
lylezhu2012 Jul 26, 2024
e7411b5
Bluetooth: HFP_AG: Improve the call terminate
lylezhu2012 Jul 26, 2024
9ec398d
Bluetooth: HFP_HF: Notify in-band ring setting
lylezhu2012 Sep 2, 2024
1063435
Bluetooth: HFP_AG: Support remote audio volume control
lylezhu2012 Jul 26, 2024
c7dc90f
Bluetooth: at: support separator "="
lylezhu2012 Jul 26, 2024
a54182c
Bluetooth: HFP_HF: Optimize initialization after SLC established
lylezhu2012 Jul 26, 2024
4937524
Bluetooth: HFP_HF: Send AT+VGM and AT+VGS after SLC established
lylezhu2012 Sep 2, 2024
14600af
Bluetooth: HHF_HF: Support read network operator
lylezhu2012 Jul 26, 2024
81a6749
Bluetooth: HFP_AG: Support network operator update
lylezhu2012 Jul 26, 2024
3bf2b61
Bluetooth: HFP_HF: Add a function to accept the call
lylezhu2012 Jul 29, 2024
265c247
Bluetooth: HFP_AG: Add dedicated SDP features definition
lylezhu2012 Jul 29, 2024
afd5b3b
Bluetooth: HFP_AG: Improve extended error result codes
lylezhu2012 Jul 29, 2024
014cc50
Bluetooth: HFP_AG: Improve codec negotiation
lylezhu2012 Jul 29, 2024
ab5de71
Bluetooth: HFP_HF: Improve codec negotiation
lylezhu2012 Aug 29, 2024
83bf9d1
Bluetooth: HFP_AG: Improve inband ringtone setting
lylezhu2012 Jul 29, 2024
8d96449
Bluetooth: HFP_HF: Add a function to reject the call
lylezhu2012 Jul 29, 2024
551d23f
Bluetooth: HFP_HF: Add a function to terminate the call
lylezhu2012 Jul 29, 2024
af4fd8d
Bluetooth: HFP_AG: Add number dialing callback
lylezhu2012 Jul 31, 2024
9916633
Bluetooth: HFP_HF: Support phone number calling
lylezhu2012 Sep 2, 2024
1c042f4
Bluetooth: HFP_HF: Support memory dialing
lylezhu2012 Jul 31, 2024
3006ada
Bluetooth: HFP_HF: Support last number recalling
lylezhu2012 Jul 31, 2024
bca0faa
Bluetooth: HFP_AG: Handle command AT+NREC=0
lylezhu2012 Jul 31, 2024
d5c07a7
Bluetooth: HFP_HF: Turn off AG's EC and NR
lylezhu2012 Jul 31, 2024
4ac35fc
Bluetooth: HFP_HF: Hold incoming call
lylezhu2012 Jul 31, 2024
18e1b53
Bluetooth: HFP_AG: Hold incoming call
lylezhu2012 Jul 31, 2024
68bca32
Bluetooth: HFP_AG: Support Enhanced call status
lylezhu2012 Aug 1, 2024
86d073a
Bluetooth: HFP_AG: Handle AT+CCWA command
lylezhu2012 Aug 2, 2024
f83fd1c
Bluetooth: HFP_HF: Code clean
lylezhu2012 Sep 2, 2024
30257de
Bluetooth: HFP_AG: Enable 3-way feature
lylezhu2012 Nov 13, 2024
fe916fe
Bluetooth: HFP_HF: Use HF object to replace conn object
lylezhu2012 Sep 2, 2024
7f14852
Bluetooth: HFP_AG: Move CLCC status definitions
lylezhu2012 Aug 29, 2024
0ae0bea
Bluetooth: HFP_HF: Enable 3-way feature
lylezhu2012 Sep 2, 2024
2e09d89
Bluetooth: HFP_HF: Avoid at status overwrote by sending
lylezhu2012 Aug 20, 2024
f6a18e7
Bluetooth: HFP_HF: Fix TX queue broken issue
lylezhu2012 Aug 15, 2024
41e29e0
Bluetooth: HFP_HF: Support Voice recognition activation
lylezhu2012 Sep 2, 2024
198f5e4
Bluetooth: HFP_AG: Support Voice recognition activation
lylezhu2012 Sep 2, 2024
7b0935e
Bluetooth: HFP_HF: Request phone number
lylezhu2012 Sep 2, 2024
418a9ca
Bluetooth: HFP_AG: Attach a phone number for a voice tag
lylezhu2012 Sep 2, 2024
3fccfbc
Bluetooth: HFP_HF: Transmit DTMF Code
lylezhu2012 Aug 27, 2024
848d423
Bluetooth: HFP_AG: Handle DTMF code
lylezhu2012 Sep 2, 2024
0e22767
Bluetooth: HFP_HF: Query subscriber number
lylezhu2012 Aug 27, 2024
40f94bd
Bluetooth: HFP_AG: Send subscriber number info
lylezhu2012 Aug 27, 2024
e2c55fe
Bluetooth: HFP_AG: Set signal strength
lylezhu2012 Sep 2, 2024
7aa5827
Bluetooth: HFP_AG: Set roaming status
lylezhu2012 Aug 27, 2024
28ef3ed
Bluetooth: HFP_AG: Set battery level
lylezhu2012 Aug 27, 2024
4e193cf
Bluetooth: HFP_AG: Set service availability
lylezhu2012 Aug 27, 2024
c629e88
Bluetooth: HFP_HF: Activate/deactivate AG indicators
lylezhu2012 Aug 28, 2024
7f10c0e
Bluetooth: HFP_AG: Indicators Activation and Deactivation
lylezhu2012 Aug 28, 2024
272cdb8
Bluetooth: HFP_HF: Optimize SLC init procedure
lylezhu2012 Aug 28, 2024
fe05f77
Bluetooth: HFP_HF: Support HF Indicators
lylezhu2012 Aug 28, 2024
ffba65a
Bluetooth: HFP_AG: Support HF Indicators
lylezhu2012 Aug 29, 2024
3e264ce
Bluetooth: HFP_HF: fix typo
lylezhu2012 Aug 29, 2024
ab1b9ef
Bluetooth: HFP_AG: fix typo
lylezhu2012 Feb 21, 2025
b877c11
Bluetooth: HFP_HF: Initiate SLC establishment
lylezhu2012 Sep 2, 2024
6df2fa3
Bluetooth: HFP_AG: Ability to reject call
lylezhu2012 Aug 28, 2024
ea107eb
Bluetooth: HFP_HF: Verify ability to reject a call
lylezhu2012 Aug 30, 2024
c4ec15d
Bluetooth: HFP_AG: Support RFCOMM responder
lylezhu2012 Aug 28, 2024
3a87711
Bluetooth: HFP_HF: Improve SCO accept
lylezhu2012 Aug 28, 2024
d7452f0
Bluetooth: shell: Support HFP HF and AG
lylezhu2012 Aug 28, 2024
e0f784d
Bluetooth: Shell: BR: Find HFP_HF records on HFP_AG side
lylezhu2012 Aug 13, 2024
6516da0
Sample: Bluetooth: HFP_AG: Update the sample
lylezhu2012 Aug 30, 2024
a6c7d70
Bluetooth: HFP: Divide hfp_internal.h
lylezhu2012 Aug 30, 2024
ff1c8d8
Sample: Bluetooth: HFP_HF: Update the sample
lylezhu2012 Aug 30, 2024
60d9db1
Bluetooth: HFP_AG: Change "-EOPNOTSUPP" to "-ENOEXEC"
lylezhu2012 Nov 12, 2024
59eb981
Bluetooth: HFP_AG: Remove unnecessary lock for feature read access
lylezhu2012 Nov 13, 2024
4020bb2
Bluetooth: HFP_AG: Optimize feature access
lylezhu2012 Nov 13, 2024
0a79a94
Bluetooth: HFP_AG: Remove unnecessary code line `__fallthrough`
lylezhu2012 Nov 13, 2024
1ecaf00
Bluetooth: HFP_AG: Add ACL conn to the `connected` callback
lylezhu2012 Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
562 changes: 533 additions & 29 deletions include/zephyr/bluetooth/classic/hfp_ag.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we don't have callbacks for AT+CGMI and AT+CGMM? Do we have them in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not find these two AT commands in HFP_v1.9 specific. Are they standard AT commands defined by HFP specific? If needed, I think you could upstream the changes.

Copy link
Contributor

@gzh-terry gzh-terry Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not find these two AT commands in HFP_v1.9 specific. Are they standard AT commands defined by HFP specific? If needed, I think you could upstream the changes.

These are 3GPP commands (3GPP TS 27.007)
20250224-123356
20250224-123359

And sure, we can add them later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhangyuan376

Please remember to add these interfaces after this PR merged.

Large diffs are not rendered by default.

897 changes: 835 additions & 62 deletions include/zephyr/bluetooth/classic/hfp_hf.h

Large diffs are not rendered by default.

84 changes: 60 additions & 24 deletions samples/bluetooth/handsfree/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,103 @@
#include <zephyr/bluetooth/classic/hfp_hf.h>
#include <zephyr/settings/settings.h>

static void connected(struct bt_conn *conn)
static void hf_connected(struct bt_conn *conn, struct bt_hfp_hf *hf)
{
printk("HFP HF Connected!\n");
}

static void disconnected(struct bt_conn *conn)
static void hf_disconnected(struct bt_hfp_hf *hf)
{
printk("HFP HF Disconnected!\n");
}

static void service(struct bt_conn *conn, uint32_t value)
static void hf_sco_connected(struct bt_hfp_hf *hf, struct bt_conn *sco_conn)
{
printk("HF SCO connected\n");
}

static void hf_sco_disconnected(struct bt_conn *sco_conn, uint8_t reason)
{
printk("HF SCO disconnected\n");
}

static void hf_service(struct bt_hfp_hf *hf, uint32_t value)
{
printk("Service indicator value: %u\n", value);
}

static void call(struct bt_conn *conn, uint32_t value)
static void hf_outgoing(struct bt_hfp_hf *hf, struct bt_hfp_hf_call *call)
{
printk("HF call %p outgoing\n", call);
}

static void hf_remote_ringing(struct bt_hfp_hf_call *call)
{
printk("HF remote call %p start ringing\n", call);
}

static void hf_incoming(struct bt_hfp_hf *hf, struct bt_hfp_hf_call *call)
{
printk("HF call %p incoming\n", call);
}

static void hf_incoming_held(struct bt_hfp_hf_call *call)
{
printk("HF call %p is held\n", call);
}

static void hf_accept(struct bt_hfp_hf_call *call)
{
printk("Call indicator value: %u\n", value);
printk("HF call %p accepted\n", call);
}

static void call_setup(struct bt_conn *conn, uint32_t value)
static void hf_reject(struct bt_hfp_hf_call *call)
{
printk("Call Setup indicator value: %u\n", value);
printk("HF call %p rejected\n", call);
}

static void call_held(struct bt_conn *conn, uint32_t value)
static void hf_terminate(struct bt_hfp_hf_call *call)
{
printk("Call Held indicator value: %u\n", value);
printk("HF call %p terminated\n", call);
}

static void signal(struct bt_conn *conn, uint32_t value)
static void hf_signal(struct bt_hfp_hf *hf, uint32_t value)
{
printk("Signal indicator value: %u\n", value);
}

static void roam(struct bt_conn *conn, uint32_t value)
static void hf_roam(struct bt_hfp_hf *hf, uint32_t value)
{
printk("Roaming indicator value: %u\n", value);
}

static void battery(struct bt_conn *conn, uint32_t value)
static void hf_battery(struct bt_hfp_hf *hf, uint32_t value)
{
printk("Battery indicator value: %u\n", value);
}

static void ring_cb(struct bt_conn *conn)
static void hf_ring_indication(struct bt_hfp_hf_call *call)
{
printk("Incoming Call...\n");
printk("HF call %p ring\n", call);
}

static struct bt_hfp_hf_cb hf_cb = {
.connected = connected,
.disconnected = disconnected,
.service = service,
.call = call,
.call_setup = call_setup,
.call_held = call_held,
.signal = signal,
.roam = roam,
.battery = battery,
.ring_indication = ring_cb,
.connected = hf_connected,
.disconnected = hf_disconnected,
.sco_connected = hf_sco_connected,
.sco_disconnected = hf_sco_disconnected,
.service = hf_service,
.outgoing = hf_outgoing,
.remote_ringing = hf_remote_ringing,
.incoming = hf_incoming,
.incoming_held = hf_incoming_held,
.accept = hf_accept,
.reject = hf_reject,
.terminate = hf_terminate,
.signal = hf_signal,
.roam = hf_roam,
.battery = hf_battery,
.ring_indication = hf_ring_indication,
};

static void bt_ready(int err)
Expand Down
30 changes: 19 additions & 11 deletions samples/bluetooth/handsfree_ag/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

static struct bt_conn *default_conn;
struct bt_hfp_ag *hfp_ag;

static struct bt_br_discovery_param br_discover;
struct bt_hfp_ag_call *hfp_ag_call;

static struct bt_br_discovery_param br_discover;
static struct bt_br_discovery_result scan_result[CONFIG_BT_HFP_AG_DISCOVER_RESULT_COUNT];
Expand All @@ -41,8 +40,15 @@ struct k_work_delayable call_remote_accept_work;
NET_BUF_POOL_DEFINE(sdp_discover_pool, 10, BT_L2CAP_BUF_SIZE(CONFIG_BT_L2CAP_TX_MTU),
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);

static void ag_connected(struct bt_hfp_ag *ag)
static void ag_connected(struct bt_conn *conn, struct bt_hfp_ag *ag)
{
if (conn != default_conn) {
printk("The conn %p is not aligned with ACL conn %p", conn, default_conn);
}

if (!hfp_ag) {
hfp_ag = ag;
}
printk("HFP AG connected!\n");
k_work_schedule(&call_connect_work, K_MSEC(CONFIG_BT_HFP_AG_START_CALL_DELAY_TIME));
}
Expand All @@ -62,38 +68,40 @@ static void ag_sco_disconnected(struct bt_hfp_ag *ag)
printk("HFP AG SCO disconnected!\n");
}

static void ag_ringing(struct bt_hfp_ag *ag, bool in_band)
static void ag_ringing(struct bt_hfp_ag_call *call, bool in_band)
{
printk("Ringing (in bond? %s)\n", in_band ? "Yes" : "No");
}

static void ag_accept(struct bt_hfp_ag *ag)
static void ag_accept(struct bt_hfp_ag_call *call)
{
printk("Call Accepted\n");
k_work_schedule(&call_disconnect_work, K_SECONDS(10));
}

static void ag_reject(struct bt_hfp_ag *ag)
static void ag_reject(struct bt_hfp_ag_call *call)
{
printk("Call Rejected\n");
k_work_schedule(&call_disconnect_work, K_SECONDS(1));
}

static void ag_terminate(struct bt_hfp_ag *ag)
static void ag_terminate(struct bt_hfp_ag_call *call)
{
printk("Call terminated\n");
k_work_schedule(&call_disconnect_work, K_SECONDS(1));
}

static void ag_outgoing(struct bt_hfp_ag *ag, const char *number)
static void ag_outgoing(struct bt_hfp_ag *ag, struct bt_hfp_ag_call *call, const char *number)
{
hfp_ag_call = call;
printk("Call outgoing, remote number %s\n", number);
k_work_cancel_delayable(&call_connect_work);
k_work_schedule(&call_remote_ringing_work, K_SECONDS(1));
}

static void ag_incoming(struct bt_hfp_ag *ag, const char *number)
static void ag_incoming(struct bt_hfp_ag *ag, struct bt_hfp_ag_call *call, const char *number)
{
hfp_ag_call = call;
printk("Incoming call, remote number %s\n", number);
k_work_cancel_delayable(&call_connect_work);
}
Expand Down Expand Up @@ -329,7 +337,7 @@ static void call_remote_ringing_work_handler(struct k_work *work)

printk("Remote starts ringing\n");

err = bt_hfp_ag_remote_ringing(hfp_ag);
err = bt_hfp_ag_remote_ringing(hfp_ag_call);

if (err != 0) {
printk("Fail to notify hfp unit that the remote starts ringing (err %d)\n", err);
Expand All @@ -344,7 +352,7 @@ static void call_remote_accept_work_handler(struct k_work *work)

printk("Remote accepts the call\n");

err = bt_hfp_ag_remote_accept(hfp_ag);
err = bt_hfp_ag_remote_accept(hfp_ag_call);

if (err != 0) {
printk("Fail to notify hfp unit that the remote accepts call (err %d)\n", err);
Expand Down
Loading
Loading