Callback function when the AP scanning is completed:
voidscan_done(void*arg,STATUSstatus)
{
uint8ssid[33];
chartemp[128];
if(status==OK){
structbss_info*bss_link=(structbss_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("scanfail!!!\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,welcometoscan-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)