!
Callback function when the AP scanning is completed:
void scan_done(void *arg, STATUS status)
{
uint8 ssid[33];
char temp[128];
if (status == OK) {
struct bss_info *bss_link = (struct bss_info *)arg;
while (bss_link != NULL) {
memset(ssid, 0, 33);
if (strlen(bss_link->ssid) <= 32)
memcpy(ssid, bss_link->ssid, strlen(bss_link->ssid));
else
memcpy(ssid, bss_link->ssid, 32);
printf("(%d,\"%s\",%d,\""MACSTR"\",%d)\r\n",
bss_link->authmode, ssid, bss_link->rssi,
MAC2STR(bss_link->bssid),bss_link->channel);
bss_link = bss_link->next.stqe_next;
}
} else {
printf("scan fail !!!\r\n");
}
}
3. Compile the application program, generate firmware and download it into the ESP8266
module.
4. Power off the module, and change it to operation mode; then power on the module and
run the program.
Result:
Hello, welcome to scan-task!
scandone
(0,"ESP_A13319",-41,"1a:fe:34:a1:33:19",1)
(4,"sscgov217",-75,"80:89:17:79:63:cc",1)
(0,"ESP_97F0B1",-46,"1a:fe:34:97:f0:b1",1)
(0,"ESP_A1327E",-36,"1a:fe:34:a1:32:7e",1)
Espressif
12 37
!
/!
3. Sample Codes
2017.05
Need help?
Do you have a question about the ESP8266EX and is the answer not in the manual?
Questions and answers