Wi-Fi 库
概述
Wi-Fi 库支持配置及监控 ESP32-S3 Wi-Fi 连网功能。支持配置:
station 模式(即 STA 模式或 Wi-Fi 客户端模式),此时 ESP32-S3 连接到接入点 (AP)。
AP 模式(即 Soft-AP 模式或接入点模式),此时基站连接到 ESP32-S3。
station/AP 共存模式(ESP32-S3 既是接入点,同时又作为基站连接到另外一个接入点)。
上述模式的各种安全模式(WPA、WPA2、WPA3 等)。
扫描接入点(包括主动扫描及被动扫描)。
使用混杂模式监控 IEEE802.11 Wi-Fi 数据包。
应用示例
ESP-IDF 仓库的 wifi 目录下提供了演示 Wi-Fi 库功能的几个应用示例,请查看 README 了解更多详细信息。
API 参考
Header File
This header file can be included with:
#include "esp_wifi.h"
This header file is a part of the API provided by the
esp_wifi
component. To declare that your component depends onesp_wifi
, add the following to your CMakeLists.txt:REQUIRES esp_wifi
or
PRIV_REQUIRES esp_wifi
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, station+soft-AP or NAN. 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 creates station control block and starts station If mode is WIFI_MODE_AP, it creates soft-AP control block and starts soft-AP If mode is WIFI_MODE_APSTA, it creates soft-AP and station control block and starts soft-AP and station If mode is WIFI_MODE_NAN, it creates NAN control block and starts NAN.
- 返回
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 stops station and frees station control block If mode is WIFI_MODE_AP, it stops soft-AP and frees soft-AP control block If mode is WIFI_MODE_APSTA, it stops station/soft-AP and frees station/soft-AP control block If mode is WIFI_MODE_NAN, it stops NAN and frees NAN 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 WiFi station to the AP.
- Attention
1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
- Attention
2. If station interface is connected to an AP, call esp_wifi_disconnect to disconnect.
- Attention
3. The scanning triggered by esp_wifi_scan_start() will not be effective until connection between device and the AP is established. If device is scanning and connecting at the same time, it will abort scanning and return a warning message and error number ESP_ERR_WIFI_STATE.
- Attention
4. This API attempts to connect to an Access Point (AP) only once. To enable reconnection in case of a connection failure, please use the 'failure_retry_cnt' feature in the 'wifi_sta_config_t'. Users are suggested to implement reconnection logic in their application for scenarios where the specified AP does not exist, or reconnection is desired after the device has received a disconnect event.
- 返回
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_MODE: WiFi mode error
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 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 then can be freed in esp_wifi_scan_get_ap_records(), esp_wifi_scan_get_ap_record() or esp_wifi_clear_ap_list(), so call any one to free the memory 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 settings for scanning, if set to NULL default settings will be used of which default values are show_hidden:false, scan_type:active, scan_time.active.min:0, scan_time.active.max:120 miliseconds, scan_time.passive:360 miliseconds
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 APs 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.
- Attention
This API will free all memory occupied by scanned AP list.
- 参数
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_scan_get_ap_record(wifi_ap_record_t *ap_record)
Get one AP record from the scanned AP list.
- Attention
Different from esp_wifi_scan_get_ap_records(), this API only gets one AP record from the scanned AP list each time. This API will free the memory of one AP record, if the user doesn't get all records in the scannned AP list, then needs to call esp_wifi_clear_ap_list() to free the remaining memory.
- 参数
ap_record -- [out] pointer to one AP record
- 返回
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_FAIL: scan APs is NULL, means all AP records fetched or no AP found
-
esp_err_t esp_wifi_clear_ap_list(void)
Clear AP list found in last scan.
- Attention
This API will free all memory occupied by scanned AP list. When the obtained AP list fails, AP records must be cleared,otherwise it may cause memory leakage.
- 返回
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_MODE: WiFi mode is wrong
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info)
Get information of AP to which the device 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). if CONFIG_SOC_WIFI_HE_SUPPORT, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX).
- Attention
Support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax 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 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 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 device.
- Attention
1. This API should be called after esp_wifi_start() and before esp_wifi_stop()
- Attention
2. When device is in STA mode, this API should not be called when STA is scanning or connecting to an external AP
- Attention
3. When device is in softAP mode, this API should not be called when softAP has connected to external STAs
- Attention
4. When device is in STA+softAP mode, this API should not be called when in the scenarios described above
- Attention
5. The channel info set by this API will not be stored in NVS. So If you want to remeber the channel used before wifi stop, you need to call this API again after wifi start, or you can call
esp_wifi_set_config()
to store the channel info in NVS.
- 参数
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_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
-
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second)
Get the primary/secondary channel of device.
- 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 "01" (world safe mode) {.cc="01", .schan=1, .nchan=11, .policy=WIFI_COUNTRY_POLICY_AUTO}.
- Attention
3. The third octet of country code string is one of the following: ' ', 'O', 'I', 'X', otherwise it is considered as ' '.
- Attention
4. 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="US", .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
5. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, then the configured country info is used always.
- Attention
6. 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
7. The country configuration is stored into flash.
- Attention
8. 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 WiFi station, soft-AP or NAN interface.
- Attention
1. This API can only be called when the interface is disabled
- Attention
2. Above mentioned interfaces have different MAC addresses, do not set them to be the same.
- Attention
3. The bit 0 of the first byte of 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_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf)
Set the configuration of the STA, AP or NAN.
- 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. ESP devices are 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 station.
- Attention
4. The configuration will be stored in NVS for station and soft-AP
- 参数
interface -- interface
conf -- station, soft-AP or NAN 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 error 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_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_INVALID_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_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_INVALID_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_INVALID_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_INVALID_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_STARTED: 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_STARTED: 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_INVALID_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_INVALID_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_INVALID_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_INVALID_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 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_INVALID_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_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_INVALID_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, if average rssi gets lower than threshold, WiFi task will post event WIFI_EVENT_STA_BSS_RSSI_LOW.
- Attention
If the user wants to receive another WIFI_EVENT_STA_BSS_RSSI_LOW event after receiving one, this API needs to be called again with an updated/same RSSI threshold.
- 参数
rssi -- threshold value in dbm between -100 to 10 Note that in some rare cases where signal strength is very strong, rssi values can be slightly positive.
- 返回
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_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
1. Use this API only in Station mode.
- Attention
2. If FTM is initiated on a different channel than Station is connected in or internal SoftAP is started in, FTM defaults to a single burst in ASAP 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_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries)
Get FTM measurements report copied into a user provided buffer.
- Attention
1. To get the FTM report, user first needs to allocate a buffer of size (sizeof(wifi_ftm_report_entry_t) * num_entries) where the API will fill up to num_entries valid FTM measurements in the buffer. Total number of entries can be found in the event WIFI_EVENT_FTM_REPORT as ftm_report_num_entries
- Attention
2. The internal FTM report is freed upon use of this API which means the API can only be used once afer every FTM session initiated
- Attention
3. Passing the buffer as NULL merely frees the FTM report
- 参数
report -- Pointer to the buffer for receiving the FTM report
num_entries -- Number of FTM report entries to be filled in the report
- 返回
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_connectionless_module_set_wake_interval(uint16_t wake_interval)
Set wake interval for connectionless modules to wake up periodically.
- Attention
1. Only one wake interval for all connectionless modules.
- Attention
2. This configuration could work at connected status. When ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is enabled, this configuration could work at disconnected status.
- Attention
3. Event WIFI_EVENT_CONNECTIONLESS_MODULE_WAKE_INTERVAL_START would be posted each time wake interval starts.
- Attention
4. Recommend to configure interval in multiples of hundred. (e.g. 100ms)
- Attention
5. Recommend to configure interval to ESP_WIFI_CONNECTIONLESS_INTERVAL_DEFAULT_MODE to get stable performance at coexistence mode.
- 参数
wake_interval -- Milliseconds after would the chip wake up, from 1 to 65535.
-
esp_err_t esp_wifi_force_wakeup_acquire(void)
Request extra reference of Wi-Fi radio. Wi-Fi keep active state(RF opened) to be able to receive packets.
- Attention
Please pair the use of
esp_wifi_force_wakeup_acquire
withesp_wifi_force_wakeup_release
.
- 返回
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_force_wakeup_release(void)
Release extra reference of Wi-Fi radio. Wi-Fi go to sleep state(RF closed) if no more use of radio.
- Attention
Please pair the use of
esp_wifi_force_wakeup_acquire
withesp_wifi_force_wakeup_release
.
- 返回
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_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 "01" (world safe mode) and ieee80211d_enabled is TRUE.
- Attention
9. The third octet of country code string is one of the following: ' ', 'O', 'I', 'X', otherwise it is considered as ' '.
- 参数
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
-
esp_err_t esp_wifi_sta_get_aid(uint16_t *aid)
Get the Association id assigned to STA by AP.
- Attention
aid = 0 if station is not connected to AP.
- 参数
aid -- [out] store the aid
- 返回
ESP_OK: succeed
-
esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode)
Get the negotiated phymode after connection.
- 参数
phymode -- [out] store the negotiated phymode.
- 返回
ESP_OK: succeed
-
esp_err_t esp_wifi_set_dynamic_cs(bool enabled)
Config dynamic carrier sense.
- Attention
This API should be called after esp_wifi_start().
- 参数
enabled -- Dynamic carrier sense is enabled or not.
- 返回
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_sta_get_rssi(int *rssi)
Get the rssi information of AP to which the device is associated with.
- Attention
1. This API should be called after station connected to AP.
- Attention
2. Use this API only in WIFI_MODE_STA or WIFI_MODE_APSTA mode.
- 参数
rssi -- store the rssi info received from last beacon.
- 返回
ESP_OK: succeed
ESP_ERR_INVALID_ARG: invalid argument
ESP_FAIL: failed
Structures
-
struct wifi_init_config_t
WiFi stack configuration parameters passed to esp_wifi_init call.
Public Members
-
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 rx_mgmt_buf_type
WiFi RX MGMT buffer type
-
int rx_mgmt_buf_num
WiFi RX MGMT 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 espnow_max_encrypt_num
Maximum encrypt number of peers supported by espnow
-
int magic
WiFi init magic number, it should be the last field
-
wifi_osi_funcs_t *osi_funcs
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
-
ESP_ERR_WIFI_TWT_FULL
no available flow id
-
ESP_ERR_WIFI_TWT_SETUP_TIMEOUT
Timeout of receiving twt setup response frame, timeout times can be set during twt setup
-
ESP_ERR_WIFI_TWT_SETUP_TXFAIL
TWT setup frame tx failed
-
ESP_ERR_WIFI_TWT_SETUP_REJECT
The twt setup request was rejected by the AP
-
ESP_ERR_WIFI_DISCARD
Discard frame
-
ESP_ERR_WIFI_ROC_IN_PROGRESS
ROC op is in progress
-
WIFI_STATIC_TX_BUFFER_NUM
-
WIFI_CACHE_TX_BUFFER_NUM
-
WIFI_DYNAMIC_TX_BUFFER_NUM
-
WIFI_RX_MGMT_BUF_NUM_DEF
-
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
-
WIFI_ENABLE_WPA3_SAE
-
WIFI_ENABLE_SPIRAM
-
WIFI_FTM_INITIATOR
-
WIFI_FTM_RESPONDER
-
CONFIG_FEATURE_WPA3_SAE_BIT
-
CONFIG_FEATURE_CACHE_TX_BUF_BIT
-
CONFIG_FEATURE_FTM_INITIATOR_BIT
-
CONFIG_FEATURE_FTM_RESPONDER_BIT
-
WIFI_FEATURE_CAPS
-
WIFI_INIT_CONFIG_DEFAULT()
-
ESP_WIFI_CONNECTIONLESS_INTERVAL_DEFAULT_MODE
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
This header file can be included with:
#include "esp_wifi_types.h"
This header file is a part of the API provided by the
esp_wifi
component. To declare that your component depends onesp_wifi
, add the following to your CMakeLists.txt:REQUIRES esp_wifi
or
PRIV_REQUIRES esp_wifi
Unions
-
union wifi_config_t
- #include <esp_wifi_types.h>
Configuration data for device's AP or STA or NAN.
The usage of this union (for ap, sta or nan configuration) is determined by the accompanying interface argument passed to esp_wifi_set_config() or esp_wifi_get_config()
Public Members
-
wifi_ap_config_t ap
configuration of AP
-
wifi_sta_config_t sta
configuration of STA
-
wifi_nan_config_t nan
configuration of NAN
-
wifi_ap_config_t ap
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 home_chan_dwell_time
time spent at home channel between scanning consecutive channels.
-
uint8_t *ssid
-
struct wifi_he_ap_info_t
Description of a WiFi AP HE Info.
Public Members
-
uint8_t bss_color
an unsigned integer whose value is the BSS Color of the BSS corresponding to the AP
-
uint8_t partial_bss_color
indicate if an AID assignment rule based on the BSS color
-
uint8_t bss_color_disabled
indicate if the use of BSS color is disabled
-
uint8_t bssid_index
in M-BSSID set, identifies the nontransmitted BSSID
-
uint8_t bss_color
-
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. Note that in some rare cases where signal strength is very strong, rssi values can be slightly positive
-
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 phy_11ax
bit: 4 flag to identify if 11ax mode is enabled or not
-
uint32_t wps
bit: 5 flag to identify if WPS is supported or not
-
uint32_t ftm_responder
bit: 6 flag to identify if FTM is supported in responder mode
-
uint32_t ftm_initiator
bit: 7 flag to identify if FTM is supported in initiator mode
-
uint32_t reserved
bit: 8..31 reserved
-
wifi_country_t country
country information of AP
-
wifi_he_ap_info_t he_ap
HE AP info
-
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 Note: Incase this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks
-
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 device.
Public Members
-
uint8_t ssid[32]
SSID of 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 soft-AP.
-
uint8_t ssid_len
Optional length of SSID field.
-
uint8_t channel
Channel of soft-AP
-
wifi_auth_mode_t authmode
Auth mode of soft-AP. Do not support AUTH_WEP, AUTH_WAPI_PSK and AUTH_OWE in soft-AP mode. When the auth mode is set to WPA2_PSK, WPA2_WPA3_PSK or WPA3_PSK, the pairwise cipher will be overwritten with WIFI_CIPHER_TYPE_CCMP.
Broadcast SSID or not, default 0, broadcast the SSID
-
uint8_t max_connection
Max number of stations allowed to connect in
-
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
-
wifi_pmf_config_t pmf_cfg
Configuration for Protected Management Frame
-
wifi_sae_pwe_method_t sae_pwe_h2e
Configuration for SAE PWE derivation method
-
uint8_t ssid[32]
-
struct wifi_sta_config_t
STA configuration settings for the device.
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 scan_threshold 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 advertised 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 ft_enabled
Whether FT is enabled for the connection
-
uint32_t owe_enabled
Whether OWE is enabled for the connection
-
uint32_t transition_disable
Whether to enable transition disable feature
-
uint32_t reserved
Reserved for future feature set
-
wifi_sae_pwe_method_t sae_pwe_h2e
Configuration for SAE PWE derivation method
-
wifi_sae_pk_mode_t sae_pk_mode
Configuration for SAE-PK (Public Key) Authentication method
-
uint8_t failure_retry_cnt
Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config. Note: Enabling this may cause connection time to increase incase best AP doesn't behave properly.
-
uint32_t he_dcm_set
Whether DCM max.constellation for transmission and reception is set.
-
uint32_t he_dcm_max_constellation_tx
Indicate the max.constellation for DCM in TB PPDU the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3.
-
uint32_t he_dcm_max_constellation_rx
Indicate the max.constellation for DCM in both Data field and HE-SIG-B field the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3.
-
uint32_t he_mcs9_enabled
Whether to support HE-MCS 0 to 9. The default value is 0.
-
uint32_t he_su_beamformee_disabled
Whether to disable support for operation as an SU beamformee.
-
uint32_t he_trig_su_bmforming_feedback_disabled
Whether to disable support the transmission of SU feedback in an HE TB sounding sequence.
-
uint32_t he_trig_mu_bmforming_partial_feedback_disabled
Whether to disable support the transmission of partial-bandwidth MU feedback in an HE TB sounding sequence.
-
uint32_t he_trig_cqi_feedback_disabled
Whether to disable support the transmission of CQI feedback in an HE TB sounding sequence.
-
uint32_t he_reserved
Reserved for future feature set
-
uint8_t sae_h2e_identifier[SAE_H2E_IDENTIFIER_LEN]
Password identifier for H2E. this needs to be null terminated string
-
uint8_t ssid[32]
-
struct wifi_nan_config_t
NAN Discovery start configuration.
-
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 phy_11ax
bit: 4 flag to identify if 11ax mode is enabled or not
-
uint32_t is_mesh_child
bit: 5 flag to identify mesh child
-
uint32_t reserved
bit: 6..31 reserved
-
uint8_t mac[6]
-
struct wifi_sta_list_t
List of stations associated with the Soft-AP.
Public Members
-
wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]
station list
-
int num
number of stations in the list (other entries are invalid)
-
wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]
-
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
Protocol of the reveived packet, 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
Set to 1 indicates that channel estimate smoothing is recommended. Set to 0 indicates that only per-carrierindependent (unsmoothed) channel estimate is recommended.
-
unsigned not_sounding
Set to 0 indicates that PPDU is a sounding PPDU. Set to 1indicates that the PPDU is not a sounding PPDU. sounding PPDU is used for channel estimation by the request receiver
-
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
Forward Error Correction(FEC). 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
the number of subframes aggregated in AMPDU
-
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 dump_ack_en
enable to dump 802.11 ACK frame, default disabled
-
bool lltf_en
-
struct wifi_csi_info_t
CSI data type.
Public Members
-
wifi_pkt_rx_ctrl_t rx_ctrl
received packet radio metadata header of the CSI data
-
uint8_t mac[6]
source MAC address of the CSI data
-
uint8_t dmac[6]
destination MAC address of the CSI data
-
bool first_word_invalid
first four bytes of the CSI data is invalid or not, true indicates the first four bytes is invalid due to hardware limition
-
int8_t *buf
valid buffer of CSI data
-
uint16_t len
valid length of CSI data
-
uint8_t *hdr
header of the wifi packet
-
uint8_t *payload
payload of the wifi packet
-
uint16_t payload_len
payload len of the wifi packet
-
uint16_t rx_seq
rx sequence number of the wifi packet
-
wifi_pkt_rx_ctrl_t rx_ctrl
-
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 period between FTM bursts in 100's of milliseconds (allowed values 0(No pref) - 100)
-
bool use_get_report_api
True - Using esp_wifi_ftm_get_report to get FTM report, False - Using ftm_report_data from WIFI_EVENT_FTM_REPORT to get FTM report
-
uint8_t resp_mac[6]
-
struct wifi_beacon_monitor_config_t
WiFi beacon monitor parameter configuration.
-
struct wifi_nan_publish_cfg_t
NAN Publish service configuration parameters.
Public Members
-
char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]
Service name identifier
-
wifi_nan_service_type_t type
Service type
-
char matching_filter[ESP_WIFI_MAX_FILTER_LEN]
Comma separated filters for filtering services
-
char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]
Service info shared in Publish frame
-
uint8_t single_replied_event
Give single Replied event or every time
-
uint8_t datapath_reqd
NAN Datapath required for the service
-
uint8_t reserved
Reserved
-
char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]
-
struct wifi_nan_subscribe_cfg_t
NAN Subscribe service configuration parameters.
Public Members
-
char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]
Service name identifier
-
wifi_nan_service_type_t type
Service type
-
char matching_filter[ESP_WIFI_MAX_FILTER_LEN]
Comma separated filters for filtering services
-
char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]
Service info shared in Subscribe frame
-
uint8_t single_match_event
Give single Match event or every time
-
uint8_t reserved
Reserved
-
char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]
-
struct wifi_nan_followup_params_t
NAN Follow-up parameters.
-
struct wifi_nan_datapath_req_t
NAN Datapath Request parameters.
-
struct wifi_nan_datapath_resp_t
NAN Datapath Response parameters.
-
struct wifi_nan_datapath_end_req_t
NAN Datapath End parameters.
-
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[MAX_SSID_LEN]
SSID of AP
-
uint8_t passphrase[MAX_PASSPHRASE_LEN]
Passphrase for the AP
-
struct wifi_event_sta_wps_er_success_t::[anonymous] ap_cred[MAX_WPS_AP_CRED]
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_event_home_channel_change_t
Argument structure for WIFI_EVENT_HOME_CHANNEL_CHANGE event
Public Members
-
uint8_t old_chan
old home channel of the device
-
wifi_second_chan_t old_snd
old second channel of the device
-
uint8_t new_chan
new home channel of the device
-
wifi_second_chan_t new_snd
new second channel of the device
-
uint8_t old_chan
-
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, should be freed after use. Note: Highly recommended to use API esp_wifi_ftm_get_report to get the report instead of using this
-
uint8_t ftm_report_num_entries
Number of entries in the FTM Report data
-
uint8_t peer_mac[6]
-
struct wifi_event_action_tx_status_t
Argument structure for WIFI_EVENT_ACTION_TX_STATUS event
Public Members
-
wifi_interface_t ifx
WiFi interface to send request to
-
uint32_t context
Context to identify the request
-
uint8_t da[6]
Destination MAC address
-
uint8_t status
Status of the operation
-
wifi_interface_t ifx
-
struct wifi_event_roc_done_t
Argument structure for WIFI_EVENT_ROC_DONE event
Public Members
-
uint32_t context
Context to identify the request
-
uint32_t context
-
struct wifi_event_ap_wps_rg_pin_t
Argument structure for WIFI_EVENT_AP_WPS_RG_PIN event
Public Members
-
uint8_t pin_code[8]
PIN code of station in enrollee mode
-
uint8_t pin_code[8]
-
struct wifi_event_ap_wps_rg_fail_reason_t
Argument structure for WIFI_EVENT_AP_WPS_RG_FAILED event
Public Members
-
wps_fail_reason_t reason
WPS failure reason wps_fail_reason_t
-
uint8_t peer_macaddr[6]
Enrollee mac address
-
wps_fail_reason_t reason
-
struct wifi_event_ap_wps_rg_success_t
Argument structure for WIFI_EVENT_AP_WPS_RG_SUCCESS event
Public Members
-
uint8_t peer_macaddr[6]
Enrollee mac address
-
uint8_t peer_macaddr[6]
-
struct wifi_event_nan_svc_match_t
Argument structure for WIFI_EVENT_NAN_SVC_MATCH event
-
struct wifi_event_nan_replied_t
Argument structure for WIFI_EVENT_NAN_REPLIED event
-
struct wifi_event_nan_receive_t
Argument structure for WIFI_EVENT_NAN_RECEIVE event
-
struct wifi_event_ndp_indication_t
Argument structure for WIFI_EVENT_NDP_INDICATION event
-
struct wifi_event_ndp_confirm_t
Argument structure for WIFI_EVENT_NDP_CONFIRM event
Public Members
-
uint8_t status
NDP status code
-
uint8_t ndp_id
NDP instance id
-
uint8_t peer_nmi[6]
Peer's NAN Management Interface MAC
-
uint8_t peer_ndi[6]
Peer's NAN Data Interface MAC
-
uint8_t own_ndi[6]
Own NAN Data Interface MAC
-
uint8_t svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]
Service Specific Info
-
uint8_t status
-
struct wifi_event_ndp_terminated_t
Argument structure for WIFI_EVENT_NDP_TERMINATED event
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
-
WIFI_PROTOCOL_11AX
-
SAE_H2E_IDENTIFIER_LEN
-
ESP_WIFI_MAX_CONN_NUM
max number of stations which can connect to ESP32/ESP32S3/ESP32S2 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
-
ESP_WIFI_NAN_MAX_SVC_SUPPORTED
-
ESP_WIFI_NAN_DATAPATH_MAX_PEERS
-
ESP_WIFI_NDP_ROLE_INITIATOR
-
ESP_WIFI_NDP_ROLE_RESPONDER
-
ESP_WIFI_MAX_SVC_NAME_LEN
-
ESP_WIFI_MAX_FILTER_LEN
-
ESP_WIFI_MAX_SVC_INFO_LEN
-
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_NAN
WiFi NAN mode
-
enumerator WIFI_MODE_MAX
-
enumerator WIFI_MODE_NULL
-
enum wifi_interface_t
Values:
-
enumerator WIFI_IF_STA
-
enumerator WIFI_IF_AP
-
enumerator WIFI_IF_MAX
-
enumerator WIFI_IF_STA
-
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_ENTERPRISE
authenticate mode : WiFi EAP security
-
enumerator WIFI_AUTH_WPA2_ENTERPRISE
authenticate mode : WiFi EAP security
-
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_OWE
authenticate mode : OWE
-
enumerator WIFI_AUTH_WPA3_ENT_192
authenticate mode : WPA3_ENT_SUITE_B_192_BIT
-
enumerator WIFI_AUTH_WPA3_EXT_PSK
this authentication mode will yield same result as WIFI_AUTH_WPA3_PSK and not recommended to be used. It will be deprecated in future, please use WIFI_AUTH_WPA3_PSK instead.
-
enumerator WIFI_AUTH_WPA3_EXT_PSK_MIXED_MODE
this authentication mode will yield same result as WIFI_AUTH_WPA3_PSK and not recommended to be used. It will be deprecated in future, please use WIFI_AUTH_WPA3_PSK instead.
-
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_TDLS_PEER_UNREACHABLE
-
enumerator WIFI_REASON_TDLS_UNSPECIFIED
-
enumerator WIFI_REASON_SSP_REQUESTED_DISASSOC
-
enumerator WIFI_REASON_NO_SSP_ROAMING_AGREEMENT
-
enumerator WIFI_REASON_BAD_CIPHER_OR_AKM
-
enumerator WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION
-
enumerator WIFI_REASON_SERVICE_CHANGE_PERCLUDES_TS
-
enumerator WIFI_REASON_UNSPECIFIED_QOS
-
enumerator WIFI_REASON_NOT_ENOUGH_BANDWIDTH
-
enumerator WIFI_REASON_MISSING_ACKS
-
enumerator WIFI_REASON_EXCEEDED_TXOP
-
enumerator WIFI_REASON_STA_LEAVING
-
enumerator WIFI_REASON_END_BA
-
enumerator WIFI_REASON_UNKNOWN_BA
-
enumerator WIFI_REASON_TIMEOUT
-
enumerator WIFI_REASON_PEER_INITIATED
-
enumerator WIFI_REASON_AP_INITIATED
-
enumerator WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT
-
enumerator WIFI_REASON_INVALID_PMKID
-
enumerator WIFI_REASON_INVALID_MDE
-
enumerator WIFI_REASON_INVALID_FTE
-
enumerator WIFI_REASON_TRANSMISSION_LINK_ESTABLISH_FAILED
-
enumerator WIFI_REASON_ALTERATIVE_CHANNEL_OCCUPIED
-
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_ASSOC_COMEBACK_TIME_TOO_LONG
-
enumerator WIFI_REASON_SA_QUERY_TIMEOUT
-
enumerator WIFI_REASON_NO_AP_FOUND_W_COMPATIBLE_SECURITY
-
enumerator WIFI_REASON_NO_AP_FOUND_IN_AUTHMODE_THRESHOLD
-
enumerator WIFI_REASON_NO_AP_FOUND_IN_RSSI_THRESHOLD
-
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_sae_pwe_method_t
Configuration for SAE PWE derivation
Values:
-
enumerator WPA3_SAE_PWE_UNSPECIFIED
-
enumerator WPA3_SAE_PWE_HUNT_AND_PECK
-
enumerator WPA3_SAE_PWE_HASH_TO_ELEMENT
-
enumerator WPA3_SAE_PWE_BOTH
-
enumerator WPA3_SAE_PWE_UNSPECIFIED
-
enum wifi_sae_pk_mode_t
Configuration for SAE-PK
Values:
-
enumerator WPA3_SAE_PK_MODE_AUTOMATIC
-
enumerator WPA3_SAE_PK_MODE_ONLY
-
enumerator WPA3_SAE_PK_MODE_DISABLED
-
enumerator WPA3_SAE_PK_MODE_AUTOMATIC
-
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_phy_mode_t
Operation Phymode.
Values:
-
enumerator WIFI_PHY_MODE_LR
PHY mode for Low Rate
-
enumerator WIFI_PHY_MODE_11B
PHY mode for 11b
-
enumerator WIFI_PHY_MODE_11G
PHY mode for 11g
-
enumerator WIFI_PHY_MODE_HT20
PHY mode for Bandwidth HT20
-
enumerator WIFI_PHY_MODE_HT40
PHY mode for Bandwidth HT40
-
enumerator WIFI_PHY_MODE_HE20
PHY mode for Bandwidth HE20
-
enumerator WIFI_PHY_MODE_LR
-
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_nan_service_type_t
NAN Services types.
Values:
-
enumerator NAN_PUBLISH_SOLICITED
Send unicast Publish frame to Subscribers that match the requirement
-
enumerator NAN_PUBLISH_UNSOLICITED
Send broadcast Publish frames in every Discovery Window(DW)
-
enumerator NAN_SUBSCRIBE_ACTIVE
Send broadcast Subscribe frames in every DW
-
enumerator NAN_SUBSCRIBE_PASSIVE
Passively listens to Publish frames
-
enumerator NAN_PUBLISH_SOLICITED
-
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 rate table and guard interval information for each MCS rate
-
enumerator WIFI_PHY_RATE_MCS0_LGI
MCS0 with long GI
-
enumerator WIFI_PHY_RATE_MCS1_LGI
MCS1 with long GI
-
enumerator WIFI_PHY_RATE_MCS2_LGI
MCS2 with long GI
-
enumerator WIFI_PHY_RATE_MCS3_LGI
MCS3 with long GI
-
enumerator WIFI_PHY_RATE_MCS4_LGI
MCS4 with long GI
-
enumerator WIFI_PHY_RATE_MCS5_LGI
MCS5 with long GI
-
enumerator WIFI_PHY_RATE_MCS6_LGI
MCS6 with long GI
-
enumerator WIFI_PHY_RATE_MCS7_LGI
MCS7 with long GI
-
enumerator WIFI_PHY_RATE_MCS0_SGI
MCS0 with short GI
-
enumerator WIFI_PHY_RATE_MCS1_SGI
MCS1 with short GI
-
enumerator WIFI_PHY_RATE_MCS2_SGI
MCS2 with short GI
-
enumerator WIFI_PHY_RATE_MCS3_SGI
MCS3 with short GI
-
enumerator WIFI_PHY_RATE_MCS4_SGI
MCS4 with short GI
-
enumerator WIFI_PHY_RATE_MCS5_SGI
MCS5 with short GI
-
enumerator WIFI_PHY_RATE_MCS6_SGI
MCS6 with short GI
-
enumerator WIFI_PHY_RATE_MCS7_SGI
MCS7 with short GI
-
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
WiFi ready
-
enumerator WIFI_EVENT_SCAN_DONE
Finished scanning AP
-
enumerator WIFI_EVENT_STA_START
Station start
-
enumerator WIFI_EVENT_STA_STOP
Station stop
-
enumerator WIFI_EVENT_STA_CONNECTED
Station connected to AP
-
enumerator WIFI_EVENT_STA_DISCONNECTED
Station disconnected from AP
-
enumerator WIFI_EVENT_STA_AUTHMODE_CHANGE
the auth mode of AP connected by device's station changed
-
enumerator WIFI_EVENT_STA_WPS_ER_SUCCESS
Station wps succeeds in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_FAILED
Station wps fails in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_TIMEOUT
Station wps timeout in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PIN
Station wps pin code in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP
Station wps overlap in enrollee mode
-
enumerator WIFI_EVENT_AP_START
Soft-AP start
-
enumerator WIFI_EVENT_AP_STOP
Soft-AP stop
-
enumerator WIFI_EVENT_AP_STACONNECTED
a station connected to Soft-AP
-
enumerator WIFI_EVENT_AP_STADISCONNECTED
a station disconnected from 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
Station beacon timeout
-
enumerator WIFI_EVENT_CONNECTIONLESS_MODULE_WAKE_INTERVAL_START
Connectionless module wake interval start
-
enumerator WIFI_EVENT_AP_WPS_RG_SUCCESS
Soft-AP wps succeeds in registrar mode
-
enumerator WIFI_EVENT_AP_WPS_RG_FAILED
Soft-AP wps fails in registrar mode
-
enumerator WIFI_EVENT_AP_WPS_RG_TIMEOUT
Soft-AP wps timeout in registrar mode
-
enumerator WIFI_EVENT_AP_WPS_RG_PIN
Soft-AP wps pin code in registrar mode
-
enumerator WIFI_EVENT_AP_WPS_RG_PBC_OVERLAP
Soft-AP wps overlap in registrar mode
-
enumerator WIFI_EVENT_ITWT_SETUP
iTWT setup
-
enumerator WIFI_EVENT_ITWT_TEARDOWN
iTWT teardown
-
enumerator WIFI_EVENT_ITWT_PROBE
iTWT probe
-
enumerator WIFI_EVENT_ITWT_SUSPEND
iTWT suspend
-
enumerator WIFI_EVENT_TWT_WAKEUP
TWT wakeup
-
enumerator WIFI_EVENT_NAN_STARTED
NAN Discovery has started
-
enumerator WIFI_EVENT_NAN_STOPPED
NAN Discovery has stopped
-
enumerator WIFI_EVENT_NAN_SVC_MATCH
NAN Service Discovery match found
-
enumerator WIFI_EVENT_NAN_REPLIED
Replied to a NAN peer with Service Discovery match
-
enumerator WIFI_EVENT_NAN_RECEIVE
Received a Follow-up message
-
enumerator WIFI_EVENT_NDP_INDICATION
Received NDP Request from a NAN Peer
-
enumerator WIFI_EVENT_NDP_CONFIRM
NDP Confirm Indication
-
enumerator WIFI_EVENT_NDP_TERMINATED
NAN Datapath terminated indication
-
enumerator WIFI_EVENT_HOME_CHANNEL_CHANGE
WiFi home channel change,doesn't occur when scanning
-
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
WPS normal fail reason
-
enumerator WPS_FAIL_REASON_RECV_M2D
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_NO_VALID_MSMT
FTM session did not result in any valid measurements
-
enumerator FTM_STATUS_USER_TERM
User triggered termination
-
enumerator FTM_STATUS_SUCCESS
Header File
components/wpa_supplicant/esp_supplicant/include/esp_eap_client.h
This header file can be included with:
#include "esp_eap_client.h"
This header file is a part of the API provided by the
wpa_supplicant
component. To declare that your component depends onwpa_supplicant
, add the following to your CMakeLists.txt:REQUIRES wpa_supplicant
or
PRIV_REQUIRES wpa_supplicant
Functions
-
esp_err_t esp_wifi_sta_enterprise_enable(void)
Enable EAP authentication(WiFi Enterprise) for the station mode.
This function enables Extensible Authentication Protocol (EAP) authentication for the Wi-Fi station mode. When EAP authentication is enabled, the ESP device will attempt to authenticate with the configured EAP credentials when connecting to a secure Wi-Fi network.
备注
Before calling this function, ensure that the Wi-Fi configuration and EAP credentials (such as username and password) have been properly set using the appropriate configuration APIs.
- 返回
ESP_OK: EAP authentication enabled successfully.
ESP_ERR_NO_MEM: Failed to enable EAP authentication due to memory allocation failure.
-
esp_err_t esp_wifi_sta_enterprise_disable(void)
Disable EAP authentication(WiFi Enterprise) for the station mode.
This function disables Extensible Authentication Protocol (EAP) authentication for the Wi-Fi station mode. When EAP authentication is disabled, the ESP device will not attempt to authenticate using EAP credentials when connecting to a secure Wi-Fi network.
备注
Disabling EAP authentication may cause the device to connect to the Wi-Fi network using other available authentication methods, if configured using esp_wifi_set_config().
- 返回
ESP_OK: EAP authentication disabled successfully.
ESP_ERR_INVALID_STATE: EAP client is in an invalid state for disabling.
-
esp_err_t esp_eap_client_set_identity(const unsigned char *identity, int len)
Set identity for PEAP/TTLS authentication method.
This function sets the identity to be used during PEAP/TTLS authentication.
- 参数
identity -- [in] Pointer to the identity data.
len -- [in] Length of the identity data (limited to 1~127 bytes).
- 返回
ESP_OK: The identity was set successfully.
ESP_ERR_INVALID_ARG: Invalid argument (len <= 0 or len >= 128).
ESP_ERR_NO_MEM: Memory allocation failure.
-
void esp_eap_client_clear_identity(void)
Clear the previously set identity for PEAP/TTLS authentication.
This function clears the identity that was previously set for the EAP client. After calling this function, the EAP client will no longer use the previously configured identity during the authentication process.
-
esp_err_t esp_eap_client_set_username(const unsigned char *username, int len)
Set username for PEAP/TTLS authentication method.
This function sets the username to be used during PEAP/TTLS authentication.
- 参数
username -- [in] Pointer to the username data.
len -- [in] Length of the username data (limited to 1~127 bytes).
- 返回
ESP_OK: The username was set successfully.
ESP_ERR_INVALID_ARG: Failed due to an invalid argument (len <= 0 or len >= 128).
ESP_ERR_NO_MEM: Failed due to memory allocation failure.
-
void esp_eap_client_clear_username(void)
Clear username for PEAP/TTLS method.
This function clears the previously set username for the EAP client.
-
esp_err_t esp_eap_client_set_password(const unsigned char *password, int len)
Set password for PEAP/TTLS authentication method.
This function sets the password to be used during PEAP/TTLS authentication.
- 参数
password -- [in] Pointer to the password data.
len -- [in] Length of the password data (len > 0).
- 返回
ESP_OK: The password was set successfully.
ESP_ERR_INVALID_ARG: Failed due to an invalid argument (len <= 0).
ESP_ERR_NO_MEM: Failed due to memory allocation failure.
-
void esp_eap_client_clear_password(void)
Clear password for PEAP/TTLS method.
This function clears the previously set password for the EAP client.
-
esp_err_t esp_eap_client_set_new_password(const unsigned char *new_password, int len)
Set a new password for MSCHAPv2 authentication method.
This function sets the new password to be used during MSCHAPv2 authentication. The new password is used to substitute the old password when an eap-mschapv2 failure request message with error code ERROR_PASSWD_EXPIRED is received.
- 参数
new_password -- [in] Pointer to the new password data.
len -- [in] Length of the new password data.
- 返回
ESP_OK: The new password was set successfully.
ESP_ERR_INVALID_ARG: Failed due to an invalid argument (len <= 0).
ESP_ERR_NO_MEM: Failed due to memory allocation failure.
-
void esp_eap_client_clear_new_password(void)
Clear new password for MSCHAPv2 method.
This function clears the previously set new password for the EAP client.
-
esp_err_t esp_eap_client_set_ca_cert(const unsigned char *ca_cert, int ca_cert_len)
Set CA certificate for EAP authentication.
This function sets the Certificate Authority (CA) certificate to be used during EAP authentication. The CA certificate is passed to the EAP client module through a global pointer.
- 参数
ca_cert -- [in] Pointer to the CA certificate data.
ca_cert_len -- [in] Length of the CA certificate data.
- 返回
ESP_OK: The CA certificate was set successfully.
-
void esp_eap_client_clear_ca_cert(void)
Clear the previously set Certificate Authority (CA) certificate for EAP authentication.
This function clears the CA certificate that was previously set for the EAP client. After calling this function, the EAP client will no longer use the previously configured CA certificate during the authentication process.
-
esp_err_t esp_eap_client_set_certificate_and_key(const unsigned char *client_cert, int client_cert_len, const unsigned char *private_key, int private_key_len, const unsigned char *private_key_password, int private_key_passwd_len)
Set client certificate and private key for EAP authentication.
This function sets the client certificate and private key to be used during authentication. Optionally, a private key password can be provided for encrypted private keys.
- Attention
1. The client certificate, private key, and private key password are provided as pointers to the respective data arrays.
- Attention
2. The client_cert, private_key, and private_key_password should be zero-terminated.
- 参数
client_cert -- [in] Pointer to the client certificate data.
client_cert_len -- [in] Length of the client certificate data.
private_key -- [in] Pointer to the private key data.
private_key_len -- [in] Length of the private key data (limited to 1~4096 bytes).
private_key_password -- [in] Pointer to the private key password data (optional).
private_key_passwd_len -- [in] Length of the private key password data (can be 0 for no password).
- 返回
ESP_OK: The certificate, private key, and password (if provided) were set successfully.
-
void esp_eap_client_clear_certificate_and_key(void)
Clear the previously set client certificate and private key for EAP authentication.
This function clears the client certificate and private key that were previously set for the EAP client. After calling this function, the EAP client will no longer use the previously configured certificate and private key during the authentication process.
-
esp_err_t esp_eap_client_set_disable_time_check(bool disable)
Set EAP client certificates time check (disable or not).
This function enables or disables the time check for EAP client certificates. When disabled, the certificates' expiration time will not be checked during the authentication process.
- 参数
disable -- [in] True to disable EAP client certificates time check, false to enable it.
- 返回
ESP_OK: The EAP client certificates time check setting was updated successfully.
-
esp_err_t esp_eap_client_get_disable_time_check(bool *disable)
Get EAP client certificates time check status.
This function retrieves the current status of the EAP client certificates time check.
- 参数
disable -- [out] Pointer to a boolean variable to store the disable status.
- 返回
ESP_OK: The status of EAP client certificates time check was retrieved successfully.
-
esp_err_t esp_eap_client_set_ttls_phase2_method(esp_eap_ttls_phase2_types type)
Set EAP-TTLS phase 2 method.
This function sets the phase 2 method to be used during EAP-TTLS authentication.
- 参数
type -- [in] The type of phase 2 method to be used (e.g., EAP, MSCHAPv2, MSCHAP, PAP, CHAP).
- 返回
ESP_OK: The EAP-TTLS phase 2 method was set successfully.
-
esp_err_t esp_eap_client_set_suiteb_192bit_certification(bool enable)
Enable or disable Suite-B 192-bit certification checks.
This function enables or disables the 192-bit Suite-B certification checks during EAP-TLS authentication. Suite-B is a set of cryptographic algorithms which generally are considered more secure.
- 参数
enable -- [in] True to enable 192-bit Suite-B certification checks, false to disable it.
- 返回
ESP_OK: The 192-bit Suite-B certification checks were set successfully.
-
esp_err_t esp_eap_client_set_pac_file(const unsigned char *pac_file, int pac_file_len)
Set the PAC (Protected Access Credential) file for EAP-FAST authentication.
EAP-FAST requires a PAC file that contains the client's credentials.
- Attention
1. For files read from the file system, length has to be decremented by 1 byte.
- Attention
2. Disabling the ESP_WIFI_MBEDTLS_TLS_CLIENT config is required to use EAP-FAST.
- 参数
pac_file -- [in] Pointer to the PAC file buffer.
pac_file_len -- [in] Length of the PAC file buffer.
- 返回
ESP_OK: The PAC file for EAP-FAST authentication was set successfully.
-
esp_err_t esp_eap_client_set_fast_params(esp_eap_fast_config config)
Set the parameters for EAP-FAST Phase 1 authentication.
EAP-FAST supports Fast Provisioning, where clients can be authenticated faster using precomputed keys (PAC). This function allows configuring parameters for Fast Provisioning.
- Attention
1. Disabling the ESP_WIFI_MBEDTLS_TLS_CLIENT config is required to use EAP-FAST.
- 参数
config -- [in] Configuration structure with Fast Provisioning parameters.
- 返回
ESP_OK: The parameters for EAP-FAST Phase 1 authentication were set successfully.
-
esp_err_t esp_eap_client_use_default_cert_bundle(bool use_default_bundle)
Use the default certificate bundle for EAP authentication.
By default, the EAP client uses a built-in certificate bundle for server verification. Enabling this option allows the use of the default certificate bundle.
- 参数
use_default_bundle -- [in] True to use the default certificate bundle, false to use a custom bundle.
- 返回
ESP_OK: The option to use the default certificate bundle was set successfully.
Structures
-
struct esp_eap_fast_config
Configuration settings for EAP-FAST (Extensible Authentication Protocol - Flexible Authentication via Secure Tunneling).
This structure defines the configuration options that can be used to customize the behavior of the EAP-FAST authentication protocol, specifically for Fast Provisioning and PAC (Protected Access Credential) handling.
Enumerations
-
enum esp_eap_ttls_phase2_types
Enumeration of phase 2 authentication types for EAP-TTLS.
This enumeration defines the supported phase 2 authentication methods that can be used in the EAP-TTLS (Extensible Authentication Protocol - Tunneled Transport Layer Security) protocol for the second authentication phase.
Values:
-
enumerator ESP_EAP_TTLS_PHASE2_EAP
EAP (Extensible Authentication Protocol)
-
enumerator ESP_EAP_TTLS_PHASE2_MSCHAPV2
MS-CHAPv2 (Microsoft Challenge Handshake Authentication Protocol - Version 2)
-
enumerator ESP_EAP_TTLS_PHASE2_MSCHAP
MS-CHAP (Microsoft Challenge Handshake Authentication Protocol)
-
enumerator ESP_EAP_TTLS_PHASE2_PAP
PAP (Password Authentication Protocol)
-
enumerator ESP_EAP_TTLS_PHASE2_CHAP
CHAP (Challenge Handshake Authentication Protocol)
-
enumerator ESP_EAP_TTLS_PHASE2_EAP
Header File
This header file can be included with:
#include "esp_wps.h"
This header file is a part of the API provided by the
wpa_supplicant
component. To declare that your component depends onwpa_supplicant
, add the following to your CMakeLists.txt:REQUIRES wpa_supplicant
or
PRIV_REQUIRES wpa_supplicant
Functions
-
esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config)
Enable Wi-Fi WPS function.
- 参数
config -- : WPS config to be used in connection
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
ESP_FAIL : wps initialization fails
-
esp_err_t esp_wifi_wps_disable(void)
Disable Wi-Fi WPS function and release resource it taken.
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
-
esp_err_t esp_wifi_wps_start(int timeout_ms)
Start WPS session.
- Attention
WPS can only be used when station is enabled. WPS needs to be enabled first for using this API.
- 参数
timeout_ms -- : deprecated: This argument's value will have not effect in functionality of API. The argument will be removed in future. The app should start WPS and register for WIFI events to get the status. WPS status is updated through WPS events. See wifi_event_t enum for more info.
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
ESP_ERR_WIFI_WPS_SM : wps state machine is not initialized
ESP_FAIL : wps initialization fails
-
esp_err_t esp_wifi_ap_wps_enable(const esp_wps_config_t *config)
Enable Wi-Fi AP WPS function.
- Attention
WPS can only be used when softAP is enabled.
- 参数
config -- wps configuration to be used.
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
ESP_FAIL : wps initialization fails
-
esp_err_t esp_wifi_ap_wps_disable(void)
Disable Wi-Fi SoftAP WPS function and release resource it taken.
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
-
esp_err_t esp_wifi_ap_wps_start(const unsigned char *pin)
WPS starts to work.
- Attention
WPS can only be used when softAP is enabled.
- 参数
pin -- : Pin to be used in case of WPS mode is pin. If Pin is not provided, device will use the pin generated/provided during esp_wifi_ap_wps_enable() and reported in WIFI_EVENT_AP_WPS_RG_PIN
- 返回
ESP_OK : succeed
ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
ESP_ERR_WIFI_WPS_SM : wps state machine is not initialized
ESP_FAIL : wps initialization fails
Structures
-
struct wps_factory_information_t
Structure representing WPS factory information for ESP device.
This structure holds various strings representing factory information for a device, such as the manufacturer, model number, model name, and device name. Each string is a null-terminated character array. If any of the strings are empty, the default values are used.
Public Members
-
char manufacturer[WPS_MAX_MANUFACTURER_LEN]
Manufacturer of the device. If empty, the default manufacturer is used.
-
char model_number[WPS_MAX_MODEL_NUMBER_LEN]
Model number of the device. If empty, the default model number is used.
-
char model_name[WPS_MAX_MODEL_NAME_LEN]
Model name of the device. If empty, the default model name is used.
-
char device_name[WPS_MAX_DEVICE_NAME_LEN]
Device name. If empty, the default device name is used.
-
char manufacturer[WPS_MAX_MANUFACTURER_LEN]
-
struct esp_wps_config_t
Structure representing configuration settings for WPS (Wi-Fi Protected Setup).
This structure encapsulates various configuration settings for WPS, including the WPS type (PBC or PIN), factory information that will be shown in the WPS Information Element (IE), and a PIN if the WPS type is set to PIN.
Public Members
-
wps_type_t wps_type
The type of WPS to be used (PBC or PIN).
-
wps_factory_information_t factory_info
Factory information to be shown in the WPS Information Element (IE). Vendor can choose to display their own information.
-
char pin[PIN_LEN]
WPS PIN (Personal Identification Number) used when wps_type is set to WPS_TYPE_PIN.
-
wps_type_t wps_type
Macros
-
ESP_ERR_WIFI_REGISTRAR
WPS registrar is not supported
-
ESP_ERR_WIFI_WPS_TYPE
WPS type error
-
ESP_ERR_WIFI_WPS_SM
WPS state machine is not initialized
-
WPS_MAX_MANUFACTURER_LEN
Maximum length of the manufacturer name in WPS information
-
WPS_MAX_MODEL_NUMBER_LEN
Maximum length of the model number in WPS information
-
WPS_MAX_MODEL_NAME_LEN
Maximum length of the model name in WPS information
-
WPS_MAX_DEVICE_NAME_LEN
Maximum length of the device name in WPS information
-
PIN_LEN
The length of the WPS PIN (Personal Identification Number).
-
WPS_CONFIG_INIT_DEFAULT(type)
Initialize a default WPS configuration structure with specified WPS type.
This macro initializes a
esp_wps_config_t
structure with default values for the specified WPS type. It sets the WPS type, factory information (including default manufacturer, model number, model name, and device name), and a default PIN value if applicable.- 参数
type -- The WPS type to be used (PBC or PIN).
- 返回
An initialized
esp_wps_config_t
structure with the specified WPS type and default values.
Type Definitions
Enumerations
-
enum wps_type
Enumeration of WPS (Wi-Fi Protected Setup) types.
Values:
-
enumerator WPS_TYPE_DISABLE
WPS is disabled
-
enumerator WPS_TYPE_PBC
WPS Push Button Configuration method
-
enumerator WPS_TYPE_PIN
WPS PIN (Personal Identification Number) method
-
enumerator WPS_TYPE_MAX
Maximum value for WPS type enumeration
-
enumerator WPS_TYPE_DISABLE
Header File
This header file can be included with:
#include "esp_rrm.h"
This header file is a part of the API provided by the
wpa_supplicant
component. To declare that your component depends onwpa_supplicant
, add the following to your CMakeLists.txt:REQUIRES wpa_supplicant
or
PRIV_REQUIRES wpa_supplicant
Functions
-
int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb, void *cb_ctx)
Send Radio measurement neighbor report request to connected AP.
- 参数
cb -- callback function for neighbor report
cb_ctx -- callback context
- 返回
0: success
-1: AP does not support RRM
-2: station not connected to AP
-
bool esp_rrm_is_rrm_supported_connection(void)
Check RRM capability of connected AP.
- 返回
true: AP supports RRM
false: AP does not support RRM or station not connected to AP
Type Definitions
-
typedef void (*neighbor_rep_request_cb)(void *ctx, const uint8_t *report, size_t report_len)
Callback function type to get neighbor report.
- Param ctx
neighbor report context
- Param report
neighbor report
- Param report_len
neighbor report length
- Return
void
Header File
This header file can be included with:
#include "esp_wnm.h"
This header file is a part of the API provided by the
wpa_supplicant
component. To declare that your component depends onwpa_supplicant
, add the following to your CMakeLists.txt:REQUIRES wpa_supplicant
or
PRIV_REQUIRES wpa_supplicant
Functions
-
int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason, const char *btm_candidates, int cand_list)
Send bss transition query to connected AP.
- 参数
query_reason -- reason for sending query
btm_candidates -- btm candidates list if available
cand_list -- whether candidate list to be included from scan results available in supplicant's cache.
- 返回
0: success
-1: AP does not support BTM
-2: station not connected to AP
-
bool esp_wnm_is_btm_supported_connection(void)
Check bss trasition capability of connected AP.
- 返回
true: AP supports BTM
false: AP does not support BTM or station not connected to AP
Enumerations
-
enum btm_query_reason
enum btm_query_reason: Reason code for sending btm query
Values:
-
enumerator REASON_UNSPECIFIED
-
enumerator REASON_FRAME_LOSS
-
enumerator REASON_DELAY
-
enumerator REASON_BANDWIDTH
-
enumerator REASON_LOAD_BALANCE
-
enumerator REASON_RSSI
-
enumerator REASON_RETRANSMISSIONS
-
enumerator REASON_INTERFERENCE
-
enumerator REASON_GRAY_ZONE
-
enumerator REASON_PREMIUM_AP
-
enumerator REASON_UNSPECIFIED
Header File
This header file can be included with:
#include "esp_mbo.h"
This header file is a part of the API provided by the
wpa_supplicant
component. To declare that your component depends onwpa_supplicant
, add the following to your CMakeLists.txt:REQUIRES wpa_supplicant
or
PRIV_REQUIRES wpa_supplicant
Functions
-
int esp_mbo_update_non_pref_chan(struct non_pref_chan_s *non_pref_chan)
Update channel preference for MBO IE.
- 参数
non_pref_chan -- Non preference channel list
- 返回
0: success else failure
Structures
-
struct non_pref_chan
Structure representing a non-preferred channel in a wireless network.
This structure encapsulates information about a non-preferred channel including the reason for its non-preference, the operating class, channel number, and preference level.
Public Members
-
enum non_pref_chan_reason reason
Reason for the channel being non-preferred
-
uint8_t oper_class
Operating class of the channel
-
uint8_t chan
Channel number
-
uint8_t preference
Preference level of the channel
-
enum non_pref_chan_reason reason
-
struct non_pref_chan_s
Structure representing a list of non-preferred channels in a wireless network.
This structure encapsulates information about a list of non-preferred channels including the number of non-preferred channels and an array of structures representing individual non-preferred channels.
Public Members
-
size_t non_pref_chan_num
Number of non-preferred channels in the list
-
struct non_pref_chan chan[]
Array of structures representing individual non-preferred channels
-
size_t non_pref_chan_num
Enumerations
-
enum non_pref_chan_reason
Enumeration of reasons for a channel being non-preferred in a wireless network.
This enumeration defines various reasons why a specific channel might be considered non-preferred in a wireless network configuration.
Values:
-
enumerator NON_PREF_CHAN_REASON_UNSPECIFIED
Unspecified reason for non-preference
-
enumerator NON_PREF_CHAN_REASON_RSSI
Non-preferred due to low RSSI (Received Signal Strength Indication)
-
enumerator NON_PREF_CHAN_REASON_EXT_INTERFERENCE
Non-preferred due to external interference
-
enumerator NON_PREF_CHAN_REASON_INT_INTERFERENCE
Non-preferred due to internal interference
-
enumerator NON_PREF_CHAN_REASON_UNSPECIFIED