Removed the generation of broadcast id inside the stack. It is now up
to the application to generate this by itself. The CAP sample has
been modified to allow either a static broadcast, or a random one.
All of this is handled in the application.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Added helper functions to set and get broadcast name
for codec capabilities and codec configs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we get an error/rejection from the CAP acceptor when
performing the Unicast Audio Start or Stop procedure then
we need to abort the procedure and let the application determine
what the next step is.
This change triggered a corner case when connecting to multiple
CAP acceptors as the CAP initiatior. This was also fixed as part
of this.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Changed dependency of the BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB
from 'select' to 'depends on' and solved all loop dependencies
caused by this change.
Fixes#79108
Signed-off-by: Babak Arisian <bbaa@demant.com>
Add unit tests of the CCID functions.
To support these new tests, the GATT mocks need to
support dynamic GATT DB so we can add and remove
a service that contains CCIDs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The QoS structure is not related to a codec, but rather a
stream, and should thus not use the "Codec" name.
The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious
choice for a name.
Since the structure is defined and used by BAP, the prefix
was changed from bt_audio to bt_bap.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add more parameter checking for the unittests for the
CAP procedure 'broadcast reception stop'
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.
This also adds unittests for the procedure which also
allow us to remove the invalid param testing from the BSIM tests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added helper functions to set and get assisted listening
stream values for codec capabilities and codec configs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BAP mandates support for bondable mode for all central and
peripheral roles.
Due to Kconfig circular dependencies, some additional
Kconfig changes had to be made.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The unit tests needed to enable the hidden Kconfig
BT_BAP_BASE. Instead of adding an additional Kconfig for this,
just enable one of the roles that enable it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added option to set the ASE count through the bap API, making ASE
configuration runtime available. The upper limit of ASEs are still
bound by the Kconfig options set for ASEs.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.
Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Move the net_buf implementation from the networking subsystem to a library
as they have no dependency on the networking subsystem.
Network buffers are used in subsystems outside of networking
(e.g. Bluetooth, USB).
Fixes: #36374
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
The CAP commander used bt_audio_valid_ltv which required
BT_BAP_STREAM to be enabled, but the CAP Commander does not
need BT_BAP_STREAM to be enabled.
Moved the function to audio.c which is always compiled for
the CAP Commander, thus removing the requirement for
BT_BAP_STREAM and the accompanying bt_bap_stream.c file.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When calling bt_cap_initiator_unicast_audio_start on a set of streams
that are all in the streaming state we return early with -EALREADY.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The unicast_start procedure should take a stream in any state
and put it in the streaming state. Adds tests with streams
in various states.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds unittests for the CAP Initiator start procedure, simply
verifying that the procedure works as well as
testing invalid parameters.
This also allows us to remove the invalid behavior checks
from the babblesim test implementation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The tests manually include sources that are normally conditionally
included (ie based on kconfig values) in the stack.
The tests should be fixed by the original authors.
For now, force-on the hidden kconfig that enables the log options.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fixes: #73831
find_package(Zephyr) should be called before first project() call.
Zephyr package will test and force-set the correct toolchain, especially
the C compiler.
The project() will also set the C compiler, if not set already.
If project() is called first, then conflict arises on the C compiler
selection and thus the following message is seen:
> You have changed variables that require your cache to be deleted.
> Configure will be re-run and you may have to reset some variables.
> The following variables have changed:
> CMAKE_C_COMPILER= /usr/bin/gcc
This cache deletion results in other errors, such as a missing BOARD
setting.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
For the LE Audio unittests there exists a few mock files
that implement mock versions, or callbacks, for some of the
roles and features tested.
These have been moved to where they are actually used,
reducing the scope of these files.
This both allows the individual tests to implement their own
versions of it, but more importantly it prevents issues when
adding tests for these roles. For example, due to the
bap_unicast_client.c mock file, it is impossible to implement
unit tests for the unicast client, as the functions are already
defined.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Refactors teh BIS bitfield values used for ISO
and BAP.
Previously BIT(1) meant BIS index 1, which was a Zephyr choice
in the early days of ISO, as the BT Core spec did not use
a bitfield for BIS indexes.
Later the BASS specification came along and defined that
BIT(0) meant BIS index 1, which meant that we had to shift BIS
bitfields between BAP and ISO.
This commit refactors the ISO layer to use BIT(0) for Index 1 now,
which means that there is no longer a need for conversion
between the BAP and ISO layers, and that we can use a value
range defined by a BT Core spec (BASS).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add validation of the number of ASEs in control point
write requests.
This validates that the number of ASEs
in the control point is not greater than the total number
of ASEs we support.
This also validates that the GATT MTU is large enough to
hold all the responses from the write since those can only be
sent as notifications and never be truncated.
Finally this validates and updates the size of the buffer used to
hold the responses, which may be an optimization for some builds.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement unit tests for the broadcast reception start procedure,
both with proper and with improper parameters.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
bt_audio_codec_cfg_get_chan_allocation() now takes an
extra parameter.
Let's set it to the value which keeps the old behaviour.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When creating a BAP broadcast source with bt_bap_broadcast_source_create
only the subgroup information is stored in the streams and the remaining
BIS specific information is not stored in the stream->codec_cfg,
which it should.
Fix is to store bis specific information also in stream codec config.
Updated broadcast source BSIM test to verify above usecase.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
These test only test the basic functionality of
bt_cap_initiator_unicast_discover so far, but will be expanded.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a fallback parameter to
bt_audio_codec_cfg_meta_get_pref_context
as absence of pref context in BAP implicitly means a unspecified
for LC3.
In the case that it is absent BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED
is the returned value.
While the metadata for codec cfg and codec cap are similar,
this only applies for codec cfg as per BAP.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a fallback parameter to
bt_audio_codec_cap_get_max_codec_frames_per_sdu
as absence of max codec frames per SDU in BAP implicitly
means a single frame for LC3.
In the case that it is absent 1 is the returned value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a fallback parameter to
bt_audio_codec_cap_get_supported_audio_chan_counts
as absence of channel count in BAP implicitly means a single channel
for Lc3.
In the case that it is absent 1 is the returned value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a fallback parameter to
bt_audio_codec_cfg_get_chan_allocation as absence of
channel allocation in BAP implicitly means Mono.
In the case that it is absent,
BT_AUDIO_LOCATION_MONO_AUDIO is the returned value.
This commit also fixes the implementation of
bt_audio_codec_cfg_get_frame_blocks_per_sdu as it only applies to
LC3 (as per the BAP spec). It also adds additional testing of it
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The 3-byte value suits the assigned number much better,
and also allows for less memory copies when getting and
setting the values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the "stream" part of the value and functions to
better fit with the name in the assigned numbers document.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.
After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Removes the CIS connection establishment from bt_bap_stream_start
and move the behavior to a new funciton bt_bap_stream_connect.
This has 2 advantages:
1) The behavior of bt_bap_stream_start is much more clear and more aligned
with the spec's behavior for the receiver start ready opcode.
2) It is possible to connect streams in both the enabling
and the QoS configured state with bt_bap_stream_connect as
per the spec. This allows us to pass additional PTS test cases.
To implement this new behavior, samples and tests have been updated.
The CAP Initiator implementation has also been updated
to accomodate for the change in BAP, but the CAP
initiator implementation should work the same for application, except
that it's now possible to do unicast start on ASEs in any order
(https://github.com/zephyrproject-rtos/zephyr/issues/72138).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Removes the requirement that CAS is found on the remove
device for ad-hoc sets. This makes the CAP API more
versatile as it allows applications to use it with
remote non-CAP devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function is useful for application to lookup set
members from bt_conn pointers, e.g. when iterating on
connected devices.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_csip_set_coordinator_csis_member_by_conn function
was seemingly missing, causing the CAP unit tests to not build.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the CSIP API expects a set member struct for nearly all
functionality, the reference to the full set member (along with
the CAS specific CSIS) should be given to the application.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the CAP commander reception start procedure which starts reception
on one or more CAP acceptors
With the implementation of broadcast reception start procedure we also need
some mockups for unit testing
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
When in the BAP unicast server role, at least PAC sink
or PAC source shall be set.
In order to fulfill this new requirement, a few other Kconfig
options had to be changed to a `depends on` from `select` to
avoid recursive Kconfig requirements. This change may require
some applications to update their configurations according
to the migration guide.
The change from `select` to `depends on` is ideal anyhow
as that is the recommended way to add dependencies.
This can checked via the combined BT_PACS Kconfig value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The unittest for cap commander is refactored, so that tests
for volumecontrol is in its own module.
This avoids the problem of having all tests in one huge file.
Due to their small size the tests for registering callbacks and
discovery haven't been put into their own module.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
When using the LC3 codec, all codec configuration are LTV encoded.
The broadcast source did not properly validate this, and it also
uncovered a bug in the bsim test for broadcast sources.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>