I have a problem with wifi_softap_get_station_info().
I use Arduino studio with esp8266 library, Board->Generic ESP8266 Module and try to create AP and get connected clients to this AP using your code listed above.
My code:
#include <ESP8266WiFi.h>
#include<user_interface.h>
const char* APSSID = "AP";
const char* PASSWORD = "password";
void setup() {
Serial.begin(115200);
delay(10);
WiFi.mode(WIFI_AP);
WiFi.softAP(APSSID,PASSWORD);
}
void loop() {
// put your main code here, to run repeatedly:
uint8 softap_stations_cnt;
struct station_info *stat_info;
struct ip_addr *IPaddress;
uint32 uintaddress;
softap_stations_cnt = wifi_softap_get_station_num(); // Count of stations which are connected to ESP8266 soft-AP
stat_info = wifi_softap_get_station_info();
Serial.write(softap_stations_cnt);
while (stat_info != NULL)
{
IPaddress = &stat_info->ip;
uintaddress = IPaddress->addr;
Serial.write((uintaddress>>24));
stat_info = STAILQ_NEXT(stat_info, next);
}
}
And get compile error:
test.ino.cpp.o: In function `setup':
C:\Program Files (x86)\Arduino/test.ino.ino:17: undefined reference to `wifi_softap_get_station_num()'
C:\Program Files (x86)\Arduino/test.ino.ino:17: undefined reference to `wifi_softap_get_station_info()'
C:\Program Files (x86)\Arduino/test.ino.ino:17: undefined reference to `wifi_softap_get_station_num()'
C:\Program Files (x86)\Arduino/test.ino.ino:17: undefined reference to `wifi_softap_get_station_info()'
collect2.exe: error: ld returned 1 exit status
When I comment #include<user_interface.h> :
test.ino:23: error: 'wifi_softap_get_station_num' was not declared in this scope
test.ino:24: error: 'wifi_softap_get_station_info' was not declared in this scope
test.ino:28: error: invalid use of incomplete type 'struct loop()::station_info'
...
Could you help me with it ? What i'am doing wrong ?
Regards,
Hubert