- Sat Apr 30, 2016 2:31 am
#46534
Have a play with these 2 functions :-
wifi_softap_get_station_num();
wifi_softap_get_station_info();
These will tell you if there is a client connected and from the latter you can find details about the client.
The only problem with these is that first tells you if a client has connected to the access point, if you call the second one straight after you wont get the info regarding the client as it hasnt completed its DHCP request.
Also sometimes a client may reconnect and if it uses its last IP it was given, the station_info isnt updated, so the number will be +1 but no info for the client.
Another problem that can occur is that the client can disconnect and wifi_softap_get_station_num(); will still report a client is connected.
Mainly these work, but sometimes they dont, just letting you know they arent very good.
Alternatively if you have time in your code , you can cycle through IP's that the AP gives out, mainly 192.168.4.2 , 192.168.4.3, 192.168.4.100, 192.168.4.101....( with an AP of 192.168.4.1 ) a very poor way of finding the IP, but I havent found 100% reliable method yet.