这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

WiFi API 参考

API 参考

int wm_wifi_init(void)

Initialize WiFi Allocate resource for WiFi. This WiFi also starts WiFi task.

Attention

This API must be called before all other WiFi API can be called

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_deinit(void)

Deinit WiFi Free all resource allocated in wm_wifi_init and stop WiFi task.

Attention

This API should be called if you want to remove WiFi driver from the system

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_set_config(wm_wifi_interface_t interface, wm_wifi_config_t *conf)

Set the configuration of STA or AP.

Attention

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

2. Limited to only one channel, so when in the softap+station mode, the softap will adjust its channel automatically to be the same as the channel of the station.

参数:
  • interface – interface

  • conf – station or softap configuration

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_config(wm_wifi_interface_t interface, wm_wifi_config_t *conf)

Get configuration of specified interface.

参数:
  • interface – interface

  • conf[out] station or softap configuration

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_protocol(wm_wifi_interface_t ifx, wm_wifi_protocol_type_t protocol)

Set protocol type of specified interface The default protocol is (WM_WIFI_PROTOCOL_11B|WM_WIFI_PROTOCOL_11G|WM_WIFI_PROTOCOL_11N)

Attention

Currently only support 802.11b or 802.11bg or 802.11bgn mode

参数:
  • ifx – interfaces

  • protocol – WiFi protocol bitmap

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_protocol(wm_wifi_interface_t ifx, wm_wifi_protocol_type_t *protocol)

Get the current protocol bitmap of the specified interface.

参数:
  • ifx – interface

  • protocol[out] store current WiFi protocol bitmap of interface ifx

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_bandwidth(wm_wifi_interface_t ifx, wm_wifi_bandwidth_t bw)

Set the bandwidth of specified interface.

Attention

WM_WIFI_BW_HT40 is supported only when the interface support 11N

参数:
  • ifx – interface to be configured

  • bw – bandwidth

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_bandwidth(wm_wifi_interface_t ifx, wm_wifi_bandwidth_t *bw)

Get the bandwidth of specified interface.

参数:
  • ifx – interface to be configured

  • bw[out] store bandwidth of interface ifx

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_storage(wm_wifi_storage_t storage)

Set the WiFi API configuration storage type.

Attention

1. The default value is WM_WIFI_STORAGE_FLASH

参数:

storage – : storage type

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_restore(void)

Restore WiFi stack persistent settings to default values.

This function will reset settings made using the following APIs:

  • wm_wifi_set_bandwidth,

  • wm_wifi_set_protocol,

  • wm_wifi_set_config related

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_connect(void)

Connect WiFi station to the AP.

Attention

1. If connected to an AP, call wm_wifi_disconnect to disconnect.

Attention

2. It will reconnecting after received disconnect event.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_disconnect(void)

Disconnect WiFi station from the AP.

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_sta_get_ap_info(wm_wifi_ap_record_t *ap_info)

Get information of AP which the station is associated with.

Attention

When the obtained country information is empty, it means that the AP does not carry country information

参数:

ap_info – the wm_wifi_ap_record_t to hold AP information sta can get the connected ap’s phy mode info through the struct member phy_11n, phy_11ax in the wm_wifi_ap_record_t struct. For example, phy_11n = 1 imply that ap support 802.11n mode

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_scan_start(const wm_wifi_scan_config_t *config, bool block)

Scan all available APs.

参数:
  • config – configuration of scanning

  • block – if block is true, this API will block the caller until the scan is done, otherwise it will return immediately

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_scan_stop(void)

Stop the scan in process.

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_scan_get_ap_num(uint16_t *number)

Get number of APs found in last scan.

Attention

This API can only be called when the scan is completed, otherwise it may get wrong value.

参数:

number[out] store number of APIs found in last scan

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_scan_get_ap_records(uint16_t *number, wm_wifi_ap_record_t *ap_records)

Get AP list found in last scan.

参数:
  • number[inout] As input param, it stores max AP number ap_records can hold. As output param, it receives the actual AP number this API returns.

  • ap_records – wifi_ap_record_t array to hold the found APs

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_ap_start(void)

Create softap control block and start softap.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_ap_stop(void)

Stop softap and free softap control block.

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_ap_get_sta_list(wm_wifi_sta_list_t *sta)

Get STAs associated with softap.

Attention

SSC only API

参数:

sta[out] station list ap can get the connected sta’s phy mode info through the struct member phy_11n, phy_11ax in the wifi_sta_info_t struct. For example, phy_11n = 1 imply that sta support 802.11n mode

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid)

Get AID of STA connected with softap.

参数:
  • mac – STA’s mac address

  • aid[out] Store the AID corresponding to STA mac

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_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

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_deauth_sta_by_mac(uint8_t mac[6])

deauthenticate all stations or mac address equals to mac

参数:

mac – when mac all is 0xFF, deauthenticate all stations, otherwise deauthenticate station whose mac address is mac

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_set_ps(wm_wifi_ps_type_t type)

Set current WiFi power save type.

Attention

Default power save type is WM_WIFI_PS_MIN_MODEM.

参数:

type – power save type

返回:

WM_ERR_SUCCESS: succeed

int wm_wifi_get_ps(wm_wifi_ps_type_t *type)

Get current WiFi power save type.

Attention

Default power save type is WM_WIFI_PS_MIN_MODEM.

参数:

type[out] store current power save type

返回:

WM_ERR_SUCCESS: succeed

int wm_wifi_set_channel(uint8_t primary, wm_wifi_second_chan_t second)

Set primary/secondary channel.

Attention

1. When in station mode, this API should not be called when STA is scanning or connecting to an external AP

Attention

2. When in softap mode, this API should not be called when softap has connected to external STAs

Attention

3. When in station+softap mode, this API should not be called when in the scenarios described above

参数:
  • primary – for HT20, primary is the channel number, for HT40, primary is the primary channel

  • second – for HT20, second is ignored, for HT40, second is the second channel

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_channel(uint8_t *primary, wm_wifi_second_chan_t *second)

Get the primary/secondary channel.

参数:
  • primary – store current primary channel

  • second[out] store current second channel

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_mac(wm_wifi_interface_t ifx, const uint8_t mac[6])

Set MAC address of the WiFi station or the softap interface.

Attention

1. softap and station have different MAC addresses, do not set them to be the same.

Attention

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

Attention

3. Existing mac addresses in tcip/ip are not modified.

参数:
  • ifx – interface

  • mac – the MAC address

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_mac(wm_wifi_interface_t ifx, uint8_t mac[6])

Get mac of specified interface.

参数:
  • ifx – interface

  • mac[out] store mac of the interface ifx

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_promiscuous_rx_cb(wm_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

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_set_promiscuous(bool en)

Enable the promiscuous mode.

参数:

en – false - disable, true - enable

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_wifi_get_promiscuous(bool *en)

Get the promiscuous mode.

参数:

en[out] store the current status of promiscuous mode

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_promiscuous_filter(const wm_wifi_promiscuous_filter_t *filter)

Enable the promiscuous mode packet type filter.

备注

The default filter is to filter all packets except WM_WIFI_PKT_MISC

参数:

filter – the packet type filtered in promiscuous mode.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_promiscuous_filter(wm_wifi_promiscuous_filter_t *filter)

Get the promiscuous filter.

参数:

filter[out] store the current status of promiscuous filter

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_promiscuous_ctrl_filter(const wm_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.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_promiscuous_ctrl_filter(wm_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

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_80211_tx(wm_wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq)

Send raw ieee80211 data.

参数:
  • 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.

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

返回:

  • WM_ERR_SUCCESS: success

  • others: failed

int wm_wifi_config_80211_tx_rate(wm_wifi_interface_t ifx, wm_wifi_phy_rate_t rate)

Config 80211 tx rate of specified interface.

参数:
  • ifx – Interface to be configured.

  • rate – Phy rate to be configured.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_inactive_time(wm_wifi_interface_t ifx, uint16_t sec)

Set the inactive time of 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.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_inactive_time(wm_wifi_interface_t ifx, uint16_t *sec)

Get inactive time of specified interface.

参数:
  • ifx – Interface to be configured.

  • sec – Inactive time. Unit seconds.

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_rssi_threshold(int32_t rssi)

Set RSSI threshold below which APP will get an event.

Attention

This API needs to be called every time after WM_EVENT_WIFI_STA_BSS_RSSI_LOW event is received.

参数:

rssi – threshold value in dbm between -100 to 0

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_set_country_code(const char country[3])

configure country

Attention

1. The country configuration is stored into flash.

Attention

2. Supported country codes are “CN”,”JP”,”US”,”CA”, “AL”,”AM”,”AT”,”AZ”,”BA”,”BE”,”BG”,”BY”,”CH”,”CY”,”CZ”,”DE”, “DK”,”EE”,”EL”,”ES”,”FI”,”FR”,”GE”,”HR”,”HU”,”IE”,”IS”,”IT”, “LI”,”LT”,”LU”,”LV”,”MD”,”ME”,”MK”,”MT”,”NL”,”NO”,”PL”,”PT”, “RO”,”RS”,”RU”,”SE”,”SI”,”SK”,”TR”,”UA”,”UK”

Attention

3. The default country is “CN”.

参数:

country – the configured country ISO code

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_wifi_get_country_code(char country[3])

get the current country code

参数:

country – country code

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

数据结构参考

Defines

WM_WIFI_MAX_CONN_NUM

max number of stations which can connect to soft-AP

Typedefs

typedef void (*wm_wifi_promiscuous_cb_t)(wm_wifi_promiscuous_pkt_t *buf, wm_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 (wm_wifi_promiscuous_pkt_t or wm_wifi_pkt_rx_ctrl_t) indicated by ‘type’ parameter.

Param type:

promiscuous packet type.

Enums

enum wm_wifi_interface_t

Values:

enumerator WM_WIFI_IF_STA

station interface

enumerator WM_WIFI_IF_AP

soft-AP interface

enumerator WM_WIFI_IF_MAX
enum wm_wifi_second_chan_t

Values:

enumerator WM_WIFI_SECOND_CHAN_NONE

the channel width is HT20

enumerator WM_WIFI_SECOND_CHAN_ABOVE

the channel width is HT40 and the secondary channel is above the primary channel

enumerator WM_WIFI_SECOND_CHAN_BELOW

the channel width is HT40 and the secondary channel is below the primary channel

enum wm_wifi_auth_mode_t

Values:

enumerator WM_WIFI_AUTH_OPEN

authenticate mode : open

enumerator WM_WIFI_AUTH_WEP

authenticate mode : WEP

enumerator WM_WIFI_AUTH_WPA_PSK

authenticate mode : WPA_PSK

enumerator WM_WIFI_AUTH_WPA2_PSK

authenticate mode : WPA2_PSK

enumerator WM_WIFI_AUTH_WPA_WPA2_PSK

authenticate mode : WPA_WPA2_PSK

enumerator WM_WIFI_AUTH_WPA2_ENTERPRISE

authenticate mode : WPA2_ENTERPRISE

enumerator WM_WIFI_AUTH_WPA3_PSK

authenticate mode : WPA3_PSK

enumerator WM_WIFI_AUTH_WPA2_WPA3_PSK

authenticate mode : WPA2_WPA3_PSK

enumerator WM_WIFI_AUTH_WAPI_PSK

authenticate mode : WAPI_PSK

enumerator WM_WIFI_AUTH_MAX
enum wm_wifi_cipher_type_t

Values:

enumerator WM_WIFI_CIPHER_TYPE_NONE

the cipher type is none

enumerator WM_WIFI_CIPHER_TYPE_WEP40

the cipher type is WEP40

enumerator WM_WIFI_CIPHER_TYPE_WEP104

the cipher type is WEP104

enumerator WM_WIFI_CIPHER_TYPE_TKIP

the cipher type is TKIP

enumerator WM_WIFI_CIPHER_TYPE_CCMP

the cipher type is CCMP

enumerator WM_WIFI_CIPHER_TYPE_TKIP_CCMP

the cipher type is TKIP and CCMP

enumerator WM_WIFI_CIPHER_TYPE_AES_CMAC128

the cipher type is AES-CMAC-128

enumerator WM_WIFI_CIPHER_TYPE_SMS4

the cipher type is SMS4

enumerator WM_WIFI_CIPHER_TYPE_GCMP

the cipher type is GCMP

enumerator WM_WIFI_CIPHER_TYPE_GCMP256

the cipher type is GCMP-256

enumerator WM_WIFI_CIPHER_TYPE_AES_GMAC128

the cipher type is AES-GMAC-128

enumerator WM_WIFI_CIPHER_TYPE_AES_GMAC256

the cipher type is AES-GMAC-256

enumerator WM_WIFI_CIPHER_TYPE_UNKNOWN

the cipher type is unknown

enum wm_wifi_country_policy_t

Values:

enumerator WM_WIFI_COUNTRY_POLICY_AUTO

Country policy is auto, use the country info of AP to which the station is connected

enumerator WM_WIFI_COUNTRY_POLICY_MANUAL

Country policy is manual, always use the configured country info

enum wm_wifi_scan_method_t

Values:

enumerator WM_WIFI_FAST_SCAN

Do fast scan, scan will end after find SSID match AP

enumerator WM_WIFI_ALL_CHANNEL_SCAN

All channel scan, scan will end after scan all the channel

enum wm_wifi_sort_method_t

Values:

enumerator WM_WIFI_CONNECT_AP_BY_SIGNAL

Sort match AP in scan list by RSSI

enumerator WM_WIFI_CONNECT_AP_BY_SECURITY

Sort match AP in scan list by security mode

enum wm_wifi_ps_type_t

Values:

enumerator WM_WIFI_PS_NONE

No power save

enumerator WM_WIFI_PS_MIN_MODEM

Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period

enumerator WM_WIFI_PS_MAX_MODEM

Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wm_wifi_sta_config_t

enum wm_wifi_protocol_type_t

Values:

enumerator WM_WIFI_PROTOCOL_11B
enumerator WM_WIFI_PROTOCOL_11G
enumerator WM_WIFI_PROTOCOL_11N
enumerator WM_WIFI_PROTOCOL_11AX
enum wm_wifi_bandwidth_t

Values:

enumerator WM_WIFI_BW_HT20
enumerator WM_WIFI_BW_HT40
enum wm_wifi_sae_pwe_method_t

Configuration for SAE PWE derivation

Values:

enumerator WM_SAE_PWE_UNSPECIFIED
enumerator WM_SAE_PWE_HUNT_AND_PECK
enumerator WM_SAE_PWE_HASH_TO_ELEMENT
enumerator WM_SAE_PWE_BOTH
enum wm_wifi_scan_type_t

Values:

enumerator WM_WIFI_SCAN_TYPE_ACTIVE

active scan

enumerator WM_WIFI_SCAN_TYPE_PASSIVE

passive scan

enum wm_wifi_storage_t

Values:

enumerator WM_WIFI_STORAGE_FLASH

all configuration will store in both memory and flash

enumerator WM_WIFI_STORAGE_RAM

all configuration will only store in the memory

enum wm_wifi_phy_rate_t

WiFi PHY rate encodings.

Values:

enumerator WM_WIFI_PHY_RATE_1M_L

1 Mbps with long preamble

enumerator WM_WIFI_PHY_RATE_2M_L

2 Mbps with long preamble

enumerator WM_WIFI_PHY_RATE_2M_S

2 Mbps with short preamble

enumerator WM_WIFI_PHY_RATE_5M_L

5.5 Mbps with long preamble

enumerator WM_WIFI_PHY_RATE_5M_S

5.5 Mbps with short preamble

enumerator WM_WIFI_PHY_RATE_11M_L

11 Mbps with long preamble

enumerator WM_WIFI_PHY_RATE_11M_S

11 Mbps with short preamble

enumerator WM_WIFI_PHY_RATE_6M

6 Mbps

enumerator WM_WIFI_PHY_RATE_9M

9 Mbps

enumerator WM_WIFI_PHY_RATE_12M

12 Mbps

enumerator WM_WIFI_PHY_RATE_18M

18 Mbps

enumerator WM_WIFI_PHY_RATE_24M

24 Mbps

enumerator WM_WIFI_PHY_RATE_36M

36 Mbps

enumerator WM_WIFI_PHY_RATE_48M

48 Mbps

enumerator WM_WIFI_PHY_RATE_54M

54 Mbps

enumerator WM_WIFI_PHY_RATE_MCS0_LGI

MCS0 with long GI, 6.5 Mbps for 20MHz, 13.5 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS1_LGI

MCS1 with long GI, 13 Mbps for 20MHz, 27 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS2_LGI

MCS2 with long GI, 19.5 Mbps for 20MHz, 40.5 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS3_LGI

MCS3 with long GI, 26 Mbps for 20MHz, 54 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS4_LGI

MCS4 with long GI, 39 Mbps for 20MHz, 81 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS5_LGI

MCS5 with long GI, 52 Mbps for 20MHz, 108 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS6_LGI

MCS6 with long GI, 58.5 Mbps for 20MHz, 121.5 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS7_LGI

MCS7 with long GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS0_SGI

MCS0 with short GI, 7.2 Mbps for 20MHz, 15 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS1_SGI

MCS1 with short GI, 14.4 Mbps for 20MHz, 30 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS2_SGI

MCS2 with short GI, 21.7 Mbps for 20MHz, 45 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS3_SGI

MCS3 with short GI, 28.9 Mbps for 20MHz, 60 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS4_SGI

MCS4 with short GI, 43.3 Mbps for 20MHz, 90 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS5_SGI

MCS5 with short GI, 57.8 Mbps for 20MHz, 120 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS6_SGI

MCS6 with short GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MCS7_SGI

MCS7 with short GI, 72.2 Mbps for 20MHz, 150 Mbps for 40MHz

enumerator WM_WIFI_PHY_RATE_MAX
enum wm_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 WM_WIFI_PKT_MGMT

Management frame, indicates ‘buf’ argument is wm_wifi_promiscuous_pkt_t

enumerator WM_WIFI_PKT_CTRL

Control frame, indicates ‘buf’ argument is wm_wifi_promiscuous_pkt_t

enumerator WM_WIFI_PKT_DATA

Data frame, indiciates ‘buf’ argument is wm_wifi_promiscuous_pkt_t

enumerator WM_WIFI_PKT_MISC

Other type, such as MIMO etc. ‘buf’ argument is wm_wifi_promiscuous_pkt_t but the payload is zero length.

enum wm_wifi_promiscuous_filter_type_t

Values:

enumerator WM_WIFI_PROMIS_FILTER_MASK_MGMT

filter the packets with type of WM_WIFI_PKT_MGMT

enumerator WM_WIFI_PROMIS_FILTER_MASK_CTRL

filter the packets with type of WM_WIFI_PKT_CTRL

enumerator WM_WIFI_PROMIS_FILTER_MASK_DATA

filter the packets with type of WM_WIFI_PKT_DATA

enumerator WM_WIFI_PROMIS_FILTER_MASK_MISC

filter the packets with type of WM_WIFI_PKT_MISC

enumerator WM_WIFI_PROMIS_FILTER_MASK_DATA_MPDU

filter the MPDU which is a kind of WM_WIFI_PKT_DATA

enumerator WM_WIFI_PROMIS_FILTER_MASK_DATA_AMPDU

filter the AMPDU which is a kind of WM_WIFI_PKT_DATA

enumerator WM_WIFI_PROMIS_FILTER_MASK_FCSFAIL

filter the FCS failed packets, do not open it in general

enumerator WM_WIFI_PROMIS_FILTER_MASK_ALL

filter all packets

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_WRAPPER

filter the control packets with subtype of Control Wrapper

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_BAR

filter the control packets with subtype of Block Ack Request

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_BA

filter the control packets with subtype of Block Ack

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_PSPOLL

filter the control packets with subtype of PS-Poll

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_RTS

filter the control packets with subtype of RTS

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_CTS

filter the control packets with subtype of CTS

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_ACK

filter the control packets with subtype of ACK

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_CFEND

filter the control packets with subtype of CF-END

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_CFENDACK

filter the control packets with subtype of CF-END+CF-ACK

enumerator WM_WIFI_PROMIS_CTRL_FILTER_MASK_ALL

filter all control packets

enum wm_wifi_reason_code_t

Values:

enumerator WM_WIFI_REASON_UNSPECIFIED
enumerator WM_WIFI_REASON_AUTH_EXPIRE
enumerator WM_WIFI_REASON_AUTH_LEAVE
enumerator WM_WIFI_REASON_ASSOC_EXPIRE
enumerator WM_WIFI_REASON_ASSOC_TOOMANY
enumerator WM_WIFI_REASON_NOT_AUTHED
enumerator WM_WIFI_REASON_NOT_ASSOCED
enumerator WM_WIFI_REASON_ASSOC_LEAVE
enumerator WM_WIFI_REASON_ASSOC_NOT_AUTHED
enumerator WM_WIFI_REASON_DISASSOC_PWRCAP_BAD
enumerator WM_WIFI_REASON_DISASSOC_SUPCHAN_BAD
enumerator WM_WIFI_REASON_BSS_TRANSITION_DISASSOC
enumerator WM_WIFI_REASON_IE_INVALID
enumerator WM_WIFI_REASON_MIC_FAILURE
enumerator WM_WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT
enumerator WM_WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT
enumerator WM_WIFI_REASON_IE_IN_4WAY_DIFFERS
enumerator WM_WIFI_REASON_GROUP_CIPHER_INVALID
enumerator WM_WIFI_REASON_PAIRWISE_CIPHER_INVALID
enumerator WM_WIFI_REASON_AKMP_INVALID
enumerator WM_WIFI_REASON_UNSUPP_RSN_IE_VERSION
enumerator WM_WIFI_REASON_INVALID_RSN_IE_CAP
enumerator WM_WIFI_REASON_CIPHER_SUITE_REJECTED
enumerator WM_WIFI_REASON_UNSPECIFIED_QOS_REASON
enumerator WM_WIFI_REASON_NOT_ENOUGH_BANDWIDTH
enumerator WM_WIFI_REASON_DISASSOC_LOW_ACK
enumerator WM_WIFI_REASON_EXCEEDED_TXOP
enumerator WM_WIFI_REASON_STA_LEAVING
enumerator WM_WIFI_REASON_TIMEOUT
enumerator WM_WIFI_REASON_INVALID_PMKID
enumerator WM_WIFI_REASON_NO_AP_FOUND
enumerator WM_WIFI_REASON_AUTH_FAIL
enumerator WM_WIFI_REASON_ASSOC_FAIL
enumerator WM_WIFI_REASON_BEACON_TIMEOUT
struct wm_wifi_country_t

Structure describing WiFi country-based regional restrictions.

Public Members

char cc[3]

country code string

uint8_t schan

start channel

uint8_t nchan

total channel number

int8_t max_tx_power

This field is used for getting WiFi maximum transmitting power.

wm_wifi_country_policy_t policy

country policy

struct wm_wifi_ap_record_t

Description of a WiFi AP.

Public Members

uint8_t bssid[6]

MAC address of AP

uint8_t ssid[33]

SSID of AP

uint8_t primary

channel of AP

wm_wifi_second_chan_t second

secondary channel of AP

int8_t rssi

signal strength of AP

wm_wifi_auth_mode_t authmode

authmode of AP

wm_wifi_cipher_type_t pairwise_cipher

pairwise cipher of AP

wm_wifi_cipher_type_t group_cipher

group cipher of AP

uint32_t phy_11n

bit: 0 flag to identify if 11n mode is enabled or not

uint32_t phy_11ax

bit: 1 flag to identify if 11ax mode is enabled or not

uint32_t wps

bit: 2 flag to identify if WPS is supported or not

uint32_t reserved

bit: 3..31 reserved

wm_wifi_country_t country

country information of AP

struct wm_wifi_scan_threshold_t

Structure describing parameters for a WiFi fast scan.

Public Members

int8_t rssi

The minimum rssi to accept in the fast scan mode

wm_wifi_auth_mode_t authmode

The weakest authmode to accept in the fast scan mode

struct wm_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 advertizes PMF capability.

bool required

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

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

struct wm_wifi_scan_time_t

Aggregate of active & passive scan time per channel.

Public Members

wm_wifi_active_scan_time_t active

active scan time per channel, units: millisecond.

uint32_t passive

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

struct wm_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 to scan AP whose SSID is hidden

wm_wifi_scan_type_t scan_type

scan type, active or passive

wm_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 wm_wifi_ap_config_t

Soft-AP configuration settings.

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

wm_wifi_auth_mode_t authmode

Auth mode of soft-AP. Do not support AUTH_WEP in soft-AP mode

uint8_t ssid_hidden

Broadcast SSID or not, default 0, broadcast the SSID

uint8_t max_connection

Max number of stations allowed to connect in, default 4, max 8

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

wm_wifi_cipher_type_t pairwise_cipher

pairwise cipher of SoftAP, group cipher will be derived using this. cipher values are valid starting from WM_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 WM_WIFI_CIPHER_TYPE_TKIP, WM_WIFI_CIPHER_TYPE_CCMP and WM_WIFI_CIPHER_TYPE_TKIP_CCMP.

wm_wifi_pmf_config_t pmf_cfg

Configuration for Protected Management Frame

wm_wifi_sae_pwe_method_t sae_pwe_h2e

Configuration for SAE PWE derivation method

struct wm_wifi_sta_config_t

STA configuration settings.

Public Members

uint8_t ssid[32]

SSID of target AP.

uint8_t password[64]

Password of target AP.

wm_wifi_scan_method_t scan_method

do all channel scan or fast scan

bool bssid_set

whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.

uint8_t bssid[6]

MAC address of target AP

uint8_t channel

channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.

uint16_t listen_interval

Listen interval for station to receive beacon when WM_WIFI_PS_MAX_MODEM is set. Units: AP beacon intervals. Defaults to 10 if set to 0.

wm_wifi_sort_method_t sort_method

sort the connect AP in the list by rssi or security mode

wm_wifi_scan_threshold_t threshold

When sort_method is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used.

wm_wifi_pmf_config_t pmf_cfg

Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE.

wm_wifi_sae_pwe_method_t sae_pwe_h2e

Configuration for SAE PWE derivation method

union wm_wifi_config_t

Configuration data for AP or STA.

The usage of this union (for ap or sta configuration) is determined by the accompanying interface argument passed to wm_wifi_set_config() or wm_wifi_get_config()

Public Members

wm_wifi_ap_config_t ap

configuration of AP

wm_wifi_sta_config_t sta

configuration of STA

struct wm_wifi_sta_info_t

Description of STA associated with AP.

Public Members

uint8_t mac[6]

mac address

uint16_t aid

the aid

uint32_t phy_11n

bit: 0 flag to identify if 11n mode is enabled or not

uint32_t phy_11ax

bit: 1 flag to identify if 11ax mode is enabled or not

uint32_t reserved

bit: 2..31 reserved

struct wm_wifi_sta_list_t

List of stations associated with the Soft-AP.

Public Members

wm_wifi_sta_info_t sta[(8)]

station list

int num

number of stations in the list (other entries are invalid)

struct wm_wifi_pkt_rx_ctrl_t

Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers.

Public Members

signed rssi

Received Signal Strength Indicator(RSSI) of packet. unit: dBm

unsigned rate

PHY rate encoding of the packet. Only valid for non HT(11bg) packet

unsigned sig_mode

0: non HT(11bg) packet; 1: HT(11n) packet; 3: HE(11ax) packet

unsigned mcs

Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 7(MSC0 ~ MCS7)

unsigned cwb

Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz

unsigned smoothing

reserved

unsigned not_sounding

reserved

unsigned aggregation

Aggregation. 0: MPDU packet; 1: AMPDU packet

unsigned stbc

Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet

unsigned fec_coding

Flag is set for 11n packets which are LDPC

unsigned sgi

Short Guide Interval(SGI). 0: Long GI; 1: Short GI

signed noise_floor

noise floor of Radio Frequency Module(RF). unit: 0.25dBm

unsigned ampdu_cnt

ampdu cnt

unsigned channel

primary channel on which this packet is received

unsigned secondary_channel

secondary channel on which this packet is received. 0: none; 1: above; 2: below

unsigned rx_state

state of the packet. 0: no error; others: error numbers which are not public

unsigned timestamp

timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: millisecond

unsigned sig_len

length of packet excluding Frame Check Sequence(FCS)

struct wm_wifi_promiscuous_pkt_t

Payload passed to ‘buf’ parameter of promiscuous mode RX callback.

Public Members

wm_wifi_pkt_rx_ctrl_t rx_ctrl

metadata header

uint8_t *payload

Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback.

struct wm_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 wm_wifi_promiscuous_filter_type_t