Any API in ESP32 Arduino or IDF to check current mode (AP, STA)
Posted: Sat Aug 17, 2024 8:43 am
Hi Experts,
I am migrating from ESP8266 NONOS SDK to ESP32 with Arduino. In our product we need to toggle between STA to AP mode on a press of a switch, i.e. if current mode is STA, change to AP and vice versa.
In ESP8266 NONOS SDK there was an API wifi_get_opmode() to check what is the current mode of device, however could not find similar API in ESP32 WiFi library that clearly tells the mode.
I can see some APIs Like WiFi.status(), WiFi.isConnected() but they does not seems to be a 100% confirmation if the device is in AP mode or STA mode. For example if device is in AP mode, WiFi.status() can still report WL_IDLE_STATUS, WL_NO_SSID_AVAIL etc because api is primarily designed to check different state of STA mode.
Is there any equivalent of NONOS SDK wifi_get_opmode() api in WiFi Library or IDF (We can call IDF functions also from Arduino).
It seems to be such an obvious requirement, I think I must be missing something? Any help please?
I am migrating from ESP8266 NONOS SDK to ESP32 with Arduino. In our product we need to toggle between STA to AP mode on a press of a switch, i.e. if current mode is STA, change to AP and vice versa.
In ESP8266 NONOS SDK there was an API wifi_get_opmode() to check what is the current mode of device, however could not find similar API in ESP32 WiFi library that clearly tells the mode.
I can see some APIs Like WiFi.status(), WiFi.isConnected() but they does not seems to be a 100% confirmation if the device is in AP mode or STA mode. For example if device is in AP mode, WiFi.status() can still report WL_IDLE_STATUS, WL_NO_SSID_AVAIL etc because api is primarily designed to check different state of STA mode.
Is there any equivalent of NONOS SDK wifi_get_opmode() api in WiFi Library or IDF (We can call IDF functions also from Arduino).
It seems to be such an obvious requirement, I think I must be missing something? Any help please?