diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index 9f77ea8520..dde650827c 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -469,7 +469,6 @@ config BT_LE_SCAN_DUPL_TYPE default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE default 0 - config BT_LE_SCAN_DUPL_CACHE_SIZE int "Maximum number of devices in scan duplicate filter" depends on BT_LE_SCAN_DUPL @@ -478,3 +477,19 @@ config BT_LE_SCAN_DUPL_CACHE_SIZE help Maximum number of devices which can be recorded in scan duplicate filter. When the maximum amount of device in the filter is reached, the cache will be refreshed. + +config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD + int "Duplicate scan list refresh period (seconds)" + depends on BT_LE_SCAN_DUPL + range 0 1000 + default 0 + help + If the period value is non-zero, the controller will periodically clear the device information + stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared + until the scanning is disabled. Duplicate advertisements for this period should not be sent to the + Host in advertising report events. + There are two scenarios where the ADV packet will be repeatedly reported: + 1. The duplicate scan cache is full, the controller will delete the oldest device information and + add new device information. + 2. When the refresh period is up, the controller will clear all device information and start filtering + again. diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index f903b3497d..332b61a0df 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -632,6 +632,7 @@ typedef enum { extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode); extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode); extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num); +extern void scan_duplicate_cache_refresh_set_time(uint32_t period_time); int ble_vhci_disc_duplicate_mode_enable(int mode) @@ -655,6 +656,12 @@ int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){ return true; } +int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){ + // TODO: use vendor hci to update + scan_duplicate_cache_refresh_set_time(refresh_period_time); + return true; +} + /** * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) */ @@ -675,6 +682,7 @@ void ble_controller_scan_duplicate_config() ble_vhci_disc_duplicate_mode_disable(0xFF); ble_vhci_disc_duplicate_mode_enable(duplicate_mode); ble_vhci_disc_duplicate_set_max_cache_size(cache_size); + ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD); } esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)