The loop was supposed to set the alert level to the highest
value by any device. The loop, however, only made sense if
CONFIG_BT_MAX_CONN > 1.
It has been modified to start from [0] instead of [1] and
the initial condition was modified.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This PR adds ability to build mesh with tf-m psa
for platforms those support tf-m.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Fixing error: undefined reference to 'vs_set_min_used_chans'
when building with 'BT_HCI_VS_EXT' option disabled.
Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>
BT_ID_DEFAULT is hardcoded in mesh. Added clarification about
the necessity of another local identity allocation for BLE
if it coexists with mesh.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Setting default value for BT_BUF_ACL_TX/RX_SIZE and
BT_CTLR_DATA_LENGTH_MAX to 37, as this will process the
incoming data the most efficient way.
When GATT is enable BT_BUF_ACL_RX_SIZE does not have to be 73,
as this will just give segmented messages for the public keys
exchange during provisioning.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
After adding support for virtual addresses with collision (where two
Label UUIDs have the same virtual address), the format of the data in
the persistent storage with the Label UUIDs which a model is subscribed
to or publishes to has been changed. The recovery code is added and the
Label UUIDs will be recovered by picking first Label UUID matching to
the virtual address in the subscription list or model publication. This
options can disable the recovery code and save some flash if the
recovery is not required (e.g. virtual address support wasn't enabled
before this option was added, or the devices were unprovisioned before
upgrading to the version with this option).
Making this option as deprecated to be able to drop support of this
option and remove the recovery code eventually.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit adds the following features related to virtual addresses
support:
- Allows to store Label UUIDs which virtual addresses collide;
- Allows to decrypt messages encrypted with a virtual address with
collision;
- Allows to publish a message to a specific Label UUID to avoid virtual
addresses collision by adding a pointer to Label UUID to
struct bt_mesh_msg_ctx and struct bt_mesh_model_pub;
- Allows to differentiate Label UUIDs in the model's Subscription List
by storing all subscribed UUIDs in struct bt_mesh_model.uuids field.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When LPN sends a segmented message to itself, it unnecesseraly polls
Friend. Since Friend doesn't receive this message, the segmented message
transmission will eventually fail (send end callback will return error),
while the message will actually be passed to the access layer.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit wrap the `settings_set_one` and `settings_delete` functions
in `bt_settings_store_one` and `bt_settings_delete`. By doing that the
Bluetooth settings can be managed in a single place.
This commit also introduce a new API to manage Bluetooth storage with
`bt_settings_store_*` and `bt_settings_delete_*` functions. Each
Bluetooth settings key have their own store and delete functions. Doing
that so custom behavior for key can be done if necessary.
This change is motivated by a need of keeping track of different
persistently stored settings inside the Bluetooth subsystem. This will
allow a better management of the settings that the Bluetooth subsystem
is responsible of.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The debug pins were configured in a board specific file, however, the
subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/debug.h file
already contains board-specific pins, meaning there's no need to split
the information in 2 places. Move the GPIO configuration calls to the
DEBUG_INIT() macro in the controller debug header.
Note that in the future, Devicetree should be used to provide a
hardware-agnostic debug module.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When config BT_CTLR_PERIPHERAL_ISO_EARLY_CIG_START is enabled, the
minimum accepted offset value in the CIS_REQ is the minimum defined by
the spec.
Add define CIS_MIN_OFFSET_MIN with value 500 us, as defined in the Core
spec. The previously used value of 400 us was incorrect.
Signed-off-by: Morten Priess <mtpr@oticon.com>
A mesh key type has been added to be able to choose the different
key representation for different security libraries.
The type as well as some functionality related to Mesh key
management has been added as a public API.
If tynicrypt is chosen then keys have representation
as 16 bytes array. If mbedTLS with PSA is used then keys are
the PSA key id. Raw value is not kept within BLE Mesh stack
for mbedTLS. Keys are imported into the security library
and key ids are gotten back. This refactoring has been done
for the network(including all derivated keys), application,
device, and session keys.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The auto-connect by name did not verify that the found device
was connectable before attempting to connect.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Even if PRB state is disabled, PRB can still be sent over GATT if Proxy
Privacy parameter is enabled. In such case PRB won't be regenerated.
To keep the privacy of the network, PRB should be regenerated when sent
over GATT regardless of PRB state.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to section 6.7, upon connection Proxy Server shall determine
value of Proxy Privacy parameter (sections 6.5 and 7.2.2.2.6). Depending
on that, it will either send Secure Network Beacon or Private Beacon to
Proxy Client, but never both.
Proxy Privacy parameter is determined by GATT Proxy, Node Identity
states and their private counterparts (section 7.2.2.2.6). Since
non-private and private states are mutually exclusive, it is enough to
only check either Private GATT Proxy state or Private Node Identity
state of any known subnet for which the state is currenty enabled.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix binding between GATT Proxy, Node Identity and their private
counterpart states according to sections 4.2.45.1 and 4.2.46.1
accordingly. When non-private state is enabled, the private counterpart
is disabled. The reverse binding prohibits change of non-private state.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This fixes the failure to use a resolvable private address in this
scenario.
1. call `bt_le_oob_get_local`, will generate and mark RPA as valid
2. start connectable adv w/ IDENTITY bit
3. start connectable adv w/o IDENTITY
4. RPA is not set (in `bt_id_set_private_addr`) because RPA
is still marked as valid
When EXT_ADV is enabled and the controller supports it, a different code
path is taken that doesn't have this issue.
Unconditionally invalidating the RPA when starting advertising works around
this issue.
Fixes#56326
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Currently, when an incoming dynamic LE L2CAP connection is requested by
a peer, the connected() callback provided by the user is raised
*before* a L2CAP_LE_CREDIT_BASED_CONNECTION_RSP is sent back to the
peer.
In some cases the user will start sending data in the connected()
callback which would be received too early by the peer.
This commit fixes this behavior by making sure the connected() callback
is raised only after the connection response has been sent to the peer.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
Fix an issue causing a wrong Bluetooth identity value to be stored. It
was happening because the `bt_dev.id_count` was incremented after the
settings being stored.
To fix this, `bt_dev.id_count` is now incremented right before the ID
creation and is decremented if the ID creation failed.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
bt_uuid_str expects UUID in little endian while UUID encoded into
unprovisioned mesh beacon is encoded in big endian. sys_memcpy_swap will
change endianess of uuid so that bt_uuid_str can be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL_INF may not be present while
CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL is always present.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When calling the `terminate_call` the `inst` would always be NULL
as we had just terminated the call that we attempted to look up.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BlueZ stack in Linux distributions use disable all
advertising sets when advertising is turned off.
Add missing implementation to support disabling all
active advertising sets.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rework internal header files to not have includes, rather
have the required includes in the c source files.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:
- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h
Fixes#58214.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add function to cancel any current proecedure. This is useful
in cases where the connection to one or more acceptors is lost
or if some acceptor does not respond to our requests for whatever
reason.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
An ASCS endpoint may go into either the idle or codec configured
state when a stream is released. However since we have such a high
coupling between audio streams and endpoints, we need to consider
the endpoint as having been released (i.e. gone to the IDLE state).
This is handled by a boolean state variable for now, but we may
want to consider a more generic approach where streams and
endpoints may be less coupled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When an audio stream in a bidirectional CIS is released,
it should not disconnect the CIS if there is still a stream
for the opposite direction streaming. Only if both streams
are not in a streaming state, should ASCS attempt to disconnect
the CIS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Log status values in events as hex instead of decimal
to make it easier to compare to the spec and hci_err.h
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When a device disconnects we previously just unref'ed it and
set default_conn = NULL. However, if we are connected to mulitple
devices, it makes sense to set the default_conn to one of the
other connections.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the implementation of parse_search to use a
net_buf_simple and bt_data_parse to parse the LTV
search structure.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set the secondary advertising PHY to a valid value when using
legacy advertising through the LE Set Extended Advertising Parameters
command.
Fixes#57885.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
As the coarse tick of ACL prepare and CIG prepare jitter by
+/- 1 tick, hence when initially scheduling the CIG place it
with enough margin so that cis_offset_min calculated when
there already exists a CIG can be larger than peer's
cis_offset_min being negotiated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrectly stored Broadcast ISO interval in
microseconds instead of storing in 1.25 ms units.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce a Kconfig BT_CTLR_ISOAL_SN_STRICT to relax the Tx
ISO Data SDUs being dropped due to strict check of sequence
numbers in ISOAL, i.e. dropped when ISO Data SDUs are
delayed from upper layer with respect to the current
payload number in the ISO radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
block_size_log can be 0x20 which will shift 1 by 32 bits which will
cause undefined behavior. Adding ULL to 1 is an option but this will add
little bit more code when debug option is enabled. So simply print the
logarithmic value.
Coverity-ID: 316387
Fixes#58951
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
GATT server was not doing enough check before udpating the CCC.
For example, a non-bonded client could update the CCC of a bonded client
by spoofing his address.
This fix the issue by dissociating the CCC configuration of a bonded and
a non-bonded peer. To do that, a new field is added to the CCC config:
`link_encrypted`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
In PR (#58723) has introduce another bug, that,
the flag ADV_FLAG_PROXY set before actually enabled.
When ctx:: BT RX call schedule_send will atomic_test_and_clear
ADV_FLAG_PROXY, but at this time, the proxy advertising will
not at advertising state, maybe in update params or set adverting
data phase,
so that, call bt_le_ext_adv_stop will nothing, and then call
k_work_reschedule --> send_pending_adv(at this time, the proxy
advertising actually enabled, but the upper layer clear proxy flags),
cause latest advertising unable start, because unable in advertising
state to update params(-EINVAL).
Fixes: #58721
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
As long as we do not have NVS support in TBS, the subscriptions shall be
removed once ACL is disconnected to avoid potential crash on
reconnection, as the subscription parameters might be not valid anymore.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>