Wi-Fi 库
概述
Wi-Fi 库支持配置及监控 ESP32-C3 Wi-Fi 连网功能。
支持配置:
基站模式(即 STA 模式或 Wi-Fi 客户端模式),此时 ESP32-C3 连接到接入点 (AP)。
AP 模式(即 Soft-AP 模式或接入点模式),此时基站连接到 ESP32-C3。
AP-STA 共存模式(ESP32-C3 既是接入点,同时又作为基站连接到另外一个接入点)。
上述模式的各种安全模式(WPA、WPA2 及 WEP 等)。
扫描接入点(包括主动扫描及被动扫描)。
使用混杂模式监控 IEEE802.11 Wi-Fi 数据包。
应用示例
ESP-IDF 示例项目的 wifi 目录下包含以下应用程序:
Wi-Fi 示例代码;
另外一个简单的应用程序 esp-idf-template,演示了如何将 ESP32-C3 模组连接到 AP。
API 参考
Header File
Functions
-
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
Initialize WiFi Allocate resource for WiFi driver, such as WiFi control structure, RX/TX buffer, WiFi NVS structure etc. This WiFi also starts WiFi task.
- Attention
1. This API must be called before all other WiFi API can be called
- Attention
2. Always use WIFI_INIT_CONFIG_DEFAULT macro to initialize the configuration to default values, this can guarantee all the fields get correct value when more fields are added into wifi_init_config_t in future release. If you want to set your own initial values, overwrite the default values which are set by WIFI_INIT_CONFIG_DEFAULT. Please be notified that the field ‘magic’ of wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC!
- 参数
config – pointer to WiFi initialized configuration structure; can point to a temporary variable.
- 返回
ESP_OK: succeed
ESP_ERR_NO_MEM: out of memory
others: refer to error code esp_err.h
-
esp_err_t esp_wifi_deinit(void)
Deinit WiFi Free all resource allocated in esp_wifi_init and stop WiFi task.
- Attention
1. This API should be called if you want to remove WiFi driver from the system
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_set_mode(wifi_mode_t mode)
Set the WiFi operating mode.
Set the WiFi operating mode as station, soft-AP or station+soft-AP, The default mode is station mode.
- 参数
mode – WiFi operating mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
others: refer to error code in esp_err.h
-
esp_err_t esp_wifi_get_mode(wifi_mode_t *mode)
Get current operating mode of WiFi.
- 参数
mode – [out] store current WiFi mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_start(void)
Start WiFi according to current configuration If mode is WIFI_MODE_STA, it create station control block and start station If mode is WIFI_MODE_AP, it create soft-AP control block and start soft-AP If mode is WIFI_MODE_APSTA, it create soft-AP and station control block and start soft-AP and station.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_NO_MEM: out of memory
ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
ESP_FAIL: other WiFi internal errors
-
esp_err_t esp_wifi_stop(void)
Stop WiFi If mode is WIFI_MODE_STA, it stop station and free station control block If mode is WIFI_MODE_AP, it stop soft-AP and free soft-AP control block If mode is WIFI_MODE_APSTA, it stop station/soft-AP and free station/soft-AP control block.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_restore(void)
Restore WiFi stack persistent settings to default values.
This function will reset settings made using the following APIs:
esp_wifi_set_bandwidth,
esp_wifi_set_protocol,
esp_wifi_set_config related
esp_wifi_set_mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_connect(void)
Connect the ESP32 WiFi station to the AP.
- Attention
1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
- Attention
2. If the ESP32 is connected to an AP, call esp_wifi_disconnect to disconnect.
- Attention
3. The scanning triggered by esp_wifi_start_scan() will not be effective until connection between ESP32 and the AP is established. If ESP32 is scanning and connecting at the same time, ESP32 will abort scanning and return a warning message and error number ESP_ERR_WIFI_STATE. If you want to do reconnection after ESP32 received disconnect event, remember to add the maximum retry time, otherwise the called scan will not work. This is especially true when the AP doesn’t exist, and you still try reconnection after ESP32 received disconnect event with the reason code WIFI_REASON_NO_AP_FOUND.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
ESP_ERR_WIFI_SSID: SSID of AP which station connects is invalid
-
esp_err_t esp_wifi_disconnect(void)
Disconnect the ESP32 WiFi station from the AP.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi was not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
ESP_FAIL: other WiFi internal errors
-
esp_err_t esp_wifi_clear_fast_connect(void)
Currently this API is just an stub API.
- 返回
ESP_OK: succeed
others: fail
-
esp_err_t esp_wifi_deauth_sta(uint16_t aid)
deauthenticate all stations or associated id equals to aid
- 参数
aid – when aid is 0, deauthenticate all stations, otherwise deauthenticate station whose associated id is aid
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_MODE: WiFi mode is wrong
-
esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block)
Scan all available APs.
- 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_scan_get_ap_records, so generally, call esp_wifi_scan_get_ap_records 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.
- 参数
config – configuration of scanning
block – if block is true, this API will block the caller until the scan is done, otherwise it will return immediately
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout
ESP_ERR_WIFI_STATE: wifi still connecting when invoke esp_wifi_scan_start
others: refer to error code in esp_err.h
-
esp_err_t esp_wifi_scan_stop(void)
Stop the scan in process.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
-
esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number)
Get number of APs found in last scan.
- Attention
This API can only be called when the scan is completed, otherwise it may get wrong value.
- 参数
number – [out] store number of APIs found in last scan
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records)
Get AP list found in last scan.
- 参数
number – [inout] As input param, it stores max AP number ap_records can hold. As output param, it receives the actual AP number this API returns.
ap_records – wifi_ap_record_t array to hold the found APs
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_NO_MEM: out of memory
-
esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info)
Get information of AP which the ESP32 station is associated with.
- Attention
When the obtained country information is empty, it means that the AP does not carry country information
- 参数
ap_info – the wifi_ap_record_t to hold AP information sta can get the connected ap’s phy mode info through the struct member phy_11b,phy_11g,phy_11n,phy_lr in the wifi_ap_record_t struct. For example, phy_11b = 1 imply that ap support 802.11b mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_CONN: The station interface don’t initialized
ESP_ERR_WIFI_NOT_CONNECT: The station is in disconnect status
-
esp_err_t esp_wifi_set_ps(wifi_ps_type_t type)
Set current WiFi power save type.
- Attention
Default power save type is WIFI_PS_MIN_MODEM.
- 参数
type – power save type
- 返回
ESP_OK: succeed
-
esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type)
Get current WiFi power save type.
- Attention
Default power save type is WIFI_PS_MIN_MODEM.
- 参数
type – [out] store current power save type
- 返回
ESP_OK: succeed
-
esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap)
Set protocol type of specified interface The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
- Attention
Support 802.11b or 802.11bg or 802.11bgn or LR mode
- 参数
ifx – interfaces
protocol_bitmap – WiFi protocol bitmap
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap)
Get the current protocol bitmap of the specified interface.
- 参数
ifx – interface
protocol_bitmap – [out] store current WiFi protocol bitmap of interface ifx
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw)
Set the bandwidth of ESP32 specified interface.
- Attention
1. API return false if try to configure an interface that is not enabled
- Attention
2. WIFI_BW_HT40 is supported only when the interface support 11N
- 参数
ifx – interface to be configured
bw – bandwidth
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw)
Get the bandwidth of ESP32 specified interface.
- Attention
1. API return false if try to get a interface that is not enable
- 参数
ifx – interface to be configured
bw – [out] store bandwidth of interface ifx
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second)
Set primary/secondary channel of ESP32.
- Attention
1. This API should be called after esp_wifi_start()
- Attention
2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting to an external AP
- Attention
3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to external STAs
- Attention
4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above
- 参数
primary – for HT20, primary is the channel number, for HT40, primary is the primary channel
second – for HT20, second is ignored, for HT40, second is the second channel
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second)
Get the primary/secondary channel of ESP32.
- Attention
1. API return false if try to get a interface that is not enable
- 参数
primary – store current primary channel
second – [out] store current second channel
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_country(const wifi_country_t *country)
configure country info
- Attention
1. It is discouraged to call this API since this doesn’t validate the per-country rules, it’s up to the user to fill in all fields according to local regulations. Please use esp_wifi_set_country_code instead.
- Attention
2. The default country is CHINA {.cc=”CN”, .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}
- Attention
3. When the country policy is WIFI_COUNTRY_POLICY_AUTO, the country info of the AP to which the station is connected is used. E.g. if the configured country info is {.cc=”USA”, .schan=1, .nchan=11} and the country info of the AP to which the station is connected is {.cc=”JP”, .schan=1, .nchan=14} then the country info that will be used is {.cc=”JP”, .schan=1, .nchan=14}. If the station disconnected from the AP the country info is set back to the country info of the station automatically, {.cc=”US”, .schan=1, .nchan=11} in the example.
- Attention
4. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, then the configured country info is used always.
- Attention
5. When the country info is changed because of configuration or because the station connects to a different external AP, the country IE in probe response/beacon of the soft-AP is also changed.
- Attention
6. The country configuration is stored into flash.
- Attention
7. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the country info.
- 参数
country – the configured country info
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_get_country(wifi_country_t *country)
get the current country info
- 参数
country – country info
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6])
Set MAC address of the ESP32 WiFi station or the soft-AP interface.
- Attention
1. This API can only be called when the interface is disabled
- Attention
2. ESP32 soft-AP and station have different MAC addresses, do not set them to be the same.
- Attention
3. The bit 0 of the first byte of ESP32 MAC address can not be 1. For example, the MAC address can set to be “1a:XX:XX:XX:XX:XX”, but can not be “15:XX:XX:XX:XX:XX”.
- 参数
ifx – interface
mac – the MAC address
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_WIFI_MAC: invalid mac address
ESP_ERR_WIFI_MODE: WiFi mode is wrong
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6])
Get mac of specified interface.
- 参数
ifx – interface
mac – [out] store mac of the interface ifx
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_IF: invalid interface
-
esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb)
Register the RX callback function in the promiscuous mode.
Each time a packet is received, the registered callback function will be called.
- 参数
cb – callback
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_set_promiscuous(bool en)
Enable the promiscuous mode.
- 参数
en – false - disable, true - enable
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_get_promiscuous(bool *en)
Get the promiscuous mode.
- 参数
en – [out] store the current status of promiscuous mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter)
Enable the promiscuous mode packet type filter.
备注
The default filter is to filter all packets except WIFI_PKT_MISC
- 参数
filter – the packet type filtered in promiscuous mode.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter)
Get the promiscuous filter.
- 参数
filter – [out] store the current status of promiscuous filter
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter)
Enable subtype filter of the control packet in promiscuous mode.
备注
The default filter is to filter none control packet.
- 参数
filter – the subtype of the control packet filtered in promiscuous mode.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter)
Get the subtype filter of the control packet in promiscuous mode.
- 参数
filter – [out] store the current status of subtype filter of the control packet in promiscuous mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf)
Set the configuration of the ESP32 STA or AP.
- Attention
1. This API can be called only when specified interface is enabled, otherwise, API fail
- Attention
2. For station configuration, bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.
- Attention
3. ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.
- 参数
interface – interface
conf – station or soft-AP configuration
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_WIFI_MODE: invalid mode
ESP_ERR_WIFI_PASSWORD: invalid password
ESP_ERR_WIFI_NVS: WiFi internal NVS error
others: refer to the erro code in esp_err.h
-
esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf)
Get configuration of specified interface.
- 参数
interface – interface
conf – [out] station or soft-AP configuration
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_IF: invalid interface
-
esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta)
Get STAs associated with soft-AP.
- Attention
SSC only API
- 参数
sta – [out] station list ap can get the connected sta’s phy mode info through the struct member phy_11b,phy_11g,phy_11n,phy_lr in the wifi_sta_info_t struct. For example, phy_11b = 1 imply that sta support 802.11b mode
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_MODE: WiFi mode is wrong
ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
-
esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid)
Get AID of STA connected with soft-AP.
- 参数
mac – STA’s mac address
aid – [out] Store the AID corresponding to STA mac
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_NOT_FOUND: Requested resource not found
ESP_ERR_WIFI_MODE: WiFi mode is wrong
ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
-
esp_err_t esp_wifi_set_storage(wifi_storage_t storage)
Set the WiFi API configuration storage type.
- Attention
1. The default value is WIFI_STORAGE_FLASH
- 参数
storage – : storage type
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie)
Set 802.11 Vendor-Specific Information Element.
- 参数
enable – If true, specified IE is enabled. If false, specified IE is removed.
type – Information Element type. Determines the frame type to associate with the IE.
idx – Index to set or clear. Each IE type can be associated with up to two elements (indices 0 & 1).
vnd_ie – Pointer to vendor specific element data. First 6 bytes should be a header with fields matching vendor_ie_data_t. If enable is false, this argument is ignored and can be NULL. Data does not need to remain valid after the function returns.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init()
ESP_ERR_INVALID_ARG: Invalid argument, including if first byte of vnd_ie is not WIFI_VENDOR_IE_ELEMENT_ID (0xDD) or second byte is an invalid length.
ESP_ERR_NO_MEM: Out of memory
-
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx)
Register Vendor-Specific Information Element monitoring callback.
- 参数
cb – Callback function
ctx – Context argument, passed to callback function.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_set_max_tx_power(int8_t power)
Set maximum transmitting power after WiFi start.
- Attention
1. Maximum power before wifi startup is limited by PHY init data bin.
- Attention
2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable.
- Attention
3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11}, {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {80, 20}}.
- Attention
4. Param power unit is 0.25dBm, range is [8, 84] corresponding to 2dBm - 20dBm.
- Attention
5. Relationship between set value and actual value. As follows: {set value range, actual value} = {{[8, 19],8}, {[20, 27],20}, {[28, 33],28}, {[34, 43],34}, {[44, 51],44}, {[52, 55],52}, {[56, 59],56}, {[60, 65],60}, {[66, 71],66}, {[72, 79],72}, {[80, 84],80}}.
- 参数
power – Maximum WiFi transmitting power.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is out of range
-
esp_err_t esp_wifi_get_max_tx_power(int8_t *power)
Get maximum transmiting power after WiFi start.
- 参数
power – Maximum WiFi transmitting power, unit is 0.25dBm.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_set_event_mask(uint32_t mask)
Set mask to enable or disable some WiFi events.
- Attention
1. Mask can be created by logical OR of various WIFI_EVENT_MASK_ constants. Events which have corresponding bit set in the mask will not be delivered to the system event handler.
- Attention
2. Default WiFi event mask is WIFI_EVENT_MASK_AP_PROBEREQRECVED.
- Attention
3. There may be lots of stations sending probe request data around. Don’t unmask this event unless you need to receive probe request data.
- 参数
mask – WiFi event mask.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_get_event_mask(uint32_t *mask)
Get mask of WiFi events.
- 参数
mask – WiFi event mask.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq)
Send raw ieee80211 data.
- Attention
Currently only support for sending beacon/probe request/probe response/action and non-QoS data frame
- 参数
ifx – interface if the Wi-Fi mode is Station, the ifx should be WIFI_IF_STA. If the Wi-Fi mode is SoftAP, the ifx should be WIFI_IF_AP. If the Wi-Fi mode is Station+SoftAP, the ifx should be WIFI_IF_STA or WIFI_IF_AP. If the ifx is wrong, the API returns ESP_ERR_WIFI_IF.
buffer – raw ieee80211 buffer
len – the length of raw buffer, the len must be <= 1500 Bytes and >= 24 Bytes
en_sys_seq – indicate whether use the internal sequence number. If en_sys_seq is false, the sequence in raw buffer is unchanged, otherwise it will be overwritten by WiFi driver with the system sequence number. Generally, if esp_wifi_80211_tx is called before the Wi-Fi connection has been set up, both en_sys_seq==true and en_sys_seq==false are fine. However, if the API is called after the Wi-Fi connection has been set up, en_sys_seq must be true, otherwise ESP_ERR_WIFI_ARG is returned.
- 返回
ESP_OK: success
ESP_ERR_WIFI_IF: Invalid interface
ESP_ERR_INVALID_ARG: Invalid parameter
ESP_ERR_WIFI_NO_MEM: out of memory
-
esp_err_t esp_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx)
Register the RX callback function of CSI data.
Each time a CSI data is received, the callback function will be called.
- 参数
cb – callback
ctx – context argument, passed to callback function
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_set_csi_config(const wifi_csi_config_t *config)
Set CSI data configuration.
return
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start or promiscuous mode is not enabled
ESP_ERR_INVALID_ARG: invalid argument
- 参数
config – configuration
-
esp_err_t esp_wifi_set_csi(bool en)
Enable or disable CSI.
return
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start or promiscuous mode is not enabled
ESP_ERR_INVALID_ARG: invalid argument
- 参数
en – true - enable, false - disable
-
esp_err_t esp_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config)
Set antenna GPIO configuration.
- 参数
config – Antenna GPIO configuration.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: Invalid argument, e.g. parameter is NULL, invalid GPIO number etc
-
esp_err_t esp_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config)
Get current antenna GPIO configuration.
- 参数
config – Antenna GPIO configuration.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is NULL
-
esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config)
Set antenna configuration.
- 参数
config – Antenna configuration.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: Invalid argument, e.g. parameter is NULL, invalid antenna mode or invalid GPIO number
-
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config)
Get current antenna configuration.
- 参数
config – Antenna configuration.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is NULL
-
int64_t esp_wifi_get_tsf_time(wifi_interface_t interface)
Get the TSF time In Station mode or SoftAP+Station mode if station is not connected or station doesn’t receive at least one beacon after connected, will return 0.
- Attention
Enabling power save may cause the return value inaccurate, except WiFi modem sleep
- 参数
interface – The interface whose tsf_time is to be retrieved.
- 返回
0 or the TSF time
-
esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec)
Set the inactive time of the ESP32 STA or AP.
- Attention
1. For Station, If the station does not receive a beacon frame from the connected SoftAP during the inactive time, disconnect from SoftAP. Default 6s.
- Attention
2. For SoftAP, If the softAP doesn’t receive any data from the connected STA during inactive time, the softAP will force deauth the STA. Default is 300s.
- Attention
3. The inactive time configuration is not stored into flash
- 参数
ifx – interface to be configured.
sec – Inactive time. Unit seconds.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument, For Station, if sec is less than 3. For SoftAP, if sec is less than 10.
-
esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec)
Get inactive time of specified interface.
- 参数
ifx – Interface to be configured.
sec – Inactive time. Unit seconds.
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_statis_dump(uint32_t modules)
Dump WiFi statistics.
- 参数
modules – statistic modules to be dumped
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi)
Set RSSI threshold below which APP will get an event.
- Attention
This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.
- 参数
rssi – threshold value in dbm between -100 to 0
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg)
Start an FTM Initiator session by sending FTM request If successful, event WIFI_EVENT_FTM_REPORT is generated with the result of the FTM procedure.
- Attention
Use this API only in Station mode
- 参数
cfg – FTM Initiator session configuration
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_ftm_end_session(void)
End the ongoing FTM Initiator session.
- Attention
This API works only on FTM Initiator
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm)
Set offset in cm for FTM Responder. An equivalent offset is calculated in picoseconds and added in TOD of FTM Measurement frame (T1).
- Attention
Use this API only in AP mode before performing FTM as responder
- 参数
offset_cm – T1 Offset to be added in centimeters
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, bool disable)
Enable or disable 11b rate of specified interface.
- Attention
1. This API should be called after esp_wifi_init() and before esp_wifi_start().
- Attention
2. Only when really need to disable 11b rate call this API otherwise don’t call this.
- 参数
ifx – Interface to be configured.
disable – true means disable 11b rate while false means enable 11b rate.
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_set_connectionless_wake_interval(uint16_t interval)
Set interval for station to wake up periodically at disconnected.
- Attention
1. Only when ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is enabled, this configuration could work
- Attention
2. This configuration only work for station mode and disconnected status
- Attention
3. This configuration would influence nothing until some module configure wake_window
- Attention
4. A sensible interval which is not too small is recommended (e.g. 100ms)
- 参数
interval – how much micriosecond would the chip wake up, from 1 to 65535.
-
esp_err_t esp_wifi_set_country_code(const char *country, bool ieee80211d_enabled)
configure country
- Attention
1. When ieee80211d_enabled, the country info of the AP to which the station is connected is used. E.g. if the configured country is US and the country info of the AP to which the station is connected is JP then the country info that will be used is JP. If the station disconnected from the AP the country info is set back to the country info of the station automatically, US in the example.
- Attention
2. When ieee80211d_enabled is disabled, then the configured country info is used always.
- Attention
3. When the country info is changed because of configuration or because the station connects to a different external AP, the country IE in probe response/beacon of the soft-AP is also changed.
- Attention
4. The country configuration is stored into flash.
- Attention
5. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the country info.
- Attention
6. Supported country codes are “01”(world safe mode) “AT”,”AU”,”BE”,”BG”,”BR”, “CA”,”CH”,”CN”,”CY”,”CZ”,”DE”,”DK”,”EE”,”ES”,”FI”,”FR”,”GB”,”GR”,”HK”,”HR”,”HU”, “IE”,”IN”,”IS”,”IT”,”JP”,”KR”,”LI”,”LT”,”LU”,”LV”,”MT”,”MX”,”NL”,”NO”,”NZ”,”PL”,”PT”, “RO”,”SE”,”SI”,”SK”,”TW”,”US”
- Attention
7. When country code “01” (world safe mode) is set, SoftAP mode won’t contain country IE.
- Attention
8. The default country is “CN” and ieee80211d_enabled is TRUE.
- 参数
country – the configured country ISO code
ieee80211d_enabled – 802.11d is enabled or not
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_get_country_code(char *country)
get the current country code
- 参数
country – country code
- 返回
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate)
Config 80211 tx rate of specified interface.
- Attention
1. This API should be called after esp_wifi_init() and before esp_wifi_start().
- 参数
ifx – Interface to be configured.
rate – Phy rate to be configured.
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx)
Disable PMF configuration for specified interface.
- Attention
This API should be called after esp_wifi_set_config() and before esp_wifi_start().
- 参数
ifx – Interface to be configured.
- 返回
ESP_OK: succeed
others: failed
Structures
-
struct wifi_init_config_t
WiFi stack configuration parameters passed to esp_wifi_init call.
Public Members
-
system_event_handler_t event_handler
WiFi event handler
-
wifi_osi_funcs_t *osi_funcs
WiFi OS functions
-
wpa_crypto_funcs_t wpa_crypto_funcs
WiFi station crypto functions when connect
-
int static_rx_buf_num
WiFi static RX buffer number
-
int dynamic_rx_buf_num
WiFi dynamic RX buffer number
-
int tx_buf_type
WiFi TX buffer type
-
int static_tx_buf_num
WiFi static TX buffer number
-
int dynamic_tx_buf_num
WiFi dynamic TX buffer number
-
int cache_tx_buf_num
WiFi TX cache buffer number
-
int csi_enable
WiFi channel state information enable flag
-
int ampdu_rx_enable
WiFi AMPDU RX feature enable flag
-
int ampdu_tx_enable
WiFi AMPDU TX feature enable flag
-
int amsdu_tx_enable
WiFi AMSDU TX feature enable flag
-
int nvs_enable
WiFi NVS flash enable flag
-
int nano_enable
Nano option for printf/scan family enable flag
-
int rx_ba_win
WiFi Block Ack RX window size
-
int wifi_task_core_id
WiFi Task Core ID
-
int beacon_max_len
WiFi softAP maximum length of the beacon
-
int mgmt_sbuf_num
WiFi management short buffer number, the minimum value is 6, the maximum value is 32
-
uint64_t feature_caps
Enables additional WiFi features and capabilities
-
bool sta_disconnected_pm
WiFi Power Management for station at disconnected status
-
int magic
WiFi init magic number, it should be the last field
-
system_event_handler_t event_handler
Macros
-
ESP_ERR_WIFI_NOT_INIT
WiFi driver was not installed by esp_wifi_init
-
ESP_ERR_WIFI_NOT_STARTED
WiFi driver was not started by esp_wifi_start
-
ESP_ERR_WIFI_NOT_STOPPED
WiFi driver was not stopped by esp_wifi_stop
-
ESP_ERR_WIFI_IF
WiFi interface error
-
ESP_ERR_WIFI_MODE
WiFi mode error
-
ESP_ERR_WIFI_STATE
WiFi internal state error
-
ESP_ERR_WIFI_CONN
WiFi internal control block of station or soft-AP error
-
ESP_ERR_WIFI_NVS
WiFi internal NVS module error
-
ESP_ERR_WIFI_MAC
MAC address is invalid
-
ESP_ERR_WIFI_SSID
SSID is invalid
-
ESP_ERR_WIFI_PASSWORD
Password is invalid
-
ESP_ERR_WIFI_TIMEOUT
Timeout error
-
ESP_ERR_WIFI_WAKE_FAIL
WiFi is in sleep state(RF closed) and wakeup fail
-
ESP_ERR_WIFI_WOULD_BLOCK
The caller would block
-
ESP_ERR_WIFI_NOT_CONNECT
Station still in disconnect status
-
ESP_ERR_WIFI_POST
Failed to post the event to WiFi task
-
ESP_ERR_WIFI_INIT_STATE
Invalid WiFi state when init/deinit is called
-
ESP_ERR_WIFI_STOP_STATE
Returned when WiFi is stopping
-
ESP_ERR_WIFI_NOT_ASSOC
The WiFi connection is not associated
-
ESP_ERR_WIFI_TX_DISALLOW
The WiFi TX is disallowed
-
WIFI_STATIC_TX_BUFFER_NUM
-
WIFI_CACHE_TX_BUFFER_NUM
-
WIFI_DYNAMIC_TX_BUFFER_NUM
-
WIFI_CSI_ENABLED
-
WIFI_AMPDU_RX_ENABLED
-
WIFI_AMPDU_TX_ENABLED
-
WIFI_AMSDU_TX_ENABLED
-
WIFI_NVS_ENABLED
-
WIFI_NANO_FORMAT_ENABLED
-
WIFI_INIT_CONFIG_MAGIC
-
WIFI_DEFAULT_RX_BA_WIN
-
WIFI_TASK_CORE_ID
-
WIFI_SOFTAP_BEACON_MAX_LEN
-
WIFI_MGMT_SBUF_NUM
-
WIFI_STA_DISCONNECTED_PM_ENABLED
-
CONFIG_FEATURE_WPA3_SAE_BIT
-
CONFIG_FEATURE_CACHE_TX_BUF_BIT
-
CONFIG_FEATURE_FTM_INITIATOR_BIT
-
CONFIG_FEATURE_FTM_RESPONDER_BIT
-
WIFI_INIT_CONFIG_DEFAULT()
Type Definitions
-
typedef void (*wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type)
The RX callback function in the promiscuous mode. Each time a packet is received, the callback function will be called.
- Param buf
Data received. Type of data in buffer (wifi_promiscuous_pkt_t or wifi_pkt_rx_ctrl_t) indicated by ‘type’ parameter.
- Param type
promiscuous packet type.
-
typedef void (*esp_vendor_ie_cb_t)(void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi)
Function signature for received Vendor-Specific Information Element callback.
- Param ctx
Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
- Param type
Information element type, based on frame type received.
- Param sa
Source 802.11 address.
- Param vnd_ie
Pointer to the vendor specific element data received.
- Param rssi
Received signal strength indication.
-
typedef void (*wifi_csi_cb_t)(void *ctx, wifi_csi_info_t *data)
The RX callback function of Channel State Information(CSI) data.
Each time a CSI data is received, the callback function will be called.
- Param ctx
context argument, passed to esp_wifi_set_csi_rx_cb() when registering callback function.
- Param data
CSI data received. The memory that it points to will be deallocated after callback function returns.
Header File
Unions
-
union wifi_config_t
- #include <esp_wifi_types.h>
Configuration data for ESP32 AP or STA.
The usage of this union (for ap or sta configuration) is determined by the accompanying interface argument passed to esp_wifi_set_config() or esp_wifi_get_config()
Structures
-
struct wifi_country_t
Structure describing WiFi country-based regional restrictions.
Public Members
-
char cc[3]
country code string
-
uint8_t schan
start channel
-
uint8_t nchan
total channel number
-
int8_t max_tx_power
This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power.
-
wifi_country_policy_t policy
country policy
-
char cc[3]
-
struct wifi_active_scan_time_t
Range of active scan times per channel.
-
struct wifi_scan_time_t
Aggregate of active & passive scan time per channel.
Public Members
-
wifi_active_scan_time_t active
active scan time per channel, units: millisecond.
-
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_active_scan_time_t active
-
struct wifi_scan_config_t
Parameters for an SSID scan.
Public Members
-
uint8_t *ssid
SSID of AP
-
uint8_t *bssid
MAC address of AP
-
uint8_t channel
channel, scan the specific channel
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
-
uint8_t *ssid
-
struct wifi_ap_record_t
Description of a WiFi AP.
Public Members
-
uint8_t bssid[6]
MAC address of AP
-
uint8_t ssid[33]
SSID of AP
-
uint8_t primary
channel of AP
-
wifi_second_chan_t second
secondary channel of AP
-
int8_t rssi
signal strength of AP
-
wifi_auth_mode_t authmode
authmode of AP
-
wifi_cipher_type_t pairwise_cipher
pairwise cipher of AP
-
wifi_cipher_type_t group_cipher
group cipher of AP
-
wifi_ant_t ant
antenna used to receive beacon from AP
-
uint32_t phy_11b
bit: 0 flag to identify if 11b mode is enabled or not
-
uint32_t phy_11g
bit: 1 flag to identify if 11g mode is enabled or not
-
uint32_t phy_11n
bit: 2 flag to identify if 11n mode is enabled or not
-
uint32_t phy_lr
bit: 3 flag to identify if low rate is enabled or not
-
uint32_t wps
bit: 4 flag to identify if WPS is supported or not
-
uint32_t ftm_responder
bit: 5 flag to identify if FTM is supported in responder mode
-
uint32_t ftm_initiator
bit: 6 flag to identify if FTM is supported in initiator mode
-
uint32_t reserved
bit: 7..31 reserved
-
wifi_country_t country
country information of AP
-
uint8_t bssid[6]
-
struct wifi_scan_threshold_t
Structure describing parameters for a WiFi fast scan.
Public Members
-
int8_t rssi
The minimum rssi to accept in the fast scan mode
-
wifi_auth_mode_t authmode
The weakest authmode to accept in the fast scan mode
-
int8_t rssi
-
struct wifi_pmf_config_t
Configuration structure for Protected Management Frame
-
struct wifi_ap_config_t
Soft-AP configuration settings for the ESP32.
Public Members
-
uint8_t ssid[32]
SSID of ESP32 soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len.
-
uint8_t password[64]
Password of ESP32 soft-AP.
-
uint8_t ssid_len
Optional length of SSID field.
-
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
Broadcast SSID or not, default 0, broadcast the SSID
-
uint8_t max_connection
Max number of stations allowed to connect in, default 4, max 10
-
uint16_t beacon_interval
Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100
-
wifi_cipher_type_t pairwise_cipher
pairwise cipher of SoftAP, group cipher will be derived using this. cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP and WIFI_CIPHER_TYPE_TKIP_CCMP.
-
bool ftm_responder
Enable FTM Responder mode
-
uint8_t ssid[32]
-
struct wifi_sta_config_t
STA configuration settings for the ESP32.
Public Members
-
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.
-
uint16_t listen_interval
Listen interval for ESP32 station to receive beacon when WIFI_PS_MAX_MODEM is set. Units: AP beacon intervals. Defaults to 3 if set to 0.
-
wifi_sort_method_t sort_method
sort the connect AP in the list by rssi or security mode
-
wifi_scan_threshold_t threshold
When sort_method is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used.
-
wifi_pmf_config_t pmf_cfg
Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE.
-
uint32_t rm_enabled
Whether Radio Measurements are enabled for the connection
-
uint32_t btm_enabled
Whether BSS Transition Management is enabled for the connection
-
uint32_t mbo_enabled
Whether MBO is enabled for the connection
-
uint32_t reserved
Reserved for future feature set
-
uint8_t ssid[32]
-
struct wifi_sta_info_t
Description of STA associated with AP.
Public Members
-
uint8_t mac[6]
mac address
-
int8_t rssi
current average rssi of sta connected
-
uint32_t phy_11b
bit: 0 flag to identify if 11b mode is enabled or not
-
uint32_t phy_11g
bit: 1 flag to identify if 11g mode is enabled or not
-
uint32_t phy_11n
bit: 2 flag to identify if 11n mode is enabled or not
-
uint32_t phy_lr
bit: 3 flag to identify if low rate is enabled or not
-
uint32_t is_mesh_child
bit: 4 flag to identify mesh child
-
uint32_t reserved
bit: 5..31 reserved
-
uint8_t mac[6]
-
struct wifi_sta_list_t
List of stations associated with the ESP32 Soft-AP.
Public Members
-
wifi_sta_info_t sta[(10)]
station list
-
int num
number of stations in the list (other entries are invalid)
-
wifi_sta_info_t sta[(10)]
-
struct vendor_ie_data_t
Vendor Information Element header.
The first bytes of the Information Element will match this header. Payload follows.
Public Members
-
uint8_t element_id
Should be set to WIFI_VENDOR_IE_ELEMENT_ID (0xDD)
-
uint8_t length
Length of all bytes in the element data following this field. Minimum 4.
-
uint8_t vendor_oui[3]
Vendor identifier (OUI).
-
uint8_t vendor_oui_type
Vendor-specific OUI type.
-
uint8_t payload[0]
Payload. Length is equal to value in ‘length’ field, minus 4.
-
uint8_t element_id
-
struct wifi_pkt_rx_ctrl_t
Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers.
Public Members
-
signed rssi
Received Signal Strength Indicator(RSSI) of packet. unit: dBm
-
unsigned rate
PHY rate encoding of the packet. Only valid for non HT(11bg) packet
-
unsigned __pad0__
reserved
-
unsigned sig_mode
0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet
-
unsigned __pad1__
reserved
-
unsigned mcs
Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76)
-
unsigned cwb
Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz
-
unsigned __pad2__
reserved
-
unsigned smoothing
reserved
-
unsigned not_sounding
reserved
-
unsigned __pad3__
reserved
-
unsigned aggregation
Aggregation. 0: MPDU packet; 1: AMPDU packet
-
unsigned stbc
Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet
-
unsigned fec_coding
Flag is set for 11n packets which are LDPC
-
unsigned sgi
Short Guide Interval(SGI). 0: Long GI; 1: Short GI
-
unsigned __pad4__
reserved
-
unsigned ampdu_cnt
ampdu cnt
-
unsigned channel
primary channel on which this packet is received
-
unsigned secondary_channel
secondary channel on which this packet is received. 0: none; 1: above; 2: below
-
unsigned __pad5__
reserved
-
unsigned timestamp
timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond
-
unsigned __pad6__
reserved
-
signed noise_floor
noise floor of Radio Frequency Module(RF). unit: dBm
-
unsigned __pad7__
reserved
-
unsigned __pad8__
reserved
-
unsigned __pad9__
reserved
-
unsigned ant
antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1
-
unsigned __pad10__
reserved
-
unsigned __pad11__
reserved
-
unsigned __pad12__
reserved
-
unsigned sig_len
length of packet including Frame Check Sequence(FCS)
-
unsigned __pad13__
reserved
-
unsigned rx_state
state of the packet. 0: no error; others: error numbers which are not public
-
signed rssi
-
struct wifi_promiscuous_pkt_t
Payload passed to ‘buf’ parameter of promiscuous mode RX callback.
Public Members
-
wifi_pkt_rx_ctrl_t rx_ctrl
metadata header
-
uint8_t payload[0]
Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback.
-
wifi_pkt_rx_ctrl_t rx_ctrl
-
struct wifi_promiscuous_filter_t
Mask for filtering different packet types in promiscuous mode.
Public Members
-
uint32_t filter_mask
OR of one or more filter values WIFI_PROMIS_FILTER_*
-
uint32_t filter_mask
-
struct wifi_csi_config_t
Channel state information(CSI) configuration type.
Public Members
-
bool lltf_en
enable to receive legacy long training field(lltf) data. Default enabled
-
bool htltf_en
enable to receive HT long training field(htltf) data. Default enabled
-
bool stbc_htltf2_en
enable to receive space time block code HT long training field(stbc-htltf2) data. Default enabled
-
bool ltf_merge_en
enable to generate htlft data by averaging lltf and ht_ltf data when receiving HT packet. Otherwise, use ht_ltf data directly. Default enabled
-
bool channel_filter_en
enable to turn on channel filter to smooth adjacent sub-carrier. Disable it to keep independence of adjacent sub-carrier. Default enabled
-
bool manu_scale
manually scale the CSI data by left shifting or automatically scale the CSI data. If set true, please set the shift bits. false: automatically. true: manually. Default false
-
uint8_t shift
manually left shift bits of the scale of the CSI data. The range of the left shift bits is 0~15
-
bool lltf_en
-
struct wifi_csi_info_t
CSI data type.
-
struct wifi_ant_gpio_t
WiFi GPIO configuration for antenna selection.
-
struct wifi_ant_gpio_config_t
WiFi GPIOs configuration for antenna selection.
Public Members
-
wifi_ant_gpio_t gpio_cfg[4]
The configurations of GPIOs that connect to external antenna switch
-
wifi_ant_gpio_t gpio_cfg[4]
-
struct wifi_ant_config_t
WiFi antenna configuration.
Public Members
-
wifi_ant_mode_t rx_ant_mode
WiFi antenna mode for receiving
-
wifi_ant_t rx_ant_default
Default antenna mode for receiving, it’s ignored if rx_ant_mode is not WIFI_ANT_MODE_AUTO
-
wifi_ant_mode_t tx_ant_mode
WiFi antenna mode for transmission, it can be set to WIFI_ANT_MODE_AUTO only if rx_ant_mode is set to WIFI_ANT_MODE_AUTO
-
uint8_t enabled_ant0
Index (in antenna GPIO configuration) of enabled WIFI_ANT_MODE_ANT0
-
uint8_t enabled_ant1
Index (in antenna GPIO configuration) of enabled WIFI_ANT_MODE_ANT1
-
wifi_ant_mode_t rx_ant_mode
-
struct wifi_action_tx_req_t
Action Frame Tx Request.
Public Members
-
wifi_interface_t ifx
WiFi interface to send request to
-
uint8_t dest_mac[6]
Destination MAC address
-
bool no_ack
Indicates no ack required
-
wifi_action_rx_cb_t rx_cb
Rx Callback to receive any response
-
uint32_t data_len
Length of the appended Data
-
uint8_t data[0]
Appended Data payload
-
wifi_interface_t ifx
-
struct wifi_ftm_initiator_cfg_t
FTM Initiator configuration.
Public Members
-
uint8_t resp_mac[6]
MAC address of the FTM Responder
-
uint8_t channel
Primary channel of the FTM Responder
-
uint8_t frm_count
No. of FTM frames requested in terms of 4 or 8 bursts (allowed values - 0(No pref), 16, 24, 32, 64)
-
uint16_t burst_period
Requested time period between consecutive FTM bursts in 100’s of milliseconds (0 - No pref)
-
uint8_t resp_mac[6]
-
struct wifi_event_sta_scan_done_t
Argument structure for WIFI_EVENT_SCAN_DONE event
-
struct wifi_event_sta_connected_t
Argument structure for WIFI_EVENT_STA_CONNECTED event
-
struct wifi_event_sta_disconnected_t
Argument structure for WIFI_EVENT_STA_DISCONNECTED event
-
struct wifi_event_sta_authmode_change_t
Argument structure for WIFI_EVENT_STA_AUTHMODE_CHANGE event
Public Members
-
wifi_auth_mode_t old_mode
the old auth mode of AP
-
wifi_auth_mode_t new_mode
the new auth mode of AP
-
wifi_auth_mode_t old_mode
-
struct wifi_event_sta_wps_er_pin_t
Argument structure for WIFI_EVENT_STA_WPS_ER_PIN event
Public Members
-
uint8_t pin_code[8]
PIN code of station in enrollee mode
-
uint8_t pin_code[8]
-
struct wifi_event_sta_wps_er_success_t
Argument structure for WIFI_EVENT_STA_WPS_ER_SUCCESS event
Public Members
-
uint8_t ap_cred_cnt
Number of AP credentials received
-
uint8_t ssid[32]
SSID of AP
-
uint8_t passphrase[64]
Passphrase for the AP
-
struct wifi_event_sta_wps_er_success_t::[anonymous] ap_cred[3]
All AP credentials received from WPS handshake
-
uint8_t ap_cred_cnt
-
struct wifi_event_ap_staconnected_t
Argument structure for WIFI_EVENT_AP_STACONNECTED event
-
struct wifi_event_ap_stadisconnected_t
Argument structure for WIFI_EVENT_AP_STADISCONNECTED event
-
struct wifi_event_ap_probe_req_rx_t
Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event
-
struct wifi_event_bss_rssi_low_t
Argument structure for WIFI_EVENT_STA_BSS_RSSI_LOW event
Public Members
-
int32_t rssi
RSSI value of bss
-
int32_t rssi
-
struct wifi_ftm_report_entry_t
Argument structure for
Public Members
-
uint8_t dlog_token
Dialog Token of the FTM frame
-
int8_t rssi
RSSI of the FTM frame received
-
uint32_t rtt
Round Trip Time in pSec with a peer
-
uint64_t t1
Time of departure of FTM frame from FTM Responder in pSec
-
uint64_t t2
Time of arrival of FTM frame at FTM Initiator in pSec
-
uint64_t t3
Time of departure of ACK from FTM Initiator in pSec
-
uint64_t t4
Time of arrival of ACK at FTM Responder in pSec
-
uint8_t dlog_token
-
struct wifi_event_ftm_report_t
Argument structure for WIFI_EVENT_FTM_REPORT event
Public Members
-
uint8_t peer_mac[6]
MAC address of the FTM Peer
-
wifi_ftm_status_t status
Status of the FTM operation
-
uint32_t rtt_raw
Raw average Round-Trip-Time with peer in Nano-Seconds
-
uint32_t rtt_est
Estimated Round-Trip-Time with peer in Nano-Seconds
-
uint32_t dist_est
Estimated one-way distance in Centi-Meters
-
wifi_ftm_report_entry_t *ftm_report_data
Pointer to FTM Report with multiple entries, should be freed after use
-
uint8_t ftm_report_num_entries
Number of entries in the FTM Report data
-
uint8_t peer_mac[6]
Macros
-
WIFI_OFFCHAN_TX_REQ
-
WIFI_OFFCHAN_TX_CANCEL
-
WIFI_ROC_REQ
-
WIFI_ROC_CANCEL
-
WIFI_PROTOCOL_11B
-
WIFI_PROTOCOL_11G
-
WIFI_PROTOCOL_11N
-
WIFI_PROTOCOL_LR
-
ESP_WIFI_MAX_CONN_NUM
max number of stations which can connect to ESP32 soft-AP
-
WIFI_VENDOR_IE_ELEMENT_ID
-
WIFI_PROMIS_FILTER_MASK_ALL
filter all packets
-
WIFI_PROMIS_FILTER_MASK_MGMT
filter the packets with type of WIFI_PKT_MGMT
-
WIFI_PROMIS_FILTER_MASK_CTRL
filter the packets with type of WIFI_PKT_CTRL
-
WIFI_PROMIS_FILTER_MASK_DATA
filter the packets with type of WIFI_PKT_DATA
-
WIFI_PROMIS_FILTER_MASK_MISC
filter the packets with type of WIFI_PKT_MISC
-
WIFI_PROMIS_FILTER_MASK_DATA_MPDU
filter the MPDU which is a kind of WIFI_PKT_DATA
-
WIFI_PROMIS_FILTER_MASK_DATA_AMPDU
filter the AMPDU which is a kind of WIFI_PKT_DATA
-
WIFI_PROMIS_FILTER_MASK_FCSFAIL
filter the FCS failed packets, do not open it in general
-
WIFI_PROMIS_CTRL_FILTER_MASK_ALL
filter all control packets
-
WIFI_PROMIS_CTRL_FILTER_MASK_WRAPPER
filter the control packets with subtype of Control Wrapper
-
WIFI_PROMIS_CTRL_FILTER_MASK_BAR
filter the control packets with subtype of Block Ack Request
-
WIFI_PROMIS_CTRL_FILTER_MASK_BA
filter the control packets with subtype of Block Ack
-
WIFI_PROMIS_CTRL_FILTER_MASK_PSPOLL
filter the control packets with subtype of PS-Poll
-
WIFI_PROMIS_CTRL_FILTER_MASK_RTS
filter the control packets with subtype of RTS
-
WIFI_PROMIS_CTRL_FILTER_MASK_CTS
filter the control packets with subtype of CTS
-
WIFI_PROMIS_CTRL_FILTER_MASK_ACK
filter the control packets with subtype of ACK
-
WIFI_PROMIS_CTRL_FILTER_MASK_CFEND
filter the control packets with subtype of CF-END
-
WIFI_PROMIS_CTRL_FILTER_MASK_CFENDACK
filter the control packets with subtype of CF-END+CF-ACK
-
WIFI_EVENT_MASK_ALL
mask all WiFi events
-
WIFI_EVENT_MASK_NONE
mask none of the WiFi events
-
WIFI_EVENT_MASK_AP_PROBEREQRECVED
mask SYSTEM_EVENT_AP_PROBEREQRECVED event
-
MAX_SSID_LEN
-
MAX_PASSPHRASE_LEN
-
MAX_WPS_AP_CRED
-
WIFI_STATIS_BUFFER
-
WIFI_STATIS_RXTX
-
WIFI_STATIS_HW
-
WIFI_STATIS_DIAG
-
WIFI_STATIS_PS
-
WIFI_STATIS_ALL
Type Definitions
-
typedef int (*wifi_action_rx_cb_t)(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel)
The Rx callback function of Action Tx operations.
- Param hdr
pointer to the IEEE 802.11 Header structure
- Param payload
pointer to the Payload following 802.11 Header
- Param len
length of the Payload
- Param channel
channel number the frame is received on
Enumerations
-
enum wifi_mode_t
Values:
-
enumerator WIFI_MODE_NULL
null mode
-
enumerator WIFI_MODE_STA
WiFi station mode
-
enumerator WIFI_MODE_AP
WiFi soft-AP mode
-
enumerator WIFI_MODE_APSTA
WiFi station + soft-AP mode
-
enumerator WIFI_MODE_MAX
-
enumerator WIFI_MODE_NULL
-
enum wifi_country_policy_t
Values:
-
enumerator WIFI_COUNTRY_POLICY_AUTO
Country policy is auto, use the country info of AP to which the station is connected
-
enumerator WIFI_COUNTRY_POLICY_MANUAL
Country policy is manual, always use the configured country info
-
enumerator WIFI_COUNTRY_POLICY_AUTO
-
enum wifi_auth_mode_t
Values:
-
enumerator WIFI_AUTH_OPEN
authenticate mode : open
-
enumerator WIFI_AUTH_WEP
authenticate mode : WEP
-
enumerator WIFI_AUTH_WPA_PSK
authenticate mode : WPA_PSK
-
enumerator WIFI_AUTH_WPA2_PSK
authenticate mode : WPA2_PSK
-
enumerator WIFI_AUTH_WPA_WPA2_PSK
authenticate mode : WPA_WPA2_PSK
-
enumerator WIFI_AUTH_WPA2_ENTERPRISE
authenticate mode : WPA2_ENTERPRISE
-
enumerator WIFI_AUTH_WPA3_PSK
authenticate mode : WPA3_PSK
-
enumerator WIFI_AUTH_WPA2_WPA3_PSK
authenticate mode : WPA2_WPA3_PSK
-
enumerator WIFI_AUTH_WAPI_PSK
authenticate mode : WAPI_PSK
-
enumerator WIFI_AUTH_MAX
-
enumerator WIFI_AUTH_OPEN
-
enum wifi_err_reason_t
Values:
-
enumerator WIFI_REASON_UNSPECIFIED
-
enumerator WIFI_REASON_AUTH_EXPIRE
-
enumerator WIFI_REASON_AUTH_LEAVE
-
enumerator WIFI_REASON_ASSOC_EXPIRE
-
enumerator WIFI_REASON_ASSOC_TOOMANY
-
enumerator WIFI_REASON_NOT_AUTHED
-
enumerator WIFI_REASON_NOT_ASSOCED
-
enumerator WIFI_REASON_ASSOC_LEAVE
-
enumerator WIFI_REASON_ASSOC_NOT_AUTHED
-
enumerator WIFI_REASON_DISASSOC_PWRCAP_BAD
-
enumerator WIFI_REASON_DISASSOC_SUPCHAN_BAD
-
enumerator WIFI_REASON_BSS_TRANSITION_DISASSOC
-
enumerator WIFI_REASON_IE_INVALID
-
enumerator WIFI_REASON_MIC_FAILURE
-
enumerator WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT
-
enumerator WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT
-
enumerator WIFI_REASON_IE_IN_4WAY_DIFFERS
-
enumerator WIFI_REASON_GROUP_CIPHER_INVALID
-
enumerator WIFI_REASON_PAIRWISE_CIPHER_INVALID
-
enumerator WIFI_REASON_AKMP_INVALID
-
enumerator WIFI_REASON_UNSUPP_RSN_IE_VERSION
-
enumerator WIFI_REASON_INVALID_RSN_IE_CAP
-
enumerator WIFI_REASON_802_1X_AUTH_FAILED
-
enumerator WIFI_REASON_CIPHER_SUITE_REJECTED
-
enumerator WIFI_REASON_INVALID_PMKID
-
enumerator WIFI_REASON_BEACON_TIMEOUT
-
enumerator WIFI_REASON_NO_AP_FOUND
-
enumerator WIFI_REASON_AUTH_FAIL
-
enumerator WIFI_REASON_ASSOC_FAIL
-
enumerator WIFI_REASON_HANDSHAKE_TIMEOUT
-
enumerator WIFI_REASON_CONNECTION_FAIL
-
enumerator WIFI_REASON_AP_TSF_RESET
-
enumerator WIFI_REASON_ROAMING
-
enumerator WIFI_REASON_UNSPECIFIED
-
enum wifi_second_chan_t
Values:
-
enumerator WIFI_SECOND_CHAN_NONE
the channel width is HT20
-
enumerator WIFI_SECOND_CHAN_ABOVE
the channel width is HT40 and the secondary channel is above the primary channel
-
enumerator WIFI_SECOND_CHAN_BELOW
the channel width is HT40 and the secondary channel is below the primary channel
-
enumerator WIFI_SECOND_CHAN_NONE
-
enum wifi_scan_type_t
Values:
-
enumerator WIFI_SCAN_TYPE_ACTIVE
active scan
-
enumerator WIFI_SCAN_TYPE_PASSIVE
passive scan
-
enumerator WIFI_SCAN_TYPE_ACTIVE
-
enum wifi_cipher_type_t
Values:
-
enumerator WIFI_CIPHER_TYPE_NONE
the cipher type is none
-
enumerator WIFI_CIPHER_TYPE_WEP40
the cipher type is WEP40
-
enumerator WIFI_CIPHER_TYPE_WEP104
the cipher type is WEP104
-
enumerator WIFI_CIPHER_TYPE_TKIP
the cipher type is TKIP
-
enumerator WIFI_CIPHER_TYPE_CCMP
the cipher type is CCMP
-
enumerator WIFI_CIPHER_TYPE_TKIP_CCMP
the cipher type is TKIP and CCMP
-
enumerator WIFI_CIPHER_TYPE_AES_CMAC128
the cipher type is AES-CMAC-128
-
enumerator WIFI_CIPHER_TYPE_SMS4
the cipher type is SMS4
-
enumerator WIFI_CIPHER_TYPE_GCMP
the cipher type is GCMP
-
enumerator WIFI_CIPHER_TYPE_GCMP256
the cipher type is GCMP-256
-
enumerator WIFI_CIPHER_TYPE_AES_GMAC128
the cipher type is AES-GMAC-128
-
enumerator WIFI_CIPHER_TYPE_AES_GMAC256
the cipher type is AES-GMAC-256
-
enumerator WIFI_CIPHER_TYPE_UNKNOWN
the cipher type is unknown
-
enumerator WIFI_CIPHER_TYPE_NONE
-
enum wifi_ant_t
WiFi antenna.
Values:
-
enumerator WIFI_ANT_ANT0
WiFi antenna 0
-
enumerator WIFI_ANT_ANT1
WiFi antenna 1
-
enumerator WIFI_ANT_MAX
Invalid WiFi antenna
-
enumerator WIFI_ANT_ANT0
-
enum wifi_scan_method_t
Values:
-
enumerator WIFI_FAST_SCAN
Do fast scan, scan will end after find SSID match AP
-
enumerator WIFI_ALL_CHANNEL_SCAN
All channel scan, scan will end after scan all the channel
-
enumerator WIFI_FAST_SCAN
-
enum wifi_sort_method_t
Values:
-
enumerator WIFI_CONNECT_AP_BY_SIGNAL
Sort match AP in scan list by RSSI
-
enumerator WIFI_CONNECT_AP_BY_SECURITY
Sort match AP in scan list by security mode
-
enumerator WIFI_CONNECT_AP_BY_SIGNAL
-
enum wifi_ps_type_t
Values:
-
enumerator WIFI_PS_NONE
No power save
-
enumerator WIFI_PS_MIN_MODEM
Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period
-
enumerator WIFI_PS_MAX_MODEM
Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi_sta_config_t
-
enumerator WIFI_PS_NONE
-
enum wifi_storage_t
Values:
-
enumerator WIFI_STORAGE_FLASH
all configuration will store in both memory and flash
-
enumerator WIFI_STORAGE_RAM
all configuration will only store in the memory
-
enumerator WIFI_STORAGE_FLASH
-
enum wifi_vendor_ie_type_t
Vendor Information Element type.
Determines the frame type that the IE will be associated with.
Values:
-
enumerator WIFI_VND_IE_TYPE_BEACON
-
enumerator WIFI_VND_IE_TYPE_PROBE_REQ
-
enumerator WIFI_VND_IE_TYPE_PROBE_RESP
-
enumerator WIFI_VND_IE_TYPE_ASSOC_REQ
-
enumerator WIFI_VND_IE_TYPE_ASSOC_RESP
-
enumerator WIFI_VND_IE_TYPE_BEACON
-
enum wifi_vendor_ie_id_t
Vendor Information Element index.
Each IE type can have up to two associated vendor ID elements.
Values:
-
enumerator WIFI_VND_IE_ID_0
-
enumerator WIFI_VND_IE_ID_1
-
enumerator WIFI_VND_IE_ID_0
-
enum wifi_promiscuous_pkt_type_t
Promiscuous frame type.
Passed to promiscuous mode RX callback to indicate the type of parameter in the buffer.
Values:
-
enumerator WIFI_PKT_MGMT
Management frame, indicates ‘buf’ argument is wifi_promiscuous_pkt_t
-
enumerator WIFI_PKT_CTRL
Control frame, indicates ‘buf’ argument is wifi_promiscuous_pkt_t
-
enumerator WIFI_PKT_DATA
Data frame, indiciates ‘buf’ argument is wifi_promiscuous_pkt_t
-
enumerator WIFI_PKT_MISC
Other type, such as MIMO etc. ‘buf’ argument is wifi_promiscuous_pkt_t but the payload is zero length.
-
enumerator WIFI_PKT_MGMT
-
enum wifi_ant_mode_t
WiFi antenna mode.
Values:
-
enumerator WIFI_ANT_MODE_ANT0
Enable WiFi antenna 0 only
-
enumerator WIFI_ANT_MODE_ANT1
Enable WiFi antenna 1 only
-
enumerator WIFI_ANT_MODE_AUTO
Enable WiFi antenna 0 and 1, automatically select an antenna
-
enumerator WIFI_ANT_MODE_MAX
Invalid WiFi enabled antenna
-
enumerator WIFI_ANT_MODE_ANT0
-
enum wifi_phy_rate_t
WiFi PHY rate encodings.
Values:
-
enumerator WIFI_PHY_RATE_1M_L
1 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_2M_L
2 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_5M_L
5.5 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_11M_L
11 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_2M_S
2 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_5M_S
5.5 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_11M_S
11 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_48M
48 Mbps
-
enumerator WIFI_PHY_RATE_24M
24 Mbps
-
enumerator WIFI_PHY_RATE_12M
12 Mbps
-
enumerator WIFI_PHY_RATE_6M
6 Mbps
-
enumerator WIFI_PHY_RATE_54M
54 Mbps
-
enumerator WIFI_PHY_RATE_36M
36 Mbps
-
enumerator WIFI_PHY_RATE_18M
18 Mbps
-
enumerator WIFI_PHY_RATE_9M
9 Mbps
-
enumerator WIFI_PHY_RATE_MCS0_LGI
MCS0 with long GI, 6.5 Mbps for 20MHz, 13.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS1_LGI
MCS1 with long GI, 13 Mbps for 20MHz, 27 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS2_LGI
MCS2 with long GI, 19.5 Mbps for 20MHz, 40.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS3_LGI
MCS3 with long GI, 26 Mbps for 20MHz, 54 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS4_LGI
MCS4 with long GI, 39 Mbps for 20MHz, 81 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS5_LGI
MCS5 with long GI, 52 Mbps for 20MHz, 108 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS6_LGI
MCS6 with long GI, 58.5 Mbps for 20MHz, 121.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS7_LGI
MCS7 with long GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS0_SGI
MCS0 with short GI, 7.2 Mbps for 20MHz, 15 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS1_SGI
MCS1 with short GI, 14.4 Mbps for 20MHz, 30 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS2_SGI
MCS2 with short GI, 21.7 Mbps for 20MHz, 45 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS3_SGI
MCS3 with short GI, 28.9 Mbps for 20MHz, 60 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS4_SGI
MCS4 with short GI, 43.3 Mbps for 20MHz, 90 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS5_SGI
MCS5 with short GI, 57.8 Mbps for 20MHz, 120 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS6_SGI
MCS6 with short GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS7_SGI
MCS7 with short GI, 72.2 Mbps for 20MHz, 150 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_LORA_250K
250 Kbps
-
enumerator WIFI_PHY_RATE_LORA_500K
500 Kbps
-
enumerator WIFI_PHY_RATE_MAX
-
enumerator WIFI_PHY_RATE_1M_L
-
enum wifi_event_t
WiFi event declarations
Values:
-
enumerator WIFI_EVENT_WIFI_READY
ESP32 WiFi ready
-
enumerator WIFI_EVENT_SCAN_DONE
ESP32 finish scanning AP
-
enumerator WIFI_EVENT_STA_START
ESP32 station start
-
enumerator WIFI_EVENT_STA_STOP
ESP32 station stop
-
enumerator WIFI_EVENT_STA_CONNECTED
ESP32 station connected to AP
-
enumerator WIFI_EVENT_STA_DISCONNECTED
ESP32 station disconnected from AP
-
enumerator WIFI_EVENT_STA_AUTHMODE_CHANGE
the auth mode of AP connected by ESP32 station changed
-
enumerator WIFI_EVENT_STA_WPS_ER_SUCCESS
ESP32 station wps succeeds in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_FAILED
ESP32 station wps fails in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_TIMEOUT
ESP32 station wps timeout in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PIN
ESP32 station wps pin code in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP
ESP32 station wps overlap in enrollee mode
-
enumerator WIFI_EVENT_AP_START
ESP32 soft-AP start
-
enumerator WIFI_EVENT_AP_STOP
ESP32 soft-AP stop
-
enumerator WIFI_EVENT_AP_STACONNECTED
a station connected to ESP32 soft-AP
-
enumerator WIFI_EVENT_AP_STADISCONNECTED
a station disconnected from ESP32 soft-AP
-
enumerator WIFI_EVENT_AP_PROBEREQRECVED
Receive probe request packet in soft-AP interface
-
enumerator WIFI_EVENT_FTM_REPORT
Receive report of FTM procedure
-
enumerator WIFI_EVENT_STA_BSS_RSSI_LOW
AP’s RSSI crossed configured threshold
-
enumerator WIFI_EVENT_ACTION_TX_STATUS
Status indication of Action Tx operation
-
enumerator WIFI_EVENT_ROC_DONE
Remain-on-Channel operation complete
-
enumerator WIFI_EVENT_STA_BEACON_TIMEOUT
ESP32 station beacon timeout
-
enumerator WIFI_EVENT_MAX
Invalid WiFi event ID
-
enumerator WIFI_EVENT_WIFI_READY
-
enum wifi_event_sta_wps_fail_reason_t
Argument structure for WIFI_EVENT_STA_WPS_ER_FAILED event
Values:
-
enumerator WPS_FAIL_REASON_NORMAL
ESP32 WPS normal fail reason
-
enumerator WPS_FAIL_REASON_RECV_M2D
ESP32 WPS receive M2D frame
-
enumerator WPS_FAIL_REASON_MAX
-
enumerator WPS_FAIL_REASON_NORMAL
-
enum wifi_ftm_status_t
FTM operation status types.
Values:
-
enumerator FTM_STATUS_SUCCESS
FTM exchange is successful
-
enumerator FTM_STATUS_UNSUPPORTED
Peer does not support FTM
-
enumerator FTM_STATUS_CONF_REJECTED
Peer rejected FTM configuration in FTM Request
-
enumerator FTM_STATUS_NO_RESPONSE
Peer did not respond to FTM Requests
-
enumerator FTM_STATUS_FAIL
Unknown error during FTM exchange
-
enumerator FTM_STATUS_SUCCESS