-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement WiFi.getCredentials #759
Implement WiFi.getCredentials #759
Conversation
Outstanding! 👍 How about we call it |
Sure. You have write access to my fork if you want to make small changes like that before merging. |
* User provides an array of WiFiAccessPoint that get filled with the APs
saved on the device
* Returns number of APs on device
* Photon only. Returns 0 on the Core since it cannot read APs back from the CC3000
Changes
* Implement wlan_get_credentials in HAL
* Implement WiFi.getCredentials with array arguments
* Add API test
Fixes #453
00ccdda
to
06fe283
Compare
I renamed this API to |
Merge when particle-iot/device-os#759 is merged
Implement WiFi.getCredentials
I don't see how this gets the configured credentials. It appears to get the everything about the configured wifi networks besides the credentials. Am I misreading this? Or is does this api exposes the preshared keys of previously configured networks. |
I think what you're saying is it would be best described as "get connections" rather than "get credentials" since it doesn't actually return the passwords, but the connection information for which passwords are available, but cannot be retrieved. I can update the docs to that effect. |
@monkbroc yes that is exactly what I am saying. Thanks! |
Changes
Fixes #453
Usage:
For discussion: my first cut of this was to return a
vector<WiFiAccessPoint>
(typedefed toWiFiAccessPointList
) fromWiFi.getCredentials
. This made for very nice application code:But I noticed that
WiFi.scan
is currently implemented to accept an array allocated on the stack by the caller, so I went with that solution in the end.Any strong reasons why not create a
vector
that allocates a fewWiFiAccessPoint
on the heap wheneverWiFi.scan
orWiFi.getCredentials
is called? It is simple to make a version ofWiFi.scan
that returns aWiFiAccessPointList
too.Another point of discussion:
Printing the list of available networks on one of my Photon gives me this:
Is it OK that there are 5 copies of the same network? Now that people will be able to read this list out it might cause confusion.
Would it be better to overwrite existing credentials if the SSID is the same rather than make multiple copies?