# Wi-Fi 库

[English]

## 概述

Wi-Fi 库支持配置及监控 ESP32-C3 Wi-Fi 连网功能。支持配置：

- station 模式（即 STA 模式或 Wi-Fi 客户端模式），此时 ESP32-C3 连接到接入点 (AP)。

- AP 模式（即 Soft-AP 模式或接入点模式），此时基站连接到 ESP32-C3。

- station/AP 共存模式（ESP32-C3 既是接入点，同时又作为基站连接到另外一个接入点）。

- 上述模式的各种安全模式（WPA、WPA2、WPA3 等）。

- 扫描接入点（包括主动扫描及被动扫描）。

- 使用混杂模式监控 IEEE802.11 Wi-Fi 数据包。

## 应用示例

ESP-IDF 仓库的 wifi 目录下提供了演示 Wi-Fi 库功能的几个应用示例，请查看 README 了解更多详细信息。

## API 参考

### Header File

- components/esp_wifi/include/esp_wifi.h

- 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 on `esp_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: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the WiFi related config is correct

    - 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 milliseconds, scan_time.passive:360 milliseconds home_chan_dwell_time:30ms

    - 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_set_scan_parameters(const wifi_scan_default_params_t *config)

  Set default parameters used for scanning by station.

  Attention

    The values set using this API are also used for scans used while connecting.

  Attention

    The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds.

  Attention

    The home_chan_dwell_time needs to be a minimum of 30ms and a maximum of 150ms.

  Attention

    Set any of the parameters to 0 to indicate using the default parameters - scan_time.active.min : 0ms, scan_time.active.max : 120ms home_chan_dwell_time : 30ms scan_time.passive : 360ms

  Attention

    Default values can be retrieved using the macro WIFI_SCAN_PARAMS_DEFAULT_CONFIG()

  Attention

    Set the config parameter to NULL to reset previously set scan parameters to their default values.

  参数:

    config -- default configuration settings for all scans by stations

  返回:

    - ESP_OK: succeed

    - ESP_FAIL: failed as station mode has not been started yet

    - ESP_ERR_INVALID_ARG: values provided do not satisfy the requirements

    - ESP_ERR_NOT_SUPPORTED: This API is not supported in AP mode yet

    - ESP_ERR_INVALID_STATE: a scan/connect is in progress right now, cannot change scan parameters

    - others: refer to error code in esp_err.h

esp_err_t esp_wifi_get_scan_parameters(wifi_scan_default_params_t *config)

  Get default parameters used for scanning by station.

  参数:

    config -- structure variable within which scan default params will be stored

  返回:

    - ESP_OK: succeed

    - ESP_ERR_INVALID_ARG: passed parameter does not point to a valid memory

    - 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_WIFI_STATE: WiFi is still connecting when esp_wifi_scan_stop() is invoked.

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)

  Retrieve the list of APs found during the last scan. The returned AP list is sorted in descending order based on RSSI.

  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 scanned 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: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the WiFi related config is correct

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 and band mode is 2.4G, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX). if CONFIG_SOC_WIFI_SUPPORT_5G and band mode is 5G, the default protocol is (WIFI_PROTOCOL_11A|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AC|WIFI_PROTOCOL_11AX).

  Attention

    1. When WiFi band mode is 2.4G only, support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax or LR mode

  Attention

    2. When WiFi band mode is 5G only, support 802.11a or 802.11an or 802.11anac or 802.11anacax

  Attention

    3. Can not set WiFi protocol under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_protocols instead

  Attention

    4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

  参数:

    - ifx -- interface

    - 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

    - ESP_ERR_INVALID_ARG: invalid argument

    - ESP_ERR_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

    - 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.

  Attention

    1. When WiFi band mode is 2.4G only, it will return the protocol supported in the 2.4G band

  Attention

    2. When WiFi band mode is 5G only, it will return the protocol supported in the 5G band

  Attention

    3. Can not get WiFi protocol under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_get_protocols instead

  Attention

    4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

  参数:

    - 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

    - ESP_ERR_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

    - 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. WIFI_BW_HT40 is supported only when the interface support 11N

  Attention

    2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.

  Attention

    3. Can not set WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_bandwidths instead

  Attention

    4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

  参数:

    - 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

    - ESP_ERR_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

    - 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. Can not get WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_get_bandwidths instead

  Attention

    2. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

  参数:

    - 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_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

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 remember 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.

  Attention

    6. When operating in 5 GHz band, the second channel is automatically determined by the primary channel according to the 802.11 standard. Any manually configured second channel will be ignored.

  参数:

    - 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

    - ESP_ERR_WIFI_STATE: WiFi still connecting when invoke esp_wifi_set_config

    - 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.

  Attention

    If user set the same vendor ie twice, the second set will fail and return ESP_ERR_INVALID_ARG. Please clear the vendor ie before setting again.

  参数:

    - 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 transmitting 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_register_80211_tx_cb(esp_wifi_80211_tx_done_cb_t cb)

  Register the TX callback function of 80211 tx data.

  Attention

    This callback will be executed in WiFi task, so avoid doing any time consuming activity in the callback. Doing heavy work here can affect the WiFi performance.

  参数:

    cb -- callback function. If the cb is NULL, then unregister the tx cb.

  返回:

    - ESP_OK: succeed

    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init

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_get_csi_config(wifi_csi_config_t *config)

  Get 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 after 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` with `esp_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` with `esp_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 is 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().

  Attention

    2. Can not set 80211 tx rate under 11A/11AC/11AX protocol, you can use esp_wifi_config_80211_tx instead.

  参数:

    - ifx -- Interface to be configured.

    - rate -- Phy rate to be configured.

  返回:

    - ESP_OK: succeed

    - others: failed

esp_err_t esp_wifi_config_80211_tx(wifi_interface_t ifx, wifi_tx_rate_config_t *config)

  Config 80211 tx rate and phymode of specified interface.

  Attention

    1. This API should be called after esp_wifi_init() and before esp_wifi_start().

  参数:

    - ifx -- Interface to be configured.

    - config -- rate_config 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

esp_err_t esp_wifi_set_band(wifi_band_t band)

  Set WiFi current band.

  Attention

    1. This API is only operational when the WiFi band mode is configured to 2.4G + 5G (WIFI_BAND_MODE_AUTO)

  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. It is recommended not to use this API. If you want to change the current band, you can use esp_wifi_set_channel instead.

  参数:

    band -- [in] WiFi band 2.4G / 5G

  返回:

    - 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_get_band(wifi_band_t *band)

  Get WiFi current band.

  参数:

    band -- [in] store current band of WiFi

  返回:

    - 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_band_mode(wifi_band_mode_t band_mode)

  Set WiFi band mode.

  Attention

    1. When the WiFi band mode is set to 2.4G only, it operates exclusively on the 2.4GHz channels.

  Attention

    2. When the WiFi band mode is set to 5G only, it operates exclusively on the 5GHz channels.

  Attention

    3. When the WiFi band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO), it can operate on both the 2.4GHz and 5GHz channels.

  Attention

    4. WiFi band mode can be set to 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO) if CONFIG_SOC_WIFI_SUPPORT_5G is supported.

  Attention

    5. If CONFIG_SOC_WIFI_SUPPORT_5G is not supported, the API will return ESP_ERR_INVALID_ARG when the band mode is set to either 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO).

  Attention

    6. When a WiFi band mode change triggers a band change, if no channel is set for the current band, a default channel will be assigned: channel 1 for 2.4G band and channel 36 for 5G band.

  参数:

    band_mode -- [in] store the band mode of WiFi

  返回:

    - 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_get_band_mode(wifi_band_mode_t *band_mode)

  get WiFi band mode.

  参数:

    band_mode -- [in] store the band mode of WiFi

  返回:

    - 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_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols)

  Set the supported WiFi protocols for the specified interface.

  Attention

    1. When the WiFi band mode is set to 2.4G only, it will not set 5G protocol

  Attention

    2. When the WiFi band mode is set to 5G only, it will not set 2.4G protocol

  Attention

    3. This API supports setting the maximum protocol. For example, if the 2.4G protocol is set to 802.11n, it will automatically configure to 802.11b/g/n.

  参数:

    - ifx -- interface

    - protocols -- WiFi protocols include 2.4G protocol and 5G protocol

  返回:

    - 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_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols)

  Get the current protocol of the specified interface and specified band.

  Attention

    1. The 5G protocol can only be read when CONFIG_SOC_WIFI_SUPPORT_5G is enabled.

  Attention

    2. When the WiFi band mode is set to 2.4G only, it will not get 5G protocol

  Attention

    3. When the WiFi band mode is set to 5G only, it will not get 2.4G protocol

  参数:

    - ifx -- interface

    - protocols -- [out] store current WiFi protocols 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_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw)

  Set the bandwidth of specified interface and specified band.

  Attention

    1. WIFI_BW_HT40 is supported only when the interface support 11N

  Attention

    2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.

  Attention

    3. When the WiFi band mode is set to 2.4G only, it will not set 5G bandwidth

  Attention

    4. When the WiFi band mode is set to 5G only, it will not set 2.4G bandwidth

  参数:

    - ifx -- interface to be configured

    - bw -- WiFi bandwidths include 2.4G bandwidth and 5G 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_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw)

  Get the bandwidth of specified interface and specified band.

  Attention

    1. The 5G bandwidth can only be read when CONFIG_SOC_WIFI_SUPPORT_5G is enabled.

  Attention

    2. When the WiFi band mode is set to 2.4G only, it will not get 5G bandwidth

  Attention

    3. When the WiFi band mode is set to 5G only, it will not get 2.4G bandwidth

  参数:

    - ifx -- interface to be configured

    - bw -- [out] store bandwidths 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_action_tx_req(wifi_action_tx_req_t *req)

  Send action frame on target channel.

  参数:

    req -- action tx request structure containing relevant fields

  返回:

    - ESP_OK: succeed

    - ESP_ERR_NO_MEM: failed to allocate memory

    - ESP_ERR_INVALID_ARG: the <channel, sec_channel> pair is invalid

    - ESP_FAIL: failed to send frame

esp_err_t esp_wifi_remain_on_channel(wifi_roc_req_t *req)

  Remain on the target channel for required duration.

  参数:

    req -- roc request structure containing relevant fields

  返回:

    - ESP_OK: succeed

    - ESP_ERR_NO_MEM: failed to allocate memory

    - ESP_ERR_INVALID_ARG: the <channel, sec_channel> pair is invalid

    - ESP_FAIL: failed to perform roc operation

### 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 tx_hetb_queue_num

    WiFi TX HE TB QUEUE number for STA HE TB PPDU transmission

  bool dump_hesigb_enable

    enable dump sigb field

  int magic

    WiFi init magic number, it should be the last field

### 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_CACHE_TX_BUFFER

WIFI_FTM_INITIATOR

WIFI_FTM_RESPONDER

WIFI_ENABLE_GCMP

WIFI_ENABLE_GMAC

WIFI_ENABLE_11R

WIFI_ENABLE_ENTERPRISE

WIFI_DUMP_HESIGB_ENABLED

WIFI_TX_HETB_QUEUE_NUM

WIFI_ENABLE_BSS_MAX_IDLE

CONFIG_FEATURE_WPA3_SAE_BIT

CONFIG_FEATURE_CACHE_TX_BUF_BIT

CONFIG_FEATURE_FTM_INITIATOR_BIT

CONFIG_FEATURE_FTM_RESPONDER_BIT

CONFIG_FEATURE_GCMP_BIT

CONFIG_FEATURE_GMAC_BIT

CONFIG_FEATURE_11R_BIT

CONFIG_FEATURE_WIFI_ENT_BIT

CONFIG_FEATURE_BSS_MAX_IDLE_BIT

WIFI_FEATURE_CAPS

WIFI_INIT_CONFIG_DEFAULT()

ESP_WIFI_CONNECTIONLESS_INTERVAL_DEFAULT_MODE

### Type Definitions

typedef struct wifi_osi_funcs_t wifi_osi_funcs_t

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 struct wifi_sta_list_t wifi_sta_list_t

  Forward declare wifi_sta_list_t. The definition depends on the target device that implements esp_wifi.

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 (*esp_wifi_80211_tx_done_cb_t)(const esp_80211_tx_info_t *tx_info)

  Callback function of 80211 tx data.

  Param tx_info:

    TX information of 80211 tx. The information can only be used in the callback context.

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

- components/esp_wifi/include/esp_wifi_types.h

- 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 on `esp_wifi`, add the following to your CMakeLists.txt:

  >     REQUIRES esp_wifi

  > or

  >     PRIV_REQUIRES esp_wifi

### Type Definitions

typedef struct wifi_csi_config_t wifi_csi_config_t

typedef struct wifi_pkt_rx_ctrl_t wifi_pkt_rx_ctrl_t

### Header File

- components/esp_wifi/include/esp_wifi_types_generic.h

- This header file can be included with:

  >     #include "esp_wifi_types_generic.h"

- This header file is a part of the API provided by the `esp_wifi` component. To declare that your component depends on `esp_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_generic.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

### Structures

struct wifi_country_t

  Structure describing Wi-Fi country-based regional restrictions.

  Public Members

  char cc[3]

    Country code string

  uint8_t schan

    Start channel of the allowed 2.4GHz Wi-Fi channels

  uint8_t nchan

    Total channel number of the allowed 2.4GHz Wi-Fi channels

  int8_t max_tx_power

    This field is used for getting Wi-Fi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power.

  wifi_country_policy_t policy

    Country policy

struct wifi_active_scan_time_t

  Range of active scan times per channel.

  Public Members

  uint32_t min

    Minimum active scan time per channel, units: millisecond

  uint32_t max

    Maximum active scan time per channel, units: millisecond, values above 1500 ms may cause station to disconnect from AP and are not recommended.

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 1500 ms may cause station to disconnect from AP and are not recommended.

struct wifi_scan_channel_bitmap_t

  Channel bitmap for setting specific channels to be scanned.

  Public Members

  uint16_t ghz_2_channels

    Represents 2.4 GHz channels, that bits can be set as wifi_2g_channel_bit_t shown.

  uint32_t ghz_5_channels

    Represents 5 GHz channels, that bits can be set as wifi_5g_channel_bit_t shown.

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

  bool show_hidden

    Enable it 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.

  wifi_scan_channel_bitmap_t channel_bitmap

    Channel bitmap for setting specific channels to be scanned. Please note that the 'channel' parameter above needs to be set to 0 to allow scanning by bitmap. Also, note that only allowed channels configured by wifi_country_t can be scanned.

  bool coex_background_scan

    Enable it to scan return home channel under coexist

struct wifi_scan_default_params_t

  Parameters default scan configurations.

  Public Members

  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.

struct wifi_he_ap_info_t

  Description of a Wi-Fi AP HE Info.

  Public Members

  uint8_t bss_color

    The BSS Color value associated with the AP's corresponding BSS

  uint8_t partial_bss_color

    Indicates whether an AID assignment rule is based on the BSS color

  uint8_t bss_color_disabled

    Indicates whether the BSS color usage is disabled

  uint8_t bssid_index

    In a M-BSSID set, identifies the non-transmitted BSSID

struct wifi_ap_record_t

  Description of a Wi-Fi 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

    Auth mode 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_11a

    Bit: 4 flag to identify if 11ax mode is enabled or not

  uint32_t phy_11ac

    Bit: 5 flag to identify if 11ax mode is enabled or not

  uint32_t phy_11ax

    Bit: 6 flag to identify if 11ax mode is enabled or not

  uint32_t wps

    Bit: 7 flag to identify if WPS is supported or not

  uint32_t ftm_responder

    Bit: 8 flag to identify if FTM is supported in responder mode

  uint32_t ftm_initiator

    Bit: 9 flag to identify if FTM is supported in initiator mode

  uint32_t reserved

    Bit: 10..31 reserved

  wifi_country_t country

    Country information of AP

  wifi_he_ap_info_t he_ap

    HE AP info

  wifi_bandwidth_t bandwidth

    Bandwidth of AP

  uint8_t vht_ch_freq1

    This fields are used only AP bandwidth is 80 and 160 MHz, to transmit the center channel frequency of the BSS. For AP bandwidth is 80 + 80 MHz, it is the center channel frequency of the lower frequency segment.

  uint8_t vht_ch_freq2

    this fields are used only AP bandwidth is 80 + 80 MHz, and is used to transmit the center channel frequency of the second segment.

struct wifi_scan_threshold_t

  Structure describing parameters for a Wi-Fi fast scan.

  Public Members

  int8_t rssi

    The minimum rssi to accept in the fast scan mode. Defaults to -127 if set to >= 0

  wifi_auth_mode_t authmode

    The weakest auth mode to accept in the fast scan mode Note: In case 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 auth mode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks

  uint8_t rssi_5g_adjustment

    The RSSI value of the 5G AP is within the rssi_5g_adjustment range compared to the 2G AP, the 5G AP will be given priority for connection.

struct wifi_protocols_t

  Description of a Wi-Fi protocols.

  Public Members

  uint16_t ghz_2g

    Represents 2.4 GHz protocol, support 802.11b or 802.11g or 802.11n or 802.11ax or LR mode

  uint16_t ghz_5g

    Represents 5 GHz protocol, support 802.11a or 802.11n or 802.11ac or 802.11ax

struct wifi_bandwidths_t

  Description of a Wi-Fi band bandwidths.

  Public Members

  wifi_bandwidth_t ghz_2g

    Represents 2.4 GHz bandwidth

  wifi_bandwidth_t ghz_5g

    Represents 5 GHz bandwidth

struct wifi_pmf_config_t

  Configuration structure for Protected Management Frame.

  Public Members

  bool capable

    Deprecated variable. Device will always connect in PMF mode if other device also advertises PMF capability.

  bool required

    Advertises that Protected Management Frame is required. Device will not associate to non-PMF capable devices.

struct wifi_bss_max_idle_config_t

  Configuration structure for BSS max idle.

  Public Members

  uint16_t period

    Sets BSS Max idle period (1 Unit = 1000TUs OR 1.024 Seconds). If there are no frames for this period from a STA, SoftAP will disassociate due to inactivity. Setting it to 0 disables the feature

  bool protected_keep_alive

    Requires clients to use protected keep alive frames for BSS Max Idle period

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 by default, unless explicitly set.

  uint8_t ssid_hidden

    Broadcast SSID or not, default 0, broadcast the SSID

  uint8_t max_connection

    Max number of stations allowed to connect in

  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

  uint8_t csa_count

    Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Default value: 3

  uint8_t dtim_period

    Dtim period of soft-AP. Range: 1 ~ 10. Default value: 1

  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, WIFI_CIPHER_TYPE_TKIP_CCMP, WIFI_CIPHER_TYPE_GCMP and WIFI_CIPHER_TYPE_GCMP256.

  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. Default value :2 (WPA3_SAE_PWE_BOTH)

  uint8_t transition_disable

    Whether to enable transition disable feature

  uint8_t sae_ext

    Enable SAE EXT feature. SOC_GCMP_SUPPORT is required for this feature.

  wifi_bss_max_idle_config_t bss_max_idle_cfg

    Configuration for bss max idle, effective if CONFIG_WIFI_BSS_MAX_IDLE_SUPPORT is enabled

  uint16_t gtk_rekey_interval

    GTK rekeying interval in seconds. If set to 0, GTK rekeying is disabled. Range: 60 ~ 65535 including 0.

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 hint for target AP. For 2.4G AP, set to 1~13 to scan starting from the specified channel before connecting to AP. For 5G AP, set to 36~177 (36, 40, 44 ... 177) to scan starting from the specified channel before connecting to AP. Set to 0 for no preference

  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. Note that when btm is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a BTM supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when BTM is enabled.

  uint32_t mbo_enabled

    Whether MBO is enabled for the connection. Note that when mbo is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a MBO supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when MBO is enabled. Enabling mbo here, automatically enables btm and rm above.

  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 reserved1

    Reserved for future feature set

  wifi_sae_pwe_method_t sae_pwe_h2e

    Configuration for SAE PWE derivation method. Default value :2 (WPA3_SAE_PWE_BOTH)

  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 in case 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-MCS8 and HE-MCS9. 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 vht_su_beamformee_disabled

    Whether to disable support for operation as an VHT SU beamformee.

  uint32_t vht_mu_beamformee_disabled

    Whether to disable support for operation as an VHT MU beamformee.

  uint32_t vht_mcs8_enabled

    Whether to support VHT-MCS8. The default value is 0.

  uint32_t reserved2

    Reserved for future feature set

  uint8_t sae_h2e_identifier[SAE_H2E_IDENTIFIER_LEN]

    Password identifier for H2E. Strings null-terminated (length < SAE_H2E_IDENTIFIER_LEN) or non-null terminated (length = SAE_H2E_IDENTIFIER_LEN) are accepted. Non-null terminated string with 0xFF for full length of SAE_H2E_IDENTIFIER_LEN is not considered a valid identifier

struct wifi_nan_config_t

  NAN Discovery start configuration.

  Public Members

  uint8_t op_channel

    NAN Discovery operating channel

  uint8_t master_pref

    Device's preference value to serve as NAN Master

  uint8_t scan_time

    Scan time in seconds while searching for a NAN cluster

  uint16_t warm_up_sec

    Warm up time before assuming NAN Anchor Master role

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_11a

    Bit: 4 flag to identify if 11ax mode is enabled or not

  uint32_t phy_11ac

    Bit: 5 flag to identify if 11ax mode is enabled or not

  uint32_t phy_11ax

    Bit: 6 flag to identify if 11ax mode is enabled or not

  uint32_t is_mesh_child

    Bit: 7 flag to identify mesh child

  uint32_t reserved

    Bit: 8..31 reserved

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.

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_*

struct wifi_ant_gpio_t

  Wi-Fi GPIO configuration for antenna selection.

  Public Members

  uint8_t gpio_select

    Whether this GPIO is connected to external antenna switch

  uint8_t gpio_num

    The GPIO number that connects to external antenna switch

struct wifi_ant_gpio_config_t

  Wi-Fi GPIOs configuration for antenna selection.

  Public Members

  wifi_ant_gpio_t gpio_cfg[4]

    The configurations of GPIOs that connect to external antenna switch

struct wifi_ant_config_t

  Wi-Fi antenna configuration.

  Public Members

  wifi_ant_mode_t rx_ant_mode

    Wi-Fi 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

    Wi-Fi 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

struct wifi_action_tx_req_t

  Action Frame Tx Request.

  Public Members

  wifi_interface_t ifx

    Wi-Fi interface to send request to

  uint8_t dest_mac[6]

    Destination MAC address

  wifi_action_tx_t type

    ACTION TX operation type

  uint8_t channel

    Channel on which to perform ACTION TX Operation

  wifi_second_chan_t sec_channel

    Secondary channel

  uint32_t wait_time_ms

    Duration to wait for on target channel

  bool no_ack

    Indicates no ack required

  wifi_action_rx_cb_t rx_cb

    Rx Callback to receive action frames

  uint8_t op_id

    Unique Identifier for operation provided by wifi driver

  uint32_t data_len

    Length of the appended Data

  uint8_t data[0]

    Appended Data payload

struct wifi_roc_req_t

  Remain on Channel request.

  Public Members

  wifi_interface_t ifx

    WiFi interface to send request to

  wifi_roc_t type

    ROC operation type

  uint8_t channel

    Channel on which to perform ROC Operation

  wifi_second_chan_t sec_channel

    Secondary channel

  uint32_t wait_time_ms

    Duration to wait for on target channel

  wifi_action_rx_cb_t rx_cb

    Rx Callback to receive any response

  uint8_t op_id

    ID of this specific ROC operation provided by wifi driver

  wifi_action_roc_done_cb_t done_cb

    Callback to function that will be called upon ROC done. If assigned, WIFI_EVENT_ROC_DONE event will not be posted

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

struct wifi_nan_wfa_ssi_t

  WFA defined Protocol types in NAN service specific info attribute.

  Public Members

  uint8_t wfa_oui[WIFI_OUI_LEN]

    WFA OUI - 0x50, 0x6F, 0x9A

  wifi_nan_svc_proto_t proto

    WFA defined protocol types

  uint8_t payload[0]

    Service Info payload

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]

    To be deprecated in next major release, use ssi instead

  uint8_t single_replied_event

    Give single Replied event or every time

  uint8_t datapath_reqd

    NAN Datapath required for the service

  uint8_t fsd_reqd

    Further Service Discovery(FSD) required

  uint8_t fsd_gas

    0 - Follow-up used for FSD, 1 - GAS used for FSD

  uint8_t reserved

    Reserved

  uint16_t ssi_len

    Length of service specific info, maximum allowed length - ESP_WIFI_MAX_SVC_SSI_LEN

  uint8_t *ssi

    Service Specific Info of type wifi_nan_wfa_ssi_t for WFA defined protocols, otherwise proprietary and defined by Applications

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]

    To be deprecated in next major release, use ssi instead

  uint8_t single_match_event

    Give single Match event(per SSI update) or every time

  uint8_t datapath_reqd

    NAN Datapath required for the service

  uint8_t fsd_reqd

    Further Service Discovery(FSD) required

  uint8_t fsd_gas

    0 - Follow-up used for FSD, 1 - GAS used for FSD

  uint8_t reserved

    Reserved

  uint16_t ssi_len

    Length of service specific info, maximum allowed length - ESP_WIFI_MAX_SVC_SSI_LEN

  uint8_t *ssi

    Service Specific Info of type wifi_nan_wfa_ssi_t for WFA defined protocols, otherwise proprietary and defined by Applications

struct wifi_nan_followup_params_t

  NAN Follow-up parameters.

  Public Members

  uint8_t inst_id

    Own service instance id

  uint8_t peer_inst_id

    Peer's service instance id

  uint8_t peer_mac[6]

    Peer's MAC address

  char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]

    To be deprecated in next major release, use ssi instead

  uint16_t ssi_len

    Length of service specific info, maximum allowed length - ESP_WIFI_MAX_FUP_SSI_LEN

  uint8_t *ssi

    Service Specific Info of type wifi_nan_wfa_ssi_t for WFA defined protocols, otherwise proprietary and defined by Applications

struct wifi_nan_datapath_req_t

  NAN Datapath Request parameters.

  Public Members

  uint8_t pub_id

    Publisher's service instance id

  uint8_t peer_mac[6]

    Peer's MAC address

  bool confirm_required

    NDP Confirm frame required

struct wifi_nan_datapath_resp_t

  NAN Datapath Response parameters.

  Public Members

  bool accept

    True - Accept incoming NDP, False - Reject it

  uint8_t ndp_id

    NAN Datapath Identifier

  uint8_t peer_mac[6]

    Peer's MAC address

struct wifi_nan_datapath_end_req_t

  NAN Datapath End parameters.

  Public Members

  uint8_t ndp_id

    NAN Datapath Identifier

  uint8_t peer_mac[6]

    Peer's MAC address

struct wifi_event_sta_scan_done_t

  Argument structure for WIFI_EVENT_SCAN_DONE event.

  Public Members

  uint32_t status

    Status of scanning APs: 0 — success, 1 - failure

  uint8_t number

    Number of scan results

  uint8_t scan_id

    Scan sequence number, used for block scan

struct wifi_event_sta_connected_t

  Argument structure for WIFI_EVENT_STA_CONNECTED event.

  Public Members

  uint8_t ssid[32]

    SSID of connected AP

  uint8_t ssid_len

    SSID length of connected AP

  uint8_t bssid[6]

    BSSID of connected AP

  uint8_t channel

    Channel of connected AP

  wifi_auth_mode_t authmode

    Authentication mode used by the connection

  uint16_t aid

    Authentication id assigned by the connected AP

struct wifi_event_sta_disconnected_t

  Argument structure for WIFI_EVENT_STA_DISCONNECTED event.

  Public Members

  uint8_t ssid[32]

    SSID of disconnected AP

  uint8_t ssid_len

    SSID length of disconnected AP

  uint8_t bssid[6]

    BSSID of disconnected AP

  uint8_t reason

    Disconnection reason

  int8_t rssi

    Disconnection RSSI

struct wifi_event_sta_authmode_change_t

  Argument structure for WIFI_EVENT_STA_AUTHMODE_CHANGE event.

  Public Members

  wifi_auth_mode_t old_mode

    Old auth mode of AP

  wifi_auth_mode_t new_mode

    New auth mode of AP

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

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 ap_cred[MAX_WPS_AP_CRED]

    All AP credentials received from WPS handshake

struct wifi_event_ap_staconnected_t

  Argument structure for WIFI_EVENT_AP_STACONNECTED event.

  Public Members

  uint8_t mac[6]

    MAC address of the station connected to Soft-AP

  uint8_t aid

    AID assigned by the Soft-AP to the connected station

  bool is_mesh_child

    Flag indicating whether the connected station is a mesh child

struct wifi_event_ap_stadisconnected_t

  Argument structure for WIFI_EVENT_AP_STADISCONNECTED event.

  Public Members

  uint8_t mac[6]

    MAC address of the station disconnects from the soft-AP

  uint8_t aid

    AID that the Soft-AP assigned to the disconnected station

  bool is_mesh_child

    Flag indicating whether the disconnected station is a mesh child

  uint16_t reason

    Disconnection reason

struct wifi_event_ap_probe_req_rx_t

  Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event.

  Public Members

  int rssi

    Received probe request signal strength

  uint8_t mac[6]

    MAC address of the station which send probe request

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

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

struct wifi_ftm_report_entry_t

  Structure representing a report entry for Fine Timing Measurement (FTM) in Wi-Fi.

  This structure holds the information related to the FTM process between a Wi-Fi FTM Initiator and a Wi-Fi FTM Responder. FTM is used for precise distance measurement by timing the exchange of frames between devices.

  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

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

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

  wifi_action_tx_status_type_t status

    Status of the operation

  uint8_t op_id

    ID of the corresponding operation that was provided during action tx request

  uint8_t channel

    Channel provided in tx request

struct wifi_event_roc_done_t

  Argument structure for WIFI_EVENT_ROC_DONE event.

  Public Members

  uint32_t context

    Context to identify the initiator of the request

  wifi_roc_done_status_t status

    ROC status

  uint8_t op_id

    ID of the corresponding ROC operation

  uint8_t channel

    Channel provided in tx request

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

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

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

struct wifi_event_nan_svc_match_t

  Argument structure for WIFI_EVENT_NAN_SVC_MATCH event.

  Public Members

  uint8_t subscribe_id

    Subscribe Service Identifier

  uint8_t publish_id

    Publish Service Identifier

  uint8_t pub_if_mac[6]

    NAN Interface MAC of the Publisher

  bool update_pub_id

    Indicates whether publisher's service ID needs to be updated

  uint8_t datapath_reqd

    NAN Datapath required for the service

  uint8_t fsd_reqd

    Further Service Discovery(FSD) required

  uint8_t fsd_gas

    0 - Follow-up used for FSD, 1 - GAS used for FSD

  uint8_t reserved

    Reserved

  uint32_t reserved_1

    Reserved

  uint32_t reserved_2

    Reserved

  uint8_t ssi_version

    Indicates version of SSI in Publish instance, 0 if not available

  uint16_t ssi_len

    Length of service specific info

  uint8_t ssi[]

    Service specific info of Publisher

struct wifi_event_nan_replied_t

  Argument structure for WIFI_EVENT_NAN_REPLIED event.

  Public Members

  uint8_t publish_id

    Publish Service Identifier

  uint8_t subscribe_id

    Subscribe Service Identifier

  uint8_t sub_if_mac[6]

    NAN Interface MAC of the Subscriber

  uint32_t reserved_1

    Reserved

  uint32_t reserved_2

    Reserved

  uint16_t ssi_len

    Length of service specific info

  uint8_t ssi[]

    Service specific info of Subscriber

struct wifi_event_nan_receive_t

  Argument structure for WIFI_EVENT_NAN_RECEIVE event.

  Public Members

  uint8_t inst_id

    Our Service Identifier

  uint8_t peer_inst_id

    Peer's Service Identifier

  uint8_t peer_if_mac[6]

    Peer's NAN Interface MAC

  uint8_t peer_svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]

    To be deprecated in next major release, use ssi instead

  uint32_t reserved_1

    Reserved

  uint32_t reserved_2

    Reserved

  uint16_t ssi_len

    Length of service specific info

  uint8_t ssi[]

    Service specific info from Follow-up

struct wifi_event_ndp_indication_t

  Argument structure for WIFI_EVENT_NDP_INDICATION event.

  Public Members

  uint8_t publish_id

    Publish Id for NAN Service

  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 svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]

    To be deprecated in next major release, use ssi instead

  uint32_t reserved_1

    Reserved

  uint32_t reserved_2

    Reserved

  uint16_t ssi_len

    Length of service specific info

  uint8_t ssi[]

    Service specific info from NDP/NDPE Attribute

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]

    To be deprecated in next major release, use ssi instead

  uint32_t reserved_1

    Reserved

  uint32_t reserved_2

    Reserved

  uint16_t ssi_len

    Length of Service Specific Info

  uint8_t ssi[]

    Service specific info from NDP/NDPE Attribute

struct wifi_event_ndp_terminated_t

  Argument structure for WIFI_EVENT_NDP_TERMINATED event.

  Public Members

  uint8_t reason

    Termination reason code

  uint8_t ndp_id

    NDP instance id

  uint8_t init_ndi[6]

    Initiator's NAN Data Interface MAC

struct wifi_event_neighbor_report_t

  Argument structure for WIFI_EVENT_STA_NEIGHBOR_REP event.

  Public Members

  uint8_t report[ESP_WIFI_MAX_NEIGHBOR_REP_LEN]

    Neighbor Report received from the AP (will be deprecated in next major release, use n_report instead)

  uint16_t report_len

    Length of the report

  uint8_t n_report[]

    Neighbor Report received from the AP

struct wifi_event_ap_wrong_password_t

  Argument structure for WIFI_EVENT_AP_WRONG_PASSWORD event

  Public Members

  uint8_t mac[6]

    MAC address of the station trying to connect to Soft-AP

struct wifi_tx_rate_config_t

  Argument structure for wifi_tx_rate_config.

  Public Members

  wifi_phy_mode_t phymode

    Phymode of specified interface

  wifi_phy_rate_t rate

    Rate of specified interface

  bool ersu

    Using ERSU to send frame, ERSU is a transmission mode related to 802.11 ax. ERSU is always used in long distance transmission, and its frame has lower rate compared with SU mode

  bool dcm

    Using dcm rate to send frame

struct wifi_reg_rule_t

  Argument structure for regulatory rule

  Public Members

  uint8_t start_channel

    start channel of regulatory rule

  uint8_t end_channel

    end channel of regulatory rule

  uint16_t max_bandwidth

    max bandwidth(MHz) of regulatory rule, 1:20M, 2:40M, 3:80M, 4:160M

  uint16_t max_eirp

    indicates the maximum Equivalent Isotropically Radiated Power (EIRP), typically measured in dBm

  uint16_t is_dfs

    flag to identify dfs channel

  uint16_t reserved

    reserved

struct wifi_regulatory_t

  Argument structure for regdomain

  Public Members

  uint8_t n_reg_rules

    number of regulatory rules

  wifi_reg_rule_t reg_rules[WIFI_MAX_REGULATORY_RULE_NUM]

    array of regulatory rules

struct wifi_regdomain_t

  Argument structure for regdomain

  Public Members

  char cn[2]

    country code string

  uint8_t regulatory_type

    regulatory type of country

struct wifi_tx_info_t

  Information of wifi sending data.

  Public Members

  uint8_t *des_addr

    The address of the receive device

  uint8_t *src_addr

    The address of the sending device

  wifi_interface_t ifidx

    Interface of sending 80211 tx data

  uint8_t *data

    The data for 80211 tx, start from the MAC header

  uint8_t data_len

    The frame body length for 80211 tx, excluding the MAC header

  wifi_phy_rate_t rate

    Data rate

  wifi_tx_status_t tx_status

    Status of sending 80211 tx data

struct wifi_event_sta_beacon_offset_unstable_t

  Argument structure for WIFI_EVENT_STA_BEACON_OFFSET_UNSTABLE event

  Public Members

  float beacon_success_rate

    Received beacon success rate

struct wifi_event_dpp_uri_ready_t

  Argument structure for WIFI_EVENT_DPP_URI_READY event

  Public Members

  uint32_t uri_data_len

    URI data length including null termination

  char uri[]

    URI data

struct wifi_event_dpp_config_received_t

  Argument structure for WIFI_EVENT_DPP_CFG_RECVD event

  Public Members

  wifi_config_t wifi_cfg

    Received WIFI config in DPP

struct wifi_event_dpp_failed_t

  Argument structure for WIFI_EVENT_DPP_FAIL event

  Public Members

  int failure_reason

    Failure reason

### Macros

WIFI_AP_DEFAULT_MAX_IDLE_PERIOD

  Default timeout for SoftAP BSS Max Idle. Unit: 1000TUs >

WIFI_ACTIVE_SCAN_MIN_DEFAULT_TIME

  Default minimum active scan time per channel

WIFI_ACTIVE_SCAN_MAX_DEFAULT_TIME

  Default maximum active scan time per channel

WIFI_PASSIVE_SCAN_DEFAULT_TIME

  Default passive scan time per channel

WIFI_SCAN_HOME_CHANNEL_DWELL_DEFAULT_TIME

  Default time spent at home channel between scanning consecutive channels

WIFI_SCAN_PARAMS_DEFAULT_CONFIG()

BIT(nr)

CHANNEL_TO_BIT_NUMBER(channel)

BIT_NUMBER_TO_CHANNEL(bit_number, band)

CHANNEL_TO_BIT(channel)

WIFI_PROTOCOL_11B

  802.11b protocol

WIFI_PROTOCOL_11G

  802.11g protocol

WIFI_PROTOCOL_11N

  802.11n protocol

WIFI_PROTOCOL_LR

  Low Rate protocol

WIFI_PROTOCOL_11A

  802.11a protocol

WIFI_PROTOCOL_11AC

  802.11ac protocol

WIFI_PROTOCOL_11AX

  802.11ax protocol

SAE_H2E_IDENTIFIER_LEN

  Length of the password identifier for H2E

WIFI_VENDOR_IE_ELEMENT_ID

  Vendor Information 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 Wi-Fi events

WIFI_EVENT_MASK_NONE

  Mask none of the Wi-Fi events

WIFI_EVENT_MASK_AP_PROBEREQRECVED

  Mask SYSTEM_EVENT_AP_PROBEREQRECVED event

ESP_WIFI_NAN_MAX_SVC_SUPPORTED

  Maximum number of NAN services supported

ESP_WIFI_NAN_DATAPATH_MAX_PEERS

  Maximum number of NAN datapath peers supported

ESP_WIFI_NDP_ROLE_INITIATOR

  Initiator role for NAN Data Path

ESP_WIFI_NDP_ROLE_RESPONDER

  Responder role for NAN Data Path

ESP_WIFI_MAX_SVC_NAME_LEN

  Maximum length of NAN service name

ESP_WIFI_MAX_FILTER_LEN

  Maximum length of NAN service filter

ESP_WIFI_MAX_SVC_INFO_LEN

  Maximum length of NAN service info

ESP_WIFI_MAX_FUP_SSI_LEN

  Maximum length of NAN Service Specific Info in a Follow-up frame

ESP_WIFI_MAX_SVC_SSI_LEN

  Maximum length of NAN Service Specific Info in Publish/Subscribe SDF's

ESP_WIFI_MAX_NEIGHBOR_REP_LEN

  Maximum length of NAN Neighbor Report

WIFI_OUI_LEN

  Length of OUI bytes in IE or attributes

MAX_SSID_LEN

  Maximum length of SSID

MAX_PASSPHRASE_LEN

  Maximum length of passphrase

MAX_WPS_AP_CRED

  Maximum number of AP credentials received from WPS handshake

WIFI_STATIS_BUFFER

  Buffer status

WIFI_STATIS_RXTX

  RX/TX status

WIFI_STATIS_HW

  Hardware status

WIFI_STATIS_DIAG

  Diagnostic status

WIFI_STATIS_PS

  Power save status

WIFI_STATIS_ALL

  All status

WIFI_MAX_SUPPORT_COUNTRY_NUM

  max number of supported countries

WIFI_MAX_REGULATORY_RULE_NUM

  max number of regulatory rules

### Type Definitions

typedef struct wifi_csi_info_t wifi_csi_info_t

  CSI data type.

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

typedef void (*wifi_action_roc_done_cb_t)(uint32_t context, uint8_t op_id, wifi_roc_done_status_t status)

  The callback function executed when ROC operation has ended.

  Param context:

    rxcb registered for the corresponding ROC operation

  Param op_id:

    ID of the corresponding ROC operation

  Param status:

    status code of the ROC operation denoted

typedef wifi_tx_info_t esp_80211_tx_info_t

### Enumerations

enum wifi_mode_t

  Wi-Fi mode type.

  Values:

  enumerator WIFI_MODE_NULL

    Null mode

  enumerator WIFI_MODE_STA

    Wi-Fi station mode

  enumerator WIFI_MODE_AP

    Wi-Fi soft-AP mode

  enumerator WIFI_MODE_APSTA

    Wi-Fi station + soft-AP mode

  enumerator WIFI_MODE_NAN

    Wi-Fi NAN mode

  enumerator WIFI_MODE_MAX

enum wifi_interface_t

  Wi-Fi interface type.

  Values:

  enumerator WIFI_IF_STA

    Station interface

  enumerator WIFI_IF_AP

    Soft-AP interface

  enumerator WIFI_IF_NAN

    NAN interface

  enumerator WIFI_IF_MAX

    Maximum number of interfaces

enum wifi_action_tx_t

  Values:

  enumerator WIFI_OFFCHAN_TX_CANCEL

    Cancel off-channel transmission

  enumerator WIFI_OFFCHAN_TX_REQ

    Request off-channel transmission

enum wifi_roc_t

  Values:

  enumerator WIFI_ROC_CANCEL

    Cancel remain on channel

  enumerator WIFI_ROC_REQ

    Request remain on channel

enum wifi_country_policy_t

  Wi-Fi country policy.

  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

enum wifi_auth_mode_t

  Wi-Fi authmode type Strength of authmodes Personal Networks : OPEN < WEP < WPA_PSK < OWE < WPA2_PSK = WPA_WPA2_PSK < WAPI_PSK < WPA3_PSK = WPA2_WPA3_PSK = DPP Enterprise Networks : WIFI_AUTH_WPA_ENTERPRISE < WIFI_AUTH_WPA2_ENTERPRISE < WIFI_AUTH_WPA3_ENTERPRISE = WIFI_AUTH_WPA2_WPA3_ENTERPRISE < WIFI_AUTH_WPA3_ENT_192.

  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 : Wi-Fi EAP security, treated the same as WIFI_AUTH_WPA2_ENTERPRISE

  enumerator WIFI_AUTH_WPA2_ENTERPRISE

    Authenticate mode : WPA2-Enterprise 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_DPP

    Authenticate mode : DPP

  enumerator WIFI_AUTH_WPA3_ENTERPRISE

    Authenticate mode : WPA3-Enterprise Only Mode

  enumerator WIFI_AUTH_WPA2_WPA3_ENTERPRISE

    Authenticate mode : WPA3-Enterprise Transition Mode

  enumerator WIFI_AUTH_WPA_ENTERPRISE

    Authenticate mode : WPA-Enterprise security

  enumerator WIFI_AUTH_MAX

enum wifi_err_reason_t

  Wi-Fi disconnection reason codes.

  These reason codes are used to indicate the cause of disconnection.

  Values:

  enumerator WIFI_REASON_UNSPECIFIED

    Unspecified reason

  enumerator WIFI_REASON_AUTH_EXPIRE

    Authentication expired

  enumerator WIFI_REASON_AUTH_LEAVE

    Deauthentication due to leaving

  enumerator WIFI_REASON_ASSOC_EXPIRE

    Deprecated, will be removed in next IDF major release

  enumerator WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY

    Disassociated due to inactivity

  enumerator WIFI_REASON_ASSOC_TOOMANY

    Too many associated stations

  enumerator WIFI_REASON_NOT_AUTHED

    Deprecated, will be removed in next IDF major release

  enumerator WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA

    Class 2 frame received from nonauthenticated STA

  enumerator WIFI_REASON_NOT_ASSOCED

    Deprecated, will be removed in next IDF major release

  enumerator WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA

    Class 3 frame received from nonassociated STA

  enumerator WIFI_REASON_ASSOC_LEAVE

    Deassociated due to leaving

  enumerator WIFI_REASON_ASSOC_NOT_AUTHED

    Association but not authenticated

  enumerator WIFI_REASON_DISASSOC_PWRCAP_BAD

    Disassociated due to poor power capability

  enumerator WIFI_REASON_DISASSOC_SUPCHAN_BAD

    Disassociated due to unsupported channel

  enumerator WIFI_REASON_BSS_TRANSITION_DISASSOC

    Disassociated due to BSS transition

  enumerator WIFI_REASON_IE_INVALID

    Invalid Information Element (IE)

  enumerator WIFI_REASON_MIC_FAILURE

    MIC failure

  enumerator WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT

    4-way handshake timeout

  enumerator WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT

    Group key update timeout

  enumerator WIFI_REASON_IE_IN_4WAY_DIFFERS

    IE differs in 4-way handshake

  enumerator WIFI_REASON_GROUP_CIPHER_INVALID

    Invalid group cipher

  enumerator WIFI_REASON_PAIRWISE_CIPHER_INVALID

    Invalid pairwise cipher

  enumerator WIFI_REASON_AKMP_INVALID

    Invalid AKMP

  enumerator WIFI_REASON_UNSUPP_RSN_IE_VERSION

    Unsupported RSN IE version

  enumerator WIFI_REASON_INVALID_RSN_IE_CAP

    Invalid RSN IE capabilities

  enumerator WIFI_REASON_802_1X_AUTH_FAILED

    802.1X authentication failed

  enumerator WIFI_REASON_CIPHER_SUITE_REJECTED

    Cipher suite rejected

  enumerator WIFI_REASON_TDLS_PEER_UNREACHABLE

    TDLS peer unreachable

  enumerator WIFI_REASON_TDLS_UNSPECIFIED

    TDLS unspecified

  enumerator WIFI_REASON_SSP_REQUESTED_DISASSOC

    SSP requested disassociation

  enumerator WIFI_REASON_NO_SSP_ROAMING_AGREEMENT

    No SSP roaming agreement

  enumerator WIFI_REASON_BAD_CIPHER_OR_AKM

    Bad cipher or AKM

  enumerator WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION

    Not authorized in this location

  enumerator WIFI_REASON_SERVICE_CHANGE_PERCLUDES_TS

    Service change precludes TS

  enumerator WIFI_REASON_UNSPECIFIED_QOS

    Unspecified QoS reason

  enumerator WIFI_REASON_NOT_ENOUGH_BANDWIDTH

    Not enough bandwidth

  enumerator WIFI_REASON_MISSING_ACKS

    Missing ACKs

  enumerator WIFI_REASON_EXCEEDED_TXOP

    Exceeded TXOP

  enumerator WIFI_REASON_STA_LEAVING

    Station leaving

  enumerator WIFI_REASON_END_BA

    End of Block Ack (BA)

  enumerator WIFI_REASON_UNKNOWN_BA

    Unknown Block Ack (BA)

  enumerator WIFI_REASON_TIMEOUT

    Timeout

  enumerator WIFI_REASON_PEER_INITIATED

    Peer initiated disassociation

  enumerator WIFI_REASON_AP_INITIATED

    AP initiated disassociation

  enumerator WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT

    Invalid FT action frame count

  enumerator WIFI_REASON_INVALID_PMKID

    Invalid PMKID

  enumerator WIFI_REASON_INVALID_MDE

    Invalid MDE

  enumerator WIFI_REASON_INVALID_FTE

    Invalid FTE

  enumerator WIFI_REASON_TRANSMISSION_LINK_ESTABLISH_FAILED

    Transmission link establishment failed

  enumerator WIFI_REASON_ALTERATIVE_CHANNEL_OCCUPIED

    Alternative channel occupied

  enumerator WIFI_REASON_BEACON_TIMEOUT

    Beacon timeout

  enumerator WIFI_REASON_NO_AP_FOUND

    No AP found

  enumerator WIFI_REASON_AUTH_FAIL

    Authentication failed

  enumerator WIFI_REASON_ASSOC_FAIL

    Association failed

  enumerator WIFI_REASON_HANDSHAKE_TIMEOUT

    Handshake timeout

  enumerator WIFI_REASON_CONNECTION_FAIL

    Connection failed

  enumerator WIFI_REASON_AP_TSF_RESET

    AP TSF reset

  enumerator WIFI_REASON_ROAMING

    Roaming

  enumerator WIFI_REASON_ASSOC_COMEBACK_TIME_TOO_LONG

    Association comeback time too long

  enumerator WIFI_REASON_SA_QUERY_TIMEOUT

    SA query timeout

  enumerator WIFI_REASON_NO_AP_FOUND_W_COMPATIBLE_SECURITY

    No AP found with compatible security

  enumerator WIFI_REASON_NO_AP_FOUND_IN_AUTHMODE_THRESHOLD

    No AP found in auth mode threshold

  enumerator WIFI_REASON_NO_AP_FOUND_IN_RSSI_THRESHOLD

    No AP found in RSSI threshold

enum wifi_second_chan_t

  Wi-Fi second channel type.

  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

enum wifi_scan_type_t

  Wi-Fi scan type.

  Values:

  enumerator WIFI_SCAN_TYPE_ACTIVE

    Active scan

  enumerator WIFI_SCAN_TYPE_PASSIVE

    Passive scan

enum wifi_cipher_type_t

  Wi-Fi cipher type.

  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

enum wifi_bandwidth_t

  Wi-Fi bandwidth type.

  Values:

  enumerator WIFI_BW_HT20

    Bandwidth is HT20

  enumerator WIFI_BW20

    Bandwidth is 20 MHz

  enumerator WIFI_BW_HT40

    Bandwidth is HT40

  enumerator WIFI_BW40

    Bandwidth is 40 MHz

  enumerator WIFI_BW80

    Bandwidth is 80 MHz

  enumerator WIFI_BW160

    Bandwidth is 160 MHz

  enumerator WIFI_BW80_BW80

    Bandwidth is 80 + 80 MHz

enum wifi_ant_t

  Wi-Fi antenna.

  Values:

  enumerator WIFI_ANT_ANT0

    Wi-Fi antenna 0

  enumerator WIFI_ANT_ANT1

    Wi-Fi antenna 1

  enumerator WIFI_ANT_MAX

    Invalid Wi-Fi antenna

enum wifi_scan_method_t

  Wi-Fi scan method.

  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

enum wifi_sort_method_t

  Wi-Fi sort AP method.

  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

enum wifi_ps_type_t

  Wi-Fi power save type.

  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

enum wifi_band_t

  Argument structure for Wi-Fi band.

  Values:

  enumerator WIFI_BAND_2G

    Band is 2.4 GHz

  enumerator WIFI_BAND_5G

    Band is 5 GHz

enum wifi_band_mode_t

  Argument structure for Wi-Fi band mode.

  Values:

  enumerator WIFI_BAND_MODE_2G_ONLY

    Wi-Fi band mode is 2.4 GHz only

  enumerator WIFI_BAND_MODE_5G_ONLY

    Wi-Fi band mode is 5 GHz only

  enumerator WIFI_BAND_MODE_AUTO

    Wi-Fi band mode is 2.4 GHz + 5 GHz

enum wifi_2g_channel_bit_t

  Argument structure for 2.4G channels

  Values:

  enumerator WIFI_CHANNEL_1

    Wi-Fi channel 1

  enumerator WIFI_CHANNEL_2

    Wi-Fi channel 2

  enumerator WIFI_CHANNEL_3

    Wi-Fi channel 3

  enumerator WIFI_CHANNEL_4

    Wi-Fi channel 4

  enumerator WIFI_CHANNEL_5

    Wi-Fi channel 5

  enumerator WIFI_CHANNEL_6

    Wi-Fi channel 6

  enumerator WIFI_CHANNEL_7

    Wi-Fi channel 7

  enumerator WIFI_CHANNEL_8

    Wi-Fi channel 8

  enumerator WIFI_CHANNEL_9

    Wi-Fi channel 9

  enumerator WIFI_CHANNEL_10

    Wi-Fi channel 10

  enumerator WIFI_CHANNEL_11

    Wi-Fi channel 11

  enumerator WIFI_CHANNEL_12

    Wi-Fi channel 12

  enumerator WIFI_CHANNEL_13

    Wi-Fi channel 13

  enumerator WIFI_CHANNEL_14

    Wi-Fi channel 14

enum wifi_5g_channel_bit_t

  Argument structure for 5G channels

  Values:

  enumerator WIFI_CHANNEL_36

    Wi-Fi channel 36

  enumerator WIFI_CHANNEL_40

    Wi-Fi channel 40

  enumerator WIFI_CHANNEL_44

    Wi-Fi channel 44

  enumerator WIFI_CHANNEL_48

    Wi-Fi channel 48

  enumerator WIFI_CHANNEL_52

    Wi-Fi channel 52

  enumerator WIFI_CHANNEL_56

    Wi-Fi channel 56

  enumerator WIFI_CHANNEL_60

    Wi-Fi channel 60

  enumerator WIFI_CHANNEL_64

    Wi-Fi channel 64

  enumerator WIFI_CHANNEL_100

    Wi-Fi channel 100

  enumerator WIFI_CHANNEL_104

    Wi-Fi channel 104

  enumerator WIFI_CHANNEL_108

    Wi-Fi channel 108

  enumerator WIFI_CHANNEL_112

    Wi-Fi channel 112

  enumerator WIFI_CHANNEL_116

    Wi-Fi channel 116

  enumerator WIFI_CHANNEL_120

    Wi-Fi channel 120

  enumerator WIFI_CHANNEL_124

    Wi-Fi channel 124

  enumerator WIFI_CHANNEL_128

    Wi-Fi channel 128

  enumerator WIFI_CHANNEL_132

    Wi-Fi channel 132

  enumerator WIFI_CHANNEL_136

    Wi-Fi channel 136

  enumerator WIFI_CHANNEL_140

    Wi-Fi channel 140

  enumerator WIFI_CHANNEL_144

    Wi-Fi channel 144

  enumerator WIFI_CHANNEL_149

    Wi-Fi channel 149

  enumerator WIFI_CHANNEL_153

    Wi-Fi channel 153

  enumerator WIFI_CHANNEL_157

    Wi-Fi channel 157

  enumerator WIFI_CHANNEL_161

    Wi-Fi channel 161

  enumerator WIFI_CHANNEL_165

    Wi-Fi channel 165

  enumerator WIFI_CHANNEL_169

    Wi-Fi channel 169

  enumerator WIFI_CHANNEL_173

    Wi-Fi channel 173

  enumerator WIFI_CHANNEL_177

    Wi-Fi channel 177

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

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

enum wifi_storage_t

  Wi-Fi storage type.

  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

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

    Beacon frame

  enumerator WIFI_VND_IE_TYPE_PROBE_REQ

    Probe request frame

  enumerator WIFI_VND_IE_TYPE_PROBE_RESP

    Probe response frame

  enumerator WIFI_VND_IE_TYPE_ASSOC_REQ

    Association request frame

  enumerator WIFI_VND_IE_TYPE_ASSOC_RESP

    Association response frame

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

    Vendor ID element 0

  enumerator WIFI_VND_IE_ID_1

    Vendor ID element 1

enum wifi_phy_mode_t

  Operation PHY mode.

  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_11A

    PHY mode for 11a

  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_VHT20

    PHY mode for Bandwidth VHT20

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, indicates '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.

enum wifi_ant_mode_t

  Wi-Fi antenna mode.

  Values:

  enumerator WIFI_ANT_MODE_ANT0

    Enable Wi-Fi antenna 0 only

  enumerator WIFI_ANT_MODE_ANT1

    Enable Wi-Fi antenna 1 only

  enumerator WIFI_ANT_MODE_AUTO

    Enable Wi-Fi antenna 0 and 1, automatically select an antenna

  enumerator WIFI_ANT_MODE_MAX

    Invalid Wi-Fi enabled antenna

enum wifi_roc_done_status_t

  Status codes for WIFI_EVENT_ROC_DONE evt

  Values:

  enumerator WIFI_ROC_DONE

    ROC operation was completed successfully

  enumerator WIFI_ROC_FAIL

    ROC operation was cancelled

enum wifi_nan_svc_proto_t

  Protocol types in NAN service specific info attribute.

  Values:

  enumerator WIFI_SVC_PROTO_RESERVED

    Value 0 Reserved

  enumerator WIFI_SVC_PROTO_BONJOUR

    Bonjour Protocol

  enumerator WIFI_SVC_PROTO_GENERIC

    Generic Service Protocol

  enumerator WIFI_SVC_PROTO_CSA_MATTER

    CSA Matter specific protocol

  enumerator WIFI_SVC_PROTO_MAX

    Values 4-255 Reserved

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

enum wifi_phy_rate_t

  Wi-Fi PHY rate encodings.

  备注

  Rate Table: MCS Rate and Guard Interval Information

  MCS RATE | HT20 | HT40 | HE20 | VHT20
  --- | --- | --- | --- | ---
  WIFI_PHY_RATE_MCS0_LGI | 6.5 Mbps (800 ns) | 13.5 Mbps (800 ns) | 8.1 Mbps (1600 ns) | 6.5 Mbps (800 ns)
  WIFI_PHY_RATE_MCS1_LGI | 13 Mbps (800 ns) | 27 Mbps (800 ns) | 16.3 Mbps (1600 ns) | 13 Mbps (800 ns)
  WIFI_PHY_RATE_MCS2_LGI | 19.5 Mbps (800 ns) | 40.5 Mbps (800 ns) | 24.4 Mbps (1600 ns) | 19.5 Mbps (800 ns)
  WIFI_PHY_RATE_MCS3_LGI | 26 Mbps (800 ns) | 54 Mbps (800 ns) | 32.5 Mbps (1600 ns) | 26 Mbps (800 ns)
  WIFI_PHY_RATE_MCS4_LGI | 39 Mbps (800 ns) | 81 Mbps (800 ns) | 48.8 Mbps (1600 ns) | 39 Mbps (800 ns)
  WIFI_PHY_RATE_MCS5_LGI | 52 Mbps (800 ns) | 108 Mbps (800 ns) | 65 Mbps (1600 ns) | 52 Mbps (800 ns)
  WIFI_PHY_RATE_MCS6_LGI | 58.5 Mbps (800 ns) | 121.5 Mbps (800 ns) | 73.1 Mbps (1600 ns) | 58.5 Mbps (800 ns)
  WIFI_PHY_RATE_MCS7_LGI | 65 Mbps (800 ns) | 135 Mbps (800 ns) | 81.3 Mbps (1600 ns) | 65 Mbps (800 ns)
  WIFI_PHY_RATE_MCS8_LGI |  |  | 97.5 Mbps (1600 ns) |
  WIFI_PHY_RATE_MCS9_LGI |  |  | 108.3 Mbps (1600 ns) |

  备注

  MCS RATE | HT20 | HT40 | HE20 | VHT20
  --- | --- | --- | --- | ---
  WIFI_PHY_RATE_MCS0_SGI | 7.2 Mbps (400 ns) | 15 Mbps (400 ns) | 8.6 Mbps (800 ns) | 7.2 Mbps (400 ns)
  WIFI_PHY_RATE_MCS1_SGI | 14.4 Mbps (400 ns) | 30 Mbps (400 ns) | 17.2 Mbps (800 ns) | 14.4 Mbps (400 ns)
  WIFI_PHY_RATE_MCS2_SGI | 21.7 Mbps (400 ns) | 45 Mbps (400 ns) | 25.8 Mbps (800 ns) | 21.7 Mbps (400 ns)
  WIFI_PHY_RATE_MCS3_SGI | 28.9 Mbps (400 ns) | 60 Mbps (400 ns) | 34.4 Mbps (800 ns) | 28.9 Mbps (400 ns)
  WIFI_PHY_RATE_MCS4_SGI | 43.3 Mbps (400 ns) | 90 Mbps (400 ns) | 51.6 Mbps (800 ns) | 43.3 Mbps (400 ns)
  WIFI_PHY_RATE_MCS5_SGI | 57.8 Mbps (400 ns) | 120 Mbps (400 ns) | 68.8 Mbps (800 ns) | 57.8 Mbps (400 ns)
  WIFI_PHY_RATE_MCS6_SGI | 65 Mbps (400 ns) | 135 Mbps (400 ns) | 77.4 Mbps (800 ns) | 65 Mbps (400 ns)
  WIFI_PHY_RATE_MCS7_SGI | 72.2 Mbps (400 ns) | 150 Mbps (400 ns) | 86 Mbps (800 ns) | 72.2 Mbps (400 ns)
  WIFI_PHY_RATE_MCS8_SGI |  |  | 103.2 Mbps (800 ns) |
  WIFI_PHY_RATE_MCS9_SGI |  |  | 114.7 Mbps (800 ns) |

  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

  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

    Espressif-specific Long Range mode rate, 250 Kbps

  enumerator WIFI_PHY_RATE_LORA_500K

    Espressif-specific Long Range mode rate, 500 Kbps

  enumerator WIFI_PHY_RATE_MAX

enum wifi_event_t

  Wi-Fi event declarations.

  Values:

  enumerator WIFI_EVENT_WIFI_READY

    Wi-Fi 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_BTWT_SETUP

    bTWT setup

  enumerator WIFI_EVENT_BTWT_TEARDOWN

    bTWT teardown

  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

    Wi-Fi home channel change，doesn't occur when scanning

  enumerator WIFI_EVENT_STA_NEIGHBOR_REP

    Received Neighbor Report response

  enumerator WIFI_EVENT_AP_WRONG_PASSWORD

    a station tried to connect with wrong password

  enumerator WIFI_EVENT_STA_BEACON_OFFSET_UNSTABLE

    Station sampled beacon offset unstable

  enumerator WIFI_EVENT_DPP_URI_READY

    DPP URI is ready through Bootstrapping

  enumerator WIFI_EVENT_DPP_CFG_RECVD

    Config received via DPP Authentication

  enumerator WIFI_EVENT_DPP_FAILED

    DPP failed

  enumerator WIFI_EVENT_MAX

    Invalid Wi-Fi event ID

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_RECV_DEAUTH

    Recv deauth from AP while wps handshake

  enumerator WPS_FAIL_REASON_MAX

    Max WPS fail reason

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

enum wifi_action_tx_status_type_t

  Status codes for WIFI_EVENT_ACTION_TX_STATUS evt There will be back to back events in success case TX_DONE and TX_DURATION_COMPLETED

  Values:

  enumerator WIFI_ACTION_TX_DONE

    ACTION_TX operation was completed successfully

  enumerator WIFI_ACTION_TX_FAILED

    ACTION_TX operation failed during tx

  enumerator WIFI_ACTION_TX_DURATION_COMPLETED

    ACTION_TX operation completed it's wait duration

  enumerator WIFI_ACTION_TX_OP_CANCELLED

    ACTION_TX operation was cancelled by application or higher priority operation

enum wps_fail_reason_t

  WPS fail reason.

  Values:

  enumerator WPS_AP_FAIL_REASON_NORMAL

    WPS normal fail reason

  enumerator WPS_AP_FAIL_REASON_CONFIG

    WPS failed due to incorrect config

  enumerator WPS_AP_FAIL_REASON_AUTH

    WPS failed during auth

  enumerator WPS_AP_FAIL_REASON_MAX

    Max WPS fail reason

enum wifi_tx_status_t

  Status of wifi sending data.

  Values:

  enumerator WIFI_SEND_SUCCESS

    Sending Wi-Fi data successfully

  enumerator WIFI_SEND_FAIL

    Sending Wi-Fi data fail

### 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 on `wpa_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().

  备注

  Calling this will reset all eap configuration set using esp_eap_client_xxx APIs. Please call esp_eap_client_XXX APIs again to set new config after calling this function.

  返回:

    - 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.

void esp_wifi_set_okc_support(bool enable)

  Set Opportunistic key caching support for station.

  参数:

    enable -- Boolean indicating whether to enable (true) or disable (false) OKC support.

esp_err_t esp_eap_client_set_domain_name(const char *domain_name)

  Set the domain name for certificate validation.

  This function sets the expected domain name for validating the certificate's subject name. If the provided domain name does not match the certificate's subject name, validation will fail.

  Attention

    1. The `domain_name` should be a NULL-terminated string.

  参数:

    domain_name -- [in] The expected domain name. Pass `NULL` to clear the domain matching.

  返回:

    - ESP_OK: The domain match was set successfully.

    - ESP_ERR_INVALID_ARG: Invalid argument (length > 255).

    - ESP_ERR_NO_MEM: Memory allocation failure.

    - ESP_ERR_NOT_SUPPORTED: Feature not supported.

esp_err_t esp_eap_client_set_eap_methods(esp_eap_method_t methods)

  Set one or more EAP (Extensible Authentication Protocol) methods to be used by the EAP client.

  This API sets the allowed EAP authentication methods using a bitmask. Multiple methods can be specified by OR-ing together values from `esp_eap_method_t`.

  备注

  If this API is not called, all supported EAP methods will be considered. If one or more methods are set using this API, only the specified methods will be considered.

  参数:

    methods -- [in] Bitmask of EAP methods to enable.

  返回:

    - ESP_OK on success

    - ESP_ERR_INVALID_ARG if none of the methods are valid

### 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.

  Public Members

  int fast_provisioning

    Enable or disable Fast Provisioning in EAP-FAST (0 = disabled, 1 = enabled)

  int fast_max_pac_list_len

    Maximum length of the PAC (Protected Access Credential) list

  bool fast_pac_format_binary

    Set to true for binary format PAC, false for ASCII format PAC

### 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)

enum esp_eap_method_t

  Bitmask of supported EAP authentication methods.

  Values:

  enumerator ESP_EAP_TYPE_NONE

    No EAP method defined

  enumerator ESP_EAP_TYPE_TLS

    EAP-TLS method

  enumerator ESP_EAP_TYPE_TTLS

    EAP-TTLS method

  enumerator ESP_EAP_TYPE_PEAP

    EAP-PEAP method

  enumerator ESP_EAP_TYPE_FAST

    EAP-FAST method

  enumerator ESP_EAP_TYPE_ALL

    All supported EAP methods

### Header File

- components/wpa_supplicant/esp_supplicant/include/esp_wps.h

- 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 on `wpa_supplicant`, add the following to your CMakeLists.txt:

  >     REQUIRES wpa_supplicant

  > or

  >     PRIV_REQUIRES wpa_supplicant

### 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.

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.

### Header File

- components/wpa_supplicant/esp_supplicant/include/esp_rrm.h

- 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 on `wpa_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.

  Deprecated:

    This function is deprecated and will be removed in the future. Please use 'esp_rrm_send_neighbor_report_request'

  参数:

    - cb -- callback function for neighbor report

    - cb_ctx -- callback context

  返回:

    - 0: success

    - -1: AP does not support RRM

    - -2: station not connected to AP

int esp_rrm_send_neighbor_report_request(void)

  Send Radio measurement neighbor report request to connected AP.

  返回:

    - 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

- components/wpa_supplicant/esp_supplicant/include/esp_wnm.h

- 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 on `wpa_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 transition 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

### Header File

- components/wpa_supplicant/esp_supplicant/include/esp_mbo.h

- 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 on `wpa_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

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

### 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

此文档对您有帮助吗？

- 反馈已收到，谢谢！
- 如果您有其他意见，欢迎填写乐鑫文档反馈表。

- 我们重视您的反馈。
- 您可以填写乐鑫文档反馈表告诉我们如何改进该文档。