-
Notifications
You must be signed in to change notification settings - Fork 220
esp32/modnetwork.c: Report SSID values as strings. #50
Conversation
Sorry for the late response. There are 2 independent changes here:
|
On Fri, May 19, 2017, at 11:04, Damien George wrote:
Changing scan results to return str instead of bytes for the ssid.
esp8266 returns bytes so that's how it should stay. It's really a
bytes entity because it could contain non-ascii chars, and so
converting to a str would be wrong.
Umm, yeah, I was going to point that out. The SSID is *generally* ASCII
but you can't rely on that, it could be set to any sequence of bytes.
If there's high-bit characters they *might* be a UTF-8 encoding so you
could decode it into a string, but there's no guarantee it'll be valid
or printable.
It's kind of inconvenient for display purposes, but so it goes.
|
Re: Perhaps at the same time as we define AP status for #186 we can define a structure for STA status (and perhaps also for the Ethernet PHY #187) |
Thanks for your PR and please do keep contributing but I'm going to close this particular PR because of the problems above. A couple of thoughts on this work though:
2 In 802.11-2012 6.3.11.2.2 there's an additional "SSID-Encoding" flag which indicates if the SSID encoding is "UNSPECIFED" or "UTF8", but there's no particular guarantee that it'll be valid or printable UTF-8 even if this flag is set so I don't know to what extent it is actually useful.
|
Yes, good point, |
How do you feel about the dictionaries-and-lists format for status as I
suggested in #186, eg for a connected WiFi station:```
{ 'connected_ap': { 'essid': b'whatever', 'mac':
b'\x74\xda\x01\xc0\xff\xee' }, 'rssi': '-22', 'rate': 54,
'quality': 0.83 } } ```
.... or something like that.
|
@nickzoic actually, if you read again the current network.rst docs it has an example for getting the STA RSSI: |
From WLAN, I would like to get reported SSID names as strings rather than byte arrays.
In the configuration, SSID names are passed via strings into the driver, and so reading SSID names
from the driver should return them as strings too.