Skip to content

Commit 3e937da

Browse files
roadrunner-97mbolivar-nordic
authored andcommitted
bluetooth: host: Added extra options to PAST subscribe
allow disabling reports (synchronise but don't generate sync reports) and allows enabling sync reporting with filtering of duplicates. the default option remains to establish sync, with sync reports, but without duplicate filtering. Signed-off-by: Raphael Treccani-Chinelli <[email protected]>
1 parent 06d53b1 commit 3e937da

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

doc/releases/release-notes-3.3.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ API Changes
2020
Changes in this release
2121
=======================
2222

23+
* Bluetooth: Add extra options to bt_le_per_adv_sync_transfer_subscribe to
24+
allow disabling sync reports, and enable sync report filtering. these two
25+
options are mutually exclusive.
26+
2327
* Bluetooth: :kconfig:option:`CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER`
2428
and :kconfig:option:`CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER` have been
2529
added to enable the PAST implementation rather than

include/zephyr/bluetooth/bluetooth.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,22 @@ enum {
15691569

15701570
/** Only sync to packets with constant tone extension */
15711571
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE = BIT(3),
1572+
1573+
/**
1574+
* @brief Sync to received PAST packets but don't generate sync reports
1575+
*
1576+
* This option must not be set at the same time as
1577+
* @ref BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES.
1578+
*/
1579+
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED = BIT(4),
1580+
1581+
/**
1582+
* @brief Sync to received PAST packets and generate sync reports with duplicate filtering
1583+
*
1584+
* This option must not be set at the same time as
1585+
* @ref BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED.
1586+
*/
1587+
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES = BIT(5),
15721588
};
15731589

15741590
struct bt_le_per_adv_sync_transfer_param {

include/zephyr/bluetooth/hci.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,10 @@ struct bt_hci_rp_le_per_adv_set_info_transfer {
17661766
uint16_t conn_handle;
17671767
} __packed;
17681768

1769-
#define BT_HCI_LE_PAST_MODE_NO_SYNC 0x00
1770-
#define BT_HCI_LE_PAST_MODE_NO_REPORTS 0x01
1771-
#define BT_HCI_LE_PAST_MODE_SYNC 0x02
1769+
#define BT_HCI_LE_PAST_MODE_NO_SYNC 0x00
1770+
#define BT_HCI_LE_PAST_MODE_NO_REPORTS 0x01
1771+
#define BT_HCI_LE_PAST_MODE_SYNC 0x02
1772+
#define BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES 0x03
17721773

17731774
#define BT_HCI_LE_PAST_CTE_TYPE_NO_AOA BIT(0)
17741775
#define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_1US BIT(1)

subsys/bluetooth/host/scan.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,10 @@ static bool valid_past_param(
17071707
param->timeout > 0x4000) {
17081708
return false;
17091709
}
1710+
if ((param->options & BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED) &&
1711+
(param->options & BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES)) {
1712+
return false;
1713+
}
17101714

17111715
return true;
17121716
}
@@ -1761,6 +1765,7 @@ int bt_le_per_adv_sync_transfer_subscribe(
17611765
const struct bt_le_per_adv_sync_transfer_param *param)
17621766
{
17631767
uint8_t cte_type = 0;
1768+
uint8_t mode = BT_HCI_LE_PAST_MODE_SYNC;
17641769

17651770
if (!BT_FEAT_LE_EXT_PER_ADV(bt_dev.le.features)) {
17661771
return -ENOTSUP;
@@ -1788,13 +1793,16 @@ int bt_le_per_adv_sync_transfer_subscribe(
17881793
cte_type |= BT_HCI_LE_PAST_CTE_TYPE_ONLY_CTE;
17891794
}
17901795

1796+
if (param->options & BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED) {
1797+
mode = BT_HCI_LE_PAST_MODE_NO_REPORTS;
1798+
} else if (param->options & BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES) {
1799+
mode = BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES;
1800+
}
1801+
17911802
if (conn) {
1792-
return past_param_set(conn, BT_HCI_LE_PAST_MODE_SYNC,
1793-
param->skip, param->timeout, cte_type);
1803+
return past_param_set(conn, mode, param->skip, param->timeout, cte_type);
17941804
} else {
1795-
return default_past_param_set(BT_HCI_LE_PAST_MODE_SYNC,
1796-
param->skip, param->timeout,
1797-
cte_type);
1805+
return default_past_param_set(mode, param->skip, param->timeout, cte_type);
17981806
}
17991807
}
18001808

0 commit comments

Comments
 (0)