WiFi: optimize scan feature

1. Add all channel scan feature
2. Add sort matched SSID by authmode feature
This commit is contained in:
Deng Xin 2017-09-14 21:27:26 +08:00
parent 8c4c5ae034
commit ee25caf4b2
3 changed files with 14 additions and 2 deletions

View file

@ -132,6 +132,16 @@ typedef struct {
uint32_t reserved:31; /**< bit: 1..31 reserved */
} wifi_ap_record_t;
typedef enum {
WIFI_FAST_SCAN = 0, /**< Do fast scan, scan will end after find SSID match AP */
WIFI_ALL_CHANNEL_SCAN, /**< All channel scan, scan will end after scan all the channel */
}wifi_scan_method_t;
typedef enum {
WIFI_CONNECT_AP_BY_SIGNAL = 0, /**< Sort match AP in scan list by RSSI */
WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode */
}wifi_sort_method_t;
typedef enum {
WIFI_PS_NONE, /**< No power save */
WIFI_PS_MODEM, /**< Modem power save */
@ -161,9 +171,11 @@ typedef struct {
typedef struct {
uint8_t ssid[32]; /**< SSID of target AP*/
uint8_t password[64]; /**< password of target AP*/
wifi_scan_method_t scan_method; /**< do all channel scan or fast scan */
bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
uint8_t channel; /**< channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */
} wifi_sta_config_t;
typedef union {

@ -1 +1 @@
Subproject commit a3c8f349fe3c9e5be6cf74b813a1dc505fe38dc1
Subproject commit 1a06dd1671e386d75f98844c454c8a86e5b71c1b

View file

@ -68,7 +68,7 @@ static void wifi_power_save(void)
wifi_config_t wifi_config = {
.sta = {
.ssid = DEFAULT_SSID,
.password = DEFAULT_PWD
.password = DEFAULT_PWD,
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));