Any information for SYSTEM_EVENT_AP_STAIPASSIGNED callback?

azarubkin
Posts: 1
Joined: Tue Jul 03, 2018 9:46 am

Any information for SYSTEM_EVENT_AP_STAIPASSIGNED callback?

Postby azarubkin » Tue Jul 03, 2018 9:49 am

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.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Any information for SYSTEM_EVENT_AP_STAIPASSIGNED callback?

Postby loboris » Tue Jul 03, 2018 3:37 pm

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)
}

Who is online

Users browsing this forum: No registered users and 234 guests