Open sovus opened 2 years ago
@sovus did you find a solution for this problem?
to set the specific MAC used by a network interface
BLE is not considered as network interface.
You can to do it by setting private addressing mode. Im not sure if it is implemented, and if it is i just dont remember which function does it.
@sovus did you find a solution for this problem?
I am still looking for a solution.
https://github.com/espressif/arduino-esp32/blob/master/libraries/BLE/src/BLEAdvertising.cpp#L278 this function allow to change esp32 address at any time, just to remember to "startAdvertising()" each time you change address.
Hi,
I am using the ESP32 BLE Arduino -> BLE_IBeacon example in Arduino IDE and would like to be able to change the MAC-Address of the advertising device after I initialized the BLEDevice.
Right now it looks like this:
This changes the BLE-MAC-Address before initializing the BLEDevice. After the initialization
esp_base_mac_addr_set(new_mac);
does not work anymore and the advertised mac stays the same. The only way I found to change it was to use
ESP.restart();
but this erases everything.I know it is possible, because https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#custom-base-mac says "It is also possible to call the function esp_netif_set_mac() to set the specific MAC used by a network interface, after network initialization.", but I can't make it work.
I tried including the necessary libraries and using esp_netif_set_mac(), but I don't know how to get the esp_netif Parameter.
Can someone help or show me a working example please?