Page 1 of 1

What are the other values for 'hidden' from WLAN.scan()?

Posted: Thu Aug 11, 2022 1:50 am
by Jibun no kage
On a PicoW, the WLAN.scan() is returning some interesting results...

'DD', 'xx:xx:xx:xx:xx:x0', 1, -41, 5, 3
'DD', 'xx:xx:xx:xx:xx:x1', 11, -73, 5, 5
'DD', 'xx:xx:xx:xx:xx:x2', 11, -42, 5, 3

Documentation states the values are ssid, bssid, channel, rssid, security, hidden. Where hidden is to be 0 or 1?

Documentation...

WLAN.scan()¶

Scan for the available wireless networks. Hidden networks – where the SSID is not broadcast – will also be scanned if the WLAN interface allows it. Scanning is only possible on STA interface. Returns list of tuples with the information about WiFi access points:

(ssid, bssid, channel, RSSI, security, hidden)

bssid is hardware address of an access point, in binary form, returned as bytes object. You can use binascii.hexlify() to convert it to ASCII form.

There are five values for security:
0 – open
1 – WEP
2 – WPA-PSK
3 – WPA2-PSK
4 – WPA/WPA2-PSK

and two for hidden:

0 – visible
1 – hidden

Re: What are the other values for 'hidden' from WLAN.scan()?

Posted: Sat Aug 13, 2022 2:33 pm
by jimmo
Jibun no kage wrote:
Thu Aug 11, 2022 1:50 am
Documentation states the values are ssid, bssid, channel, rssid, security, hidden. Where hidden is to be 0 or 1?
The Pico W uses the same driver as the Pyboard D. Just reading the code, it appears that it does something completely different with the "hidden" field that seems to be something to do with how many times the same BSSID was seen in the scan.

I'm also not sure why the security (auth mode) field is different to the defined values. Or why the constants are missing from the network module (like they are on esp32, e.g. `network.AUTH_OPEN`).

This needs to be documented, and the constants need to be added to the network module. I will raise an issue on Monday.

Re: What are the other values for 'hidden' from WLAN.scan()?

Posted: Sun Aug 14, 2022 3:26 am
by Jibun no kage
Thanks! Really appreciate it!