Code: Select all
int dev_num = esp_ble_get_bond_device_num();
esp_ble_bond_dev_t *dev_list = (esp_ble_bond_dev_t *)malloc(sizeof(esp_ble_bond_dev_t) * dev_num);
esp_ble_get_bond_device_list(&dev_num, dev_list);
for (int i = 0; i < dev_num; i++) {
esp_err_t result = esp_ble_gap_update_whitelist(true, dev_list[i].bd_addr);
if (result != ESP_OK) {
ESP_LOGI(TAG, "Error updating white list - %d.", result);
}
}
free(dev_list);
Code: Select all
static esp_ble_adv_params_t master_adv_params = {
.adv_int_min = 0x0020,
.adv_int_max = 0x0040,
.adv_type = ADV_TYPE_IND,
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
.channel_map = ADV_CHNL_ALL,
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST;,
};
esp_ble_gap_start_advertising(&master_adv_params);
If, however, I set the filter to ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY, I can connect with the Android with privacy mode.
What I can see is that the Android is using a consistent BDA even when in privacy mode because it has previously bonded with my device. Nevertheless, it does not see my device and cannot connect. Am I using the wrong bda for setting up the whitelist? I have tried to use a static address using the pid_key, but I ran up against a different problem expressed here viewtopic.php?f=14&t=4790.
Anyone else have success using white listing and bonded connections?