Page 1 of 1

Any information for SYSTEM_EVENT_AP_STAIPASSIGNED callback?

Posted: Tue Jul 03, 2018 9:49 am
by azarubkin
Hello,

I've found there's SYSTEM_EVENT_AP_STAIPASSIGNED callback which is called when a client connects to ESP32 softAP and gets IP from ESP32 DHCP server. But is there any way to know which IP was assigned? There is no corresponding member in system_event_info_t union in esp_event.h.

Re: Any information for SYSTEM_EVENT_AP_STAIPASSIGNED callback?

Posted: Tue Jul 03, 2018 3:37 pm
by loboris
You can use

Code: Select all

wifi_sta_list_t station_list;
esp_wifi_ap_get_sta_list(&station_list)
wifi_sta_info_t *stations = (wifi_sta_info_t*)station_list.sta;
to get the stations list.
Than you can iteraatee trough stations list to get the stations IPs:

Code: Select all

for (int i = 0; i < station_list.num; ++i) {
    ip4_addr_t addr;
    dhcp_search_ip_on_mac(stations[i].mac , &addr)
}