Page 1 of 1

esp_ble_gap_update_whitelist

Posted: Thu Dec 09, 2021 7:24 am
by yemred
hello,

i am curious about how many devicess can we add to the white list. is there any limitations.
can i add 10 000 devicess for example

and information for someone who is searching about this topic, how to use and implement it:

Code: Select all

static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param){
    if(event==ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT){
        ESP_LOGI(TAG, "--------ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT----------");
        esp_ble_gap_update_whitelist(true, whitelist_addr, BLE_ADDR_TYPE_PUBLIC);
        uint32_t duration = 0;
        esp_ble_gap_start_scanning(duration);
        .
        .
        .
and esp_ble_gap_set_scan_params can be here

Code: Select all

void app_main(void)
{
 .
 .
 .
    esp_ble_gap_set_scan_params(&ble_scan_params);  
}
params can be like that

Code: Select all

static esp_ble_scan_params_t ble_scan_params = {
    .scan_type              = BLE_SCAN_TYPE_ACTIVE,
    .own_addr_type          = BLE_ADDR_TYPE_PUBLIC,
    .scan_filter_policy     = BLE_SCAN_FILTER_ALLOW_ONLY_WLST,
    .scan_interval          = 0x50,
    .scan_window            = 0x30,
    .scan_duplicate         = BLE_SCAN_DUPLICATE_DISABLE
};
and device list can be like this

Code: Select all


uint8_t whitelist_address[6] = {0x60, 0xc0, 0xbf, 0x28, 0xa4, 0x31};

and if you have still problems then try to change PUBLIC to RANDOM

Code: Select all

static esp_ble_scan_params_t ble_scan_params = {
    .
    .own_addr_type          = BLE_ADDR_TYPE_PUBLIC,
    .
};