Hi Everyone !
My ESP is in station mode, I can get the RSSI of few APs in my school but I can't get the MAC adress of this APs.
Is there anyone who knows how to get theses informations ?
Thank you!
How to get Access Point MAC adress
-
- Posts: 1
- Joined: Wed Nov 16, 2016 6:59 pm
Re: How to get Access Point MAC adress
Postby pratik » Sat Nov 19, 2016 1:12 pm
Are you using the SDK? If yes, here is how you do this:
You can access the MAC address of any AP the moment the ESP8266 connects to it by registering a WiFi event callback:
void wifi_set_event_handler_cb(wifi_event_handler_cb_t cb);
The function could be of the form:
The line
os_printf("AP MAC address is %s\n", evt->event_info.connected.bssid);
will get you the MAC of the currently connected AP in station mode.
You can access the MAC address of any AP the moment the ESP8266 connects to it by registering a WiFi event callback:
void wifi_set_event_handler_cb(wifi_event_handler_cb_t cb);
The function could be of the form:
Code: Select all
void wifi_handle_event_cb(System_Event_t *evt) {
os_printf("event %x\n", evt->event);
switch (evt->event)
{
case EVENT_STAMODE_CONNECTED:
os_printf("connect to ssid %s, channel %d\n", evt->event_info.connected.ssid, evt->event_info.connected.channel);
os_printf("AP MAC address is %s\n", evt->event_info.connected.bssid);
break;
case ....
....
}
The line
os_printf("AP MAC address is %s\n", evt->event_info.connected.bssid);
will get you the MAC of the currently connected AP in station mode.
Who is online
Users browsing this forum: No registered users and 1 guest
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.