Direction finding functionality allows to send a number of periodic
advertising PDUs in a chain that have CTE.
ll_df_set_cl_cte_tx_enable function was changed to update periodic
advertising chain to include cte_info field. If the chain is too short,
there is less PDUs in the chain than requested number of CTEs,
the function will add new empty PDUs to the chain end.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Enabling or disabling transmission of Constant Tone Extension with
periodic advertising PDUs requires update of a PDU content.
CTE_INFO field of periodic advertising PDU must be filled with
appropriate data. That operation may be done for periodic
advertising PDU (or chain of PDUs) filled with other payload that
wasn't enqueued towards LLL. In that situation PDUs are updated
in place, to avoid increase of memory consumption.
The commit changes ull_adv_sync_pdu_set_clear function to
make possible update of the advertising PDU in place.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Some functions, provided to handle changing content of periodic
advertising PDUs, were defined as static.
Code responsible for handling direction finding updates periodic
advertising PDUs also. For that purposes, those functions were mede
globally accessible.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add configuration of CTE for periodic advertising chain transmission.
The commit provides configuration of radio in prepare stage and
in handle of Tx ISR. CTE is configured only for PDUs that
have cte_info field in extended advertising header.
During prepare of periodic advertising event there are updated
aux_ptr fields in extended advertising header in other PDUs from
a periodic advertising chain. aux_ptr offset value also depends
on CTE length. CTE configuration is always the same for every
PDU in periodic advertising chain.
CTE may be added to requested number of PDUs in periodic
advertising chain. Although it is possible that there are PDUs
that don't have CTE. PDUs that have CTE are alsways at the beginning
of a periodic advertising chain.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Configuration of CTE for transmission is stored in extra_date member
of a lll_adv_sync object. PDUs in periodic advertising chain share the
same CTE configuration, so there is single instance of the extra_data.
To configure CTE transmission for every PDU in periodic advertising
chain a new function was introduced to peek extra_data instance without
peeking new PDU.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Transmission of Constant Tone Extension is done after END event
triggered by radio. To correctly switch from TX to TX (back 2 back
TX) after transmission of CTE PHYEND event must be used instead of
END event.
The commit provides required function that allows LLL to correctly
setup radio to do back to back switch of TX when CTE transmission
is enabled.
The radio_switch_complete_and_phy_end_b2b_tx cannot be implemented
in radio.c source file. It will fail build of unit tests targeted
for NRFBSIM simulator board. There is no RADIO_SHORTS_PHYEND_DISABLE_Msk
macro defined in bsim_hw_models module.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Amount of memory allocated for advertising PDUs (including
periodic advertising) depends on two factors:
- maximum advertising data length
- maximum number of CTE in a periodic advertising chain.
Maximum advertising data length is divided by maximum size
of a single fragment (number of payload bytes that single
advertising PDU may hold) to get required number of fragments.
Actual number of PDUs allocated for advertising is maximum
of acutal number of advertising payload fragments and maximum
number of CTEs.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add possiblity to configure maximum number of PDUs with Constant Tone
Extension in a single periodic advertising chain.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
We had added a break in a switch statement that stopped
ISO channels from setting the BT_CONN_CLEANUP flag
which in turn stopped them from disconnecting (in the
eyes of the upper layers) properly.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of just writing "err" we make it clear that it is
the ISO server that failed to accept.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add implementation to resume primary PDU scanning window
after use of LLL scheduling to receive auxiliary PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When Auxiliary PDUs are scanning by the primary scan's LLL
scheduling, then flush the Auxiliary PDUs when processing
them in the ULL instead of using the disabled callback.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This can be used to check if pointer is a valid lll_scan_aux pointer,
e.g. if we need to decide what kind of struct is attached to RX node
for further processing.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
We need to reset isr status before returning as otherwise irq will be
triggered over and over again.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix bug in adv timeout for limited advertiser when extended advertising
features has been enabled. The advertiser was only stopped when
configured as an extended advertiser. It should be stopped when
configured as a legacy advertiser also.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix the received Extended Advertising PDU's address
resolution latency due to missing reset of pending IRQ in
the NVIC which caused the wait loop from not exit correctly.
Fixes#30243.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When generating LE Extended Advertising Report the device
address can be either in primary or auxiliary channel PDU,
do not overwrite resolving list index if present in primary
channel PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix key distribution not calling pairing complete callback when
distributing encryption information when not bonding.
Encryption information is only distributed in legacy pairing so issue
was only seen during legacy pairing.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The existing extension tree does not support all the features that are
defined by the specification (e.g. multiple parents).
This patch approaches this problem by defining a circular single-linked
list of extension models. So for a given model, all models that are on
the same list as that model are in some extension relationship with that
model. All models on a list represent a single connected component of an
extension graph but without defining specific relationships between each
pair of models. This list is used to manage a shared subscription list
as per the Mesh Profile Specification:
```4.2.4 Subscription List
Within an element, each model has a separate instance of a Subscription
List, unless the model extends another model on that element. Instances
of models that extend other models (i.e., all models within an extension
relation tree) shall share a single instance of a Subscription List per
element.
```
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
The Bluetooth Core spec 5.2 requires to provide CTE type in
periodic advertising report.
The implementation of le_per_adv_sync_report assigned
value zero to be default CTE type. The assigned value
in Bluetooth Core spec 5.2 means "AoA Constant Tone
Extension". In case there is no CTE attached to periodic
advertising PDU, CTE type should contain value 0xFF.
This commit fixes the issue.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Fix compilation warning in hci_df_set_cl_cte_rx_enable function.
The struct bt_hci_cp_le_set_cl_cte_sampling_enable *cp variable
was used just to evaluate size in bt_hci_cmd_create call.
The variable is moved to prepare_cte_rx_enable_cmd_params
function and size of the buf is evaluated directly from type.
Code is simpler and prepare_cte_rx_enable_cmd_params does not
require passing additional argument.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
It is desirable to have the read and write like functions follow the
POSIX read and write parameter types.
Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
There were missing calls to periodic advertising functions:
lll_adv_sync_init() and lll_adv_sync_reset() corresponding
functions in lll_adv.c.
Lack of those calls didn't introduce any harm.
I've added them to have complete init and reset patch,
similar to extended advertising implementation.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
There is missing handling of periodic advertising reset for
HCI_Reset command. That makes impossible to execute e.g.
qualification tests without rebooting of the DUT
for periodic advertising and direction finding.
This commit adds missing implementation.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
There was an issue with receiving CTE packets when the time
slot has changed from 2us to 1us. After receiving the packets
when it tries to enable receiving of CTE, the validator
returns EINVAL error.
Source of the problem is "validate_cte_rx_params" function,
it calls DF_AOA_RX_1US_SUPPORT(df_ant_info.switch_sample_rates)
which is expanded to:
((df_ant_info.switch_sample_rates) & BIT((BT_HCI_LE_1US_AOA_RX)))
And due to definition of BT_HCI_LE_1US_AOA_RX in hci.h it will be:
((df_ant_info.switch_sample_rates) & BIT(BIT(2)))
So the BIT operation has executed two times.
Signed-off-by: Saleh Mehdikhani <saleh.mehdikhani@unikie.com>
When in le_ecred_reconf_req multiple CIDs are received host should
return 0x0002 error (Reconfiguration failed - reduction in size of
MPS not allowed for more than one channel at a time).
This affects test L2CAP/ECFC/BI-04-C
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
In limited advertising advertising should end after certain timeout.
Previously, limited advertising was just general advertising with
BT_LE_AD_LIMITED flag set. Now, if this flag is set the work is
scheduled, that will disable advertising after timeout.
This affects tests GAP/DISC/LIMM/BV-03-C and GAP/DISC/LIMM/BV-04-C
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Flush any pending Tx PDUs in the lower link layer before
enqueueing PHY_UPDATE_IND PDU with instant to ensure the
PDU is transmitted before the instant occurs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Implement the advanced scheduling for Extended Initiator to
group central connections established to Extended
Advertisements.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
To be consistent in how order header flags are handled when
updating the common header format fields, explicit check
for ADI flag in previous auxiliary PDU buffer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remember last used DID for each SID, so that DID value used,
when updating the advertising PDU fields, change between
consecutive changes to PDU fields.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Make the Extended Advertising DID value updated to be unique
for every new advertising set created.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix corrupt AD data used after directed advertising by
storing a backup of the AD data before switching to directed
advertising. Restore back the AD data with switching to non-
directed advertising.
The fix also addresses AD data backup when switching between
Legacy and Extended Advertising.
Fixes#18850.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add implementation to resolve AdvA in the received
AUX_CONNECT_RSP PDU before generating the connection
complete.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>