fix(wifi_prov): Added API to set random address

This commit is contained in:
Rahul Tank
2024-07-24 20:56:35 +05:30
parent 021c03c9f2
commit 59aa45ad23
8 changed files with 122 additions and 28 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -48,12 +48,24 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
switch (event) {
case ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT:
adv_config_done &= (~adv_config_flag);
if (g_ble_cfg_p->ble_addr) {
esp_ble_gap_set_rand_addr(g_ble_cfg_p->ble_addr);
g_ble_cfg_p->adv_params.own_addr_type = BLE_ADDR_TYPE_RANDOM;
}
if (adv_config_done == 0) {
esp_ble_gap_start_advertising(&g_ble_cfg_p->adv_params);
}
break;
case ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT:
adv_config_done &= (~scan_rsp_config_flag);
if (g_ble_cfg_p->ble_addr) {
esp_ble_gap_set_rand_addr(g_ble_cfg_p->ble_addr);
g_ble_cfg_p->adv_params.own_addr_type = BLE_ADDR_TYPE_RANDOM;
}
if (adv_config_done == 0) {
esp_ble_gap_start_advertising(&g_ble_cfg_p->adv_params);
}
@@ -51,6 +51,9 @@ typedef struct {
unsigned ble_bonding:1;
/** BLE Secure Connection flag */
unsigned ble_sm_sc:1;
/** BLE Address */
uint8_t *ble_addr;
} simple_ble_cfg_t;