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>
Add bt_bap_base_subgroup_get_bis_indexes that gets the BIS indexes
of a subgroup. This work very similar to
bt_bap_base_get_bis_indexes, except that it works for subgroups
rather than BASEs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The LC3 framed macros were unused.
The LC3 unframe macros only added the 7500/10000
parameter, but since the the 7500/10000 requirement is also
defined by BAP, it makes equally much sense to simply use the BAP
presets.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
LC3 does not define any such configurations, and they are in
fact defined by the BAP. The LC3 header file should thus not
pretend that there are these specific configurations for LC3.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_iso_chan_send function could take an optional
timestamp by using 0 as an indicator. The issue with
this approach was that a timestamp value of 0 is valid,
and could cause potential issue with syncing streams
in a group.
To fully support transmitting with and without timestamp,
bt_iso_chan_send_ts has been introduced, which is the only
function of the two (bt_iso_chan_send being the other) that
supports timestamps.
A new function, rather than adding a boolean to the existing,
was chosen as it simplifies the individual functions as well
as making it more explicit what the function does.
Since the bt_iso_chan_send function is used by LE audio, both
the BAP and CAP send functions have similarly been updated.
Likewise, all tests and samples have been updated to use the
updated function(s), and BT_ISO_TIMESTAMP_NONE has been
removed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The defines from the Bluetooth Audio assigned numbers are not
specific for LC3. This commit removes the LC3 infix and
the reference to LC3 in the documentation for them.
It also cleans up some of the documentation and
names of the enums.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The get_val functions will now return -ENODATA in case that
a value isn't found, instead of 0.
This makes them more similar to the meta_get_val functions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add functions to unset, or remove, specific codec
LTV structure from codec_cfgs or codec_caps.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add callbacks to the stream objects that reflects the
state of the isochronous channel. The connected callback
is called when the isochronous channel is connected, and
similarly the disconnected callback is called when it is
disconnected.
There is a special case for unicast, where if the ACL
disconnects first, then we won't get a ISO disconnect
callback. It should be assumed that the isochronous channel
is no longer valid when the BAP stream enters the idle state,
i.e. when the "released" callback is called.
The purpose of the new callbacks is to provide additional
information to the application. Especially the unicast client
can use this to determine when the stream_start function
can be called again, as there can only ever be 1 outstanding
CIS connection request at a time, but there can be multiple
GATT requests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function did not move data correctly when increasing
or decreasing the size of a value that was not the last value
in the LTV array.
Added a few tests to verify the fix, using the CCID list as the
main way of verifying it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement the CAP Commander discovery function.
Adds support for it in the shell.
This includes initial babblesim and unit testing as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This adds the expect_bt_bap_stream_ops_released_called function that
takes an array of streams to verify as an argument. It's more versatile
approach than having expect_bt_bap_stream_ops_released_called_twice
erc. functions, that scales bad.
The function ignores the arhument list order, so that the user does not
have to predict the exact order of function calls.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This limits the default number of ASEs available to 1.
The value can be overwritten in test case specific parameters
in testcase.yaml file.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes duplicated CONFIG_BT_ISO_MAX_CHAN config setting and leaves
the default value set to 1.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds missing tests for invalid operations initiated by
locally or by client on ASE in Releasing state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes 2 tests related to ASCS handling ACL disconnection.
c3c83c7049 modified the ACL disconection
behavior, so that ASE goes directly to idle state, not waiting in
releasing state for CIS disconnection. Thus the tests where state
machine waits for CIS disconnection can be removed now.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds the function that sets the available contexts value per
connection object so that API user can set different available contexts
per connection.
The lifetime of such overriden value is the same as connection lifetime,
so on reconnection or device reboot all devices return to having the
same available contexts value again.
Fixes: #64968
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Even though the ASCS Sink ASE state machine does not enter the disabling
state according to ASCS spec, it still makes sense to do so.
the state transition unit tests are updated to verify calling or not
calling the disable callback, depending on the transition of the state
fixes#63230
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This adds test for ASE state notification retry. The test verifies
whether the state transition is repeated if failed due to notification
error.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds k_work_schedule mock implementation that will be used in
bluetooth audio unit tests.
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>
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>
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>
Add verification of all stream's SDU, RTN and PHY rather than
just the first.
Also add another test case where only a subset of streams are being
reconfigured, but where the above values shall be updated for
all streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rearranges the k_mem_slab fields so that information that describes
how much of the memory slab is used is co-located. This will allow
easier of its statistics into the object core statistics reporting
framework.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
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>
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>
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>