Any API in ESP32 Arduino or IDF to check current mode (AP, STA)

gailu96
Posts: 9
Joined: Sat Aug 10, 2024 6:06 pm

Any API in ESP32 Arduino or IDF to check current mode (AP, STA)

Postby gailu96 » 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?


gailu96
Posts: 9
Joined: Sat Aug 10, 2024 6:06 pm

Re: Any API in ESP32 Arduino or IDF to check current mode (AP, STA)

Postby gailu96 » Sun Aug 18, 2024 6:03 am

Thank you @MicroController

Who is online

Users browsing this forum: No registered users and 105 guests