Now I send four UDP unicast packets separately to those first four stations. The problem is if only one station is connected it will receive the data and three additional ARP whois packets for the missing stations. This puts unnecessary stress on station and ESP module.
The right way to do it would be to know which stations are connected and send data to those IPs only. I have experimented with two functions found in the SDK programming guide. The first is wifi_softap_get_station_num() which returns the number of stations connected to ESP. Unfortunately this isn't enough since stations can connect and disconnect freely and for every new station the IP address increases.
The second function is wifi_softap_get_station_info(). I haven't figured out how to extract the connected station IP addresses. I can't find an example using this function either.
Can someone explain me or show how to use this function?
The function returns a structure struct station_info which I could find only one reference here: https://github.com/sandeepmistry/esp826 ... nterface.h
where it's defined as:
struct station_info {
STAILQ_ENTRY(station_info) next;
uint8 bssid[6];
struct ip_addr ip;
};
Can someone explain the meaning of the STAILQ_ENTRY(station_info) next; to me?
I have been able to extract bssid from the structure by printing it out:
struct station_info *stat_info;
stat_info = wifi_softap_get_station_info();
Serial.write(stat_info->bssid[0]);
Serial.write(stat_info->bssid[1]);
Serial.write(stat_info->bssid[2]);
Serial.write(stat_info->bssid[3]);
Serial.write(stat_info->bssid[4]);
Serial.write(stat_info->bssid[5]);
But failed to do so with ip parameter (some problem transforming the ip_addr type to unsigned char - it's a bit late in the day...).
Further I'm only seeing the bssid of the first station connected. How do I get the parameters (at least IP) for all the stations connected from the structure?
I'm also worried this method uses a lot of time but I can't think of a better way. Any suggestions?
Regards,
Mat