Code: Select all
struct station_info *stations;
ESP_ERROR_CHECK(esp_wifi_get_station_list(&stations));
struct station_list *infoList;
ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(stations, &infoList));
struct station_list *head = infoList;
while(infoList != NULL) {
printf("mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x " IPSTR " %d\n",
infoList->mac[0],infoList->mac[1],infoList->mac[2],
infoList->mac[3],infoList->mac[4],infoList->mac[5],
IP2STR(&(infoList->ip)),
(uint32_t)(infoList->ip.addr));
infoList = STAILQ_NEXT(infoList, next);
}
ESP_ERROR_CHECK(esp_adapter_free_sta_list(head));
ESP_ERROR_CHECK(esp_wifi_free_station_list());