Get clients connected to esp AP
Posted:
Sun Nov 01, 2015 3:40 am
by Ashutosh choudhary
How to get client list connected to esp8266 AP through C code. I am able to get client list through AT command but how to run that code in C or execute AT commands through C.
Re: Get clients connected to esp AP
Posted:
Sun Nov 01, 2015 10:31 am
by martinayotte
Here is a piece of code that list all Client MAC addresses :
Code: Select allvoid showClientList()
{
struct station_info *stat_info;
stat_info = wifi_softap_get_station_info();
uint8_t client_count = wifi_softap_get_station_num();
String str = "Number of clients = ";
str += String(client_count);
str += "\r\nList of clients : \r\n";
int i = 1;
while (stat_info != NULL) {
str += "Station #";
str += String(i);
str += " : ";
str += String(stat_info->bssid[0], HEX);
str += ":";
str += String(stat_info->bssid[1], HEX);
str += ":";
str += String(stat_info->bssid[2], HEX);
str += ":";
str += String(stat_info->bssid[3], HEX);
str += ":";
str += String(stat_info->bssid[4], HEX);
str += ":";
str += String(stat_info->bssid[5], HEX);
str += "\r\n";
i++;
stat_info = STAILQ_NEXT(stat_info, next);
}
Serial.println(str);
}