Skip to content
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

Added channel, ssid scan #4636

Merged
merged 4 commits into from
Apr 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ std::function<void(int)> ESP8266WiFiScanClass::_onComplete;
* Start scan WiFi networks available
* @param async run in async mode
* @param show_hidden show hidden networks
* @param channel scan only this channel (0 for all channels)
* @param ssid* scan for only this ssid (NULL for all ssid's)
* @return Number of discovered networks
*/
int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden) {
int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden, uint8 channel, uint8* ssid) {
if(ESP8266WiFiScanClass::_scanStarted) {
return WIFI_SCAN_RUNNING;
}
Expand All @@ -84,6 +86,8 @@ int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden) {

struct scan_config config;
memset(&config, 0, sizeof(config));
config.ssid = ssid;
config.channel = channel;
config.show_hidden = show_hidden;
if(wifi_station_scan(&config, reinterpret_cast<scan_done_cb_t>(&ESP8266WiFiScanClass::_scanDone))) {
ESP8266WiFiScanClass::_scanComplete = false;
Expand Down
2 changes: 1 addition & 1 deletion libraries/ESP8266WiFi/src/ESP8266WiFiScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ESP8266WiFiScanClass {

public:

int8_t scanNetworks(bool async = false, bool show_hidden = false);
int8_t scanNetworks(bool async = false, bool show_hidden = false, uint8 channel = 0, uint8* ssid = NULL);
void scanNetworksAsync(std::function<void(int)> onComplete, bool show_hidden = false);

int8_t scanComplete();
Expand Down