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

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

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

Post by Jibun no kage » Thu Aug 11, 2022 1:50 am

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

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

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

Post by jimmo » Sat Aug 13, 2022 2:33 pm

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.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

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

Post by Jibun no kage » Sun Aug 14, 2022 3:26 am

Thanks! Really appreciate it!

Post Reply