Merging the two structs cleans up significant amount of code
and makes it easier to expand later.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Previously the calculation of the PSN was done using
just a timer. This would not work correctly when
attempting to send multiple packets in a single SDU
interval (e.g. to enqueue 2 or more).
Previously we only ever attempted to send 1 packet in
the `sent` callback but scheduling the work item. However
in the case that the `sent` callback was called twice
before the work item had been triggered (possible due
to the priority of the RX thread being higher than the
system workqueue thread). This has been modified so that
if we can enqueue more packets in the lc3_audio_send_data
function, we re-enqueue the work item. We re-enqueue rather
than sending multiple in a single call to avoid blocking
other items on the system workqueue from being scheduled.
This could cause possible missed intervals (if other workqueue
items are processed), but it should be OK from a ISO perspective,
and the new PSN calculator handles this much better.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify lc3_audio_send_data to be triggered on a delayable
k_work so that we can retry it with a delay if it fails for whatever
reason.
This also moves the calculation of the seq_num closer
to when it is used, which makes sense as it is based on
a timed calculation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The current API for changing the bondable mode uses the global flag.
With Zephyr support for multiple Bluetooth identities, the API for
changing the bondable mode should be more fine-grained.
The bondable requirements of one identity should not have an impact on
another identity which can have a different set of requirements.
This change introduces function to overlay bondable flag per
connection.
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
Current structure of Bluetooth Mesh Kconfig options is quite messy.
This makes impossible to understand which configuration belongs to
which feature. Especially when using interactive Kconfig interface, like
menuconfig or guiconfig.
This commit restructures the options grouping them by protocol layer
they belong to (Network, Transport, Access, etc.), or specific feature
(LPN, Friend, Proxy, Relay, etc.), or implementation (Advertiser, Shell,
Persistent storage). Amount of supported keys, subnets, group addresses
and labels are grouped under Capabilities menu. Generic options that
don't fall to any category are kept at the root menu. For better
visibility, if a specific feature or layer has more than 1 option, they
are hidden under menu.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PR adds the statistic module to estimate frame handling.
The module helps to understand the ratio of
the received\relayed\dropped\transmited frames.
That shows the efficiency of the current configuration\implementation.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The broadcast_id and the pa_sync fields should be set before calling
broadcast_sink_add_src as broadcast_sink_add_src will those values to
compare against other receive states.
The function was also missing a call to broadcast_sink_cleanup
for the newly allocated sink in case there was an error.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The CIG state variable is set to CIG_STATE_CONFIGURABLE, but then
cleared by memcpy from configuration cache. Set state after memcpy.
Fixes EBQ test /HCI/CIS/BI-10-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
In the case where memq_deinit in LLL flushing ends up with the free
link being the link provided by the CIS instance, and pointed to by
lll.link_tx_free, the free counter data in the link element is
overwritten during central CIS creation.
This has the effect that when starting the next CIG, there will suddenly
be 0 links available, and controller fails assertion.
By saving- and restoring the lll.link_tx before and after CIS
configuration cache copying, the free counter is intact.
Signed-off-by: Morten Priess <mtpr@oticon.com>
An advertising report must not be generated unless the AUX_ADV_IND
has been received (for ADV_EXT_IND with an auxptr)
Signed-off-by: Troels Nilsson <trnn@demant.com>
Use CONFIG_BT_CTLR_PHY_CODED to flag out coded phy code
Don't schedule a scan for coded phy when it is not supported
Signed-off-by: Troels Nilsson <trnn@demant.com>
When a stream leaves the streaming state the `stopped` callback
will now be called, similar to how the `started` callback works.
This ensures that `stopped` is always called and not just when
the CIS disconnects.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The enum used for connection types gets named bt_conn_type to guard
against accidental usage of generic integers with relation to it.
The added default case in several switch statements avoids warnings
against unhandled enum values.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Fail gracefully if an HCI event of one type arrives for a handle of a
different connection type. The requested types are currently based on
what fields are used, not on the usage context, in order to keep every
correct use so far still working.
A warning is logged if the connection identified by the handle does not
match the requested connection type.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Instead of waiting for ase_buf to be available, the read of an
ASE in IDLE state can be handled without using ase_buf.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing control point status and ASE status change, when
failed to disconnect the CIS. As the server may, but does not have to
disconnect the CIS, the operation should not be considered as failed
when it happens.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
PR instantiates cdb and core keys to prevent scenario
when key is changed over cdb API and gets new ID but
core still operates with old ID(potentially invalid).
Known issue the keys will be desynchronized
during\after key refresh procedure.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commits eliminates the old way of
pacs notifications, replacing k_work with
simple bt_gatt_notify.
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
When doing the bt_ots_dir_list_reset_anchor we now explicitly ignore
the return value of bt_gatt_ots_obj_manager_first_obj_get
to fix a coverity issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Cast ticker_stop() calls to void where return value is not checked.
This is to satisfy coverity and indicate that return value is not
important.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
The bt_csip_set_coordinator_csis_inst_by_handle did not check the input
parameters and could call lookup_instance_by_handle with handle == 0
which triggers an ASSERT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we are use the shell as a CAP initiator, then we need to
register the stream callbacks for the CAP streams as well, as
CAP will use the BAP callbacks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When populating the conns array in
bt_cap_initiator_codec_configured, coverity did not like just
having the __ASSERT, so modified the checks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When syncing via the broadcast sink or the scan delegator
it makes more sense to filter on duplicates, as the expected
data rarely changes.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The internval of how often we report
receive stats can now be configured via the cmd_recv_stats
command.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add more information when we print the recv every 100th
packet, and remove all per-recv printing.
This also resets all information on stream start. This does,
however, no properly support multiple streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The callback should not be modified by the stack,
and should thus be const.
Also fixes a missing include of conn.h.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This restores a line of code that was accidentally deleted in
5580cb4391. This fixes an uninitialized
`le_addr` getting printed and producing garbage output in the scan
results.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Patch to rename struct bt_ots_init to struct bt_ots_init_param
to avoid duplicating the name bt_ots_init.
Fix for issue#45968
Signed-off-by: Jai Arora <infolinesoni@gmail.com>
Rename the bt_codec struct to bt_audio_codec_conf or
to the new struct bt_audio_codec_cap.
Rename the bt_codec_data to bt_audio_codec_data.
The purpose of this is to split the codec specific configuration
and codec capabilities into seperate structs, as they do not
reflect the same values, or used for the same purpose.
This commit depends on the preset macros workings on either
type of struct (for now), but will be modified in future updates.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes metadata length checks for BT_AUDIO_METADATA_TYPE_EXTENDED
and BT_AUDIO_METADATA_TYPE_VENDOR that should be at least 2 bytes long.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The CCID list can be empty, as the Assigned Numbers is not strict
regarding it's minimum length.
Fixes: #59666
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing drop of ISO Data PDUs received in non-streaming state.
The client shall indicate first it's readiness to receive the ISO Data.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing drop of ISO Data PDUs received in non-streaming state.
The server shall indicate first it's readiness to receive the ISO Data
by calling bt_bap_stream_start that triggers state transition from
Enabling to Streaming state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add check for CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES > 1 before
comparing inst_cnt, as otherwise it was always false which
caused a coverity issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>