Add the configuration `BT_HFP_HF_CODEC_NEG` to configure the codec
negotiation feature.
Add a configuration `BT_HFP_HF_CODEC_MSBC` to support mSBC codec.
Add a configuration `BT_HFP_HF_CODEC_LC3_SWB` to support LC3 SWB codec.
Add a function `bt_hfp_hf_audio_connect` to trigger audio connection
sequence.
Add a function `bt_hfp_hf_select_codec` to response the codec
negotiation request.
Add a function `bt_hfp_hf_set_codecs` to notify the AG supported Codec
IDs of HF.
Handle unsolicited response `+BCS` sent from AG.
Send supported Codec IDs supported by HF if the SLC is established.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a configuration BT_HFP_AG_CODEC_NEG to configure the feature.
Add a function bt_hfp_ag_audio_connect to setup the codec negotiation
procedure.
Improve AT+BAC and AT+BCC handle.
Add callback codec_negotiate to notify the application of codec
negotiation result.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a configuration BT_HFP_AG_EXT_ERR for this feature.
If the feature is not set, response the ERROR to the peer if the AT
command AT+CMEE received.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a dedicated SDP features definition.
Set feature "Three-way calling" by default both in SDP features
definition and AT command features definition. Because it is set
by default in Spec.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a function `bt_hfp_hf_accept` to accept the incoming call.
Add a flag BT_HFP_HF_FLAG_INCOMING to identify the incoming call.
Set the flag if the call_setup value is 1.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Expose a function to set the network operator and mode.
Response the AT+COPS? command with set mode and operator.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add function `bt_hfp_hf_get_operator` to read the currently network
operator of AG.
Add callback `operator` to notify the application of the response.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Send AT command AT+VGM and AT+VGS after SLC established.
The `VGM` and `VGS` can be set by calling function `bt_hfp_hf_vgs` and
`bt_hfp_hf_vgs` in HF connection callback.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add AT command sending structure to queue all AT commander needed to
be sent after the SLC established.
After the SLC established, send AT command line one by one.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Support separator "=".
If the separator is "=", only when result code is VGS" or "VGM", the
result code is valid.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +BSIR issued by the AG to indicate
to the HF that the in-band ring tone setting has been locally changed.
Add a callback `inband_ring` to notify the in-band ring tone setting.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
All set flags are cleared when call is terminated. But for case that
SLC is not disconnected, only call related flags should be cleared.
Just clear call related flags if the call is terminated.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The AT command `AT+CLIP=1` or `AT+CLIP=0` cannot be parsed correctly.
Check `=` before get AT command value.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add function bt_hfp_hf_vgm to configure Gain of Microphone.
Add function bt_hfp_hf_vgs to configure Gain of Speaker.
These functions are controlled by configuration
`CONFIG_BT_HFP_HF_VOLUME`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +VGS and +VGM if the configuration
`CONFIG_BT_HFP_HF_VOLUME` is enabled.
Add a callback `vgm` to notify the application speaker microphone
notification if the configuration `CONFIG_BT_HFP_HF_VOLUME` is enabled.
Add a callback `vgs` to notify the application speaker gain
notification if the configuration `CONFIG_BT_HFP_HF_VOLUME` is enabled.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add tx pending queue to queue call AT commands.
Add a function bt_hfp_hf_cli to enable/disable CLI notification.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +CLIP.
Add a callback `clip` to notify the application if the configuration
`CONFIG_BT_HFP_HF_CLI` is enabled.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add Kconfig to configure the HF `CLI` and `VOLUME` features.
Add a macro `BT_HFP_HF_SDP_SUPPORTED_FEATURES` for SDP HF record.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
After SSP has been completed and before LK event notification, the
link key may be invalid when handling the ACL disconnection event.
Check `conn->br.link_key` before calling the function
`bt_keys_link_key_clear()` to clear it.
Fixes#87880.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the bonding information of classic is
queried by calling the function `bt_foreach_bond()`. And the bonding
information of classic is deleted by calling `bt_unpair()`.
There are two issues if the LE and classic are bonded at same time for
dual mode peer device.
Issue 1, for the function `bt_foreach_bond()`, there are two bonding
information will be found. But there is no way to find which bonding
information belongs to LE or classic.
Issue 2, For the function `bt_unpair()`, all bonding information will
be deleted if the passed address is the public address. But there is
no way to delete the bonding information of LE or classic.
Remove the calling of function `bt_foreach_bond_br()` from the
function `bt_foreach_bond()`. And rename it to `bt_br_foreach_bond()`,
and public it as an API to query the bonding information of classic.
Remove the calling of function `bt_keys_link_key_clear_addr()` from
the function `bt_unpair()`. Add an API `bt_br_unpair()` to delete the
bonding information of classic.
Add a `br_bond_deleted` to structure `bt_conn_auth_info_cb` for
classic. The callback will be triggered if the bonding information has
been deleted by the function `bt_br_unpair()`.
Add a `clear` shell command for classic to delete the bonding
information.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, when receiving the L2CAP frame
`L2CAP_COMMAND_REJECT_RSP` if the L2CAP is working as client role, the
L2CAP frame `L2CAP_COMMAND_REJECT_RSP` will be sent by the L2CAP
client incorrectly.
When the command response `L2CAP_COMMAND_REJECT_RSP` is received, find
the channel of the command request according to the received `ident`.
If the channel is found, try to disconnect the channel. If fail to
disconnect the channel, remove and delete the channel.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the `ident` of the command response is not
checked whether it is same as the `ident` sent by the L2CAP command.
Keep the `ident` of the command. If the received `ident` of the
command response is not aligned with the `ident` of the command,
discard the response silently. Or, clear the saved `ident`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
If more than one CIS in the same CIG was shutdown at the same time
(e.g. due to supervision timeout), the mayfly calling cis_tx_lll_flush
would be busy and the assert would be triggered
cis_tx_lll_flush now operates similar to cis_disabled_cb; Loop through
all CISes for a CIG and flush any marked as LLL_CIS_FLUSH_PENDING
Signed-off-by: Troels Nilsson <trnn@demant.com>
We can't do synchronous HCI command sending in any settings commit()
callback, since we don't know what context the callback is being called
from. One particular deadlock can happen if settings_load() is called from
the preemptible main thread:
main()
|--> settings_load() (aquire settings_lock mutex)
|-->commit callback A that defers to system wq
|-->commit callback B that calls bt_hci_cmd_send_sync()
system wq from the previous deferral from within settings_load():
|--> work item
|--> settings_save_one()
|--> attempt to aquire settings_lock mutex
In the above scenario, the bt_hci_cmd_send_sync() call from the main thread
depends on the system workqueue being processed (since that's what does HCI
command processing by default), while at the same time holding the settings
subsystem's mutex. At the same time, a system wq item tries to store
something into settings, however it deadlocks waiting for the settings
mutex.
The actual scenario that we have in the Bluetooth subsystem is where
"commit callback A" is commit_settings() in host/settings.c, and "commit
callback B" is keys_commit() in host/keys.c.
The solution to the deadlock is to take advantage of deferred bt_id_add()
handling which already exists, i.e. set a flag and deferre the actual
adding to the system workqueue.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The CS complete callbacks provide both status and params.
In the case of errors, NULL pointer is passed to the params of callbacks.
Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
If the HCI status of a complete event is not BT_HCI_ERR_SUCCESS,
the remaining parameters could be invalid.
In this case, the params is passed as NULL pointer to the callbacks.
- LE CS Read Remote Supported Capabilities Complete event
- LE CS Read Remote FAE Table Complete event
- LE CS Config Complete event
- LE CS Security Enable Complete event
- LE CS Procedure Enable Complete event
This change avoids forwarding the invalid fileds to the applications.
Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
Due to sizeof('\0') evaluating to 4 bytes instead of 1:
- Each UDI field had 4 instead of 1 'zero byte' appended
(as specified by BLE spec).
- Any field of length 4 was being skipped entirely.
Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
The publication period is defined by Steps and Resolution.
At BLE Mesh protocol level, the period is encoded in a byte
where first LSB 6 bits correspond to PerSteps and the last
two to PerRes. There is an issue on how the code at
`subsys/bluetooth/mesh/shell/cfg.c:model_pub_set` is encoding
these two values into the publication period byte.
This is commit fixes issue #87780
Signed-off-by: Raúl Gotor <raulgotor@gmail.com>
If the connection handle given to a Read/Write Authenticated Payload
Timeout HCI command is a CIS or BIS handle, the error returned has to
be BT_HCI_ERR_CMD_DISALLOWED with the new TCRL
Fixes EBQ test failures in HCI/BIS/BI-14-C, HCI/BIS/BI-15-C,
HCI/CIS/BI-20-C and HCI/CIS/BI-22-C
Signed-off-by: Troels Nilsson <trnn@demant.com>
Commit fixes bug when corresponding group ID was never
incremented for independent corresponding relationships.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
When deriving the new LK, remove the old LK if it exists.
Store the derived LK if the flag `SMP_FLAG_BOND` of LE SMP is set.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The flag `BT_LINK_KEY_SC` of LK will also be set when derive LK from
LTK.
It is a incorrect behavior.
The flag `BT_LINK_KEY_SC` should only be set if the flag `BT_KEYS_SC`
of LTK has been set.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The flag `SMP_FLAG_BR_CONNECTED` is cleared by the function
`smp_br_reset()` and `smp_br_init`. But the flag
`SMP_FLAG_BR_CONNECTED` should not be cleared at this time.
Recovery the flag `SMP_FLAG_BR_CONNECTED` after the all flags of SMP
cleared.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
If the encrypt value of classic connection is
`BT_HCI_ENCRYPTION_ON_BR_AES_CCM`, set the flag `BT_KEYS_SC` for
the derived LTK.
Or, clear the flag `BT_KEYS_SC` for the derived LTK.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the flag `local_dist` will be cleared when
the distributed key frame is performed if the local is the SMP
initiator. After the distributed key is sent out, the function
`smp_pairing_br_complete()` will be called if all bits of `local_dist`
are cleared.
It causes the function `smp_pairing_br_complete()` will be called
multiple times.
Add a flag `local_distributed` to flag the all sent keys. Add only the
flag `local_distributed` is not set, preform the key distribution
frame.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The derived LE keys are not saved to NVM. And the IRK is not added to
controller resolving list. It causes two issues,
Issue 1, the LE connection connection cannot be established if the adv
address of peer is RPA.
Issue 2, the LE keys are missing after the power reset.
For issue 1, add a function `smp_br_id_add_replace` to add LE keys.
For issue 2, check the BR bondable flag `BT_CONN_BR_NOBOND` instead of
`SMP_FLAG_BOND`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix incorrect payload count at CIS Establish due to existing
CIG event overlapping the ACL event at the instant when the
CIS gets the active flag set.
The overlapping CIG event picked up the new CIS that had its
active flag set in the current CIG event instead of at the
actual CIS offset which is in the next CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS offset calculation due to use of decremented ACL
event counter, where as the CIS offset is inquired in the
next ACL event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect CIS offset in use if instant is picked from
the peer sent CIS RSP PDU. Instead, keep the instant that
was sent in the CIS REQ PDU as the instant to send in the
CIS IND PDU.
This fixes CIS failed to be established when dissimilar
ACL and ISO intervals are in use.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect payload count at CIS Establish due to existing
CIG event overlapping the ACL event at the instant when the
CIS gets the active flag set.
The overlapping CIG event picked up the new CIS that had its
active flag set in the current CIG event instead of at the
actual CIS offset which is in the next CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Peripheral CIS sorted by CIG implemenation to use CIS
offset stored in LLL context which is the correct offset
from the CIG anchor point. CIS offset in the ULL context
is the offset from the ACL anchor point at the time of
the CIS establishment.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS event_count_prepare use missed as part of fixes
related to commit be91cfedfb ("Bluetooth: Controller: Fix
incorrect event_count when CIG overlaps").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Commit removes device key candidate if provisionee failed
during device key refresh procedure or mesh reset has been
called in between. Otherwise, device key candidate gets
stuck in the internal trusted storage of crypto library.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>