Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By ym58
#59215 Up !!!!
---
I guess I have something interesting to bring to the discussion.

I noticed that the above reported bug happens ONLY when another ESP client connects to the ESP-AP but not when a 'regular' client (iPad, Android, you name it, connects to the ESP-AP) !

Let me explain it with the following sequence :
#1 launching the ESP-AP :
Configuring Access Point ...
AP IP address: 192.168.4.1
HTTP server started
-------------Connected Clients List-----------------------
0 clients.
-------------Connected Clients List-----------------------
0 clients.


#2 connecting my Android smartphone :
-------------Connected Clients List-----------------------
1 clients.
18:3A:2D:89:EB:17 192.168.4.2
-------------Connected Clients List-----------------------
1 clients.
18:3A:2D:89:EB:17 192.168.4.2


#3 connecting another ESP in STA mode :
-------------Connected Clients List-----------------------
2 clients.
18:3A:2D:89:EB:17 192.168.4.2
-------------Connected Clients List-----------------------
2 clients.
18:3A:2D:89:EB:17 192.168.4.2


#4 connecting my iPad :
-------------Connected Clients List-----------------------
3 clients.
18:3A:2D:89:EB:17 192.168.4.2
54:E4:3A:C1:3D:9F 192.168.4.3
-------------Connected Clients List-----------------------
3 clients.
18:3A:2D:89:EB:17 192.168.4.2
54:E4:3A:C1:3D:9F 192.168.4.3


You can see that the problem arises when the ESP(STA) connects to the AP (phase #3).
The # of clients is properly raised to 2, but there is no indication of the ESP(STA) MAC addr. nor its IP addr. !!!
Then, when the iPad gets in the game, the # of clients is now 3 and the iPad MAC & IP are correctly displayed.

Strangely enough, I FINALLY do have 3 connected clients, but the ESP(AP) does not show the ESP(STA) MAC & IP whereas the Android and iPad MAC & IP are 100% recognized and displayed ...

What could be wrong ?
User avatar
By Thomas H
#59910 I am getting the error message of "undefined reference" although using 'extern "C"'.
Not sure if this due to eclipse environment I am using.
Nevertheless the other projects not using this function are compiling flawlessly.

Code: Select all"C:\arduino2016\sloeber\/arduinoPlugin/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc" -g -w -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-LC:\arduino2016\sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.3.0/tools/sdk/lib" "-LC:\arduino2016\sloeber\/arduinoPlugin/packages/esp8266/hardware/esp8266/2.3.0/tools/sdk/ld" "-Teagle.flash.4m1m.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy  -o "C:/arduino2016/workspace4/ESP12E_SoftAP_GetStation_Num/Release/ESP12E_SoftAP_GetStation_Num.elf" -Wl,--start-group    ./.ino.cpp.o  ./libraries/ESP8266WiFi/src/ESP8266WiFi.cpp.o ./libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp.o ./libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp.o ./libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp.o ./libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp.o ./libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp.o ./libraries/ESP8266WiFi/src/WiFiClient.cpp.o ./libraries/ESP8266WiFi/src/WiFiClientSecure.cpp.o ./libraries/ESP8266WiFi/src/WiFiServer.cpp.o ./libraries/ESP8266WiFi/src/WiFiUdp.cpp.o   C:/arduino2016/workspace4/ESP12E_SoftAP_GetStation_Num/Release/arduino.ar   "C:/arduino2016/workspace4/ESP12E_SoftAP_GetStation_Num/Release/arduino.ar" -lm -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lwps -laxtls -lsmartconfig -lmesh -lwpa2 -llwip_gcc -lstdc++ -Wl,--end-group  "-LC:/arduino2016/workspace4/ESP12E_SoftAP_GetStation_Num/Release" C:/arduino2016/workspace4/ESP12E_SoftAP_GetStation_Num/Release/arduino.ar
./.ino.cpp.o:(.text._Z13client_statusv+0x8): undefined reference to `wifi_softap_get_station_num()'
./.ino.cpp.o:(.text._Z13client_statusv+0xc): undefined reference to `wifi_softap_get_station_info()'
./.ino.cpp.o:(.text._Z13client_statusv+0x19): undefined reference to `wifi_softap_get_station_num()'
./.ino.cpp.o: In function `client_status()':
C:\arduino2016\workspace4\ESP12E_SoftAP_GetStation_Num\Release/../ESP12E_SoftAP_GetStation_Num.ino:8: undefined reference to `wifi_softap_get_station_info()'
collect2.exe: error: ld returned 1 exit status
makefile:83: recipe for target 'ESP12E_SoftAP_GetStation_Num.elf' failed
make: *** [ESP12E_SoftAP_GetStation_Num.elf] Error 1



I am using this sample code to exclude other erros:

Code: Select all#include <ESP8266WiFi.h>

extern "C" {
   #include<user_interface.h>
}

void client_status( )
{

unsigned char number_client;
struct station_info *stat_info;

number_client= wifi_softap_get_station_num();

yield();
delay(100);
stat_info = wifi_softap_get_station_info();

Serial.print("Total connected_client are = ");
Serial.println(number_client);

delay(100);
}

void setup() {
Serial.begin(115200);
delay(10);
WiFi.mode(WIFI_AP);
WiFi.softAP("testAP","12345678");
WiFi.printDiag(Serial);
}

void loop ()
{
client_status();
}


In eclipse I have addded 'http://arduino.esp8266.com/stable/package_esp8266com_index.json'
and selected version 2.3.0

When searching for 'wifi_softap_get_station_num' in the ESP8266 libraries I do get only one file "ESP8266WiFiAP.cpp" showing this string:
Code: Select alluint8_t ESP8266WiFiAPClass::softAPgetStationNum() {
    return wifi_softap_get_station_num();
}


This file is shing in the header 'Reworked on 28 Dec 2015 by Markus Sattler'.
Is my library out of date ?
User avatar
By Mif
#86181
TridentTD wrote:extern "C" {
#include "user_interface.h"
}


//------------------------------------------------------------------------------------------------------

Serial.println("-------------Connected Clients List-----------------------");
Serial.print(wifi_softap_get_station_num()); Serial.println(" clients.");

struct station_info *station_list = wifi_softap_get_station_info();
while (station_list != NULL) {
char station_mac[18] = {0}; sprintf(station_mac, "%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(station_list->bssid));
String station_ip = IPAddress((&station_list->ip)->addr).toString();

Serial.print(station_mac); Serial.print(" "); Serial.println(station_ip);

station_list = STAILQ_NEXT(station_list, next);
}
wifi_softap_free_station_info();
Serial.println();

//------------------------------------------------------------------------------------------------------


I like how elegant this code is, but I seem to be having an issue with all the codes I found here. I can only print the first station info.
Has anyone had this issue before?
User avatar
By RichardS
#86182
ym58 wrote:Up !!!!
---
I guess I have something interesting to bring to the discussion.

I noticed that the above reported bug happens ONLY when another ESP client connects to the ESP-AP but not when a 'regular' client (iPad, Android, you name it, connects to the ESP-AP) !

Let me explain it with the following sequence :
#1 launching the ESP-AP :
Configuring Access Point ...
AP IP address: 192.168.4.1
HTTP server started
-------------Connected Clients List-----------------------
0 clients.
-------------Connected Clients List-----------------------
0 clients.


#2 connecting my Android smartphone :
-------------Connected Clients List-----------------------
1 clients.
18:3A:2D:89:EB:17 192.168.4.2
-------------Connected Clients List-----------------------
1 clients.
18:3A:2D:89:EB:17 192.168.4.2


#3 connecting another ESP in STA mode :
-------------Connected Clients List-----------------------
2 clients.
18:3A:2D:89:EB:17 192.168.4.2
-------------Connected Clients List-----------------------
2 clients.
18:3A:2D:89:EB:17 192.168.4.2


#4 connecting my iPad :
-------------Connected Clients List-----------------------
3 clients.
18:3A:2D:89:EB:17 192.168.4.2
54:E4:3A:C1:3D:9F 192.168.4.3
-------------Connected Clients List-----------------------
3 clients.
18:3A:2D:89:EB:17 192.168.4.2
54:E4:3A:C1:3D:9F 192.168.4.3


You can see that the problem arises when the ESP(STA) connects to the AP (phase #3).
The # of clients is properly raised to 2, but there is no indication of the ESP(STA) MAC addr. nor its IP addr. !!!
Then, when the iPad gets in the game, the # of clients is now 3 and the iPad MAC & IP are correctly displayed.

Strangely enough, I FINALLY do have 3 connected clients, but the ESP(AP) does not show the ESP(STA) MAC & IP whereas the Android and iPad MAC & IP are 100% recognized and displayed ...

What could be wrong ?


Maybe the MAC addresses of the 2 ESP are the same?? Only thing I can think of, normally this works fine.

RichardS