Remove experimental label from Advertising Extensions and
Periodic Advertising features in the Controller.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This PR sets the refactored LLCP as the default instead of legacy
so that more people will use this, giving us more feedback
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Sometimes it is important to know when the backend fails to send out
data because no memory / buffers are available. Return -ENOMEM in that
case.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Enable HAS shell only if preset support is enabled. Otherwise there are
no functions yet that can be exposed if the preset support is disabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fix unused `ccc_cfg_changed` function warning that shows up when
preset support is disabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Introduce invisible helper symbol that could simplify and make more
readable condiitional code checks.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Update the users of the "write" callback in the
bt_gatt_subscribe_params to use the new "subscribe" callback instead.
Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
Add a "subscribe" callback in the bt_gatt_subscribe params, and
deprecate the "write" callback.
The purpose of this is to be able to return the subscription
parameters in the callback. The write callback
- (in principle) returns write parameters
- in fact returns nothing - the pointer is set to NULL
Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
Direction finding functionality does antenna switching during CTE
reception in AoA mode and CTE transmission in AoD mode. Antennas are
switched according to user provided antenna switch pattern. If a CTE
length is enough to exhaust all antenna ids in a switch pattern then
radio should loopback to reference antenna and continue from switching
from that. Current implementation loops back to antenna that is just
after reference antenna in the switch pattern.
The commit fixes that by insertion of the reference antenna
at the end of switch pattern. Radio will operate as it was before,
it will restart switching from the same index in a switch pattern.
At the same time reference antenna will be inserted into the loop
if switching pattern is exhausted. That also means, the maximum
number of antenna ids in a switch pattern has to be decreased by
one.
The commit also fixes lower bound in the BT_CTLR_DF_MAX_ANT_SW_PATTERN-
_LEN that should be equal two. It was set to three, because in the
past the antenna at index zero was used for reception of a PDU.
Now this antenna ID is provided by device tree configuration.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
The SYNC_STAT_READY_OR_CONT_SCAN state into two: SYNC_STAT_READY
and SYNC_STAT_CONT_SCAN. The connected state was used for two
cases:
- synchronization with periodic advertising is already established,
- CTE type is wrong but periodic advertising list is used to filter
synchronized devices.
In the past states were connected because there was only one difference
between them. In case of sync already established, Controller generated
sync report notification to host.The sync was not terminated when
Controller was about to continue search for other periodic advertiser.
The state was split because now Controller terminates sync ticker and
continues search for other periodic advertised. The split improves
readability and makes code easier to understand.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
In case of use of filtering based on: periodic advertising list and
CTE type, the synchronization can hang. That is possible if a periodic
advertiser uses wrong CTE type. In such situation the sync is not
released in ull_sync_done call. What more the sync->timeout_reload
is not cleared and Host is not able to cancel the synchronization.
The periodic advertising is in a semi-sync-established state.
There are no reports send to Host. Host can't use the sync set to
synchronize with other device. It is only able to terminate the
sync (call to ll_sync_terminate).
To fix the issue following changes should be applied:
- isr_rx_adv_sync_estab should call isr_rx_done_cleanup
with sync_term parameter in case the sync_ok isn't SYNC_STAT_ALLOWED.
In any case the CTE type is wrong, no matter is the periodic
advertising list filtering is enabled or not.
- ull_sync_established_report should set sync->is_term to true
in case the CTE type is not allowed. That change is required for devices
that do not support Direction Finding Extension. For those devices CTE
type based filtering is done in ULL by ull_sync_established_report
function. The sync->is_term should be set unconditionally, hence is
moved up in the function.
With these two changes done, ull_sync_done function will execute
sync_ticker_release in case the CTE has wrong type. ULL, depending on
notifications prepared by ull_sync_established_report, will follow up
on sync termination if required.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Return `-ENOTSUP` on calls to device_runtime functions if the underlying
device does not support power management.
Fixes#45648.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
By default the newlib does not compile with %hhu processing,
to avoid turning on additional options for newlib compilation
this commit changes formatting string to use %hu instead.
The commit fixes problem with malformed version string being
returned, by smp_svr, when CONFIG_NEWLIB_LIBC=y is set together
with CONFIG_NEWLIB_LIBC_NANO=y.
Fixes#45261
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Modify the function slightly to take a different
argument, and add more debugging to the function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Ensure that we don't attempt to send any data to the
controller if `can_send` is not set, and return an
error code to the application instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Besides checking for the rx/tx pointer, we now also validate
the can_send and can_recv values to ensure that we do
not setup a useless data path.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Set the can_send to true and can_recv to false for broadcaster.
Set the can_send to false and can_recv to true for the sync
receiver.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of relying only on the `tx` and `rx` qos pointers,
we extract further information from the
bt_hci_evt_le_cis_established event to properly determine if we
can actually send or receive data.
This is useful to help determine which data paths to setup,
and whether to reject requests to send.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If CONFIG_SHELL_STATS is disabled, shell->stats is NULL and
must not be dereferenced. Guard against it.
Fixes#44089
Signed-off-by: Alexej Rempel <Alexej.Rempel@de.eckerle-gruppe.com>
Remove call to bt_audio_stream_iso_listen which
calls bt_iso_server_register for the unicast client.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bluetooth ISO shell module now supports the newly
added central and peripheral ISO configs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move a few unicast functions around so that we reduce the number
of #if defined guards. No code has changed, but a single
prototype has been added.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add two new Kconfigs: BT_ISO_CENTRAL and BT_ISO_PERIPHERAL
that is used to do central or peripheral only builds,
similar to the BT_CENTRAL or BT_PERIPHERAL Kconfigs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
output of ztest is not easy to ready with many testsuites running in
sequence, make it a bit more readable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
There is a race condition in a multicore system that happens when the
idle thread in a CPU checks if the state was forced, if not it will
call the policy manager. If a secondary core forces a state after that
this point the value returned by the policy will be rewritten.
Another case is, if a state is forced while a CPU is sleeping,
when this CPU resumes, the forced bit is cleared and the forced state
is never be used.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
In pm_system_suspend there is a goto label that is supposed to be used
to do cleanup before exit the function but it is not doing anything
right now. Just remove it.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This extends client implementation with Read Presets Request operation
support.
The implementation can maintain up to BT_L2CAP_TX_BUF_COUNT control
point requests so that user could perform/queue another Control Point
Operation if one is ongoing. E.g. preset can be selected from Read Preset
Response notification context or perform multiple operations if EATT
enabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The periodic CTE_REQ disable command, requested by Host, may be locked
until connection is dropped due to missing CTE_RSP from peer device.
That is caused by implementation of CTE_REQ disable and CTE_REQ
control procedure handling.
The procedure is marked as active when CTE request was send to peer
device. It is marked as inactive after completion of the procedure.
That caused locking of CTE disable on a semaphore.
The BT 5.3 Core Spec, Vol 4, Part E, section 7.8.85 says the HCI_LE_-
Connection_CTE_Request_Enable should be considered active on a conne-
ction from when Host successfully issues the command with Enable=0x1
until a command is issued with Enable=0x0 or single LLCP CTE request
has finished (CTE_Request_Interval=0x0). Also there is a clarification
from BT SIG that the command with Enable=0x0 does not affect any
initiated LLCP CTE request. That means Controller is allowed to finish
already started procedure and it is not allowed to start new LLCP CTE
request procedure after completion of the command with Enable=0x0.
Taking that into account, there is no need to synchronize ULL and LLL
in regard of disable the LLCP CTE request while the procedure is
pending. Controller is free to complete the procedure or terminate it.
The change removes all code related with cte_req.is_active, disable
callback and waiting of ULL for LLL to finish the LLCP CTE request.
The ULL will complete the HCI_LE_Connection_Request_Enable with
Enable=0x0 immediately. In case the procedure is disabled in before
the response arrives, then further processing of the response is
dropped and the procedure context released.
The context is not released by the code responsible for disable
handling, to have single place where it is done.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
There is an error in the condition that checks if new CTE_REQ should
be started after end of connection event. The condition verifies if
counter req_expire is set to zero. Then new CTE_REQ is started
irrespectively to CTE_REQ being disabled.
req_interval is used to store information if the CTE_REQ is:
- periodic, then value doesn't equal zero,
- single shot or disabled, then value equals zero.
The condition should verify if the req_interval is not zero and
req_expire is not zero. The second part of the if condition is
required to avoid starting next CTE_REQ until last one has been
completed.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Some of control procedures has set ctx->rx_opcode in rp_comm_tx
function to values that state there is an expected PDU.
This is not always true. In case of procedures that do not expect
any response from remote device, the ctx->rx_opcode should be set
to PDU_DATA_LLCTRL_TYPE_UNUSED.
In the worst cases scenario, when the same control procedure
is executed locally and remotely, correct response PDU may
cause an assertion in ull_cp_rx. It could happen because
of wrong ctx->rx_opcode value. A packet with opcode that is
set in remote and local control procedure context rx_opcode
will be treated as expected value for both. That is a situation
that cannot happen.
The commit changes the assignments of rx_opcode to fix the problem.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
If the echo flag is disabled the cmd_buff isn't printed and the
characters in it must not be counted in this function.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
Adds a check that number of records to be encoded does not exceed the
maximum limit configured through Kconfig.
Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
This commit fixes the build errors for the testcases in
the tests/bluetooth/init folder
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The tests/bluetooth/ctrl_user_ext test fails due to
compilation errors, which are fixed with this PR
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Make use of the status field, reported by TCP, in the socket receive
callback. This allows to differentiate a graceful connection shutdown
from actual errors at TCP level (transmission timeout or RST received).
In case of error reported from TCP layer, set a new SOCK_ERROR flag on
the socket, and store the error code in the net_context user_data.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make use of the status argument in the recv_cb() callback function -
instead of blindly reporting ECONNRESET whenever TCP context is
dereferenced, indicate whether an actual error condition happened (by
setting respective errno value) or a graceful shutdown took place (by
setting status to 0).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>