In order to avoid using multiple sources of truth for the platfom's
endianness, convert the in-tree code to use the (BIG|LITTLE)_ENDIAN
Kconfig variables exclusively, instead of the compiler's
__BYTE_ORDER__.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
If using the advertiser list when syncing to a PA, then the
address address needs to be updated for the PA sync object.
This is a small optimization to avoid doing a copy when
the address and SID is already set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When deleting a PA sync with bt_le_per_adv_sync_delete
Zephyr should call the `term` callback for the PA sync
as per the documentation for the callback.
This was not done in the case that the PA sync was
terminated by local request.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
To avoid legacy extended adv repots blocking important
events or work, mark them as discaradble.
Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
According to specification, when executing a remote procedure the
rx parameters used need to be updated when the REQ from the peer
is received. Currently this is done only when an ACK is
received on the RSP PDU send out.
This commit updates the RX parameters upon receipt of the REQ PDU
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit prevents the assertion error added in the previous commit,
by introducing the following behavior.
When the Host detects that a pairing procedue would result in more than
one local identity having a bond with the same remote address, it will
try to abort the pairing. If the pairing procedure cannot be properly
aborted, it will remove the pairing locally and disconnect.
This commit also introduces a new kconfig `BT_ID_UNPAIR_MATCHING_BONDS`.
This config changes the above-described behavior to instead un-pair the
old bond and continue with the pairing (if the new bond has the same or
better security.)
The new kconfig is not enabled by default. See the help text of the new
kconfig option for more details.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This change prevents two local identities from having bonds to the same
device.
The Core specification is not well suited for Zephyr's multiple-local-
identities feature. The HCI specification seems written with intent that
a controller is used for only one GAP device. A GAP device has at most
one public address, and at most one random static address.
The Zephyr Bluetooth API, on the other hand, has a concept of local
identities. This feature allows the Zephyr Bluetooth stack to
simulatainously assume multiple local addresses. This does not mesh well
with the above intent in the specification.
In particular, the HCI specification for the resolve list does not allow
more than one entry for a remote address. The controller will deny any
attempts at doing this.
The current implementation of the Zephyr host will try the above and be
denied. But there is no handling for this situation and the host ends up
in a confused state. Some parts of the system are ok with the two bonds,
but other parts assume this situation never occurs behave badly.
The result is that the host confuses the multiple bonds to the same
device. Symtoms include:
- Directed advertisements have a different source address than what the
host intended, in which case the two sides are confused about the
address of the Zephyr advertiser, and as a result LTKs will not match.
- Errors in the log.
This commit simply asserts. This is not a solution, just a placeholder
for a fix. The next commit will implement a strategy for handling this
situation instead of failing this assert.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
If 2 ASEs shared the same CIS and the first ASE had the CIS
connected before the second ASE was QoS configured, then
the CIS was missing either the TX or RX pointer, causing
it to be considered unidirectional by the ISO layer.
This commit fixes this issue by configuring the (static)
pointers at an earlier time, so that the RX and TX QoS
pointers are always valid.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This changes the API to use proper naming convention, as the code has
been moved out of capabilities.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing checks, and invalid struct bt_pac definition that was
missing one mandatory metadata byte.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This makes use of bt_audio_foreach_capability fuction to
simplify building the PAC attribute value.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
There is no point of having dedicated source file that is PACS
dependent. This moves all of the code from capabilities.c to pacs.c.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Macro that was defined in the `common/log.h` has been moved to the newly
created `common/assert.h` file.
Files that were using those macro has been updated consequently. Also, the
include of `common/log.h` has been removed of files that were actually not
using any logging methods.
Some `#include "common/log.h"` have been removed. Those were required
before when including `hal/debug.h`. With this change, `hal/debug.h` no
longer has this requirement, because the replacement, `common/assert.h`
includes what it uses.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Replace unnecessary `BT_HEXDUMP_DBG` with `LOG_HEXDUMP_DBG`.
`BT_HEXDUMP_DBG` did an extra cast to `const uint8_t *` on its first
argument. This was probably the reason it was introduced. But the
current definition of `LOG_HEXDUMP_DBG` does this cast for us.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Fix copying addresses returned in response to command
BT_HCI_OP_VS_READ_STATIC_ADDRS for reading controller static addresses.
The loop was iterating only over the destination locations while
keeping the source address pointing to the first location of
the command response.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Add a new stream object, bt_cap_stream, which is an extension
of the BAP bt_audio_stream. The purpose of this stream
is that we can extend the data stored in the BAP stream for
CAP usage, as well as making it more explicit what type
of stream should be used for CAP.
The callbacks will be extended for CAP in specific use cases,
e.g. when starting one or more unicast audio streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the generic CONFIG_BT_CAP and CONFIG_BT_DEBUG_CAP
and only use Kconfigs specific to the individual roles.
This also includes renaming cap.c to cap_acceptor.c.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The CAP initiator will now discover, or return a
known, CSIS instance included by CAS (if any).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Change the CSIS client callback to a slist so that
multiple applications can register it. An example of
such a case is that both the application and CAP initiator
want to get the callbacks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The API will now take a simple bt_conn instead of a
set member struct. This is due to the set member struct
being moved to the stack. The reasoning for this is that
having the struct in the stack, rather than in the
application, the stack itself can initiate the CSIS
discovery which is useful if the remote device
has a service that includes a CSIS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This is the primary discovery of the CAS on the remote device,
but does not include discovering the (optional) CSIS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add skeleton for the expected APIs and
implementation. May be subject to change as
implementation progresses.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The sequence number is by the core spec defined as 16-bit.
We had implemented a workaround for the wrapping of the
sequence number, which required the type to be larger
than 16-bit (32-bit).
However, since the definition of the sequence number,
and the use of, is poorly defined by the core spec, we
are reverting this workaround and reducing the sequence
number to 16-bit again. This way it is more in line
with the core spec, as well as more intuitive given the
other uses for the sequence number.
This change moves the responsibility of using the
right value to the upper layers, as the stack can
and will no longer provide any guarantees.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function did not provide anything that could
not just as easily have been done in the existing
loops.
This just required moving the call to ad_init to
after the param parsing loop.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The struct bt_ascs holds the conn reference already,
thus it's not needed to store the device address.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
bt_id_del() was setting the bit 'BT_KEYS_ID_PENDING_ADD' instead
of setting the bit 'BT_KEYS_ID_PENDING_DEL'
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Increment the number of identities after a successful execution
of id_create() by checking if the return value is 0.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Document `bt_irk.rpa` as "Cache for `bt_keys_find_irk`. Not reliable as
"current RPA"!".
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Add NULL checks when registering the media_proxy_pl_calls.
Currently the media player expects all of them to be set.
In the future, ideally the callbacks would mostly be
optional and reflect which of the optional
characteristics that there is in the MCS.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Convert model_ackd_send and model_send from health_cli.c to a common API
to get rid of code duplication in other client models that implement
synchronous messages' sending.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
There should be functional equivalence between these two forms. And the
'_eq'-form is more readable.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>