Bluetooth: Host: Add Periodic Advertising ADI support
Add Periodic Advertising ADI support.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
diff --git a/include/bluetooth/bluetooth.h b/include/bluetooth/bluetooth.h
index a1250c3..c3aa204 100644
--- a/include/bluetooth/bluetooth.h
+++ b/include/bluetooth/bluetooth.h
@@ -1276,17 +1276,20 @@
*/
BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED = BIT(1),
+ /** Filter duplicate Periodic Advertising reports */
+ BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE = BIT(2),
+
/** Sync with Angle of Arrival (AoA) constant tone extension */
- BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA = BIT(2),
+ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA = BIT(3),
/** Sync with Angle of Departure (AoD) 1 us constant tone extension */
- BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US = BIT(3),
+ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US = BIT(4),
/** Sync with Angle of Departure (AoD) 2 us constant tone extension */
- BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US = BIT(4),
+ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US = BIT(5),
/** Do not sync to packets without a constant tone extension */
- BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT = BIT(5),
+ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT = BIT(6),
};
struct bt_le_per_adv_sync_param {
diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c
index e655449..26442cd 100644
--- a/subsys/bluetooth/host/scan.c
+++ b/subsys/bluetooth/host/scan.c
@@ -1186,6 +1186,20 @@
cp->options |= BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST;
}
+ if (param->options &
+ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED) {
+ cp->options |=
+ BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED;
+
+ atomic_set_bit(per_adv_sync->flags,
+ BT_PER_ADV_SYNC_RECV_DISABLED);
+ }
+
+ if (param->options & BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE) {
+ cp->options |=
+ BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE;
+ }
+
if (param->options & BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA) {
cp->cte_type |= BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOA;
}
@@ -1204,15 +1218,6 @@
cp->cte_type |= BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ONLY_CTE;
}
- if (param->options &
- BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED) {
- cp->options |=
- BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED;
-
- atomic_set_bit(per_adv_sync->flags,
- BT_PER_ADV_SYNC_RECV_DISABLED);
- }
-
cp->sid = param->sid;
cp->skip = sys_cpu_to_le16(param->skip);
cp->sync_timeout = sys_cpu_to_le16(param->timeout);