Merge branch 'feature/btdm_add_adv_packet_duplicate_in_scan_duplicate' into 'master'
component/bt: add adv packet duplicate in scan duplicate See merge request idf/esp-idf!2939
This commit is contained in:
commit
e6e2d7ebee
4 changed files with 75 additions and 6 deletions
|
@ -175,11 +175,49 @@ config BLE_SCAN_DUPLICATE
|
|||
help
|
||||
This select enables parameters setting of BLE scan duplicate.
|
||||
|
||||
choice SCAN_DUPLICATE_TYPE
|
||||
prompt "Scan Duplicate Type"
|
||||
default SCAN_DUPLICATE_BY_DEVICE_ADDR
|
||||
depends on BLE_SCAN_DUPLICATE
|
||||
help
|
||||
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
|
||||
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
|
||||
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
|
||||
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
|
||||
Data". This way is to use advertising data filtering. All same advertising data only allow to be reported once even though
|
||||
they are from different devices.
|
||||
|
||||
config SCAN_DUPLICATE_BY_DEVICE_ADDR
|
||||
bool "Scan Duplicate By Device Address"
|
||||
help
|
||||
This way is to use advertiser address filtering. The adv packet of the same address is only allowed to be reported once
|
||||
|
||||
config SCAN_DUPLICATE_BY_ADV_DATA
|
||||
bool "Scan Duplicate By Advertising Data"
|
||||
help
|
||||
This way is to use advertising data filtering. All same advertising data only allow to be reported once even though
|
||||
they are from different devices.
|
||||
|
||||
config SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR
|
||||
bool "Scan Duplicate By Device Address And Advertising Data"
|
||||
help
|
||||
This way is to use advertising data and device address filtering. All different adv packets with the same address are
|
||||
allowed to be reported.
|
||||
endchoice
|
||||
|
||||
config SCAN_DUPLICATE_TYPE
|
||||
int
|
||||
depends on BLE_SCAN_DUPLICATE
|
||||
default 0 if SCAN_DUPLICATE_BY_DEVICE_ADDR
|
||||
default 1 if SCAN_DUPLICATE_BY_ADV_DATA
|
||||
default 2 if SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR
|
||||
default 0
|
||||
|
||||
config DUPLICATE_SCAN_CACHE_SIZE
|
||||
int "Maximum number of devices in scan duplicate filter"
|
||||
depends on BLE_SCAN_DUPLICATE
|
||||
range 10 200
|
||||
default 20
|
||||
range 10 1000
|
||||
default 200
|
||||
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.
|
||||
|
@ -194,8 +232,8 @@ config BLE_MESH_SCAN_DUPLICATE_EN
|
|||
config MESH_DUPLICATE_SCAN_CACHE_SIZE
|
||||
int "Maximum number of Mesh adv packets in scan duplicate filter"
|
||||
depends on BLE_MESH_SCAN_DUPLICATE_EN
|
||||
range 10 200
|
||||
default 50
|
||||
range 10 1000
|
||||
default 200
|
||||
help
|
||||
Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
|
||||
When the maximum amount of device in the filter is reached, the cache will be refreshed.
|
||||
|
|
|
@ -199,6 +199,7 @@ extern int ble_txpwr_get(int power_type);
|
|||
extern int bredr_txpwr_set(int min_power_level, int max_power_level);
|
||||
extern int bredr_txpwr_get(int *min_power_level, int *max_power_level);
|
||||
extern void bredr_sco_datapath_set(uint8_t data_path);
|
||||
extern void btdm_controller_scan_duplicate_list_clear(void);
|
||||
|
||||
extern char _bss_start_btdm;
|
||||
extern char _bss_end_btdm;
|
||||
|
@ -1299,4 +1300,13 @@ esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path)
|
|||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_scan_dupilcate_list_flush(void)
|
||||
{
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
btdm_controller_scan_duplicate_list_clear();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
|
|
|
@ -56,6 +56,12 @@ the adv packet will be discarded until the memory is restored. */
|
|||
#define BT_HCI_UART_BAUDRATE_DEFAULT 921600
|
||||
#endif /* BT_HCI_UART_BAUDRATE_DEFAULT */
|
||||
|
||||
#ifdef CONFIG_SCAN_DUPLICATE_TYPE
|
||||
#define SCAN_DUPLICATE_TYPE_VALUE CONFIG_SCAN_DUPLICATE_TYPE
|
||||
#else
|
||||
#define SCAN_DUPLICATE_TYPE_VALUE 0
|
||||
#endif
|
||||
|
||||
/* normal adv cache size */
|
||||
#ifdef CONFIG_DUPLICATE_SCAN_CACHE_SIZE
|
||||
#define NORMAL_SCAN_DUPLICATE_CACHE_SIZE CONFIG_DUPLICATE_SCAN_CACHE_SIZE
|
||||
|
@ -100,6 +106,7 @@ the adv packet will be discarded until the memory is restored. */
|
|||
.hci_uart_no = BT_HCI_UART_NO_DEFAULT, \
|
||||
.hci_uart_baudrate = BT_HCI_UART_BAUDRATE_DEFAULT, \
|
||||
.scan_duplicate_mode = SCAN_DUPLICATE_MODE, \
|
||||
.scan_duplicate_type = SCAN_DUPLICATE_TYPE_VALUE, \
|
||||
.normal_adv_size = NORMAL_SCAN_DUPLICATE_CACHE_SIZE, \
|
||||
.mesh_adv_size = MESH_DUPLICATE_SCAN_CACHE_SIZE, \
|
||||
.send_adv_reserved_size = SCAN_SEND_ADV_RESERVED_SIZE, \
|
||||
|
@ -128,7 +135,8 @@ typedef struct {
|
|||
uint8_t controller_task_prio; /*!< Bluetooth controller task priority */
|
||||
uint8_t hci_uart_no; /*!< If use UART1/2 as HCI IO interface, indicate UART number */
|
||||
uint32_t hci_uart_baudrate; /*!< If use UART1/2 as HCI IO interface, indicate UART baudrate */
|
||||
uint8_t scan_duplicate_mode; /*!< If use UART1/2 as HCI IO interface, indicate UART baudrate */
|
||||
uint8_t scan_duplicate_mode; /*!< scan duplicate mode */
|
||||
uint8_t scan_duplicate_type; /*!< scan duplicate type */
|
||||
uint16_t normal_adv_size; /*!< Normal adv size for scan duplicate */
|
||||
uint16_t mesh_adv_size; /*!< Mesh adv size for scan duplicate */
|
||||
uint16_t send_adv_reserved_size; /*!< Controller minimum memory value */
|
||||
|
@ -444,6 +452,19 @@ bool esp_bt_controller_is_sleeping(void);
|
|||
*/
|
||||
void esp_bt_controller_wakeup_request(void);
|
||||
|
||||
/**
|
||||
* @brief Manually clear scan duplicate list
|
||||
*
|
||||
* Note that scan duplicate list will be automatically cleared when the maximum amount of device in the filter is reached
|
||||
* the amount of device in the filter can be configured in menuconfig.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_scan_dupilcate_list_flush(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c272133d6d9c046e05e2514b12e17cc561980865
|
||||
Subproject commit 4c71417a4f0a35750620eb360c971a2e9e216958
|
Loading…
Reference in a new issue