Bluetooth: df: Split CTE filtering SYNC_STAT_READY_OR_CONT_SCAN

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>
This commit is contained in:
Piotr Pryga 2022-05-12 00:34:52 +02:00 committed by Carles Cufí
parent 3715241bde
commit 5a6ed86d46
3 changed files with 10 additions and 9 deletions

View file

@ -7,7 +7,8 @@
/* Periodic advertisements synchronization status. */
enum sync_status {
SYNC_STAT_ALLOWED,
SYNC_STAT_READY_OR_CONT_SCAN,
SYNC_STAT_READY,
SYNC_STAT_CONT_SCAN,
SYNC_STAT_TERM
};

View file

@ -226,7 +226,7 @@ enum sync_status lll_sync_cte_is_allowed(uint8_t cte_type_mask, uint8_t filter_p
}
if (!cte_ok) {
return filter_policy ? SYNC_STAT_READY_OR_CONT_SCAN : SYNC_STAT_TERM;
return filter_policy ? SYNC_STAT_CONT_SCAN : SYNC_STAT_TERM;
}
return SYNC_STAT_ALLOWED;
@ -869,8 +869,8 @@ static void isr_rx_adv_sync(void *param)
* affect synchronization even when new CTE type is not allowed by sync parameters.
* Hence the SYNC_STAT_READY is set.
*/
err = isr_rx(lll, NODE_RX_TYPE_SYNC_REPORT, crc_ok, phy_flags_rx,
cte_ready, rssi_ready, SYNC_STAT_READY_OR_CONT_SCAN);
err = isr_rx(lll, NODE_RX_TYPE_SYNC_REPORT, crc_ok, phy_flags_rx, cte_ready, rssi_ready,
SYNC_STAT_READY);
if (err == -EBUSY) {
return;
}
@ -938,8 +938,8 @@ static void isr_rx_aux_chain(void *param)
* affect synchronization even when new CTE type is not allowed by sync parameters.
* Hence the SYNC_STAT_READY is set.
*/
err = isr_rx(lll, NODE_RX_TYPE_EXT_AUX_REPORT, crc_ok, phy_flags_rx,
cte_ready, rssi_ready, SYNC_STAT_READY_OR_CONT_SCAN);
err = isr_rx(lll, NODE_RX_TYPE_EXT_AUX_REPORT, crc_ok, phy_flags_rx, cte_ready, rssi_ready,
SYNC_STAT_READY);
if (err == -EBUSY) {
return;

View file

@ -815,13 +815,13 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
* host. If the periodic filtering list is used then stop synchronization with this
* particular periodic advertised but continue to search for other one.
*/
sync->is_term = (sync_status != SYNC_STAT_ALLOWED);
sync->is_term = ((sync_status == SYNC_STAT_TERM) || (sync_status == SYNC_STAT_CONT_SCAN));
#endif /* CONFIG_BT_CTLR_CTEINLINE_SUPPORT */
/* Send periodic advertisement sync established report when sync has correct CTE type
* or the CTE type is incorrect and filter policy doesn't allow to continue scanning.
*/
if (sync_status != SYNC_STAT_READY_OR_CONT_SCAN) {
if (sync_status == SYNC_STAT_ALLOWED || sync_status == SYNC_STAT_TERM) {
#else /* !CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
if (1) {
@ -853,7 +853,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
* the sync was found or was established in the past. The report is not send if
* scanning is terminated due to wrong CTE type.
*/
if (sync_status == SYNC_STAT_ALLOWED) {
if (sync_status == SYNC_STAT_ALLOWED || sync_status == SYNC_STAT_READY) {
#else /* !CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
if (1) {