Wi-Fi
Introduction
The Wi-Fi libraries provide support for configuring and monitoring the ESP32 Wi-Fi networking functionality. This includes configuration for:
Station mode (aka STA mode or Wi-Fi client mode). ESP32 connects to an access point.
AP mode (aka Soft-AP mode or Access Point mode). Stations connect to the ESP32.
Station/AP-coexistence mode (ESP32 is concurrently an access point and a station connected to another access point).
Various security modes for the above (WPA, WPA2, WEP, etc.)
Scanning for access points (active & passive scanning).
Promiscuous mode for monitoring of IEEE802.11 Wi-Fi packets.
Application Examples
The wifi directory of ESP-IDF examples contains the following applications:
Code examples for Wi-Fi.
A simple esp-idf-template application to demonstrate a minimal IDF project structure.
API Reference
Header File
Functions
-
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
Initialize WiFi Allocate resource for WiFi driver, such as WiFi control structure, RX/TX buffer, WiFi NVS structure etc. This WiFi also starts WiFi task.
- Attention
1. This API must be called before all other WiFi API can be called
- Attention
2. Always use WIFI_INIT_CONFIG_DEFAULT macro to initialize the configuration to default values, this can guarantee all the fields get correct value when more fields are added into wifi_init_config_t in future release. If you want to set your own initial values, overwrite the default values which are set by WIFI_INIT_CONFIG_DEFAULT. Please be notified that the field ‘magic’ of wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC!
- Parameters
config – pointer to WiFi initialized configuration structure; can point to a temporary variable.
- Returns
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
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_set_mode(wifi_mode_t mode)
Set the WiFi operating mode.
Set the WiFi operating mode as station, soft-AP or station+soft-AP, The default mode is station mode.
- Parameters
mode – WiFi operating mode
- Returns
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.
- Parameters
mode – [out] store current WiFi mode
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_start(void)
Start WiFi according to current configuration If mode is WIFI_MODE_STA, it create station control block and start station If mode is WIFI_MODE_AP, it create soft-AP control block and start soft-AP If mode is WIFI_MODE_APSTA, it create soft-AP and station control block and start soft-AP and station.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_NO_MEM: out of memory
ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
ESP_FAIL: other WiFi internal errors
-
esp_err_t esp_wifi_stop(void)
Stop WiFi If mode is WIFI_MODE_STA, it stop station and free station control block If mode is WIFI_MODE_AP, it stop soft-AP and free soft-AP control block If mode is WIFI_MODE_APSTA, it stop station/soft-AP and free station/soft-AP control block.
- Returns
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
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
-
esp_err_t esp_wifi_connect(void)
Connect the ESP32 WiFi station to the AP.
- Attention
1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
- Attention
2. If the ESP32 is connected to an AP, call esp_wifi_disconnect to disconnect.
- Attention
3. The scanning triggered by esp_wifi_scan_start() will not be effective until connection between ESP32 and the AP is established. If ESP32 is scanning and connecting at the same time, ESP32 will abort scanning and return a warning message and error number ESP_ERR_WIFI_STATE. If you want to do reconnection after ESP32 received disconnect event, remember to add the maximum retry time, otherwise the called scan will not work. This is especially true when the AP doesn’t exist, and you still try reconnection after ESP32 received disconnect event with the reason code WIFI_REASON_NO_AP_FOUND.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
ESP_ERR_WIFI_SSID: SSID of AP which station connects is invalid
-
esp_err_t esp_wifi_disconnect(void)
Disconnect the ESP32 WiFi station from the AP.
- Returns
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.
- Returns
ESP_OK: succeed
others: fail
-
esp_err_t esp_wifi_deauth_sta(uint16_t aid)
deauthenticate all stations or associated id equals to aid
- Parameters
aid – when aid is 0, deauthenticate all stations, otherwise deauthenticate station whose associated id is aid
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_MODE: WiFi mode is wrong
-
esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block)
Scan all available APs.
- Attention
If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and the will be freed in esp_wifi_scan_get_ap_records, so generally, call esp_wifi_scan_get_ap_records to cause the memory to be freed once the scan is done
- Attention
The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds. Values above 1500ms may cause station to disconnect from AP and are not recommended.
- Parameters
config – configuration of scanning
block – if block is true, this API will block the caller until the scan is done, otherwise it will return immediately
- Returns
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.
- Returns
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.
- Parameters
number – [out] store number of APIs found in last scan
- Returns
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.
- Parameters
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
- Returns
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_clear_ap_list(void)
Clear AP list found in last scan.
- Attention
When the obtained ap list fails,bss info must be cleared,otherwise it may cause memory leakage.
- Returns
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 which the ESP32 station is associated with.
- Attention
When the obtained country information is empty, it means that the AP does not carry country information
- Parameters
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
- Returns
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.
- Parameters
type – power save type
- Returns
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.
- Parameters
type – [out] store current power save type
- Returns
ESP_OK: succeed
-
esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap)
Set protocol type of specified interface The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
- Attention
Support 802.11b or 802.11bg or 802.11bgn or LR mode
- Parameters
ifx – interfaces
protocol_bitmap – WiFi protocol bitmap
- Returns
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.
- Parameters
ifx – interface
protocol_bitmap – [out] store current WiFi protocol bitmap of interface ifx
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw)
Set the bandwidth of ESP32 specified interface.
- Attention
1. API return false if try to configure an interface that is not enabled
- Attention
2. WIFI_BW_HT40 is supported only when the interface support 11N
- Parameters
ifx – interface to be configured
bw – bandwidth
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
others: refer to error codes in esp_err.h
-
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw)
Get the bandwidth of ESP32 specified interface.
- Attention
1. API return false if try to get a interface that is not enable
- Parameters
ifx – interface to be configured
bw – [out] store bandwidth of interface ifx
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second)
Set primary/secondary channel of ESP32.
- Attention
1. This API should be called after esp_wifi_start()
- Attention
2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting to an external AP
- Attention
3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to external STAs
- Attention
4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above
- 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.
- Parameters
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
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second)
Get the primary/secondary channel of ESP32.
- Attention
1. API return false if try to get a interface that is not enable
- Parameters
primary – store current primary channel
second – [out] store current second channel
- Returns
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 octect 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.
- Parameters
country – the configured country info
- Returns
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
- Parameters
country – country info
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
-
esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6])
Set MAC address of the ESP32 WiFi station or the soft-AP interface.
- Attention
1. This API can only be called when the interface is disabled
- Attention
2. ESP32 soft-AP and station have different MAC addresses, do not set them to be the same.
- Attention
3. The bit 0 of the first byte of ESP32 MAC address can not be 1. For example, the MAC address can set to be “1a:XX:XX:XX:XX:XX”, but can not be “15:XX:XX:XX:XX:XX”.
- Parameters
ifx – interface
mac – the MAC address
- Returns
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.
- Parameters
ifx – interface
mac – [out] store mac of the interface ifx
- Returns
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.
- Parameters
cb – callback
- Returns
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.
- Parameters
en – false - disable, true - enable
- Returns
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.
- Parameters
en – [out] store the current status of promiscuous mode
- Returns
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.
Note
The default filter is to filter all packets except WIFI_PKT_MISC
- Parameters
filter – the packet type filtered in promiscuous mode.
- Returns
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.
- Parameters
filter – [out] store the current status of promiscuous filter
- Returns
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.
Note
The default filter is to filter none control packet.
- Parameters
filter – the subtype of the control packet filtered in promiscuous mode.
- Returns
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.
- Parameters
filter – [out] store the current status of subtype filter of the control packet in promiscuous mode
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf)
Set the configuration of the ESP32 STA or AP.
- Attention
1. This API can be called only when specified interface is enabled, otherwise, API fail
- Attention
2. For station configuration, bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.
- Attention
3. ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.
- Attention
4. The configuration will be stored in NVS
- Parameters
interface – interface
conf – station or soft-AP configuration
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_INVALID_ARG: invalid argument
ESP_ERR_WIFI_IF: invalid interface
ESP_ERR_WIFI_MODE: invalid mode
ESP_ERR_WIFI_PASSWORD: invalid password
ESP_ERR_WIFI_NVS: WiFi internal NVS error
others: refer to the erro code in esp_err.h
-
esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf)
Get configuration of specified interface.
- Parameters
interface – interface
conf – [out] station or soft-AP configuration
- Returns
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
- Parameters
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
- Returns
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.
- Parameters
mac – STA’s mac address
aid – [out] Store the AID corresponding to STA mac
- Returns
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
- Parameters
storage – : storage type
- Returns
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.
- Parameters
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.
- 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.
- Parameters
cb – Callback function
ctx – Context argument, passed to callback function.
- Returns
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}}.
- Parameters
power – Maximum WiFi transmitting power.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument, 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.
- Parameters
power – Maximum WiFi transmitting power, unit is 0.25dBm.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument
-
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.
- Parameters
mask – WiFi event mask.
- Returns
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.
- Parameters
mask – WiFi event mask.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq)
Send raw ieee80211 data.
- Attention
Currently only support for sending beacon/probe request/probe response/action and non-QoS data frame
- Parameters
ifx – interface if the Wi-Fi mode is Station, the ifx should be WIFI_IF_STA. If the Wi-Fi mode is SoftAP, the ifx should be WIFI_IF_AP. If the Wi-Fi mode is Station+SoftAP, the ifx should be WIFI_IF_STA or WIFI_IF_AP. If the ifx is wrong, the API returns ESP_ERR_WIFI_IF.
buffer – raw ieee80211 buffer
len – the length of raw buffer, the len must be <= 1500 Bytes and >= 24 Bytes
en_sys_seq – indicate whether use the internal sequence number. If en_sys_seq is false, the sequence in raw buffer is unchanged, otherwise it will be overwritten by WiFi driver with the system sequence number. Generally, if esp_wifi_80211_tx is called before the Wi-Fi connection has been set up, both en_sys_seq==true and en_sys_seq==false are fine. However, if the API is called after the Wi-Fi connection has been set up, en_sys_seq must be true, otherwise ESP_ERR_WIFI_ARG is returned.
- Returns
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.
- Parameters
cb – callback
ctx – context argument, passed to callback function
- Returns
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
- Parameters
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
- Parameters
en – true - enable, false - disable
-
esp_err_t esp_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config)
Set antenna GPIO configuration.
- Parameters
config – Antenna GPIO configuration.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: Invalid argument, e.g. parameter is NULL, invalid GPIO number etc
-
esp_err_t esp_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config)
Get current antenna GPIO configuration.
- Parameters
config – Antenna GPIO configuration.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is NULL
-
esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config)
Set antenna configuration.
- Parameters
config – Antenna configuration.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: Invalid argument, e.g. parameter is NULL, invalid antenna mode or invalid GPIO number
-
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config)
Get current antenna configuration.
- Parameters
config – Antenna configuration.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is NULL
-
int64_t esp_wifi_get_tsf_time(wifi_interface_t interface)
Get the TSF time In Station mode or SoftAP+Station mode if station is not connected or station doesn’t receive at least one beacon after connected, will return 0.
- Attention
Enabling power save may cause the return value inaccurate, except WiFi modem sleep
- Parameters
interface – The interface whose tsf_time is to be retrieved.
- Returns
0 or the TSF time
-
esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec)
Set the inactive time of the ESP32 STA or AP.
- Attention
1. For Station, If the station does not receive a beacon frame from the connected SoftAP during the inactive time, disconnect from SoftAP. Default 6s.
- Attention
2. For SoftAP, If the softAP doesn’t receive any data from the connected STA during inactive time, the softAP will force deauth the STA. Default is 300s.
- Attention
3. The inactive time configuration is not stored into flash
- Parameters
ifx – interface to be configured.
sec – Inactive time. Unit seconds.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument, For Station, if sec is less than 3. For SoftAP, if sec is less than 10.
-
esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec)
Get inactive time of specified interface.
- Parameters
ifx – Interface to be configured.
sec – Inactive time. Unit seconds.
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_statis_dump(uint32_t modules)
Dump WiFi statistics.
- Parameters
modules – statistic modules to be dumped
- Returns
ESP_OK: succeed
others: failed
-
esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi)
Set RSSI threshold below which APP will get an event.
- Attention
This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.
- Parameters
rssi – threshold value in dbm between -100 to 0
- Returns
ESP_OK: succeed
ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
ESP_ERR_WIFI_ARG: invalid argument
-
esp_err_t esp_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg)
Start an FTM Initiator session by sending FTM request If successful, event WIFI_EVENT_FTM_REPORT is generated with the result of the FTM procedure.
- Attention
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.
- Parameters
cfg – FTM Initiator session configuration
- Returns
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
- Returns
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
- Parameters
offset_cm – T1 Offset to be added in centimeters
- Returns
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.
- Parameters
ifx – Interface to be configured.
disable – true means disable 11b rate while false means enable 11b rate.
- Returns
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.
- Parameters
wake_interval – Milliseconds after would the chip wake up, from 1 to 65535.
-
esp_err_t esp_wifi_set_country_code(const char *country, bool ieee80211d_enabled)
configure country
- Attention
1. When ieee80211d_enabled, the country info of the AP to which the station is connected is used. E.g. if the configured country is US and the country info of the AP to which the station is connected is JP then the country info that will be used is JP. If the station disconnected from the AP the country info is set back to the country info of the station automatically, US in the example.
- Attention
2. When ieee80211d_enabled is disabled, then the configured country info is used always.
- Attention
3. When the country info is changed because of configuration or because the station connects to a different external AP, the country IE in probe response/beacon of the soft-AP is also changed.
- Attention
4. The country configuration is stored into flash.
- Attention
5. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the country info.
- Attention
6. Supported country codes are “01”(world safe mode) “AT”,”AU”,”BE”,”BG”,”BR”, “CA”,”CH”,”CN”,”CY”,”CZ”,”DE”,”DK”,”EE”,”ES”,”FI”,”FR”,”GB”,”GR”,”HK”,”HR”,”HU”, “IE”,”IN”,”IS”,”IT”,”JP”,”KR”,”LI”,”LT”,”LU”,”LV”,”MT”,”MX”,”NL”,”NO”,”NZ”,”PL”,”PT”, “RO”,”SE”,”SI”,”SK”,”TW”,”US”
- Attention
7. When country code “01” (world safe mode) is set, SoftAP mode won’t contain country IE.
- Attention
8. The default country is “01” (world safe mode) and ieee80211d_enabled is TRUE.
- Attention
9. The third octect of country code string is one of the following: ‘ ‘, ‘O’, ‘I’, ‘X’, otherwise it is considered as ‘ ‘.
- Parameters
country – the configured country ISO code
ieee80211d_enabled – 802.11d is enabled or not
- Returns
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
- Parameters
country – country code
- Returns
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().
- Parameters
ifx – Interface to be configured.
rate – Phy rate to be configured.
- Returns
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().
- Parameters
ifx – Interface to be configured.
- Returns
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.
- Parameters
aid – [out] store the aid
- Returns
ESP_OK: succeed
-
esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode)
Get the negotiated phymode after connection.
- Attention
Operation phy mode, BIT[5]: indicate whether LR enabled, BIT[0-4]: wifi_phy_mode_t
- Parameters
phymode – [out] store the negotiated phymode.
- Returns
ESP_OK: succeed
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 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
-
WIFI_STATIC_TX_BUFFER_NUM
-
WIFI_CACHE_TX_BUFFER_NUM
-
WIFI_DYNAMIC_TX_BUFFER_NUM
-
WIFI_CSI_ENABLED
-
WIFI_AMPDU_RX_ENABLED
-
WIFI_AMPDU_TX_ENABLED
-
WIFI_AMSDU_TX_ENABLED
-
WIFI_NVS_ENABLED
-
WIFI_NANO_FORMAT_ENABLED
-
WIFI_INIT_CONFIG_MAGIC
-
WIFI_DEFAULT_RX_BA_WIN
-
WIFI_TASK_CORE_ID
-
WIFI_SOFTAP_BEACON_MAX_LEN
-
WIFI_MGMT_SBUF_NUM
-
WIFI_STA_DISCONNECTED_PM_ENABLED
-
CONFIG_FEATURE_WPA3_SAE_BIT
-
CONFIG_FEATURE_CACHE_TX_BUF_BIT
-
CONFIG_FEATURE_FTM_INITIATOR_BIT
-
CONFIG_FEATURE_FTM_RESPONDER_BIT
-
WIFI_INIT_CONFIG_DEFAULT()
-
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
Unions
-
union wifi_config_t
- #include <esp_wifi_types.h>
Configuration data for ESP32 AP or STA.
The usage of this union (for ap or sta configuration) is determined by the accompanying interface argument passed to esp_wifi_set_config() or esp_wifi_get_config()
Structures
-
struct wifi_country_t
Structure describing WiFi country-based regional restrictions.
Public Members
-
char cc[3]
country code string
-
uint8_t schan
start channel
-
uint8_t nchan
total channel number
-
int8_t max_tx_power
This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power.
-
wifi_country_policy_t policy
country policy
-
char cc[3]
-
struct wifi_active_scan_time_t
Range of active scan times per channel.
-
struct wifi_scan_time_t
Aggregate of active & passive scan time per channel.
Public Members
-
wifi_active_scan_time_t active
active scan time per channel, units: millisecond.
-
uint32_t passive
passive scan time per channel, units: millisecond, values above 1500ms may cause station to disconnect from AP and are not recommended.
-
wifi_active_scan_time_t active
-
struct wifi_scan_config_t
Parameters for an SSID scan.
Public Members
-
uint8_t *ssid
SSID of AP
-
uint8_t *bssid
MAC address of AP
-
uint8_t channel
channel, scan the specific channel
enable to scan AP whose SSID is hidden
-
wifi_scan_type_t scan_type
scan type, active or passive
-
wifi_scan_time_t scan_time
scan time per channel
-
uint8_t *ssid
-
struct wifi_ap_record_t
Description of a WiFi AP.
Public Members
-
uint8_t bssid[6]
MAC address of AP
-
uint8_t ssid[33]
SSID of AP
-
uint8_t primary
channel of AP
-
wifi_second_chan_t second
secondary channel of AP
-
int8_t rssi
signal strength of AP
-
wifi_auth_mode_t authmode
authmode of AP
-
wifi_cipher_type_t pairwise_cipher
pairwise cipher of AP
-
wifi_cipher_type_t group_cipher
group cipher of AP
-
wifi_ant_t ant
antenna used to receive beacon from AP
-
uint32_t phy_11b
bit: 0 flag to identify if 11b mode is enabled or not
-
uint32_t phy_11g
bit: 1 flag to identify if 11g mode is enabled or not
-
uint32_t phy_11n
bit: 2 flag to identify if 11n mode is enabled or not
-
uint32_t phy_lr
bit: 3 flag to identify if low rate is enabled or not
-
uint32_t wps
bit: 4 flag to identify if WPS is supported or not
-
uint32_t ftm_responder
bit: 5 flag to identify if FTM is supported in responder mode
-
uint32_t ftm_initiator
bit: 6 flag to identify if FTM is supported in initiator mode
-
uint32_t reserved
bit: 7..31 reserved
-
wifi_country_t country
country information of AP
-
uint8_t bssid[6]
-
struct wifi_scan_threshold_t
Structure describing parameters for a WiFi fast scan.
Public Members
-
int8_t rssi
The minimum rssi to accept in the fast scan mode
-
wifi_auth_mode_t authmode
The weakest authmode to accept in the fast scan mode 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 ESP32.
Public Members
-
uint8_t ssid[32]
SSID of ESP32 soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len.
-
uint8_t password[64]
Password of ESP32 soft-AP.
-
uint8_t ssid_len
Optional length of SSID field.
-
uint8_t channel
Channel of 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
-
uint8_t ssid[32]
-
struct wifi_sta_config_t
STA configuration settings for the ESP32.
Public Members
-
uint8_t ssid[32]
SSID of target AP.
-
uint8_t password[64]
Password of target AP.
-
wifi_scan_method_t scan_method
do all channel scan or fast scan
-
bool bssid_set
whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.
-
uint8_t bssid[6]
MAC address of target AP
-
uint8_t channel
channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.
-
uint16_t listen_interval
Listen interval for ESP32 station to receive beacon when WIFI_PS_MAX_MODEM is set. Units: AP beacon intervals. Defaults to 3 if set to 0.
-
wifi_sort_method_t sort_method
sort the connect AP in the list by rssi or security mode
-
wifi_scan_threshold_t threshold
When sort_method is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used.
-
wifi_pmf_config_t pmf_cfg
Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE.
-
uint32_t rm_enabled
Whether Radio Measurements are enabled for the connection
-
uint32_t btm_enabled
Whether BSS Transition Management is enabled for the connection
-
uint32_t mbo_enabled
Whether MBO is enabled for the connection
-
uint32_t 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
Whether SAE hash to element is enabled
-
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.
-
uint8_t ssid[32]
-
struct wifi_sta_info_t
Description of STA associated with AP.
Public Members
-
uint8_t mac[6]
mac address
-
int8_t rssi
current average rssi of sta connected
-
uint32_t phy_11b
bit: 0 flag to identify if 11b mode is enabled or not
-
uint32_t phy_11g
bit: 1 flag to identify if 11g mode is enabled or not
-
uint32_t phy_11n
bit: 2 flag to identify if 11n mode is enabled or not
-
uint32_t phy_lr
bit: 3 flag to identify if low rate is enabled or not
-
uint32_t is_mesh_child
bit: 4 flag to identify mesh child
-
uint32_t reserved
bit: 5..31 reserved
-
uint8_t mac[6]
-
struct wifi_sta_list_t
List of stations associated with the ESP32 Soft-AP.
Public Members
-
wifi_sta_info_t sta[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
0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet
-
unsigned __pad1__
reserved
-
unsigned mcs
Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76)
-
unsigned cwb
Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz
-
unsigned __pad2__
reserved
-
unsigned smoothing
reserved
-
unsigned not_sounding
reserved
-
unsigned __pad3__
reserved
-
unsigned aggregation
Aggregation. 0: MPDU packet; 1: AMPDU packet
-
unsigned stbc
Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet
-
unsigned fec_coding
Flag is set for 11n packets which are LDPC
-
unsigned sgi
Short Guide Interval(SGI). 0: Long GI; 1: Short GI
-
signed noise_floor
noise floor of Radio Frequency Module(RF). unit: dBm
-
unsigned ampdu_cnt
ampdu cnt
-
unsigned channel
primary channel on which this packet is received
-
unsigned secondary_channel
secondary channel on which this packet is received. 0: none; 1: above; 2: below
-
unsigned __pad4__
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 __pad5__
reserved
-
unsigned __pad6__
reserved
-
unsigned ant
antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1
-
unsigned sig_len
length of packet including Frame Check Sequence(FCS)
-
unsigned __pad7__
reserved
-
unsigned rx_state
state of the packet. 0: no error; others: error numbers which are not public
-
signed rssi
-
struct wifi_promiscuous_pkt_t
Payload passed to ‘buf’ parameter of promiscuous mode RX callback.
Public Members
-
wifi_pkt_rx_ctrl_t rx_ctrl
metadata header
-
uint8_t payload[0]
Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback.
-
wifi_pkt_rx_ctrl_t rx_ctrl
-
struct wifi_promiscuous_filter_t
Mask for filtering different packet types in promiscuous mode.
Public Members
-
uint32_t filter_mask
OR of one or more filter values WIFI_PROMIS_FILTER_*
-
uint32_t filter_mask
-
struct wifi_csi_config_t
Channel state information(CSI) configuration type.
Public Members
-
bool lltf_en
enable to receive legacy long training field(lltf) data. Default enabled
-
bool htltf_en
enable to receive HT long training field(htltf) data. Default enabled
-
bool stbc_htltf2_en
enable to receive space time block code HT long training field(stbc-htltf2) data. Default enabled
-
bool ltf_merge_en
enable to generate htlft data by averaging lltf and ht_ltf data when receiving HT packet. Otherwise, use ht_ltf data directly. Default enabled
-
bool channel_filter_en
enable to turn on channel filter to smooth adjacent sub-carrier. Disable it to keep independence of adjacent sub-carrier. Default enabled
-
bool manu_scale
manually scale the CSI data by left shifting or automatically scale the CSI data. If set true, please set the shift bits. false: automatically. true: manually. Default false
-
uint8_t shift
manually left shift bits of the scale of the CSI data. The range of the left shift bits is 0~15
-
bool lltf_en
-
struct wifi_csi_info_t
CSI data type.
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
-
int8_t *buf
buffer of CSI data
-
uint16_t len
length of CSI data
-
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 time period between consecutive FTM bursts in 100’s of milliseconds (0 - No pref)
-
uint8_t resp_mac[6]
-
struct wifi_event_sta_scan_done_t
Argument structure for WIFI_EVENT_SCAN_DONE event
-
struct wifi_event_sta_connected_t
Argument structure for WIFI_EVENT_STA_CONNECTED event
-
struct wifi_event_sta_disconnected_t
Argument structure for WIFI_EVENT_STA_DISCONNECTED event
-
struct wifi_event_sta_authmode_change_t
Argument structure for WIFI_EVENT_STA_AUTHMODE_CHANGE event
Public Members
-
wifi_auth_mode_t old_mode
the old auth mode of AP
-
wifi_auth_mode_t new_mode
the new auth mode of AP
-
wifi_auth_mode_t old_mode
-
struct wifi_event_sta_wps_er_pin_t
Argument structure for WIFI_EVENT_STA_WPS_ER_PIN event
Public Members
-
uint8_t pin_code[8]
PIN code of station in enrollee mode
-
uint8_t pin_code[8]
-
struct wifi_event_sta_wps_er_success_t
Argument structure for WIFI_EVENT_STA_WPS_ER_SUCCESS event
Public Members
-
uint8_t ap_cred_cnt
Number of AP credentials received
-
uint8_t ssid[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_ftm_report_entry_t
Argument structure for
Public Members
-
uint8_t dlog_token
Dialog Token of the FTM frame
-
int8_t rssi
RSSI of the FTM frame received
-
uint32_t rtt
Round Trip Time in pSec with a peer
-
uint64_t t1
Time of departure of FTM frame from FTM Responder in pSec
-
uint64_t t2
Time of arrival of FTM frame at FTM Initiator in pSec
-
uint64_t t3
Time of departure of ACK from FTM Initiator in pSec
-
uint64_t t4
Time of arrival of ACK at FTM Responder in pSec
-
uint8_t dlog_token
-
struct wifi_event_ftm_report_t
Argument structure for WIFI_EVENT_FTM_REPORT event
Public Members
-
uint8_t peer_mac[6]
MAC address of the FTM Peer
-
wifi_ftm_status_t status
Status of the FTM operation
-
uint32_t rtt_raw
Raw average Round-Trip-Time with peer in Nano-Seconds
-
uint32_t rtt_est
Estimated Round-Trip-Time with peer in Nano-Seconds
-
uint32_t dist_est
Estimated one-way distance in Centi-Meters
-
wifi_ftm_report_entry_t *ftm_report_data
Pointer to FTM Report with multiple entries, should be freed after use
-
uint8_t ftm_report_num_entries
Number of entries in the FTM Report data
-
uint8_t peer_mac[6]
-
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
Macros
-
WIFI_OFFCHAN_TX_REQ
-
WIFI_OFFCHAN_TX_CANCEL
-
WIFI_ROC_REQ
-
WIFI_ROC_CANCEL
-
WIFI_PROTOCOL_11B
-
WIFI_PROTOCOL_11G
-
WIFI_PROTOCOL_11N
-
WIFI_PROTOCOL_LR
-
ESP_WIFI_MAX_CONN_NUM
max number of stations which can connect to ESP32/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
-
MAX_SSID_LEN
-
MAX_PASSPHRASE_LEN
-
MAX_WPS_AP_CRED
-
WIFI_STATIS_BUFFER
-
WIFI_STATIS_RXTX
-
WIFI_STATIS_HW
-
WIFI_STATIS_DIAG
-
WIFI_STATIS_PS
-
WIFI_STATIS_ALL
Type Definitions
-
typedef int (*wifi_action_rx_cb_t)(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel)
The Rx callback function of Action Tx operations.
- Param hdr
pointer to the IEEE 802.11 Header structure
- Param payload
pointer to the Payload following 802.11 Header
- Param len
length of the Payload
- Param channel
channel number the frame is received on
Enumerations
-
enum wifi_mode_t
Values:
-
enumerator WIFI_MODE_NULL
null mode
-
enumerator WIFI_MODE_STA
WiFi station mode
-
enumerator WIFI_MODE_AP
WiFi soft-AP mode
-
enumerator WIFI_MODE_APSTA
WiFi station + soft-AP mode
-
enumerator WIFI_MODE_MAX
-
enumerator WIFI_MODE_NULL
-
enum wifi_country_policy_t
Values:
-
enumerator WIFI_COUNTRY_POLICY_AUTO
Country policy is auto, use the country info of AP to which the station is connected
-
enumerator WIFI_COUNTRY_POLICY_MANUAL
Country policy is manual, always use the configured country info
-
enumerator WIFI_COUNTRY_POLICY_AUTO
-
enum wifi_auth_mode_t
Values:
-
enumerator WIFI_AUTH_OPEN
authenticate mode : open
-
enumerator WIFI_AUTH_WEP
authenticate mode : WEP
-
enumerator WIFI_AUTH_WPA_PSK
authenticate mode : WPA_PSK
-
enumerator WIFI_AUTH_WPA2_PSK
authenticate mode : WPA2_PSK
-
enumerator WIFI_AUTH_WPA_WPA2_PSK
authenticate mode : WPA_WPA2_PSK
-
enumerator WIFI_AUTH_WPA2_ENTERPRISE
authenticate mode : WPA2_ENTERPRISE
-
enumerator WIFI_AUTH_WPA3_PSK
authenticate mode : WPA3_PSK
-
enumerator WIFI_AUTH_WPA2_WPA3_PSK
authenticate mode : WPA2_WPA3_PSK
-
enumerator WIFI_AUTH_WAPI_PSK
authenticate mode : WAPI_PSK
-
enumerator WIFI_AUTH_OWE
authenticate mode : OWE
-
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_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_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_phy_rate_t
WiFi PHY rate encodings.
Values:
-
enumerator WIFI_PHY_RATE_1M_L
1 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_2M_L
2 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_5M_L
5.5 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_11M_L
11 Mbps with long preamble
-
enumerator WIFI_PHY_RATE_2M_S
2 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_5M_S
5.5 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_11M_S
11 Mbps with short preamble
-
enumerator WIFI_PHY_RATE_48M
48 Mbps
-
enumerator WIFI_PHY_RATE_24M
24 Mbps
-
enumerator WIFI_PHY_RATE_12M
12 Mbps
-
enumerator WIFI_PHY_RATE_6M
6 Mbps
-
enumerator WIFI_PHY_RATE_54M
54 Mbps
-
enumerator WIFI_PHY_RATE_36M
36 Mbps
-
enumerator WIFI_PHY_RATE_18M
18 Mbps
-
enumerator WIFI_PHY_RATE_9M
9 Mbps
-
enumerator WIFI_PHY_RATE_MCS0_LGI
MCS0 with long GI, 6.5 Mbps for 20MHz, 13.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS1_LGI
MCS1 with long GI, 13 Mbps for 20MHz, 27 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS2_LGI
MCS2 with long GI, 19.5 Mbps for 20MHz, 40.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS3_LGI
MCS3 with long GI, 26 Mbps for 20MHz, 54 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS4_LGI
MCS4 with long GI, 39 Mbps for 20MHz, 81 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS5_LGI
MCS5 with long GI, 52 Mbps for 20MHz, 108 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS6_LGI
MCS6 with long GI, 58.5 Mbps for 20MHz, 121.5 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS7_LGI
MCS7 with long GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS0_SGI
MCS0 with short GI, 7.2 Mbps for 20MHz, 15 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS1_SGI
MCS1 with short GI, 14.4 Mbps for 20MHz, 30 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS2_SGI
MCS2 with short GI, 21.7 Mbps for 20MHz, 45 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS3_SGI
MCS3 with short GI, 28.9 Mbps for 20MHz, 60 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS4_SGI
MCS4 with short GI, 43.3 Mbps for 20MHz, 90 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS5_SGI
MCS5 with short GI, 57.8 Mbps for 20MHz, 120 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS6_SGI
MCS6 with short GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_MCS7_SGI
MCS7 with short GI, 72.2 Mbps for 20MHz, 150 Mbps for 40MHz
-
enumerator WIFI_PHY_RATE_LORA_250K
250 Kbps
-
enumerator WIFI_PHY_RATE_LORA_500K
500 Kbps
-
enumerator WIFI_PHY_RATE_MAX
-
enumerator WIFI_PHY_RATE_1M_L
-
enum wifi_event_t
WiFi event declarations
Values:
-
enumerator WIFI_EVENT_WIFI_READY
ESP32 WiFi ready
-
enumerator WIFI_EVENT_SCAN_DONE
ESP32 finish scanning AP
-
enumerator WIFI_EVENT_STA_START
ESP32 station start
-
enumerator WIFI_EVENT_STA_STOP
ESP32 station stop
-
enumerator WIFI_EVENT_STA_CONNECTED
ESP32 station connected to AP
-
enumerator WIFI_EVENT_STA_DISCONNECTED
ESP32 station disconnected from AP
-
enumerator WIFI_EVENT_STA_AUTHMODE_CHANGE
the auth mode of AP connected by ESP32 station changed
-
enumerator WIFI_EVENT_STA_WPS_ER_SUCCESS
ESP32 station wps succeeds in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_FAILED
ESP32 station wps fails in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_TIMEOUT
ESP32 station wps timeout in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PIN
ESP32 station wps pin code in enrollee mode
-
enumerator WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP
ESP32 station wps overlap in enrollee mode
-
enumerator WIFI_EVENT_AP_START
ESP32 soft-AP start
-
enumerator WIFI_EVENT_AP_STOP
ESP32 soft-AP stop
-
enumerator WIFI_EVENT_AP_STACONNECTED
a station connected to ESP32 soft-AP
-
enumerator WIFI_EVENT_AP_STADISCONNECTED
a station disconnected from ESP32 soft-AP
-
enumerator WIFI_EVENT_AP_PROBEREQRECVED
Receive probe request packet in soft-AP interface
-
enumerator WIFI_EVENT_FTM_REPORT
Receive report of FTM procedure
-
enumerator WIFI_EVENT_STA_BSS_RSSI_LOW
AP’s RSSI crossed configured threshold
-
enumerator WIFI_EVENT_ACTION_TX_STATUS
Status indication of Action Tx operation
-
enumerator WIFI_EVENT_ROC_DONE
Remain-on-Channel operation complete
-
enumerator WIFI_EVENT_STA_BEACON_TIMEOUT
ESP32 station beacon timeout
-
enumerator WIFI_EVENT_CONNECTIONLESS_MODULE_WAKE_INTERVAL_START
ESP32 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_MAX
Invalid WiFi event ID
-
enumerator WIFI_EVENT_WIFI_READY
-
enum wifi_event_sta_wps_fail_reason_t
Argument structure for WIFI_EVENT_STA_WPS_ER_FAILED event
Values:
-
enumerator WPS_FAIL_REASON_NORMAL
ESP32 WPS normal fail reason
-
enumerator WPS_FAIL_REASON_RECV_M2D
ESP32 WPS receive M2D frame
-
enumerator WPS_FAIL_REASON_MAX
-
enumerator WPS_FAIL_REASON_NORMAL
-
enum wifi_ftm_status_t
FTM operation status types.
Values:
-
enumerator FTM_STATUS_SUCCESS
FTM exchange is successful
-
enumerator FTM_STATUS_UNSUPPORTED
Peer does not support FTM
-
enumerator FTM_STATUS_CONF_REJECTED
Peer rejected FTM configuration in FTM Request
-
enumerator FTM_STATUS_NO_RESPONSE
Peer did not respond to FTM Requests
-
enumerator FTM_STATUS_FAIL
Unknown error during FTM exchange
-
enumerator FTM_STATUS_SUCCESS