JAndrassy / WiFiEspAT

Arduino networking library. Standard Arduino WiFi networking API over ESP8266 or ESP32 AT commands.
GNU Lesser General Public License v2.1
271 stars 44 forks source link

[question] which ssid is my esp currently connected? #70

Closed atesin closed 2 years ago

atesin commented 2 years ago

hi..... i have some esp8266 with join remote ap persistent on its own flash, not set by me

is there any way to find which ssid are esp's currently connected??... like the WiFi.localIP() function that tells the station ip assigned by ap dhcp, but a command to tell the actual name of external ap.... i have many wifis surrounding, i need this function to know which wifi connect my devices to reach the esp (imagine ssid and ip will be printed on an lcd)

with direct AT commands i can send AT+CWJAP_CUR? to know the ssid of remote ap which connected in realtime, but i am asking for an equivalent in this library.... i couldn't found any reference on documentation

atesin commented 2 years ago

i answer myself... accordig the PrintPersistentSettings,ino example, the function seems to be WiFi.SSID(charBuffer) which puts the currently connected ap ssid in char buffer... this differs a little from wifinina api, this only works on curently connected wifi ans is reentrant

not tested yet... any additional comment? .. thanks

(looking the source, it seems to return the same char pointer)

JAndrassy commented 2 years ago

https://github.com/jandrassy/WiFiEspAT#enhanced-wifi-api

SSID optionally can be called with char array to fill (see PrintPersistentSettings.ino tool example)

the WiFiNINA way works too