Added a Kconfig option that makes the RPA sharing feature optional. By
default, the Zephyr Bluetooth stack now uses the RPA rotation policy
that was active before the introduction of the RPA sharing functionality
in the following PR:
https://github.com/zephyrproject-rtos/zephyr/pull/55449
The new Kconfig option configures the advertising sets linked with the
same Bluetooth identity to use the same Resolvable Private Address in
a given rotation period. After the RPA timeout, the new RPA is
generated and shared between the advertising sets in the subsequent
rotation period.
When this option is disabled, the generated RPAs of the advertising
sets differ from each other in a given rotation period.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Statically initialise the callback list so that subscriptions can be
registered before the call to `bt_enable`.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
`bt_mesh_default_key` is declared as const and thus located in flash.
`bt_mesh_cdb_subnet_key_export` tries to copy to that address which
results in a Bus Fault.
Use separate array for storing net_key.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the conn security elevation is already in progress, retry the ATT
request if failed due to security reasons.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add set functions for codec capability, to set all
assigned number values in the bt_audio_codec_cap
struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new function, ltv_set_val, that did most of the
data manipulation from codec_cfg_set_val, so that we can
reuse that code for the codec cap and codec meta
functions as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the PTS BASS/SR/CP/BV-19-C test case a client executes Set
Broadcast Code operation of Broadcast Audio Scan Control Point
characteristic with Broadcast_Code set to an invalid value.
After syncing to an ISO stream there is an expected failed attempt
to decrypt the stream data, but the host does not set BIG_Encryption
value to the expected value 0x03 (BT_BAP_BIG_ENC_STATE_BAD_CODE).
Add missing BIG_Encryption state into the failing check.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
From BASS spec:
If the PA_Sync parameter value written by the client is set to a value
of 0x00 (Do not synchronize to PA) and the server is synchronized to
the PA, the server shall stop synchronization with the PA and shall
write a value of 0x00 (Not synchronized to PA) to the PA_Sync_State
field of the Broadcast Receive State characteristic .
Fixes BASS/SR/CP/BV-12-C test case.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
If the total length of the opcode and parameter values of Broadcast
Receive State characteristic operation is incorrect, the server shall
respond with an ATT Error Response and the Error Code set to Write
Request Rejected (0xfc), instead of 0x0d
(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN).
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This change fixes uninitialized RPA values for advertising sets of
non-default Bluetooth identities. The regression has been introduced
in the following commit:
8d6b206064
The follow-up fix for the default Bluetooth identity has been
introduced in a separate commit:
88c20b9cdd
Non-default Bluetooth identities can be loaded from the Settings
subsystem. In this case, RPAs of related advertising sets to these
identities are left uninitialized as the bt_id_create() function
context is not executed. As a result, the RPA is not created for
advertising sets of non-default Bluetooth identities, and the
advertising is started with the 00:00:00:00:00:00 address.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
On-Demand proxy client API has been changed but
usage of this API in shell test was missed.
Commit fixes this API usage.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The ability to send the solicitation PDU doesn't
depend on GATT Client role.
Commit makes independent one functionality from
another.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This new API returns the version string corresponding to a given
HCI version.
The API can be used by applications to print out human-readable
information about the controller being used.
Adding this API removes possible code duplication.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
If the server has synchronized to the PA and detected that the BIS is
encrypted, the server writes a value of 0x01 (Broadcast_Code
required) to the BIG_Encryption field of the Broadcast Receive State
characteristic to request a client to provide a Broadcast_Code.
In PTS BASS/SR/CP/BV-14-C test case the PTS (client) expects that the
new value of the Broadcast Receive State characteristicstate will be
notified, so the PTS could sent Set Broadcast_Code operation to the
server.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Fixes failing EBQ test LL/DDI/SCN/BV-88-C Extended Scanning,
Active, Properly Ignore RFU Fields
Several minor modifications made to le_ext_adv_report() to
properly ignore any invalid fields present in the received PDUs
Signed-off-by: Troels Nilsson <trnn@demant.com>
There was a conditional compile misssing for the
BT_PER_ADV_SYNC_TRANSFER_SENDER, potentially leading
to build failures
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The existing driver and sample:
- drivers/bluetooth/hci/rpmsg
- samples/bluetooth/hci_rpmsg
are no longer correctly named, since they now use the IPC subsystem to
send and receive data. The IPC subsystem can use RPMsg as a transport,
but that is one of several selectable backends.
I initially wanted to deprecated both the BT_RPMSG Kconfig option as
well as the zephyr,bt-hci-rpmsg-ipc chosen node in Devicetree. However,
this proved to be undoable in the case of the Kconfig option. This is
because it's a choice option, and those have special behavior. In
particular, the only practical way to deprecate would've been to keep
the old Kconfig option outside the choice (much like it's done in this
commit) but then also add a 'depends on !BT_RPMSG' on each of the
remaining choice symbols *except* on the new BT_HCI_IPC one. This, however,
only works correctly for .conf files. If a board instead sets the
default BT_HCI_BUS_TYPE in the Kconfig.defconfig file then the Kconfig
tree parsing would fail, because it'd try to set it to a value
(BT_RPMSG) that is no longer part of the choice.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
radio_pkt_big_ctrl_get() returns a statically allocated
buffer of type pdu_big_ctrl, but the callers expect a
buffer where a whole PDU for a BIG control packet can fit
(not just space for the payload),
and use it as such, overflowing this statically
allocated buffer, and smashing other variables after.
Let's fix it by allocating a buffer of the correct size
to fit a BIG control PDU.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/64497
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
With very fast HCI interfaces (for ex. in the simulated nrf5340)
the tx_rate calculation can do a division by 0
(if to packets are enqueued in the same 32KHz clock period).
Let's avoid it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When no parameters are given to the 'bt' command it prints
the help message. The 'iso' command responds with 'missing
subcommand'. This commit updates the behaviour of the iso
command so that it behaves the same as the bt command, i.e.
prints a help message
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
If CONFIG_BT_ISO_TEST_PARAMS=y then the CIG and BIG
create params was not properly initialized.
Modified the TX for BIS and CIS to be more similar
Added a timeout on the buffer to avoid any potentional
deadlocks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Ensures correct packing of net idx in Heartbeat Publication Status
messages on the Configuration Server.
Reference to net idx packing format: MshPRTv1.1 section 4.3.1.1
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fixes incorrect unpacking of Heartbeat Publication status
messages on the Configuration client.
Reference to packing format: MshPRTv1.1 section 4.3.2.63
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fixes issue where Heartbeat Publication Status message sends
garbage data when destination field is set to the unassigned address.
MshPRTv1.1, section 4.4.1.2.15:
"When the Destination field is set to the unassigned address, the values
of the CountLog, PeriodLog, TTL, and Features fields shall be set to
0x00 and NetKeyIndex field shall be set to 0x0000."
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Updates Bluetooth mesh specification references:
- Change "Profile" to "Protocol" since the main specification has
changed its name.
- Update/align formating of specification references. This will
make it easier to find spec references in the future.
- Change some section references to point to the correct section of the
newest version of the specification (v1.1).
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fix missing Extended Advertising terminate event and
advertising scheduling not being stopped.
Under race conditions, auxiliary event is aborted without
the generation of done extra event which is suppose to
stop the scheduling when max events count is used.
The fix now generates the done extra event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix periodic advertising sync window calculation to include
the scheduling resolution margin, i.e. be double as with
the event jitter value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
According to conditions in the DFU spec section 6.1.3.7 (Sending a
Firmware Update Status message) and in 'Idempotency' part of section
6.1.3.4 (Receiving a Firmware Update Start message), the FU Server
should not update internal state when 'Wrong Phase' error condition
is triggered.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Use IN_RANGE instead of explicitly checking that a value is
in between two other values
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The BT Core Spec v5.4 allows separate SDU_Interval to
be set on C_To_P and P_To_C directions,
but this is not possible with the existing interface.
This PR splits the interval parameter in the call to
bt_iso_sig_create into one for C_To_P
and one for P_To_C
It also splits the latency parameter into one for
C_To_P and one for P_To_C
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Bluetooth: ISO: update UI for extended API
The API for setting the SDU interval and latency have been updated.
This PR also updates the setting of these by the user in the shell
and the iso_connected_benchmark sample
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
When EATT is established, the value returned from `bt_att_get_mtu` is
not useful to determine the ATT_MTU that applies to a ATT response. This
is because `bt_att_get_mtu` may return the value for a different bearer
than the request is serviced on.
To fix this, the params struct for the GATT read operation is given a
new field that will record the ATT_MTU that applies to this ATT
operation. This value is then used to determine if the GATT long read
operation is concluded.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/61741
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The `BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS` is not expected to generate a
response from the controller, but from the spec:
Normally, no event is generated after the
HCI_Host_Number_Of_Completed_Packets command has completed. However, if
the HCI_Host_Number_Of_Completed_Packets command contains one or more
invalid parameters, the Controller shall return an HCI_Command_Complete
event with a failure status indicating the Invalid HCI Command
Parameters error code.
In practice, this can also be generated if flow control is inadvertedly
turned off during operation. Running `hci_cmd_done` is not correct when
the event happens (as there is no corresponding command buffer), and
`ncmd` should not be returned as this command ignores the semaphore when
sending.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Refactors the implementation of the Opcode Aggregator
models to allow them to coexist on the same device.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Adds a goto statement to ensure that model extensions are registered
in Composition Data Page 1 if it is enabled.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
This fixes an issue where the DFU client could get stuck trying to
transmit a message to servers if the DFU client was misconfigured, for
instance missing application key or network key.
Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
If instantiated models don't have any relations at all, then the
extensions list will be empty. We should allow to disable it at all
to not waste RAM.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If a receive state is removed, then the bis_syn_req callback
will be called with 0x00000000, to indicate to the application
that the sink should be desynced.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The flag was not properly set when the broadcast sink
did not add the source (e.g. if a broadcast assistant
added it).
This also downgrades two LOG_WRN to LOG_DBG as they may
happen without indicating an issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When the BLOB server is in Pull mode and all chunks were received for
the current block, and the current block is the last block, then
according to section 5.2.4 of MshMBTv1.0 the server should stop sending
BLOB Partial Block Report messages if it determines that the client
knows that the transfer is complete:
```
While the Pull BLOB State Machine is in the All Chunks Received state,
the Pull BLOB State Machine continues to send the BLOB Partial Block
Report messages until one of the following happens:
• The Receive BLOB Timeout timer expires.
• If the current block is not the last block, then the client starts a
new block, in which case a new Pull BLOB State Machine is instantiated.
• If the current block is the last block, then the server determines
that the client knows the transfer is complete. For example, a
higher-layer model may indicate that the client considers the transfer
complete.
```
We currently don't have any OOB mean (for example, API) to determine
whether the client knows that the transfer is complete. We also need to
keep in mind that the Partial Block Report message can get lost so one
transmission may not be enough. The client could immediately send BLOB
Transfer Get message to get the transfer status, but this goes against
its state machine defined in section 6.2.4.2, where a Block transmission
completes when a BLOB Partial Block Report message is received with an
empty list of requested chunks (table 6.4, figure 6.1).
Because of this, we need to keep sending Partial Block Report messages.
We can keep sending them at least until Block Report timer expires.
If the client sends BLOB Transfer Get message, then it finished with
sending the block and we can change the phase and finish the transfer.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Links host to mbedTLS library if Bluetooth Mesh is enabled, and
CONFIG_BT_TESTING=y.
Bluetooth Mesh has test dependencies in the host.
In order to compile Bsim tests with these test features
and PSA enabled, the libraries must be linked.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Since the BIS indexes start at 0x01, then BIT(0) is a
invalid BIS sync value and shall not be sent by the
broadcast assistant.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When the initiator provides CCID in the metadata, we verify
that the CCIDs exist on the device.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix bitfield crossing byte boundary - replaced with macros for
setting/getting the values
Fix missing endianness conversion for evt_cntr
Changed aa from uint32_t to uint8_t[4] to align with the rest of
the code and avoid any potential endianness issues
Signed-off-by: Troels Nilsson <trnn@demant.com>
For the CAP acceptor the size and rank characteristic shall
be set as per the CAP spec. Add checks for 0, as 0 indicates
not initializing the characteristics in the CSIS instance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds parsing of Private Network Identity parsing in the proxy client,
allowing the client to use these messages to establish a GATT
connection.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
BT_CTLR_ISOAL_LOG_DBG_VERBOSE, BT_CTLR_ISO_TX_SEG_PLAYLOAD_MIN, and
BT_CTLR_CONN_ISO_AVOID_SEGMENTATION are very tied to the BT_LL_SW_SPLIT
implementation. It is very unlikely that these will ever be used by
another controller
Therefore move them out to the BT_LL_SW_SPLIT specific configuration
file. This will likely create less confusion when using another
controller.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Update the BSIM test and the shell to use
bt_audio_codec_cfg_set_chan_allocation rather than implementing
their own versions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The BAP unicast babblesim tests now does RX and TX
and verifies that the data is correctly received on both
the client and server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Refactor the codec_cfg_get_frame_duration function to return the
assigned numbers value, instead of a converted value, but with
support for converting the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the default process dhkey gen in bt rx, will block send
Trans Ack, cause peer device send more package.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Since notice that simultaneous advertising is not only used
by relay message, provision over pb-adv can also be used.
so it was changed to a more general name.
refs:https://github.com/zephyrproject-rtos/zephyr/pull/48903
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This will truncate ATT notifications/indications if exceed ATT MTU size.
It is up to the client to exchange MTU.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes sending proper Preset List notifications after
reconnection. The issue was observed when the last preset
known to the client has been removed.
As we do not hold the information about the deleted presets,
we need to use Generic Update procedure to:
1. Notify the presets that have been removed in range
(PrevIndex = current_preset_last, Index=previous_preset_last)
2. Notify deletion of preset Index=previous_preset_last.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Some of the data shall be persistent across connections to bonded
clients. This includes notidication state flags that are used to
determine whether notify bonded client after reconnection.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This refactors the preset list to use sys_slist API. There have been
various issues seen while iterating presets, thus it's more save to use
well-defined and tested sys_slist API.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Defer sending the features, active index, preset list and preset read
response to sysworkq and retry sending in case failed due to buffers not
available at the moment.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Verify that a HAS Server IUT sends changed characteristic notifications
or indications when the Lower Tester reconnects.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This moves common code to set_preset_availability function to be called
from bt_has_preset_available and bt_has_preset_unavailable.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing setting of FLAG_CONTROL_POINT_NOTIFY flag that
indicate whether submit control_point_work. In case the there are more
indications/notifications to sent (is_last flag is unset), the
FLAG_CONTROL_POINT_NOTIFY shall be set to resubmit control_point_work.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes revering the features value back to previous state if work
submission failes. Even if it fails it indicates an internal sysworkq
issue, so even retry won't help. The client can read the features value
anyway, thus it's sane to just log an error in such case.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Rename the Kconfig option from BT_ISO_ADVANCED to
BT_ISO_TEST_PARAMS to more explicitly denote that it
enables support for using the ISO test parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Check whether peer is subscribed for ASE state notification before
calling bt_gatt_notify. This handles an assert thrown when the
notification failed to be sent.
Fixes: #63728
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
If the PA gets terminated, we clear the pa_sync field of the
corresponding broadcast sink object.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For some reason the state_change variable was static, which
does not make any sense. Changed it to a regular local
bool in bt_bap_scan_delegator_mod_src.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit makes workable proxy solicitation functionality
only server part without dependencies on client part.
Only on demand proxy server is required.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The `upload_status_rsp_with_progress` function uses the currently set
slot pointer to set firmware id field in the message. If another
upload starts but the firmware is already received, the slot API won't
let us to set the fwid and will return an error code. In this case, the
slot pointer stays invalid as fwid wasn't set, and
`upload_status_rsp_with_progress` will not add fwid as the lenght is
zero.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix hung Controller when establishing CIS on an encrypted
ACL connection with Controller built with direction finding
support enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the bt_bap_broadcast_source_reconfig was supplied with a subset
of the streams, it would only update the codec cfg and qos for the
streams provided in the parameters.
This commit changes that, so all streams are properly updated,
as they share some common values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When calling bt_bap_broadcast_sink_delete, the broadcast sink
should not attempt to terminate the PA Sync. The PA sync can live
on without the broadcast sink, just as the broadcast sink can live
on without the PA sync (which is why the PA sync check was completely
removed).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When updating the Scan Delegator receive state, we shall only
set the BIS indexes in bis_sync that we are actually synced to.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the previous upload was in-band and it didn't complete, the slot will
stay reserved. By design we release slot not at the end of the upload
phase, but at the start of a new upload phase.
This fixes DFU/SR/FD/BV-13-C.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If a Fw Distribution Client sends the Upload OOB Start message, but the
application layer didn't call bt_mesh_dfd_srv_oob_check_complete yet,
we have no other option other than ignore the message. The next phase
in this case could be Transfer Active, Transfer Success or Failed and it
will be set only after Check Firmware OOB procedure completes.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This message _at least_ 2 bytes long, but can be longer, thus
BT_MESH_LEN_MIN should be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In OOB upload, when Check Firmware OOB procedure completes successfully
and the firmware is already received, we send Firmware Distribution
Upload Status message with update Phase set to Transfer Success. In this
case, we must set Upload Progress to 100%. This can't be done through
the callback as the application layer doesn't yet know that the firmware
is already received. This will happen by the exist from
bt_mesh_dfd_srv_oob_check_complete function, which will return error
code -EEXIST.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to the ASCS_v1.0 the ASE in Streaming state shall transit to
QoS Configured state when link loss happen.
Relates: ES-24215 (errata)
Fixes: BAP/USR/SCC/BV-168-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The list of receives in the Firmware Distribution Server model and
and the Firmware Update Client model are 2 different lists.
In the Firmware Update Client model it is called the Update Receives
state and the Active Update Receivers state which is a subset of
receivers from the Update Receivers State. In the Firmware Distribution
Server model it is called the Distribution Receivers List state.
When Distribute Firmware procedure starts, in the Initiate step, the
Receivers List input (which is the input for the Update Receivers
state), is composed of the Distribution Receives List state. During DFU,
the Update Receivers state becomes the Active Update Receivers state
which keeps only active nodes. Timed out or failed nodes dropped out
from this list. The Distribution Receivers List state stays unchanged
and thus don't need to be populated again after every successfull and
failed DFU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Added offset to the model relation register for vendor
models to find correct model index
for Composition Data Page 1. The previous implementation used the
'mod_idx' from the 'bt_mesh_model' struct, which led to issues in the
model relation register due to SIG and vender models having the same
model index.
Modified existing functions related to the model relation
register to take in the offset.
Modified macros for determining if a model is a base- or
extending model.
Added check in 'add_items_to_page' to check whether the model relation
is an extension.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Changed buffer length check in bt_mesh_comp_p1_elem_pull.
The previous threshold would result in the
method not detecting the final element when it consisted of just one
model.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
When compiling conn.c using arm-none-eabi-gcc version 11.3.1 20220712
with the -Wmaybe-uninitialized flag a warning is emitted due to
pending_no_cb not being initialized. I'm not sure if initializing it to
NULL is the "correct" fix, but it's certainly not any worse then it being
uninitialized, and it fixes the warning.
Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
Connection states are non-trivial to understand based on their names
only, so add short descriptions in the header file explaining what they
do.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix errenous return value in pacs_gatt_notify function. The function
would always return zero, and not forward the error correctly.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Don't reset values set in init callback as it is called only once by
bt_mesh_init call. The reset callback is called on every node reset.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
A few of the length checks that deal with HCI packets coming from the
controller were using assert statements. But the recommended practice is
to drop invalid packets and continue execution whenever a malformed
packet arrives from an external source, so replace those assert
statements with branches that will drop the packet and return.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed issue when reprovisioning is done on a device with
both RPR client and server on the same device.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The existing formula for the amount of data that can be filled
in in the current PDU is correct but confusing. Replace it with
a simpler formula.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Updates the chaining for advertising.
Instead of unconditionally adding a new PDU when new data
is added we now instead fill the last PDU in the chain with
the incoming data, only adding a new PDU when there is
not enough room.
This reduces the nr. of PDUs used for advertising, and also
fixes some qualification failures
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The indexes were reset to 0 for each subgroup, which meant
that if we had a broadcast source with 2 subgroups and
1 BIS in each, both of them would use index 0x01.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A race condition between ATT RX and the connection teardown can happen, as
the teardown is executed from a workqueue.
For example:
- connection is established
- `connected` cb is called (in BT RX context)
- user calls `bt_conn_disconnect` in that cb
- connection is marked as disconnecting
- ATT teardown & general conn cleanup is scheduled
- BT RX gets an ATT request, tries to handle it
- ATT bearer is still not GC'd, so it tries and fails to send it
-> results in error message "not connected" on log
- ATT teardown & general conn cleanup runs
To avoid that, we not only check the bearer state, but also its ACL conn
state.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix leak in scheduled ticker node when rescheduling ticker
nodes.
Applications having active Extended Advertising or Observer
role with the use of ticker reschedule in window feature
would experience assertion check failure due to delayed
radio event preparation or stalled controller with no active
roles.
Fix updating of the ticker linked list when handling
rescheduled tickers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the legacy LLCP implementation was removed this Kconfig option was
mistakenly left over. Remove it now with all its users.
Fixes#63212.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This module calls `log_output_*` functions so it should enable
the `LOG_OUTPUT` Kconfig option explicitly.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Make the aa argument const to solve a Coverity issue
that assumes that any value that is being byteswapped
is tainted. Making the argument const should avoid
this assumption from Coverity.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the coverity issue CWE570, comparison of unsigned int to 0
in the definition of IS_SYNC_ISO_HANDLE
There is a potentially the same issue for IS_ADV_ISO_HANDLE,
fixed that as well
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
If RPR server is used then Mesh settings work queue
requires more size during provisioning procedure.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The check for number of streams in a subgroup was reversed, so
it would never allow for correct values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added run-time BT_CENTRAL role check for the path that was
central specific and did not have such check.
When multi-role BT device tried to pair without bonding (peripheral role)
while already previously bonded with the same device on another
Bluetooth identity, pairing failed.
It executed central-specific code, which should not be executed in case
when the device acts as peripheral (as it is even opt-out from code when
CONFIG_BT_CENTRAL is not enabled).
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
In ll_setup_iso_path cis is only ever set if CONFIG_BT_CTLR_CONN_ISO
is enabled, and similarly adv_stream is only ever set if
CONFIG_BT_CTLR_ADV_ISO is enabled.
The two assignments were reported as dead code by Coverity due
to this, which has been fixed by guarding the code with
the respective Kconfigs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BT_SECURITY_FORCE_PAIR option gets overridden when CONFIG_BT_SMP_SC_ONLY
or CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is defined. Cache the bit value
before overrides.
Add explicit forced pair handling to existing security level check.
Functionality did not change as this was done implicitly due to integer
comparison for enums.
Add extra clarification to the method doc.
Signed-off-by: Rait Rääk <raitraak@gmail.com>
Remove the terminate_ack from struct ll_conn since it is
not used anywhere, and results in dead code.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The remaining bit should be zero if auth is
shorter than PROV_AUTH_MAX_LEN and it should
be trimmed by removing octets with indexes
higher than PROV_AUTH_MAX_LEN.
Signed-off-by: Alperen Şener <alperen.sener@nordicsemi.no>
Fix issues when setting new values in cfg that modify
the length of the codec configuration LTV value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added comment to KConfig.iso file to make description
of BT_ISO_TX_MTU and BT_ISO_RX_MTU more clear
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
iso_has_ts wasn't set correcrly for fragments of HCI ISO Data packets,
now it is set depending on timestamp
provided in the original buffer provided by host user
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
this commit partially reverts e460847b60
According to Core Spec 5.4, Vol. 4, Part E, 5.4.5, Data_Total_Length field
contains length of the whole packet including optional fields of SDU
(Time_Stamp, Packet_Sequence_Number, ISO_SDU_Length, RFU and
Packet_Status_Flag). In Zephyr Host, Data_Total_Length value
is stored in bt_dev.le.iso_mtu field.
Therefore, there is no need to calculate iso_hdr_len(),
this length is already taken into account in conn_mtu(conn).
This commits removes iso_hdr_len() function and fixes
calculation of HCI ISO Data packet length calculations.
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
Fix number of completed packets generated when BIS HCI ISO
Data packets sent to Controller are in fragments. Use the
ISOAL stored sdu_fragment count to generate the number of
completed packets count.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Kconfig option to turn off ISO Data Packet Sequence Number
use to place the ISO Data in the correct radio event,
instead simply buffer it to next radio event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO data timestamp to reflect the SDU reference point
and not the ISO event anchor point when PDUs received after
retransmissions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use of payload_count for supporting flush timeout in
Central and Peripheral ISO Lower Link Layer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update the function name from codec_cfg_get_chan_allocation_val
to just codec_cfg_get_chan_allocation, and add
codec_cfg_set_chan_allocation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the bt_audio_codec_cfg_set_frame_blocks_per_sdu function
to set or add the frame blocks per SDU field in the
codec configuration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix a clang warning
ull.c:1235: warning: use of bitwise '|' with boolean operands
The result of ({1/0} &&(int)) is either true(1) or false(0),
not the int and therefore bm is not a bitmask, but just true(1)
or false(0) all together.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add the bt_audio_codec_cfg_set_octets_per_frame function
to set or add the octets per frame field in the
codec configuration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Split the bt_audio_codec_meta_get functions to cfg and cap
variants. This provides a more explicit API where users
do not need to dereference their cfg/cap structs in order
to use this functions.
Furthermore this will also make the get functions more
similar to the upcoming set functions, where the set functions
will require the use of the cfg and cap structs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The firmware on these devices seems to have a bug that can cause reordering
of received packets. This can lead to new GATT requests being received
before the acknowledgement of the previous GATT response, accompanied by
log messages like the following:
<wrn> bt_att: bt_att_recv: Ignoring unexpected request
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Refactor the codec_cfg_get_freq function to return the assigned
numbers value, instead of a converted value, but with
support for converting the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For asymetrical features there needs to be a separate mechanism to
unmask features in peer. This must be used in central for unmasking in case
of 'unsupported in peer' condition for CIS Create.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>