Commit graph

9787 commits

Author SHA1 Message Date
Pavel Vasilyev
fd4cc0e031 bluetooth: host: att: Remove meaningless check
`>= 0` was used when EATT support was implemented (#23199) because
`bt_l2cap_chan_send` could return number of bytes sent. After PR #67528,
`bt_l2cap_chan_send` doesn't return amount of bytes sent or any positive
value, but either 0 or negative value. Thus `>= 0` is not needed. It
also confusing when reading code, especially when the same check is not
implemented in other cases where underlying function `chan_send` is
used.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Pavel Vasilyev
e53e4cf0a2 bluetooth: host: att: Remove att_sent function
`att_sent` is removed as it does not provide any value. All checks are
already performed in `att_on_sent_cb`, and keeping it only increases
readability complexity.

`att_sent` is removed as doesn't give any value. All checks are done
already in `att_on_sent_cb`. It just increases readness complexity.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Pavel Vasilyev
18b85290cd bluetooth: host: att: Remove chan_req_send
The extra `bt_att_chan_req_send` does nothing but increases readability
complexity. All checks are already performed by the caller.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-07 09:59:29 +02:00
Emil Gydesen
707c518a92 Bluetooth: CAP: Add better active_proc checks
The existing checks were not thread safe at all.
Replace the checks by using atomic_test_and_set_bit
and then clearing the bit again on error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-07 09:59:08 +02:00
Mark Wang
28ba838cda bluetooth: classic: hfp: sco_conn is null in hfp sco_disconnected callback
In bt_sco_disconnected, chan->sco is set as NULL before callback. Then
hfp disconnection callback use it to callback to application in
hfp_hf_sco_disconnected.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-07 07:28:18 +02:00
Alberto Escolar Piedras
59b62243fa Bluetooth: HFP_AG: Initialize variable to avoid warning
gcc 11.4.0, seems to believe this variable may be used uninitialized,
and warns about it (causing a test build failure due to warnings
being treated as errors).
Let's just initialize the variable to 0 to avoid the issue, as the
cost is trivial.

subsys/bluetooth/host/classic/hfp_ag.c: In function
  ‘bt_hfp_ag_vts_handler’:
1095
subsys/bluetooth/host/classic/hfp_ag.c:3091:17: error: ‘code’ may be
  used uninitialized in this function [-Werror=maybe-uninitialized]
1096
 3091 |                 bt_ag->transmit_dtmf_code(ag, code);
1097
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1098

The issue can be reproduced for ex. with:
$ mkdir build ; cd build
$ cmake -GNinja -DBOARD=native_sim/native/64 ../tests/bluetooth/shell \
 -DCONF_FILE="prj_br.conf"
$ ninja

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-04-04 18:18:16 +02:00
Emil Gydesen
2dbc10ab6b Bluetooth: BAP: Fix bad cast to void * instead of void for memcpy
The result of memcpy should be cast to (void) and not (void *).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 18:16:54 +02:00
Lars-Ove Karlsson
bf29b2a8d7 bluetooth: host: Fixed missing guard for BT_SETTINGS_DEFINE
While linking with the IAR linker using generated linker scripts,
and with errors if unhandled sections are encountered, many of the
bluetooth tests failed because CONFIG_SETTINGS was not set.

The section that was not handled was
'._settings_handler_static.static.settings_handler_bt_ccc_'

Now it's only set if CONFIG_SETTINGS is set.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-04-04 14:56:10 +02:00
Emil Gydesen
acd7080350 Bluetooth: BAP: Call bis_sync_req for all BIS sync state changes
Previously bis_sync_req was only called when requested_bis_sync
was changed. However that meant that there were cases where the
requested_bis_sync was the same as the new request, but where
the actual BIS sync state were different. This was mostly
the case when the scan delegator had autonousmly
added or modified the receive state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 12:06:19 +02:00
Emil Gydesen
f39feb8aa7 Bluetooth: BAP: Fix bad overwrite of requested_bis_sync
The scan_delegator_mod_src accidentally may have overwritten
the value of internal_state->requested_bis_sync before the
entire request had been verified, causing a mismatch between
what the application knows and what the stack stored.

Fixed by storing the request in a temporary value until
everything has been verified and accepted.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-04 12:06:19 +02:00
Vinayak Kariappa Chettimada
47c7918393 Bluetooth: Controller: Single recv thread for HCI-only builds
Updated implementation to use single receive thread to
enqueue HCI ISO data, ACL data and events towards Host when
building HCI-Only samples/applications, i.e. when building
hci_uart, hci_spi or hci_ipc samples (CONFIG_BT_HCI_RAW=y).

This implementation will serialize HCI events and data as
they occur corresponding to on-air timelines of their
occurrences which is how they are generated by the Link
Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-04-04 09:35:16 +02:00
Mark Wang
891e457873 bluetooth: classic: Fix remote name resolving with multiple devices
The error occur when discoverying br devices and need to send request_name
for many found devices.
In system work queue task, bt_hci_inquiry_complete->
report_discovery_results is called, then request_name is called for all
the found devices. The controller gives HCI_Remote_Name_Request_Complete
event for every name request result and one buf is allocated from
hci_rx_pool to save HCI_Remote_Name_Request_Complete. When system work
queue task is blocked to call request_name for every device, many
HCI_Remote_Name_Request_Complete are received for the already sent
request_name, it uses up all the buf of hci_rx_pool, then the bt_rx_thread
task is blocked to get buf from hci_rx_pool when next
HCI_Remote_Name_Request_Complete is received, meanwhile the next
request_name send hci cmd and wait the result, but the hci status/complete
event can't be received because the bt_rx_thread is blocked and
bt_uart_isr is kept in the state to receive last
HCI_Remote_Name_Request_Complete, then bt_dev.ncmd_sem is not released,
then the next request_name send hci cmd again, but the bt_dev.ncmd_sem is
invalid, then bt_hci_cmd_send_sync fail and assert.

resolve it by requesting name one by one.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-03 17:48:04 +02:00
Troels Nilsson
c32bf58173 Bluetooth: Controller: Fix an error code in ll_adv_sync_ad_data_set
When an advertising set is not configured for periodic advertising,
the correct error to return is BT_HCI_ERR_CMD_DISALLOWED

Fixes EBQ test failure of HCI/DDI/BI-70-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-04-03 13:16:14 +02:00
Lyle Zhu
c09cf23844 Bluetooth: HFP_AG: Add ACL conn to the connected callback
If the AG works as Data Channel Acceptor, the ACL conn cannot be known
by the application of AG. Similar with HF, add ACL conn as the first
parameter to the `connected` callback of AG.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
ec0d473ec0 Bluetooth: HFP_AG: Remove unnecessary code line __fallthrough
Remove all unnecessary code lines `__fallthrough` from switch-case.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
ded0b176a6 Bluetooth: HFP_AG: Optimize feature access
Add `BOTH_SUPT_FEAT(ag, _hf_feature, _ag_feature)` to check if the
feature is supported by both side.
Add `HF_SUPT_FEAT(ag, _feature)` to check if the feature is supported
by HF.
Add `AG_SUPT_FEAT(ag, _feature)` to check if the feature is supported
by AG.

Use `BOTH_SUPT_FEAT/HF_SUPT_FEAT/AG_SUPT_FEAT` to optimize code that
checks whether a feature is supported.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
9cda31a4ca Bluetooth: HFP_AG: Remove unnecessary lock for feature read access
The lock/unlock for AG/HF feature read access is unnecessary.
For AG feature, it only be changed when creating new AG object.
For HF feature, it only be changed when exchanging feature in SLC
establishment.

Remove the hfp_ag_lock/hfp_ag_unlock for AG/HF feature read access.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
d37f250174 Bluetooth: HFP_AG: Change "-EOPNOTSUPP" to "-ENOEXEC"
There is an error reported in platform `native_sim` that the value of
`EOPNOTSUPP` is same as `ENOTSUP`.
It cause the building error `duplicate case value '-95'` reported.

Use `ENOEXEC` to replace `EOPNOTSUPP` to fix the building issue.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
eb327af328 Bluetooth: HFP: Divide hfp_internal.h
Divide hfp_internal.h into two parts, HFP HF part hfp_hf_internal.h and
HFP common part hfp_internal.h.

Includes "hfp_internal.h" in file "hfp_ag_internal.h".
Includes "hfp_ag_internal.h" in file "hfp_ag.c".

Includes "hfp_internal.h" in file "hfp_hf_internal.h".
Includes "hfp_hf_internal.h" in file "hfp_hf.c".

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
67e01dfd26 Bluetooth: Shell: BR: Find HFP_HF records on HFP_AG side
Add a option `HFPHF` to find HFP HF SDP records from HFP AG side.

Add a SDP records discovery parameter `discov_hfphf` for this option.

Add a function `sdp_hfp_hf_user` to handle the discovery result.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
eba356d56b Bluetooth: shell: Support HFP HF and AG
Support HFP HF and AG in shell.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
781074c6e2 Bluetooth: HFP_HF: Improve SCO accept
Find HF object according to conn object index directly.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
3723ba1eee Bluetooth: HFP_AG: Support RFCOMM responder
Define SDP records for HFP AG. Register HFP AG SDP service records in
AG initialization.

Register HFP AG RFCOMM server in AG initialization.

Register HFP AG SCO server in AG initialization.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
4833f82a8c Bluetooth: HFP_HF: Verify ability to reject a call
Check the ability of AG to reject a call. If the AG cannot reject the
call, return error `-ENOTSUP`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
507c2e7fc0 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 <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
d7cdadc4be Bluetooth: HFP_HF: Initiate SLC establishment
Add function `bt_hfp_hf_connect` to initialize the Service Level
Connection establishment procedure.

Add function `bt_hfp_hf_disconnect` to release the Service Level
Connection.

Clear HF object if the RFCOMM is disconnected.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
d9dd2e476b Bluetooth: HFP_HF: fix typo
Change `HF_SINGNAL_IND` to `HF_SIGNAL_IND`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
0d7eca6955 Bluetooth: HFP_AG: Support HF Indicators
Add configuration `CONFIG_BT_HFP_AG_HF_INDICATORS` to enable feature
HF Indicators.

Add configuration `CONFIG_BT_HFP_AG_HF_INDICATOR_ENH_SAFETY` to
support HF indicator `Enhanced Safety`.

Add configuration `CONFIG_BT_HFP_AG_HF_INDICATOR_BATTERY` to support
HF indicator `Remaining level of Battery`.

Add function `bt_hfp_ag_hf_indicator` to activate/deactivate HF
indicator.

Optimize the handle of AT command `AT+BIND`.

Handle AT command `AT+BIEV`.

Add callback `hf_indicator_value` to notify the value of HF indicator.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
01de855828 Bluetooth: HFP_HF: Support HF Indicators
Add configuration `CONFIG_BT_HFP_HF_HF_INDICATORS` to enable feature
HF Indicators.

Add configuration `CONFIG_BT_HFP_HF_HF_INDICATOR_ENH_SAFETY` to
support HF indicator `Enhanced Safety`.

Add configuration `CONFIG_BT_HFP_HF_HF_INDICATOR_BATTERY` to support
HF indicator `Remaining level of Battery`.

Add function `bt_hfp_hf_enhanced_safety` to transfer enhanced safety
status.

Add function `bt_hfp_hf_battery` to transfer Remaining level of
Battery.

Send AT command to notify AG the supported HF indicators of HF in SLC
initialization sequence.

Send AT command to get the supported HF indicators of AG in SLC
initialization sequence.

Send AT command to get the enabled/disabled state of generic status
indicators from AG in SLC initialization sequence.

Handle unsolicited result code `+BIND`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
04122445bb Bluetooth: HFP_HF: Optimize SLC init procedure
In current implementation, it is difficult to insert new AT commands
in the SLC initialization sequence.

Add a SLC initialization sequence. Send AT command one by one.

It will be easy to insert new AT commands in the appropriate position.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
32e6c21e0d 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 <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
2011dcb3ee Bluetooth: HFP_HF: Activate/deactivate AG indicators
Add a function `bt_hfp_hf_indicator_status` to activate/deactivate AG
indicators.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
f915f86761 Bluetooth: HFP_AG: Set service availability
Add a function `bt_hfp_ag_service_availability` to set the service
availability.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
dbd3887b91 Bluetooth: HFP_AG: Set battery level
Add a function `bt_hfp_ag_battery_level` to set the battery level.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
04c4abdcb3 Bluetooth: HFP_AG: Set roaming status
Add a function `bt_hfp_ag_roaming_status` to set the roaming status.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
afa09067ca Bluetooth: HFP_AG: Set signal strength
Add a function `bt_hfp_ag_signal_strength` to set the signal strength.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
b622e748b8 Bluetooth: HFP_AG: Send subscriber number info
Handle AT command `AT+CNUM`.

Add a callback function `subscriber_number` to notify the upper layer
that the HF needs to get subscriber number information from the AG.

If there is subscriber number information needs to be sent, the passed
function `bt_hfp_ag_query_subscriber_func_t func` can be called for
this purpose.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
5dd303620a Bluetooth: HFP_HF: Query subscriber number
Add function `bt_hfp_hf_query_subscriber` to query the AG subscriber
number.

Add callback `subscriber_number` to notify the result of the query of
the subscriber number information.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
1e4c740298 Bluetooth: HFP_AG: Handle DTMF code
Handle AT command `AT+VTS`.

Add a callback `transmit_dtmf_code`. When a valid AT command `AT+VTS`
is received, call the callback to notify the upper layer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
a3a1b409dc Bluetooth: HFP_HF: Transmit DTMF Code
Add a function `bt_hfp_hf_transmit_dtmf_code` to transmit DTMF Codes.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
43be8b8698 Bluetooth: HFP_AG: Attach a phone number for a voice tag
Add configuration `CONFIG_BT_HFP_AG_VOICE_TAG` to enable the feature
`attach a phone number for a voice tag`.

Handle AT command `AT+BINP=1`.

Add callback `request_phone_number` to notify the request and get the
phone number from the upper layer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
853b51d3f6 Bluetooth: HFP_HF: Request phone number
Add a function `bt_hfp_hf_request_phone_number` to request phone number
to the AG.

Add a callback `request_phone_number` to notify the result of the
request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
f842c19ff9 Bluetooth: HFP_AG: Support Voice recognition activation
Add configuration `CONFIG_BT_HFP_AG_VOICE_RECG` to enable Voice
recognition activation feature.

Add configuration `CONFIG_BT_HFP_AG_ENH_VOICE_RECG` to enable Enhanced
Voice Recognition Status feature.

Add configuration `CONFIG_BT_HFP_AG_VOICE_RECG_TEXT` to enable Voice
Recognition Text feature.

Add function `bt_hfp_ag_voice_recognition` activate/deactivate the
Voice recognition activation feature.

Add function `bt_hfp_ag_vre_state` to notify the state of the voice
recognition engine.

Add function `bt_hfp_ag_vre_textual_representation` to notify the
state and textual representation of voice recognition engine.

Add callback `voice_recognition` to notify the upper layer the status
of voice recognition activation.

Add callback `ready_to_accept_audio` to notify the upper layer that
the HF is ready to accept audio.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
b4d4270351 Bluetooth: HFP_HF: Support Voice recognition activation
Add configuration `CONFIG_BT_HFP_HF_VOICE_RECG` to enable Voice
recognition activation feature.

Add configuration `CONFIG_BT_HFP_HF_ENH_VOICE_RECG` to enable Enhanced
Voice Recognition Status feature.

Add configuration `CONFIG_BT_HFP_HF_VOICE_RECG_TEXT` to enable Voice
Recognition Text feature.

Add function `bt_hfp_hf_voice_recognition` to activate/deactivate the
Voice recognition activation feature.

Add function `bt_hfp_hf_ready_to_accept_audio` to indicate that the HF
is ready to accept audio.

Add a callback `voice_recognition` to notify the upper layer the
status of voice recognition activation.

Add a callback `vre_state` to notify the upper layer the state of
voice recognition engine.

Add a callback `textual_representation` to notify the upper layer the
textual representation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
384483a6e6 Bluetooth: HFP_HF: Fix TX queue broken issue
The TX buf will be removed from TX queue after the data has been sent.

It causes the following TX buffers to be lost.

Fix it by removing TX buffer when sending it.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
a1ea2b266b Bluetooth: HFP_HF: Avoid at status overwrote by sending
There is an issue that the sending of AT+command will overwrite the at
status when the at is handling receiving.

Add a flag `BT_HFP_HF_FLAG_RX_ONGOING` to flag the receiving is
working.

When the flag is set, suspend the TX sending.

Add a worker to restart the tx sending.

After the flag `BT_HFP_HF_FLAG_RX_ONGOING` is cleared, submit the TX
worker to restart the tx sending.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
77b640446f Bluetooth: HFP_HF: Enable 3-way feature
Add a configuration `BT_HFP_HF_3WAY_CALL` to control the feature.

Add a configuration `BT_HFP_HF_MAX_CALLS` to define supported maximum
calls.

Add a configuration `BT_HFP_HF_ECS` to configure the Enhanced Call
Status feature.

Add a configuration `BT_HFP_HF_ECC` to configure the Enhanced Call
Control feature.

Add a structure `struct bt_hfp_hf_call` to manage the call.

Add the call object to callback `outgoing`, and`incoming`.

Use call object to replace AG object for callbacks `remote_ringing`,
`on_hold`, `accept`, `reject`, `terminate`, `call_held`,
`ring_indication`, and `clip`.

Change callback `call_held` to `held`.

Add callback `retrieve` for the retrieved held call.

Add callback `call_waiting` to notify the application a new call is
waiting.

Use call object to replace AG object for function `bt_hfp_hf_accept`,
`bt_hfp_hf_reject`, `bt_hfp_hf_terminate`, and
`bt_hfp_hf_hold_incoming`.

Add functions for 3-way feature, including
`bt_hfp_hf_call_waiting_notify`, `bt_hfp_hf_release_all_held`,
`bt_hfp_hf_set_udub`, `bt_hfp_hf_release_active_accept_other`,
`bt_hfp_hf_hold_active_accept_other`, `bt_hfp_hf_join_conversation`,
`bt_hfp_hf_explicit_call_transfer`, `bt_hfp_hf_release_specified_call`,
and `bt_hfp_hf_private_consultation_mode`.

Add a new function `at_get_raw_string` to get the raw string from AT
response.

Move definitions of AT+CLCC value from hfp_ag_internal.h to
hfp_internal.h.

Monitor unsolicited result code `+CCWA`.

Enable `Call Waiting Notification` if the feature is supported by both
side when the SLC connected.

Get CHLD values supported by AG if the 3-way calling feature is
supported by both side.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
bc6684b745 Bluetooth: HFP_AG: Move CLCC status definitions
Move CLCC status definitions from hfp_ag_internal.h to hfp_internal.h.

And change name from HFP_AG_CLCC_STATUS_XXX to BT_HFP_CLCC_STATUS_XXX.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
0d5cfaab19 Bluetooth: HFP_HF: Use HF object to replace conn object
Use HF object to replace conn object for callbacks `disconnected`,
`sco_connected`, `service`, `outgoing`, `remote_ringing`, `incoming`,
`incoming_held`, `accept`, `reject`, `terminate`, `call_held`,
`signal`, `roam`, `battery`, `ring_indication`, `dialing`, `clip`,
`vgm`, `vgs`, `inband_ring`, `operator`, `codec_negotiate`, and
`ecnr_turn_off`.

Use HF object to replace conn object for functions `bt_hfp_hf_cli`,
`bt_hfp_hf_vgm`, `bt_hfp_hf_vgs`, `bt_hfp_hf_get_operator`,
`bt_hfp_hf_accept`, `bt_hfp_hf_reject`, `bt_hfp_hf_terminate`,
`bt_hfp_hf_hold_incoming`, `bt_hfp_hf_query_respond_hold_status`,
`bt_hfp_hf_number_call`, `bt_hfp_hf_memory_dial`, `bt_hfp_hf_redial`,
`bt_hfp_hf_audio_connect`, `bt_hfp_hf_select_codec`,
`bt_hfp_hf_set_codecs`, and `bt_hfp_hf_turn_off_ecnr`.

Add a parameter `struct bt_hfp_hf *hf` to callback `connected`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
94de015498 Bluetooth: HFP_AG: Enable 3-way feature
Add a configuration `BT_HFP_AG_3WAY_CALL` to control the feature.

Add a configuration `BT_HFP_AG_MAX_CALLS` to define supported maximum
calls.

Add a structure `struct bt_hfp_ag_call` to manage the call.

Add the call object to callback `outgoing`, and`incoming`.

Use call object to replace AG object for callbacks `incoming_held`,
`ringing`, `accept`, `reject`, and `terminate`.

Add callback `held` to notify the call held status.

Use call object to replace AG object for function
`bt_hfp_ag_hold_incoming`, `bt_hfp_ag_reject`, `bt_hfp_ag_accept`,
`bt_hfp_ag_terminate`, `bt_hfp_ag_remote_ringing`,
`bt_hfp_ag_remote_reject`, `bt_hfp_ag_remote_accept`, and
`bt_hfp_ag_remote_terminate`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00