Invalid first entry in list of bss_info structures
Invalid first entry in list of bss_info structures
Postby kolban » Tue Jul 07, 2015 3:30 am
Looking at this forum post, viewtopic.php?f=21&t=229 we are told that the first entry returned in the call to wifi_station_scan is invalid and should be skipped. Is this considered a bug? If not, why are we being returned an invalid structure just to skip over it?
Re: Invalid first entry in list of bss_info structures
Postby doswork » Wed Jul 08, 2015 9:55 am
Actually the first arg of scan_done is pointed to the list head, not the first entry.
u can get more detail from user_webserver.c in the SDK example.
u can get more detail from user_webserver.c in the SDK example.
Code: Select all
wifi_station_scan(NULL, json_scan_cb);
LOCAL void ICACHE_FLASH_ATTR json_scan_cb(void *arg, STATUS status)
{
pscaninfo->pbss = arg;
....
}
struct bss_info *bss = NULL;
bss = STAILQ_FIRST(pscaninfo->pbss);
-
- Posts: 28
- Joined: Tue Mar 31, 2015 7:27 pm
Re: Invalid first entry in list of bss_info structures
Postby geo.espressif » Fri Nov 13, 2015 6:11 pm
Realise this is old, but I've been wrangling with it today. I had been using the queue macros as doswork advised, but it is important to NULL check void* arg, which crucially the reference code in IoTDemo / user_webserver.c does not. About 1 scan in 20 seems to come back with this as NULL, and it depends on how frequently I perform the scan. Anyway here's my code culled to the iteration bits:
Code: Select all
scaninfo pscaninfo;
pscaninfo.pbss = arg;
if (( arg != NULL ) && ( status == OK ))
{
bss = STAILQ_FIRST( pscaninfo.pbss );
while ( bss != NULL )
{
os_printf ( "Station MAC: " MACSTR ", ssid: %.32s, channel: %d, rssi: %d\n", MAC2STR(bss->bssid),
bss->ssid,
bss->channel,
bss->rssi );
// get nexts
bss = STAILQ_NEXT( bss, next );
}
else
{
// empty the list
os_printf ( "Failed to scan\n" );
}
Who is online
Users browsing this forum: No registered users and 2 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.