From bd2e55def3bb7f98a8bcdd7a71564cda93f80471 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 19:45:36 +0800 Subject: [PATCH 1/5] component/esp32: adjust some APIs 1. Modify wifi_init_config_t to: typedef struct { wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; 2. Modify argument of esp_wifi_set/get_promiscuous from uint8_t/uint8_t* to bool/bool* --- components/esp32/include/esp_wifi.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 32d5cd0f6..b128e373c 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -138,23 +138,11 @@ typedef enum { } wifi_second_chan_t; +typedef esp_err_t (*wifi_event_handler_t)(void *event); typedef struct { - QueueHandle_t event_queue; /**< WiFi event queue handle */ - uint8_t rx_ba_win; /**< TBC */ - uint8_t tx_ba_win; /**< TBC */ - uint8_t rx_buf_cnt; /**< TBC */ - uint8_t tx_buf_cnt; /**< TBC */ + wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; - -#define WIFI_INIT_CONFIG_DEFAULT(event_queue_) { \ - .event_queue = event_queue_, \ - .rx_ba_win = 0, \ - .tx_ba_win = 0, \ - .rx_buf_cnt = 0, \ - .tx_buf_cnt = 0 \ -}; - /** * @brief Init WiFi * Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, @@ -165,7 +153,6 @@ typedef struct { * to this queue when event happens, such as, when station connects to WiFi, WiFi driver * will post station connected event to this queue. If the queue is not initialized, WiFi * will not post any events - * @attention 3. For other parameters, currently it's not ready, just ignore it. * * @param wifi_init_config_t *config : provide WiFi init configuration * @@ -531,22 +518,22 @@ esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); /** * @brief Enable the promiscuous mode. * - * @param uint8 promiscuous : 0 - disable / 1 - enable + * @param bool promiscuous : false - disable / true - enable * * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_set_promiscuous(uint8_t enable); +esp_err_t esp_wifi_set_promiscuous(bool enable); /** * @brief Get the promiscuous mode. * - * @param uint8 *enable : store the current status of promiscuous mode + * @param bool *enable : store the current status of promiscuous mode * * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_get_promiscuous(uint8_t *enable); +esp_err_t esp_wifi_get_promiscuous(bool *enable); typedef struct { char ssid[32]; /**< SSID of ESP32 soft-AP */ From 0aace445a6032d6acaf1c20b4e8f62371f25fcc0 Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 20:15:16 +0800 Subject: [PATCH 2/5] component/esp32: modify bool argument name from enable to en 1. Modify WIFI_INIT_CONFIG_DEFAULT 2. Modify bool argument name from enable to en --- components/esp32/include/esp_wifi.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index b128e373c..463d1281a 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -143,6 +143,11 @@ typedef struct { wifi_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; + +#define WIFI_INIT_CONFIG_DEFAULT(event_handler_) { \ + .event_handler = (wifi_event_handler_t)event_handler_, \ +}; + /** * @brief Init WiFi * Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, @@ -523,7 +528,7 @@ esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_set_promiscuous(bool enable); +esp_err_t esp_wifi_set_promiscuous(bool en); /** * @brief Get the promiscuous mode. @@ -533,7 +538,7 @@ esp_err_t esp_wifi_set_promiscuous(bool enable); * @return ESP_OK : succeed * @return others : fail */ -esp_err_t esp_wifi_get_promiscuous(bool *enable); +esp_err_t esp_wifi_get_promiscuous(bool *en); typedef struct { char ssid[32]; /**< SSID of ESP32 soft-AP */ From 62dbce1e81ae68553c86c8e3e73fb0e33199b81f Mon Sep 17 00:00:00 2001 From: liuzhifu Date: Mon, 26 Sep 2016 20:43:19 +0800 Subject: [PATCH 3/5] component/esp32: udpate wifi lib 1. 1a01e34f - adjust esp_wifi_set/get_promiscuous' arguments from uint8/uint8* to bool/bool* 2. 3611e699 - register event handler instead of event Q in esp_wifi_init --- components/esp32/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/lib b/components/esp32/lib index f6d558367..a6967f4c1 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit f6d558367a08b6c9b18c2de515bd0a6740d2c45c +Subproject commit a6967f4c1bac9269eb6651e84f2cebf81eb5f982 From 01a7efad88092dc6c32411fa28efbab895b7e9db Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 27 Sep 2016 11:33:19 +0800 Subject: [PATCH 4/5] wifi: use default esp_event_send handler in WIFI_INIT_CONFIG_DEFAULT --- components/esp32/include/esp_wifi.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 463d1281a..a6ad8dd30 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -61,8 +61,9 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/queue.h" -#include "esp_err.h" #include "rom/queue.h" +#include "esp_err.h" +#include "esp_event.h" #ifdef __cplusplus extern "C" { @@ -144,8 +145,8 @@ typedef struct { } wifi_init_config_t; -#define WIFI_INIT_CONFIG_DEFAULT(event_handler_) { \ - .event_handler = (wifi_event_handler_t)event_handler_, \ +#define WIFI_INIT_CONFIG_DEFAULT() { \ + .event_handler = &esp_event_send, \ }; /** From 952df01a10d2d755bc304bed0a9f50c85901a6cb Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 27 Sep 2016 11:47:47 +0800 Subject: [PATCH 5/5] wifi: move type definitions into separate header file While this may reduce esp_wifi.h file readability for people who don't have a "go to definition" function in their editors, this is needed to decouple esp_wifi and esp_event headers, and possibly other headers which may use wifi types in the future. --- components/esp32/include/esp_event.h | 5 +- components/esp32/include/esp_wifi.h | 160 +-------------- components/esp32/include/esp_wifi_types.h | 190 ++++++++++++++++++ .../tcpip_adapter/include/tcpip_adapter.h | 2 +- 4 files changed, 196 insertions(+), 161 deletions(-) create mode 100644 components/esp32/include/esp_wifi_types.h diff --git a/components/esp32/include/esp_event.h b/components/esp32/include/esp_event.h index 86afab2c4..0ca4ca90b 100644 --- a/components/esp32/include/esp_event.h +++ b/components/esp32/include/esp_event.h @@ -19,8 +19,7 @@ #include #include "esp_err.h" -#include "esp_wifi.h" - +#include "esp_wifi_types.h" #include "tcpip_adapter.h" #ifdef __cplusplus @@ -105,6 +104,8 @@ typedef struct { system_event_info_t event_info; /**< event information */ } system_event_t; +typedef esp_err_t (*system_event_handler_t)(system_event_t *event); + /** * @brief Send a event to event task * diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index a6ad8dd30..12378f334 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -63,85 +63,15 @@ #include "freertos/queue.h" #include "rom/queue.h" #include "esp_err.h" +#include "esp_wifi_types.h" #include "esp_event.h" #ifdef __cplusplus extern "C" { #endif -typedef enum { - WIFI_MODE_NULL = 0, /**< null mode */ - WIFI_MODE_STA, /**< WiFi station mode */ - WIFI_MODE_AP, /**< WiFi soft-AP mode */ - WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */ - WIFI_MODE_MAX -} wifi_mode_t; - -typedef enum { - WIFI_IF_STA = 0, /**< ESP32 station interface */ - WIFI_IF_AP, /**< ESP32 soft-AP interface */ - WIFI_IF_MAX -} wifi_interface_t; - -typedef enum { - WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */ - WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */ - WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */ - WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */ - WIFI_COUNTRY_MAX -} wifi_country_t; - -typedef enum { - WIFI_AUTH_OPEN = 0, /**< authenticate mode : open */ - WIFI_AUTH_WEP, /**< authenticate mode : WEP */ - WIFI_AUTH_WPA_PSK, /**< authenticate mode : WPA_PSK */ - WIFI_AUTH_WPA2_PSK, /**< authenticate mode : WPA2_PSK */ - WIFI_AUTH_WPA_WPA2_PSK, /**< authenticate mode : WPA_WPA2_PSK */ - WIFI_AUTH_MAX -} wifi_auth_mode_t; - -enum { - WIFI_REASON_UNSPECIFIED = 1, - WIFI_REASON_AUTH_EXPIRE = 2, - WIFI_REASON_AUTH_LEAVE = 3, - WIFI_REASON_ASSOC_EXPIRE = 4, - WIFI_REASON_ASSOC_TOOMANY = 5, - WIFI_REASON_NOT_AUTHED = 6, - WIFI_REASON_NOT_ASSOCED = 7, - WIFI_REASON_ASSOC_LEAVE = 8, - WIFI_REASON_ASSOC_NOT_AUTHED = 9, - WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, - WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, - WIFI_REASON_IE_INVALID = 13, - WIFI_REASON_MIC_FAILURE = 14, - WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, - WIFI_REASON_IE_IN_4WAY_DIFFERS = 17, - WIFI_REASON_GROUP_CIPHER_INVALID = 18, - WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19, - WIFI_REASON_AKMP_INVALID = 20, - WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21, - WIFI_REASON_INVALID_RSN_IE_CAP = 22, - WIFI_REASON_802_1X_AUTH_FAILED = 23, - WIFI_REASON_CIPHER_SUITE_REJECTED = 24, - - WIFI_REASON_BEACON_TIMEOUT = 200, - WIFI_REASON_NO_AP_FOUND = 201, - WIFI_REASON_AUTH_FAIL = 202, - WIFI_REASON_ASSOC_FAIL = 203, - WIFI_REASON_HANDSHAKE_TIMEOUT = 204, -}; - -typedef enum { - WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */ - WIFI_SECOND_CHAN_ABOVE, /**< the channel width is HT40 and the second channel is above the primary channel */ - WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ -} wifi_second_chan_t; - - -typedef esp_err_t (*wifi_event_handler_t)(void *event); typedef struct { - wifi_event_handler_t event_handler; /**< WiFi event handler */ + system_event_handler_t event_handler; /**< WiFi event handler */ } wifi_init_config_t; @@ -270,13 +200,6 @@ esp_err_t esp_wifi_clear_fast_connect(void); */ esp_err_t esp_wifi_kick_station(uint16_t aid); -typedef struct { - char *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_config_t; - /** * @brief Scan all available APs. * @@ -314,15 +237,6 @@ esp_err_t esp_wifi_scan_stop(void); */ esp_err_t esp_wifi_get_ap_num(uint16_t *number); -typedef struct { - uint8_t bssid[6]; /**< MAC address of AP */ - uint8_t ssid[32]; /**< SSID of AP */ - uint8_t primary; /**< channel of AP */ - wifi_second_chan_t second; /**< second channel of AP */ - int8_t rssi; /**< signal strength of AP */ - wifi_auth_mode_t authmode; /**< authmode of AP */ -} wifi_ap_list_t; - /** * @brief Get AP list found in last scan * @@ -335,13 +249,6 @@ typedef struct { */ esp_err_t esp_wifi_get_ap_list(uint16_t *number, wifi_ap_list_t *ap_list); -typedef enum { - WIFI_PS_NONE, /**< No power save */ - WIFI_PS_MODEM, /**< Modem power save */ - WIFI_PS_LIGHT, /**< Light power save */ - WIFI_PS_MAC, /**< MAC power save */ -} wifi_ps_type_t; - /** * @brief Set current power save type * @@ -362,10 +269,6 @@ esp_err_t esp_wifi_set_ps(wifi_ps_type_t type); */ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type); -#define WIFI_PROTOCOL_11B 1 -#define WIFI_PROTOCOL_11G 2 -#define WIFI_PROTOCOL_11N 4 - /** * @brief Set protocol type of specified interface * The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) @@ -391,11 +294,6 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); */ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -typedef enum { - WIFI_BW_HT20 = 0, /* Bandwidth is HT20 */ - WIFI_BW_HT40, /* Bandwidth is HT40 */ -} wifi_bandwidth_t; - /** * @brief Set the bandwidth of ESP32 specified interface * @@ -541,29 +439,6 @@ esp_err_t esp_wifi_set_promiscuous(bool en); */ esp_err_t esp_wifi_get_promiscuous(bool *en); -typedef struct { - char ssid[32]; /**< SSID of ESP32 soft-AP */ - char password[64]; /**< Password of ESP32 soft-AP */ - uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */ - uint8_t channel; /**< Channel of ESP32 soft-AP */ - wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ - uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ - uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ - uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ -} wifi_ap_config_t; - -typedef struct { - char ssid[32]; /**< SSID of target AP*/ - char password[64]; /**< password of target AP*/ - 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*/ -} wifi_sta_config_t; - -typedef union { - wifi_ap_config_t ap; /**< configuration of AP */ - wifi_sta_config_t sta; /**< configuration of STA */ -} wifi_config_t; - /** * @brief Set the configuration of the ESP32 STA or AP * @@ -591,11 +466,6 @@ esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf); */ esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf); -struct station_info { - STAILQ_ENTRY(station_info) next; - uint8_t bssid[6]; -}; - /** * @brief Get STAs associated with soft-AP * @@ -610,11 +480,6 @@ esp_err_t esp_wifi_get_station_list(struct station_info **station); esp_err_t esp_wifi_free_station_list(void); -typedef enum { - WIFI_STORAGE_FLASH, /**< all configuration will strore in both memory and flash */ - WIFI_STORAGE_RAM, /**< all configuration will only store in the memory */ -} wifi_storage_t; - /** * @brief Set the WiFi API configuration storage type * @@ -671,27 +536,6 @@ esp_err_t esp_wifi_set_auto_connect(bool en); */ esp_err_t esp_wifi_get_auto_connect(bool *en); -/** - * @brief Vendor IE type - * - */ -typedef enum { - WIFI_VND_IE_TYPE_BEACON, - WIFI_VND_IE_TYPE_PROBE_REQ, - WIFI_VND_IE_TYPE_PROBE_RESP, - WIFI_VND_IE_TYPE_ASSOC_REQ, - WIFI_VND_IE_TYPE_ASSOC_RESP, -} wifi_vendor_ie_type_t; - -/** - * @brief Vendor IE index - * - */ -typedef enum { - WIFI_VND_IE_ID_0, - WIFI_VND_IE_ID_1, -} wifi_vendor_ie_id_t; - /** * @brief Set vendor specific element * diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h new file mode 100644 index 000000000..b3474769e --- /dev/null +++ b/components/esp32/include/esp_wifi_types.h @@ -0,0 +1,190 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef __ESP_WIFI_TYPES_H__ +#define __ESP_WIFI_TYPES_H__ + +#include +#include +#include "rom/queue.h" +#include "esp_err.h" +#include "esp_wifi_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + WIFI_MODE_NULL = 0, /**< null mode */ + WIFI_MODE_STA, /**< WiFi station mode */ + WIFI_MODE_AP, /**< WiFi soft-AP mode */ + WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */ + WIFI_MODE_MAX +} wifi_mode_t; + +typedef enum { + WIFI_IF_STA = 0, /**< ESP32 station interface */ + WIFI_IF_AP, /**< ESP32 soft-AP interface */ + WIFI_IF_MAX +} wifi_interface_t; + +typedef enum { + WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */ + WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */ + WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */ + WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */ + WIFI_COUNTRY_MAX +} wifi_country_t; + +typedef enum { + WIFI_AUTH_OPEN = 0, /**< authenticate mode : open */ + WIFI_AUTH_WEP, /**< authenticate mode : WEP */ + WIFI_AUTH_WPA_PSK, /**< authenticate mode : WPA_PSK */ + WIFI_AUTH_WPA2_PSK, /**< authenticate mode : WPA2_PSK */ + WIFI_AUTH_WPA_WPA2_PSK, /**< authenticate mode : WPA_WPA2_PSK */ + WIFI_AUTH_MAX +} wifi_auth_mode_t; + +enum { + WIFI_REASON_UNSPECIFIED = 1, + WIFI_REASON_AUTH_EXPIRE = 2, + WIFI_REASON_AUTH_LEAVE = 3, + WIFI_REASON_ASSOC_EXPIRE = 4, + WIFI_REASON_ASSOC_TOOMANY = 5, + WIFI_REASON_NOT_AUTHED = 6, + WIFI_REASON_NOT_ASSOCED = 7, + WIFI_REASON_ASSOC_LEAVE = 8, + WIFI_REASON_ASSOC_NOT_AUTHED = 9, + WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, + WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, + WIFI_REASON_IE_INVALID = 13, + WIFI_REASON_MIC_FAILURE = 14, + WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, + WIFI_REASON_IE_IN_4WAY_DIFFERS = 17, + WIFI_REASON_GROUP_CIPHER_INVALID = 18, + WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19, + WIFI_REASON_AKMP_INVALID = 20, + WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21, + WIFI_REASON_INVALID_RSN_IE_CAP = 22, + WIFI_REASON_802_1X_AUTH_FAILED = 23, + WIFI_REASON_CIPHER_SUITE_REJECTED = 24, + + WIFI_REASON_BEACON_TIMEOUT = 200, + WIFI_REASON_NO_AP_FOUND = 201, + WIFI_REASON_AUTH_FAIL = 202, + WIFI_REASON_ASSOC_FAIL = 203, + WIFI_REASON_HANDSHAKE_TIMEOUT = 204, +}; + +typedef enum { + WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */ + WIFI_SECOND_CHAN_ABOVE, /**< the channel width is HT40 and the second channel is above the primary channel */ + WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */ +} wifi_second_chan_t; + +typedef struct { + char *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_config_t; + +typedef struct { + uint8_t bssid[6]; /**< MAC address of AP */ + uint8_t ssid[32]; /**< SSID of AP */ + uint8_t primary; /**< channel of AP */ + wifi_second_chan_t second; /**< second channel of AP */ + int8_t rssi; /**< signal strength of AP */ + wifi_auth_mode_t authmode; /**< authmode of AP */ +} wifi_ap_list_t; + +typedef enum { + WIFI_PS_NONE, /**< No power save */ + WIFI_PS_MODEM, /**< Modem power save */ + WIFI_PS_LIGHT, /**< Light power save */ + WIFI_PS_MAC, /**< MAC power save */ +} wifi_ps_type_t; + +#define WIFI_PROTOCOL_11B 1 +#define WIFI_PROTOCOL_11G 2 +#define WIFI_PROTOCOL_11N 4 + +typedef enum { + WIFI_BW_HT20 = 0, /* Bandwidth is HT20 */ + WIFI_BW_HT40, /* Bandwidth is HT40 */ +} wifi_bandwidth_t; + +typedef struct { + char ssid[32]; /**< SSID of ESP32 soft-AP */ + char password[64]; /**< Password of ESP32 soft-AP */ + uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */ + uint8_t channel; /**< Channel of ESP32 soft-AP */ + wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ + uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ + uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ + uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ +} wifi_ap_config_t; + +typedef struct { + char ssid[32]; /**< SSID of target AP*/ + char password[64]; /**< password of target AP*/ + 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*/ +} wifi_sta_config_t; + +typedef union { + wifi_ap_config_t ap; /**< configuration of AP */ + wifi_sta_config_t sta; /**< configuration of STA */ +} wifi_config_t; + +struct station_info { + STAILQ_ENTRY(station_info) next; + uint8_t bssid[6]; +}; + +typedef enum { + WIFI_STORAGE_FLASH, /**< all configuration will strore in both memory and flash */ + WIFI_STORAGE_RAM, /**< all configuration will only store in the memory */ +} wifi_storage_t; + +/** + * @brief Vendor IE type + * + */ +typedef enum { + WIFI_VND_IE_TYPE_BEACON, + WIFI_VND_IE_TYPE_PROBE_REQ, + WIFI_VND_IE_TYPE_PROBE_RESP, + WIFI_VND_IE_TYPE_ASSOC_REQ, + WIFI_VND_IE_TYPE_ASSOC_RESP, +} wifi_vendor_ie_type_t; + +/** + * @brief Vendor IE index + * + */ +typedef enum { + WIFI_VND_IE_ID_0, + WIFI_VND_IE_ID_1, +} wifi_vendor_ie_id_t; + + +#ifdef __cplusplus +} +#endif + + +#endif /* __ESP_WIFI_TYPES_H__ */ diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 51fb233d8..ae3389209 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -17,7 +17,7 @@ #include #include "rom/queue.h" -#include "esp_wifi.h" +#include "esp_wifi_types.h" #define CONFIG_TCPIP_LWIP 1 #define CONFIG_DHCP_STA_LIST 1