How to update device name in BLE enabled wifi provisioning example?

karunt
Posts: 76
Joined: Sat Apr 03, 2021 7:58 am

How to update device name in BLE enabled wifi provisioning example?

Postby karunt » Wed Aug 04, 2021 11:00 am

New to ESP32. Working with Wifi-Provisioning Manager Example.

Code: Select all

get_device_service_name(service_name, sizeof(service_name))
seems to set the device name. Code for get_device_service_name is:

Code: Select all

    uint8_t eth_mac[6];
    const char *ssid_prefix = "PROV_";
    esp_wifi_get_mac(WIFI_IF_STA, eth_mac);
    snprintf(service_name, max, "%s%02X%02X%02X", ssid_prefix, eth_mac[3], eth_mac[4], eth_mac[5]);
Even though I change ssid_prefix from "PROV_" to something else ("ESP32" for example), BLE scan on Android app always shows "PROV_XXXXXX", where XXXXXX are the 4th, 5th and 6th elements of eth_mac. How can I change the device name which gets adverstised in a BLE scan?

karunt
Posts: 76
Joined: Sat Apr 03, 2021 7:58 am

Re: How to update device name in BLE enabled wifi provisioning example?

Postby karunt » Thu Aug 05, 2021 8:13 am

After much research, it appears that the GAP server (or is it the GATT server in this case? - not sure since I'm new to ESP32 and BLE myself) seems to cache data on devices. While I haven't figured out how to clear this cached programmatically (I'm using Angular and Ionic to develop the Android app), turning Bluetooth OFF and then ON seems to resolve the matter on my Android device. For reference, I'm developing my app on Android 11. I understand this is by no means an ideal or elegant solution, but at least allows me to continue the development process. So if anyone has suggestions on implementing the GAP/GATT refresh programmatically for Angular/Ionic, I'd very much appreciate that too.

Who is online

Users browsing this forum: No registered users and 9 guests