Code: Select all
tcpip_adapter_init();
pNetworkService->EspErrorCheck(esp_event_loop_create_default());
pNetworkService->EspErrorCheck(esp_event_loop_init(nullptr, nullptr));
wifi_init_config_t Config= WIFI_INIT_CONFIG_DEFAULT();
pNetworkService->EspErrorCheck(esp_wifi_init(&Config));
pNetworkService->EspErrorCheck(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifiEventHandle, nullptr));
pNetworkService->EspErrorCheck(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &wifiEventHandle, nullptr));
pNetworkService->EspErrorCheck(esp_wifi_set_storage(WIFI_STORAGE_RAM));
pNetworkService->EspErrorCheck(esp_wifi_set_mode(WIFI_MODE_STA));
wifi_scan_config_t WifiConfig;
WifiConfig.ssid= 0;
WifiConfig.bssid= 0;
WifiConfig.channel= 0;
WifiConfig.show_hidden= true;
pNetworkService->EspErrorCheck(esp_wifi_scan_start(&WifiConfig, true));
pNetworkService->EspErrorCheck(esp_wifi_start());
uint16_t AccessPointMax= 20;
wifi_ap_record_t AccessPointRecords[20];
pNetworkService->EspErrorCheck(esp_wifi_scan_get_ap_records(&AccessPointMax, AccessPointRecords));
pNetworkService->OnLog("WIFIScanTask Access points: "+ std::to_string(AccessPointMax));
for (int count= 0; count< AccessPointMax; count++) {
pNetworkService->OnLog("WIFIScanTask SSID: "+ std::string((char*)AccessPointRecords[count].ssid)+ ", rssi: "+ std::to_string(AccessPointRecords[count].rssi));
}
How can I enumerate the access points without to be cconnected to someone?