diff --git a/include/bluetooth/bluetooth.h b/include/bluetooth/bluetooth.h index a1250c3e7ed..c3aa204309f 100644 --- a/include/bluetooth/bluetooth.h +++ b/include/bluetooth/bluetooth.h @@ -1276,17 +1276,20 @@ enum { */ 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 e655449e738..26442cdb615 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -1186,6 +1186,20 @@ int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, 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 @@ int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, 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);