get the avdtp error code based on Zephyr err code to make the codes more
clear.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1d4d97fdb41791501eb63934f096bcc88cb2da81)
If the previous cmd req is triggered, the cmd fail to trigger again and
keep the previous cmd req.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit f4197d51b62799748a75c97bd0b68778185ff293)
The `a2dp` is got by `req` through CONTAINER_OF, then the if always is
true.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 24ef59d835c69a30fe8a8e6569405791532d9e0d)
avdtp defines the data format by struct, use it to fill net buf.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit a89f4eddac6f13f981f2ca0b94f07edaad104afa)
check the buf tail room before adding data to buf.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 65f8a9e03baf899684198e707170ad17817f7ce5)
In current implementation, the SLC connected event will be early
notified. It causes the SLC state of AG is not aligned with the state
of HF.
The SLC connected event should be notified after the procedure of HF
indicators is done if the HF indicators feature is supported by both
devices.
Do not notify the SLC connected event after the AG has successfully
responded with information about how call hold and multiparty services
are supported if the HF indicators feature is supported by both
devices.
Notify the SLC connected event after the procedure of HF indicators is
done.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Make sure to consider both the new peripheral and central Kconfig options
when calculating needed TX buffers.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The BT_AUTO_PHY_UPDATE option was problematic in the sense that it didn't
really allow any kind of fine-tuning of what automation is desired. In
particular, it didn't allow specifying which PHY was the preferred one (it
was hardcoded to 2M) and also didn't allow specifying role-specific
(central vs peripheral) preferences.
To solve this, deprecate the old option, and instead introduce
role-specific options that allow specifying 1M/2M/Coded/None as the
preference. The new options have slightly different defaults than the new:
for central role 2M stays as the preference, however since it's uncommon to
require automated changes on the peripheral side the default is set to
None there.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
bt_conn_get_info API is used to retrieve connection-related
information. However, bt_conn_get_info sends the HCI command
BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE to retrieve current
key_size, causing excessive blocking time.
Signed-off-by: Xiang Liu <liuxiang18@xiaomi.com>
when ep is configured, the ep is used by the avdtp session, so combine
them together when ep is configured.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
ep->stream is cleared when stream l2cap is released, it should not be
cleared by close and abort cmd procedure.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
When signal l2cap is disconnected, use `release_work` to release the
related stream l2cap connections. When releasing the sep's stream l2cap,
use `delay_work` to check the stream l2cap disconnecting result.
Move the stream l2cap disconnecting callback to sep because the chan is
in sep, then use this callback to indicate the sep stream chan is
released and sep is idle.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
The `released` callback is enough indicate that the stream is
invalid/released, so remove the `aborted` callback.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Set the MOPL of RX and TX to `BT_OBEX_MIN_MTU` when registering OBEX
server.
Set the TX MOPL to `BT_OBEX_MIN_MTU` when sending OBEX connection
request.
Check if the MOPL of client exceeds MTU of transport when server
receives the connection request.
Check if the MOPL of server exceeds MTU of transport when client
receives the connection response.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Split the structure `struct bt_obex` into two parts.
Part 1 `struct bt_obex`, it is the common part and shared by all OBEX
sessions which share the same one transport.
Part 2 `struct bt_obex_server` and `struct bt_obex_client`. The
`struct bt_obex_server` is used to manage the OBEX session of server
role. The `struct bt_obex_client` is used to manage the OBEX session
of client role.
Add function `bt_obex_server_register()` to register the OBEX server
with specific uuid.
Add function `bt_obex_server_unregister()` to unregister the OBEX
server.
Add function `bt_obex_make_uuid()` to make UUID.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The receiving segmented L2CAP data can not be handled properly. Due to
the `struct bt_l2cap_chan_ops::alloc_buf` is NULL, the partial data
will be notified through callback `struct bt_l2cap_chan_ops::recv`.
The GOEP does not consider this issue and handles it as a completed
packet. It causes the L2CAP disconnecting due to the partial packet
cannot be processed by OBEX.
Add a RX pool, and set `struct bt_l2cap_chan_ops::alloc_buf`. The
L2CAP will allocate the buffer from the pool to buff the segmented
data. Only the completed packet will be notified through
`struct bt_l2cap_chan_ops::recv`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].
Options and parameters for this behavior have been removed,
and the internal bit flag BT_ADV_PERSIST is now always false.
The behavior it used to configure (to keep advertising after a
connection has been established as long as there are connections
available) has also been removed.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].
Options and parameters for this behavior have been removed,
as well as all calls to bt_le_adv_resume().
Also remove adv_get_options() whose bt_le_adv_resume()
is the only caller.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Automatic advertiser resumption is publicly deprecated
since Zephyr 4.0 [1].
Options and parameters for this behavior have been removed.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].
Options and parameters for this behavior have been removed.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
In bt_conn_unref(), if we remove the last reference to the connection,
we notify listeners that a connection object has been freed
and can be taken, then immediately reuse this freed slot
to resume advertising.
This behavior is source of errors, and automatic advertiser resumption
is publicly deprecated since Zephyr 4.0 [1].
Options and parameters for this behavior have been removed.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Automatic advertiser resumption is deprecated since Zephyr 4.0 [1].
To maintain the behavior during the deprecation period, internal
transitional symbols were introduced to replace the deprecated ones
in the implementation:
- _BT_LE_ADV_OPT_CONNECTABLE: same option bit
as BT_LE_ADV_OPT_CONNECTABLE (deprecated)
- _BT_LE_ADV_CONN_ONE_TIME: same option bit
as BT_LE_ADV_CONN_ONE_TIME (deprecated)
The only option for connectable advertising is now BT_LE_ADV_OPT_CONN,
whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME.
We can assume _BT_LE_ADV_CONN_ONE_TIME is true for connectable
advertisers, and meaningless for non-connectable advertisers.
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Automatic advertiser resumption is deprecated since Zephyr 4.0 [1].
To maintain the behavior during the deprecation period, internal
transitional symbols were introduced to replace the deprecated ones
in the implementation:
- _BT_LE_ADV_OPT_CONNECTABLE: same option bit
as BT_LE_ADV_OPT_CONNECTABLE (deprecated)
- _BT_LE_ADV_CONN_ONE_TIME: same option bit
as BT_LE_ADV_CONN_ONE_TIME (deprecated)
The only option for connectable advertising is now BT_LE_ADV_OPT_CONN,
whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME.
We can substitute BT_LE_ADV_OPT_CONN for _BT_LE_ADV_OPT_CONNECTABLE
when testing if an advertising set is connectable.
Note: to fix a ClangFormat warning raised by check_compliance.py,
this commit also includes a formatting change next to the lines
actually edited (subsys/bluetooth/host/id.c:810).
[1] Bluetooth: Deprecate adv auto-resume #73395
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
The bt_conn_tx_processor logged connections not in the
connected state as LOG_WRN, but this is a case that is handled
and could occur during regular behavior.
For this reason the log statement was changed to LOG_DBG,
as the developer/user does not need to worry about it.
Also modifies the statement to log the conn->state for
debugging purposes.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add SDP discovery handlers for AVRCP CT/TG roles and corresponding
discovery parameters and a common result handling function.
Signed-off-by: Make Shi <make.shi@nxp.com>
Fix to improve decryption speed. Decryption starts after
payload reception, hence use fastest mode to decrypt PDUs.
nRF54Lx only supports decryption after payload reception,
this implementation was already there in the code.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reverts relaxed radio packet assignment deadline as it is
too risky and can cause invalid bits be transmitted and/or
cause MIC failures.
Reverts commit 4dbfb22a7e ("Bluetooth: Controller: Relax
radio packet pointer assignment deadline"), and
commit 230df77993 ("Bluetooth: Controller: Relax radio
packet pointer assignment deadline").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
bt_iso_chan_send and bt_iso_chan_send_ts would log
twice for each TX, which is unncessary. LOG_DBG statements
include the function name by default, so the 2nd log
statement was unncessary, and were removed.
Added logging of the ts in bt_iso_chan_send_ts which
would still make it possible to tell the 2 apart,
even if CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix implementation of Broadcast ISO Synchronized Receiver
using single switch timer to consider minimum compare value
requirement.
This fix reduces latencies to setup radio receptions and
fixes an assertion in lll_sync_iso when radio_tmr_start_us()
is checked for latencies.
Relates to commit 5dfc58cff9 ("Bluetooth: Controller: Fix
single switch timer minimum compare value").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
ll_length_req_send and ll_length_default_set were defined to return
a uint32_t, but only returned a uint8_t HCI error code and
was the return value was always stored as such.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
0-init some non-static global variables to avoid
issues with uninitialized values. Also modify
the printing of the broadcast sources found slightly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When `CONFIG_NRF_SYS_EVENT` is enabled, route constant latency requests
through the reference counted API.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Adds assert for bt_bap_iso_bind_ep to ensure that endpoints
from different connection don't share a CIS (a bt_bap_iso).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a check that verifies that 2 endpoints from different
connection don't share a CIS, which would be invalid.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We can actually already when we bind the endpoint to the stream
perform the call to bt_bap_iso_bind_ep, if the stream has been
added to a group.
If the stream has not yet been added to a group, then when
the stream is added to a group, then bt_bap_iso_bind_ep will
be done there (existing behavior).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the issue reported by Coverity CID 487708. The LL_ASSERT was
performed on lll->ptc, which is a 4-bit bitfield and therefore always
succeeds. Instead, the computation (lll->nse - nse) should be checked
to ensure it falls within the 4-bit value range before assigning it
to lll->ptc.
Signed-off-by: Loic Domaigne <tech@domaigne.com>
Use default_unicast_group everywhere in the CAP shell, and mark
all creation of it as default_unicast_group.is_cap = true.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move the function bap_ac_create_unicast_group to the CAP
shell, as that was the only user of it, and rename it to
cap_ac_create_unicast_group, and make it use the CAP API.
Also rename bap_unicast_ac_param to cap_unicast_ac_param
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a common unicast_group struct for both the BAP and
CAP shell, similar to the broadcast_source.
The purpose of this is to be able to use the appropriate type
for both the CAP and BAP shells, instead of using the BAP
unicast group for the CAP shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds support for the user defining their own channels within the
fixed L2CAP channel range. To make this possible, the
`bt_l2cap_fixed_chan` struct and `BT_L2CAP_CHANNEL_DEFINE` macro
needed to converted to public API. In the process of doing so, the
`_destroy` parameter was removed from the `BT_L2CAP_CHANNEL_DEFINE`
macro as it was never used (fixed channels will not be destroyed over
the lifetime of the connection). `BT_L2CAP_CHANNEL_DEFINE` is renamed
`BT_L2CAP_FIXED_CHANNEL_DEFINE` to avoid confusion
The `bt_l2cap_chan_send` function is updated to be able to send data
on fixed l2cap channels.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Rename the bt_bap_is_x_ep functions to better match the
modules where they are implemented.
Additionally modify the check to use IS_ARRAY_ELEMENT
in the broadcast sink and source for a stricter check.
IS_ARRAY_ELEMENT cannot easily be used in the unicast
client and server, as the endpoints are part of another
structure.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>