From c690447dd9abbcb805c7c4c2fb5a89d9296372e2 Mon Sep 17 00:00:00 2001 From: XiaXiaotian Date: Thu, 16 Mar 2017 16:20:19 +0800 Subject: [PATCH] wifi scan: add wifi scan type and time config --- components/esp32/include/esp_wifi.h | 2 ++ components/esp32/include/esp_wifi_types.h | 27 +++++++++++++++++++---- components/esp32/lib | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index a9b072200f..f48146b25b 100755 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -296,6 +296,8 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid); * @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and the * will be freed in esp_wifi_get_ap_list, so generally, call esp_wifi_get_ap_list to cause * the memory to be freed once the scan is done + * @attention The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds. + * Values above 1500ms may cause station to disconnect from AP and are not recommended. * * @param config configuration of scanning * @param block if block is true, this API will block the caller until the scan is done, otherwise diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h index 2b30f5b8ba..be5435da0e 100755 --- a/components/esp32/include/esp_wifi_types.h +++ b/components/esp32/include/esp_wifi_types.h @@ -96,11 +96,30 @@ typedef enum { WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ } wifi_second_chan_t; +typedef enum { + WIFI_SCAN_TYPE_ACTIVE = 0, /**< active scan */ + WIFI_SCAN_TYPE_PASSIVE, /**< passive scan */ +} wifi_scan_type_t; + typedef struct { - uint8_t *ssid; /**< SSID of AP */ - uint8_t *bssid; /**< MAC address of AP */ - uint8_t channel; /**< channel, scan the specific channel */ - bool show_hidden; /**< enable to scan AP whose SSID is hidden */ + uint32_t min; /**< minimum active scan time per channel, units: millisecond */ + uint32_t max; /**< maximum active scan time per channel, units: millisecond, values above 1500ms may + cause station to disconnect from AP and are not recommended. */ +} wifi_active_scan_time_t; + +typedef union { + wifi_active_scan_time_t active; /**< active scan time per channel */ + uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may + cause station to disconnect from AP and are not recommended. */ +} wifi_scan_time_t; + +typedef struct { + uint8_t *ssid; /**< SSID of AP */ + uint8_t *bssid; /**< MAC address of AP */ + uint8_t channel; /**< channel, scan the specific channel */ + bool show_hidden; /**< enable to scan AP whose SSID is hidden */ + wifi_scan_type_t scan_type; /**< scan type, active or passive */ + wifi_scan_time_t scan_time; /**< scan time per channel */ } wifi_scan_config_t; typedef struct { diff --git a/components/esp32/lib b/components/esp32/lib index 5c98c5a8b9..bd53ad194d 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 5c98c5a8b93dbf181849b40c6d6cd164a52bfc4c +Subproject commit bd53ad194dd85885d3d41f455e9debeb9409aef9