@@ -60,13 +60,15 @@ std::function<void(int)> ESP8266WiFiScanClass::_onComplete;
60
60
61
61
/* *
62
62
* Start scan WiFi networks available
63
- * @param async run in async mode
64
- * @param show_hidden show hidden networks
65
- * @param channel scan only this channel (0 for all channels)
66
- * @param ssid* scan for only this ssid (NULL for all ssid's)
63
+ * @param async run in async mode
64
+ * @param show_hidden show hidden networks
65
+ * @param passive scan type passive or active
66
+ * @param max_ms_per_chan scan time per channel
67
+ * @param channel scan only this channel (0 for all channels)
68
+ * @param ssid* scan for only this ssid (NULL for all ssid's)
67
69
* @return Number of discovered networks
68
70
*/
69
- int8_t ESP8266WiFiScanClass::scanNetworks (bool async, bool show_hidden, uint8 channel, uint8* ssid) {
71
+ int8_t ESP8266WiFiScanClass::scanNetworks (bool async, bool show_hidden, bool passive, uint32_t max_ms_per_chan, uint8_t channel, uint8* ssid) {
70
72
if (ESP8266WiFiScanClass::_scanStarted) {
71
73
return WIFI_SCAN_RUNNING;
72
74
}
@@ -87,6 +89,14 @@ int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden, uint8 ch
87
89
config.ssid = ssid;
88
90
config.channel = channel;
89
91
config.show_hidden = show_hidden;
92
+ if (passive){
93
+ config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
94
+ config.scan_time .passive = max_ms_per_chan;
95
+ } else {
96
+ config.scan_type = WIFI_SCAN_TYPE_ACTIVE;
97
+ config.scan_time .active .min = 100 ;
98
+ config.scan_time .active .max = max_ms_per_chan;
99
+ }
90
100
if (wifi_station_scan (&config, reinterpret_cast <scan_done_cb_t >(&ESP8266WiFiScanClass::_scanDone))) {
91
101
ESP8266WiFiScanClass::_scanComplete = false ;
92
102
ESP8266WiFiScanClass::_scanStarted = true ;
0 commit comments