MT7687 API Reference  LinkIt SDK v4
WIFI

This section introduces the Wi-Fi driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, Wi-Fi function groups, enumerations, structures and functions. More...

Overview

This section introduces the Wi-Fi driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, Wi-Fi function groups, enumerations, structures and functions.

The Wi-Fi APIs are divided into three categories: Profile, Configuration and Connection. And there are four types of operation modes supported in Wi-Fi module: WIFI_MODE_STA_ONLY, WIFI_MODE_AP_ONLY, WIFI_MODE_REPEATER and WIFI_MODE_MONITOR.

Profile APIs get or set the profile in the Flash memory. The profile settings can be read by Wi-Fi profile get APIs. The profile settings can be used to initialize the Wi-Fi driver configuration at system boot up. There are many profile sections in the Flash memory, such as: STA, AP, common. Use the same profile section for WIFI_PORT_STA/WIFI_PORT_APCLI.

Configuration APIs get and set the Wi-Fi driver configuration. In most cases they take effect immediately, but there are some configuration APIs that only take effect by calling the wifi_config_reload_setting() API, such as:
wifi_config_set_pmk()
wifi_config_set_security_mode()
wifi_config_set_ssid()
wifi_config_set_wep_key()
wifi_config_set_wpa_psk_key()
The Configuration APIs include wifi_config_xxx APIs and wifi_wps_config_xxx APIs. They use in-band mechanism (in-band is a mechanism used for Wi-Fi driver and Wi-Fi firmware communication), thus these APIs must be called after OS task scheduler is started to make sure an in-band task is running. The wifi_wps_config_xxx APIs can be used to set or get default device configuration before triggering the Push Button Connection (PBC) or Personal Identification Number (PIN) process. The function wifi_config_register_rx_handler() registers wifi_rx_handler to manage the raw packet. There is a limitation calling this handler as it's using an in-band mechanism, it's restricted to call any in-band function similar to Wi-Fi Configuration or Wi-Fi Connection APIs in wifi_rx_handler.

The Connection APIs include wifi_connection_xxx APIs and wifi_wps_connection_xxx APIs. They manage the link status, such as disconnect AP, disconnect the station, get the link status, get the station list, start or stop the scan. Register an event handler for scan, connect or disconnect event. The Connection APIs use an in-band mechanism, thus these APIs must be called after the OS Task scheduler is started, to make sure an in-band task is running. The wifi_wps_connection_xxx APIs can be used to trigger the PBC or PIN process.

Terms Details
STA In station (STA) mode the device operates as a client that connects to a Wi-Fi access point.
AP In Access Point (AP) mode other devices can connect to the Wi-Fi access point.
APCLI In AP Client (APCLI) mode the Access Point becomes a wireless client for another AP.
DTIM Delivery Traffic Indication Message (DTIM) is how the AP (wireless router) warns its clients that it is about to transmit the multicast (and broadcast*) frames it queued up since the previous DTIM. For more information, please refer to introduction to DTIM in Wikipedia.
MCS Modulation and Coding Set (MCS) implies the packet data rate. For more information, please refer to introduction to MCS in Wikipedia.
WPS Wi-Fi Protected Setup (WPS) is a network security standard to create a secure wireless home network. For more information, please refer to introduction to WPS in Wikipedia.
PIN Personal identification number (PIN) is a method of WPS, has to be read from either a sticker or display on the new wireless device. This PIN must then be entered at the "representant" of the network, usually the network's AP. Alternately, a PIN provided by the AP may be entered into the new device. This method is the mandatory baseline mode and everything must support it. The Wi-Fi direct specification supersedes this requirement by stating that all devices with a keypad or display must support the PIN method.
PBC Push button (PBC) is a method of WPS. For more information, please refer to introduction to PBC in Wikipedia.
STBC Space-time Block Code (STBC) used in wireless telecommunications. Space-time block coding is a technique used in wireless communications to transmit multiple copies of a data stream across a number of antennas and to exploit the various received versions of the data to improve the reliability of data-transfer. For more information, please refer to introduction to STBC in Wikipedia.
FCS Frame Check Sequence (FCS) refers to the extra error-detecting code added to a frame in a communications protocol. For more information, please refer to introduction to FCS in Wikipedia.
Broadcast A communication where a piece of information is sent from one point to all other points.
Multicast A communication where a piece of information is sent from one or more points to a set of other points.
RTS Request to Send (RTS) is IEEE 802.11 control signal is an optional mechanism used by the 802.11 wireless networking protocol to reduce frame collisions. For more information, please refer to introduction to RTS in Wikipedia.
CTS Clear to Send (CTS) is IEEE 802.11 control signal is an optional mechanism used by the 802.11 wireless networking protocols to reduce frame collisions. For more information, please refer to introduction to CTS in Wikipedia.
RSSI Received Signal Strength Indication (RSSI). For more information, please refer to introduction to RSSI in Wikipedia.
Beacon Beacon frame is one of the management frames in IEEE 802.11 based WLANs.
WPA Wi-Fi Protected Access (WPA) is a wireless encryption standard. For more information, please refer to introduction to WPA in Wikipedia.
WPS Wi-Fi Protected Setup (WPS) is a network security standard. For more information, please refer to introduction to WPS in Wikipedia.
OPMODE Operate Mode (OPMODE) is STA/AP/APCLI.
PSK Pre-shared key (PSK) is a method to set encryption keys. For more information, please refer to introduction to PSK in Wikipedia.
PMK Pair-wise Master Key (PMK) is calculated from PSK.
WEP Wired Equivalent Privacy (WEP) is a wireless network security standard. For more information, please refer to introduction to WEP in Wikipedia.
WOW Wake on Wireless (WOW) is a technology that allows remote wake-up of workstations from a standby power state to facilitate device management.
TKIP Temporal Key Integrity Protocol (TKIP) is an algorithm used to secure wireless computer networks. For more information, please refer to introduction to TKIP in Wikipedia.
AES Advanced Encryption Standard process (AES) is a 'symmetric block cipher' for encrypting texts which can be decrypted with the original encryption key. For more information, please refer to introduction to AES in Wikipedia.
PHY PHY of the Open system interconnection (OSI) model and refers to the circuitry required to implement physical layer functions. For more information, please refer to introduction to PHY in Wikipedia.
BSS The basic service set (BSS) provides the basic building-block of an 802.11 wireless LAN. For more information, please refer to introduction to 802.11 network in Wikipedia.
IBSS With 802.11, one can set up an ad hoc network of client devices without a controlling access point; the result is called an IBSS (independent BSS). For more information, please refer to introduction to 802.11 network in Wikipedia.
MCS Modulation and Coding Scheme (MCS) is related to the maximum data rate and robustness of data transmission. For more information, please refer to introduction to Link adaptation in Wikipedia.
LDPC In information theory, a low-density parity-check (LDPC) code is a linear error correcting code, a method of transmitting a message over a noisy transmission channel. For more information, please refer to introduction to Low-density parity-check code in Wikipedia.
GI In telecommunications, guard intervals (GI) are used to ensure that distinct transmissions do not interfere with one another. For more information, please refer to introduction to Guard interval in Wikipedia.
MPDU MPDU stands for MAC protocol data unit.
TSC TKIP uses a per-MPDU TKIP sequence counter (TSC) to sequence the MPDUs it sends. The receiver drops MPDUs received out of order, i.e., not received with increasing sequence numbers.

Functions

void wifi_init (wifi_config_t *config, wifi_config_ext_t *config_ext)
 This function initializes the Wi-Fi module. More...
 
int32_t wifi_config_get_opmode (uint8_t *mode)
 This function receives the wireless operation mode of the Wi-Fi driver. More...
 
int32_t wifi_config_set_opmode (uint8_t mode)
 This function sets the Wi-Fi operation mode and it takes effect immediately. More...
 
int32_t wifi_config_get_mac_address (uint8_t port, uint8_t *address)
 This function gets the MAC address of a specific wireless port used by the Wi-Fi driver. More...
 
int32_t wifi_config_get_ssid (uint8_t port, uint8_t *ssid, uint8_t *ssid_length)
 This function gets the SSID and SSID length of a specific wireless port used by the Wi-Fi driver. More...
 
int32_t wifi_config_set_ssid (uint8_t port, uint8_t *ssid, uint8_t ssid_length)
 This function sets the SSID and SSID length that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_get_bssid (uint8_t *bssid)
 This function should be used only in station mode or in APCLI port of repeater mode. More...
 
int32_t wifi_config_set_bssid (uint8_t *bssid)
 This function should be used only in station mode or in APCLI port of repeater mode. More...
 
int32_t wifi_config_set_bandwidth (uint8_t port, uint8_t bandwidth)
 This function sets the bandwidth configuration that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_get_bandwidth (uint8_t port, uint8_t *bandwidth)
 This function gets the bandwidth configuration that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_set_channel (uint8_t port, uint8_t channel)
 This function sets the channel number that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_get_channel (uint8_t port, uint8_t *channel)
 This function gets the channel number that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_get_wireless_mode (uint8_t port, wifi_phy_mode_t *mode)
 This function gets the wireless mode that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_set_wireless_mode (uint8_t port, wifi_phy_mode_t mode)
 This function gets the wireless mode that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_set_country_code (wifi_country_code_t *wifi_country_code)
 Set the country code. More...
 
int32_t wifi_config_get_country_code (wifi_country_code_t *wifi_country_code)
 This function gets the country code string that the Wi-Fi driver uses. More...
 
int32_t wifi_config_get_country_region (uint8_t band, uint8_t *region)
 This function gets the country region that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_set_country_region (uint8_t band, uint8_t region)
 This function sets the country region that the Wi-Fi driver uses for a specific wireless port. More...
 
int32_t wifi_config_get_dtim_interval (uint8_t *interval)
 This function gets the DTIM interval used in the Wi-Fi driver in the SoftAP mode. More...
 
int32_t wifi_config_set_dtim_interval (uint8_t interval)
 This function sets the DTIM interval used in the Wi-Fi driver in the SoftAP mode. More...
 
int32_t wifi_config_get_listen_interval (uint8_t *interval)
 This function gets the beacon listen interval used in the Wi-Fi driver in a station mode. More...
 
int32_t wifi_config_set_listen_interval (uint8_t interval)
 This function sets the beacon listen interval used in the Wi-Fi driver in a station mode. More...
 
int32_t wifi_config_get_security_mode (uint8_t port, wifi_auth_mode_t *auth_mode, wifi_encrypt_type_t *encrypt_type)
 This function gets the authentication and encryption modes used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_set_security_mode (uint8_t port, wifi_auth_mode_t auth_mode, wifi_encrypt_type_t encrypt_type)
 This function sets the authentication and encryption modes used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_get_wpa_psk_key (uint8_t port, uint8_t *passphrase, uint8_t *passphrase_length)
 This function gets the password of the WPA-PSK or WPA2-PSK encryption type used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_set_wpa_psk_key (uint8_t port, uint8_t *passphrase, uint8_t passphrase_length)
 This function sets the password of the WPA-PSK or WPA2-PSK encryption type used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_get_pmk (uint8_t port, uint8_t *pmk)
 This function gets the PMK used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_set_pmk (uint8_t port, uint8_t *pmk)
 
int32_t wifi_config_get_wep_key (uint8_t port, wifi_wep_key_t *wep_keys)
 This function gets the WEP key group used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_set_wep_key (uint8_t port, wifi_wep_key_t *wep_keys)
 This function sets the WEP key group used in the Wi-Fi driver for a specific wireless port. More...
 
int32_t wifi_config_reload_setting (void)
 This function informs the wpa_supplicant to reload the configuration and applies the configuration settings of the Wi-Fi Configuration APIs. More...
 
int32_t wifi_config_register_rx_handler (wifi_rx_handler_t wifi_rx_handler)
 This function registers a handler to receive 802.11 raw packets from a network processor. More...
 
int32_t wifi_config_unregister_rx_handler (void)
 This function unregisters the handler to receive 802.11 raw packets from the network processor. More...
 
int32_t wifi_config_get_rx_filter (uint32_t *flag)
 This function gets the Wi-Fi RX filter used in the Wi-Fi driver. More...
 
int32_t wifi_config_set_rx_filter (uint32_t flag)
 This function sets the Wi-Fi RX filter used in the Wi-Fi driver. More...
 
int32_t wifi_config_get_smart_connection_filter (uint8_t *flag)
 This function gets MediaTek Smart Connection RX Filter used in the Wi-Fi driver. More...
 
int32_t wifi_config_set_smart_connection_filter (uint8_t flag)
 This function sets MediaTek Smart Connection RX Filter used in the Wi-Fi driver. More...
 
int32_t wifi_config_get_radio (uint8_t *on_off)
 This function gets the radio status of the Wi-Fi driver. More...
 
int32_t wifi_config_set_radio (uint8_t on_off)
 This function sets the radio status of the Wi-Fi driver. More...
 
int32_t wifi_connection_disconnect_ap (void)
 This function disconnects the current connection from AP. More...
 
int32_t wifi_connection_disconnect_sta (uint8_t *address)
 This function disconnects specific station's connection, and takes effect immediately. More...
 
int32_t wifi_connection_get_link_status (uint8_t *link_status)
 This function gets the current STA port's link up or link down connection status. More...
 
int32_t wifi_connection_scan_init (wifi_scan_list_item_t *ap_list, uint32_t max_count)
 This function initializes the scan table to the driver. More...
 
int32_t wifi_connection_scan_deinit (void)
 This function deinitializes the scan table. More...
 
int32_t wifi_connection_start_scan (uint8_t *ssid, uint8_t ssid_length, uint8_t *bssid, uint8_t scan_mode, uint8_t scan_option)
 This function starts Wi-Fi Scanning. More...
 
int32_t wifi_connection_stop_scan (void)
 This function stops the Wi-Fi Scanning triggered by wifi_connection_start_scan(). More...
 
int32_t wifi_connection_parse_beacon (uint8_t *pbuf, uint32_t len, wifi_scan_list_item_t *ap_data)
 This function parses the beacon or probe request packets. More...
 
int32_t wifi_connection_get_sta_list (uint8_t *number, wifi_sta_list_t *sta_list)
 This function gets the station list associated with the Wi-Fi, only for SoftAP mode. More...
 
int32_t wifi_connection_get_max_sta_number (uint8_t *sta_number)
 This function gets the maximum number of the supported stations in the AP mode or repeater mode. More...
 
int32_t wifi_connection_get_rssi (int8_t *rssi)
 This function gets the RSSI of the connected AP. More...
 
int32_t wifi_connection_register_event_handler (wifi_event_t event, wifi_event_handler_t handler)
 This function registers the Wi-Fi event handler. More...
 
int32_t wifi_connection_register_event_notifier (uint8_t event, wifi_event_handler_t notifier)
 
int32_t wifi_connection_unregister_event_handler (wifi_event_t event, wifi_event_handler_t handler)
 This function unregisters Wi-Fi event handler. More...
 
int32_t wifi_connection_unregister_event_notifier (uint8_t event, wifi_event_handler_t notifier)
 
int32_t wifi_profile_set_opmode (uint8_t mode)
 
int32_t wifi_profile_get_opmode (uint8_t *mode)
 
int32_t wifi_profile_set_channel (uint8_t port, uint8_t channel)
 
int32_t wifi_profile_get_channel (uint8_t port, uint8_t *channel)
 
int32_t wifi_profile_set_bandwidth (uint8_t port, uint8_t bandwidth)
 
int32_t wifi_profile_get_bandwidth (uint8_t port, uint8_t *bandwidth)
 
int32_t wifi_profile_get_mac_address (uint8_t port, uint8_t *address)
 
int32_t wifi_profile_set_mac_address (uint8_t port, uint8_t *address)
 
int32_t wifi_profile_set_ssid (uint8_t port, uint8_t *ssid, uint8_t ssid_length)
 
int32_t wifi_profile_get_ssid (uint8_t port, uint8_t *ssid, uint8_t *ssid_length)
 
int32_t wifi_profile_set_wireless_mode (uint8_t port, wifi_phy_mode_t mode)
 
int32_t wifi_profile_get_wireless_mode (uint8_t port, wifi_phy_mode_t *mode)
 
int32_t wifi_profile_set_security_mode (uint8_t port, wifi_auth_mode_t auth_mode, wifi_encrypt_type_t encrypt_type)
 
int32_t wifi_profile_get_security_mode (uint8_t port, wifi_auth_mode_t *auth_mode, wifi_encrypt_type_t *encrypt_type)
 
int32_t wifi_profile_set_wpa_psk_key (uint8_t port, uint8_t *passphrase, uint8_t passphrase_length)
 
int32_t wifi_profile_get_wpa_psk_key (uint8_t port, uint8_t *passphrase, uint8_t *passphrase_length)
 
int32_t wifi_profile_set_pmk (uint8_t port, uint8_t *pmk)
 
int32_t wifi_profile_get_pmk (uint8_t port, uint8_t *pmk)
 
int32_t wifi_profile_set_wep_key (uint8_t port, wifi_wep_key_t *wep_keys)
 
int32_t wifi_profile_get_wep_key (uint8_t port, wifi_wep_key_t *wep_keys)
 
int32_t wifi_profile_get_country_region (uint8_t band, uint8_t *region)
 
int32_t wifi_profile_set_country_region (uint8_t band, uint8_t region)
 
int32_t wifi_profile_get_dtim_interval (uint8_t *interval)
 
int32_t wifi_profile_set_dtim_interval (uint8_t interval)
 
int32_t wifi_profile_get_listen_interval (uint8_t *interval)
 
int32_t wifi_profile_set_listen_interval (uint8_t interval)
 
int32_t wifi_profile_set_power_save_mode (uint8_t power_save_mode)
 
int32_t wifi_profile_get_power_save_mode (uint8_t *power_save_mode)
 
int32_t wifi_profile_commit_setting (char *profile_section)
 
int32_t wifi_profile_get_profile (uint8_t port, wifi_profile_t *profile)
 
int32_t wifi_wps_config_get_pin_code (uint8_t port, uint8_t *pin_code)
 This function gets the pin code of a specific wireless port, the pin code may be different for each function call. More...
 
int32_t wifi_wps_connection_by_pbc (uint8_t port, uint8_t *bssid)
 This function triggers a WPS PBC process. More...
 
int32_t wifi_wps_connection_by_pin (uint8_t port, uint8_t *bssid, uint8_t *pin_code)
 This function triggers the WPS PIN process. More...
 
int32_t wifi_wps_config_set_device_info (wifi_wps_device_info_t *device_info)
 This function sets the WPS device information. More...
 
int32_t wifi_wps_config_get_device_info (wifi_wps_device_info_t *device_info)
 This function gets the WPS device information. More...
 
int32_t wifi_wps_config_set_auto_connection (bool auto_connection)
 This function controls the auto connection behavior after the WPS credential information is received by the Enrollee. More...
 
int32_t wifi_wps_config_get_auto_connection (bool *auto_connection)
 This function gets auto connection configuration. More...
 
int32_t wifi_connection_send_raw_packet (uint8_t *raw_packet, uint32_t length)
 This function sends a raw Wi-Fi packet over the air. More...
 

Modules

 Define
 
 Enumeration
 
 Structure
 
 Typedef
 

Function Documentation

int32_t wifi_config_get_bandwidth ( uint8_t  port,
uint8_t *  bandwidth 
)

This function gets the bandwidth configuration that the Wi-Fi driver uses for a specific wireless port.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]bandwidthis the wireless bandwidth.
Value Definition
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ 20MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ 40MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ 20 or 40MHz
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The default value is WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ.
int32_t wifi_config_get_bssid ( uint8_t *  bssid)

This function should be used only in station mode or in APCLI port of repeater mode.

Parameters
[out]bssidis the BSSID of the target AP that this station device or the APCLI port is connected to. If bssid is NULL, it indicates this device is not connected yet.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_channel ( uint8_t  port,
uint8_t *  channel 
)

This function gets the channel number that the Wi-Fi driver uses for a specific wireless port.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]channelis the channel number that the Wi-Fi driver uses for a specific wireless port. The channel number range is from 1 to 14 for 2.4GHz bandwidth. The specific channel number is determined by country region settings in the profile.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_country_code ( wifi_country_code_t wifi_country_code)

This function gets the country code string that the Wi-Fi driver uses.

Parameters
[out]country_codecontains the country code string, which is already set by wifi_config_set_country_code(), upon the return of this function call.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The Wi-Fi driver provides the country code already defined in wifi_country_code_t.
int32_t wifi_config_get_country_region ( uint8_t  band,
uint8_t *  region 
)

This function gets the country region that the Wi-Fi driver uses for a specific wireless port.

Various world regions have allocated different amounts of frequency space around 2.4GHz for Wi-Fi communication and some of them have fewer or more channels available than others. The region setting ensures that your router enables using the Wi-Fi channels valid only in user-specific location.

Parameters
[in]bandindicates the Wi-Fi bandwidth that the function will operate on.
Value Definition
WIFI_BAND_2_4_G 2.4GHz
WIFI_BAND_5_G 5GHz
Parameters
[out]regionindicates different channels in 2.4GHz and 5GHz.
region(2.4GHz) the channel list for different regions in 2.4GHz.
Value Definition
0 CH1-11 active scan
1 CH1-13 active scan
2 CH10-11 active scan
3 CH10-13 active scan
4 CH14 active scan
5 CH1-14 all active scan
6 CH3-9 active scan
7 CH5-13 active scan
31 CH1-11 active scan, CH12-14 passive scan
32 CH1-11 active scan, CH12-13 passive scan
33 CH1-14 all active scan
Parameters
region(5GHz) the channel list for different regions in 5GHz.
Value Definition
0 CH36-64 active scan, CH149-165 active scan
1 CH36-64 active scan, CH100-140 active scan
2 CH36-64 active scan
3 CH52-64 active scan, CH149-161 active scan
4 CH149-165 active scan
5 CH149-161 active scan
6 CH36-48 active scan
7 CH36-64 active scan, CH100-140 active scan, CH149-165 active scan
8 CH52-64 active scan
9 CH36-64 active scan, CH100-116 active scan, CH132-140 active scan, CH149-165 active scan
10 CH36-48 active scan, CH149-165 active scan
11 CH36-64 active scan, CH100-120 active scan, CH149-161 active scan
12 CH36-64 active scan, CH100-140 active scan
13 CH52-64 active scan, CH100-140 active scan, CH149-161 active scan
14 CH36-64 active scan, CH100-116 active scan, CH136-140 active scan, CH149-165 active scan
15 CH149-173 active scan
16 CH52-64 active scan, CH149-165 active scan
17 CH36-48 active scan, CH149-161 active scan
18 CH36-64 active scan, CH100-116 active scan, CH132-140 active scan
19 CH56-64 active scan, CH100-140 active scan, CH149-161 active scan
20 CH36-64 active scan, CH100-124 active scan, CH149-161 active scan
21 CH36-64 active scan, CH100-140 active scan, CH149-161 active scan
22 CH36-64 active scan
30 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan, CH149-165 active scan
31 CH52-64 passive scan, CH100-140 passive scan, CH149-165 active scan
32 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan, CH149-161 active scan
33 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan
34 CH36-48 active scan, CH52-64 passive scan, CH149-165 active scan
35 CH36-48 active scan, CH52-64 passive scan
36 CH36-48 active scan, CH100-140 passive scan, CH149-165 active scan
37 CH36-48 active scan, CH52-64 passive scan, CH149-165 active scan, CH173 active scan
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_dtim_interval ( uint8_t *  interval)

This function gets the DTIM interval used in the Wi-Fi driver in the SoftAP mode.

Depending on the value set in the SoftAP mode, the AP will buffer broadcast and multicast data and let clients know when to wake up to receive those data.

Parameters
[out]intervalbeacon intervals between 1 to 255. For more information, please refer to introduction to DTIM in Wikipedia.|
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_listen_interval ( uint8_t *  interval)

This function gets the beacon listen interval used in the Wi-Fi driver in a station mode.

Depending on the timing set in the station, the station in power saving mode resumes to listen to the beacon and receives buffered packets from the AP, if the TIM element in beacon frame indicates the AP has stored packets for specific station.

Parameters
[out]intervalis the beacon's interval in a range from 1 to 255. The beacon's interval is usually 100 times the unit (100*1.024 ms), which means, the listen interval range is around (1~255) * 102.4ms.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_mac_address ( uint8_t  port,
uint8_t *  address 
)

This function gets the MAC address of a specific wireless port used by the Wi-Fi driver.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]addressis the MAC address. The length of the MAC address is WIFI_MAC_ADDRESS_LENGTH in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
To get the MAC address, follow these steps:
  1. Read eFuse from address 0x00, take bytes 4 to 9 as the STA MAC address and generate AP address from it by increasing the last byte by 1.
  2. If NVDM is enabled, read NVDM from group "STA" and key "MacAddr" for STA MAC address and from group "AP" and key "MacAddr" for AP MAC address. If the MAC address is retrieved successfully in Step 1, skip Step 2. If no information is set in eFuse and NVDM, this function will return an error and consequently the Wi-Fi driver initialization will possibly fail, too.
int32_t wifi_config_get_opmode ( uint8_t *  mode)

This function receives the wireless operation mode of the Wi-Fi driver.

Parameters
[out]modeindicates the operation mode.
Value Definition
0x01 WIFI_MODE_STA_ONLY
0x02 WIFI_MODE_AP_ONLY
0x03 WIFI_MODE_REPEATER
0x04 WIFI_MODE_MONITOR
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_pmk ( uint8_t  port,
uint8_t *  pmk 
)

This function gets the PMK used in the Wi-Fi driver for a specific wireless port.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]pmkis pairwise master key, the shared secret key used in the IEEE 802.11 protocol.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_radio ( uint8_t *  on_off)

This function gets the radio status of the Wi-Fi driver.

Parameters
[out]on_offindicates the Wi-Fi radio is on or off.
Value Definition
0 OFF, the Wi-Fi radio is turned off, and Wi-Fi TX/RX is disabled.
1 ON, the Wi-Fi radio is turned on, and Wi-Fi TX/RX is enabled.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
This API is only supported in the station mode.
int32_t wifi_config_get_rx_filter ( uint32_t *  flag)

This function gets the Wi-Fi RX filter used in the Wi-Fi driver.

The RX filter setting provides the packet format to be received, such as broadcast, multicast or unicast frames.

Parameters
[out]flagis defined in wifi_rx_filter_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_security_mode ( uint8_t  port,
wifi_auth_mode_t auth_mode,
wifi_encrypt_type_t encrypt_type 
)

This function gets the authentication and encryption modes used in the Wi-Fi driver for a specific wireless port.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]auth_modeis the authentication mode. For details about this parameter, please refer to wifi_auth_mode_t.
[out]encrypt_typeis the encryption mode. For details about this parameter, please refer to wifi_encrypt_type_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_smart_connection_filter ( uint8_t *  flag)

This function gets MediaTek Smart Connection RX Filter used in the Wi-Fi driver.

When MediaTek Smart Connection filter is enabled, the data frames with ToDS=1, A3=multicast address will be received and delivered to the RX filter handler, other frames will be dropped. Call wifi_config_set_rx_filter() to receive other frames.

Parameters
[out]flagindicates if the smart connection function is enabled or disabled.
Value Definition
0 DISABLE
1 ENABLE
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_ssid ( uint8_t  port,
uint8_t *  ssid,
uint8_t *  ssid_length 
)

This function gets the SSID and SSID length of a specific wireless port used by the Wi-Fi driver.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]ssidis the SSID content. In STA mode, the SSID is the target AP's SSID;
In SoftAP mode, the SSID indicates the device's own SSID.
[out]ssid_lengthis the length of the SSID. The maximum length is WIFI_MAX_LENGTH_OF_SSID in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_wep_key ( uint8_t  port,
wifi_wep_key_t wep_keys 
)

This function gets the WEP key group used in the Wi-Fi driver for a specific wireless port.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]wep_keysis a pointer to the WEP keys. For more details, please refer to wifi_wep_key_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_wireless_mode ( uint8_t  port,
wifi_phy_mode_t mode 
)

This function gets the wireless mode that the Wi-Fi driver uses for a specific wireless port.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]modeis the wireless mode. For more information, please refer to wifi_phy_mode_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_get_wpa_psk_key ( uint8_t  port,
uint8_t *  passphrase,
uint8_t *  passphrase_length 
)

This function gets the password of the WPA-PSK or WPA2-PSK encryption type used in the Wi-Fi driver for a specific wireless port.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]passphraseis 8 to 63 bytes ASCII or 64 bytes hexadecimal.
[out]passphrase_lengthis the length range from 8 to 64.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_register_rx_handler ( wifi_rx_handler_t  wifi_rx_handler)

This function registers a handler to receive 802.11 raw packets from a network processor.

Once the handler is registered, the network processor does not send the packets to the IP stack but delivers to the handler function. The raw packet includes received packet information header, 802.11 header and data. Usually, this API cooperates with the RX filter set APIs; either wifi_config_set_rx_filter() or wifi_config_set_smart_connection_filter() , or both of them, to deal with specifically formatted RX packets.

Parameters
[in]wifi_rx_handleris the handler routine. For more information, please refer to wifi_rx_handler_t. There is a limitation to use the handler that is based on the in-band mechanism. Calls to any in-band functions, such as Wi-Fi Configuration or Wi-Fi connection API in wifi_rx_handler, are prohibited.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_reload_setting ( void  )

This function informs the wpa_supplicant to reload the configuration and applies the configuration settings of the Wi-Fi Configuration APIs.

This function is applied to the following APIs: wifi_config_set_ssid(), wifi_config_set_security_mode(), wifi_config_set_wpa_psk_key(), wifi_config_set_wep_key() and wifi_config_set_pmk(). In wireless station mode, the device will use the new configuration and start to scan and connect to the target AP router. In wireless AP mode, device will load the new SSID and encryption information.

Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_bandwidth ( uint8_t  port,
uint8_t  bandwidth 
)

This function sets the bandwidth configuration that the Wi-Fi driver uses for a specific wireless port.

This operation takes effect immediately.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]bandwidthis the wireless bandwidth.
Value Definition
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ 20MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ 40MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ 20 or 40MHz
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The default value is WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ.
int32_t wifi_config_set_bssid ( uint8_t *  bssid)

This function should be used only in station mode or in APCLI port of repeater mode.

It must be called along with wifi_config_set_ssid(). When both wifi_config_set_ssid() and wifi_config_set_bssid() are called, the device will connect to the AP with matching SSID and BSSID. If only wifi_config_set_bssid() is called, the connection might fail. This operation only takes effect after wifi_config_reload_setting() is called. BSSID configuration setting (wifi_config_set_bssid()) is optional. To cancel the BSSID setting, simply do not call wifi_config_set_bssid() before wifi_config_reload_setting().

Parameters
[in]bssidis the target AP's BSSID to connect.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_channel ( uint8_t  port,
uint8_t  channel 
)

This function sets the channel number that the Wi-Fi driver uses for a specific wireless port.

Call wifi_config_set_channel() in station mode while the device is disconnected from the AP, then the device will scan and change the channel in a loop.
Call wifi_config_set_channel() in station mode while the device is connected to the AP, the device will disconnect from this AP and stay in the specified channel for a short time, then the device will scan and change the channel in a loop.
This operation takes effect immediately in the station mode, in the AP mode, it'll take effect after calling wifi_config_reload_setting().

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]channelis the channel number that the Wi-Fi driver uses for a specific wireless port. The channel number range is from 1 to 14 for 2.4GHz bandwidth. The specific channel number is determined by country region settings in the profile.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_country_code ( wifi_country_code_t wifi_country_code)

Set the country code.

Parameters
[in]wifi_country_codeis the country code that the driver uses. For more information, please refer to wifi_country_code_t.
Note
The standard country code settings are provided below, initialize wifi_country_code based on the requirements.
The country code can also be custom-defined.
1 static wifi_country_code_t wifi_country_code[] =
2 {
3  { // Antigua and Berbuda
4  "AG",
5  CE,
6  4,
7  {
8  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
9  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
10  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
11  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
12  }
13  },
14  { // Argentina
15  "AR",
16  CE,
17  3,
18  {
19  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
20  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
21  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
22  }
23  },
24 
25  { // Aruba
26  "AW",
27  CE,
28  4,
29  {
30  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
31  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
32  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
33  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
34  }
35  },
36 
37  { // Australia
38  "AU",
39  CE,
40  4,
41  {
42  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
43  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
44  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
45  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
46  }
47  },
48 
49  { // Austria
50  "AT",
51  CE,
52  4,
53  {
54  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
55  { 36, 4, 23, IDOR, TRUE}, // 5GHz, ch 36~48
56  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
57  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
58  }
59  },
60 
61  { // Bahamas
62  "BS",
63  CE,
64  4,
65  {
66  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
67  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
68  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
69  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
70  }
71  },
72 
73  { // Barbados
74  "BB",
75  CE,
76  4,
77  {
78  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
79  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
80  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
81  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
82  }
83  },
84 
85  { // Bermuda
86  "BM",
87  CE,
88  4,
89  {
90  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
91  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
92  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
93  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
94  }
95  },
96 
97  { // Brazil
98  "BR",
99  CE,
100  5,
101  {
102  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
103  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
104  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
105  { 100, 11, 24, BOTH, FALSE}, // 5GHz, ch 100~140
106  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 100~140
107  }
108  },
109 
110  { // Belgium
111  "BE",
112  CE,
113  3,
114  {
115  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
116  { 36, 4, 18, IDOR, FALSE}, // 5GHz, ch 36~48
117  { 52, 4, 18, IDOR, FALSE}, // 5GHz, ch 52~64
118  }
119  },
120 
121  { // Bulgaria
122  "BG",
123  CE,
124  4,
125  {
126  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
127  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
128  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
129  { 100, 11, 30, ODOR, TRUE}, // 5GHz, ch 100~140
130  }
131  },
132 
133  { // Canada
134  "CA",
135  CE,
136  4,
137  {
138  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
139  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
140  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
141  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
142  }
143  },
144 
145  { // Cayman IsLands
146  "KY",
147  CE,
148  4,
149  {
150  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
151  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
152  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
153  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
154  }
155  },
156 
157  { // Chile
158  "CL",
159  CE,
160  4,
161  {
162  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
163  { 36, 4, 20, BOTH, FALSE}, // 5GHz, ch 36~48
164  { 52, 4, 20, BOTH, FALSE}, // 5GHz, ch 52~64
165  { 149, 5, 20, BOTH, FALSE}, // 5GHz, ch 149~165
166  }
167  },
168 
169  { // China
170  "CN",
171  CE,
172  2,
173  {
174  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
175  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
176  }
177  },
178 
179  { // Colombia
180  "CO",
181  CE,
182  5,
183  {
184  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
185  { 36, 4, 17, BOTH, FALSE}, // 5GHz, ch 36~48
186  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
187  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
188  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
189  }
190  },
191 
192  { // Costa Rica
193  "CR",
194  CE,
195  4,
196  {
197  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
198  { 36, 4, 17, BOTH, FALSE}, // 5GHz, ch 36~48
199  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
200  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
201  }
202  },
203 
204  { // Cyprus
205  "CY",
206  CE,
207  4,
208  {
209  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
210  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
211  { 52, 4, 24, IDOR, TRUE}, // 5GHz, ch 52~64
212  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
213  }
214  },
215 
216  { // Czech Republic
217  "CZ",
218  CE,
219  3,
220  {
221  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
222  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
223  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
224  }
225  },
226 
227  { // Denmark
228  "DK",
229  CE,
230  4,
231  {
232  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
233  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
234  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
235  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
236  }
237  },
238 
239  { // Dominican Republic
240  "DO",
241  CE,
242  2,
243  {
244  { 1, 0, 20, BOTH, FALSE}, // 2.4GHz, ch 0
245  { 149, 4, 20, BOTH, FALSE}, // 5GHz, ch 149~161
246  }
247  },
248 
249  { // Equador
250  "EC",
251  CE,
252  2,
253  {
254  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
255  { 100, 11, 27, BOTH, FALSE}, // 5GHz, ch 100~140
256  }
257  },
258 
259  { // El Salvador
260  "SV",
261  CE,
262  4,
263  {
264  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
265  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
266  { 52, 4, 30, BOTH, TRUE}, // 5GHz, ch 52~64
267  { 149, 4, 36, BOTH, TRUE}, // 5GHz, ch 149~165
268  }
269  },
270 
271  { // Finland
272  "FI",
273  CE,
274  4,
275  {
276  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
277  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
278  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
279  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
280  }
281  },
282 
283  { // France
284  "FR",
285  CE,
286  3,
287  {
288  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
289  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
290  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
291  }
292  },
293 
294  { // Germany
295  "DE",
296  CE,
297  4,
298  {
299  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
300  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
301  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
302  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
303  }
304  },
305 
306  { // Greece
307  "GR",
308  CE,
309  4,
310  {
311  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
312  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
313  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
314  { 100, 11, 30, ODOR, TRUE}, // 5GHz, ch 100~140
315  }
316  },
317 
318  { // Guam
319  "GU",
320  CE,
321  5,
322  {
323  { 1, 11, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
324  { 36, 4, 17, BOTH, FALSE}, // 5GHz, ch 36~48
325  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
326  { 100, 11, 30, BOTH, FALSE}, // 5GHz, ch 100~140
327  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
328  }
329  },
330 
331  { // Guatemala
332  "GT",
333  CE,
334  4,
335  {
336  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
337  { 36, 4, 17, BOTH, FALSE}, // 5GHz, ch 36~48
338  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
339  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
340  }
341  },
342 
343  { // Haiti
344  "HT",
345  CE,
346  4,
347  {
348  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
349  { 36, 4, 17, BOTH, FALSE}, // 5GHz, ch 36~48
350  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
351  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
352  }
353  },
354 
355  { // Honduras
356  "HN",
357  CE,
358  2,
359  {
360  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
361  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
362  }
363  },
364 
365  { // Hong Kong
366  "HK",
367  CE,
368  4,
369  {
370  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
371  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
372  { 52, 4, 23, IDOR, FALSE}, // 5GHz, ch 52~64
373  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
374  }
375  },
376 
377  { // Hungary
378  "HU",
379  CE,
380  3,
381  {
382  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
383  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
384  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
385  }
386  },
387 
388  { // Iceland
389  "IS",
390  CE,
391  4,
392  {
393  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
394  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
395  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
396  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
397  }
398  },
399 
400  { // India
401  "IN",
402  CE,
403  2,
404  {
405  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
406  { 149, 4, 24, IDOR, FALSE}, // 5GHz, ch 149~161
407  }
408  },
409 
410  { // Indonesia
411  "ID",
412  CE,
413  2,
414  {
415  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
416  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
417  }
418  },
419 
420  { // Indonesia
421  "ID",
422  CE,
423  2,
424  {
425  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
426  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
427  }
428  },
429 
430  { // Ireland
431  "IE",
432  CE,
433  4,
434  {
435  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
436  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
437  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
438  { 100, 11, 30, ODOR, TRUE}, // 5GHz, ch 100~140
439  }
440  },
441 
442  { // Israel
443  "IL",
444  CE,
445  3,
446  {
447  { 1, 3, 20, IDOR, FALSE}, // 2.4GHz, ch 1~3
448  { 4, 6, 20, BOTH, FALSE}, // 2.4GHz, ch 4~9
449  { 10, 4, 20, IDOR, FALSE}, // 2.4GHz, ch 10~13
450  }
451  },
452 
453  { // Italy
454  "IT",
455  CE,
456  4,
457  {
458  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
459  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
460  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
461  { 100, 11, 30, ODOR, TRUE}, // 5GHz, ch 100~140
462  }
463  },
464 
465  { // Japan
466  "JP",
467  JAP,
468  2,
469  {
470  { 1, 14, 20, BOTH, FALSE}, // 2.4GHz, ch 1~14
471  { 34, 4, 23, IDOR, FALSE}, // 5GHz, ch 34~46
472  }
473  },
474 
475  { // Jordan
476  "JO",
477  CE,
478  3,
479  {
480  { 1, 13, 20, IDOR, FALSE}, // 2.4GHz, ch 1~13
481  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
482  { 149, 4, 23, IDOR, FALSE}, // 5GHz, ch 149~161
483  }
484  },
485 
486  { // Latvia
487  "LV",
488  CE,
489  4,
490  {
491  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
492  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
493  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
494  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
495  }
496  },
497 
498  { // Liechtenstein
499  "LI",
500  CE,
501  3,
502  {
503  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
504  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
505  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
506  }
507  },
508 
509  { // Lithuania
510  "LT",
511  CE,
512  4,
513  {
514  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
515  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
516  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
517  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
518  }
519  },
520 
521  { // Luxemburg
522  "LU",
523  CE,
524  4,
525  {
526  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
527  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
528  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
529  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
530  }
531  },
532 
533  { // Malaysia
534  "MY",
535  CE,
536  3,
537  {
538  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
539  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
540  { 149, 5, 20, BOTH, FALSE}, // 5GHz, ch 149~165
541  }
542  },
543 
544  { // Malta
545  "MT",
546  CE,
547  4,
548  {
549  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
550  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
551  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
552  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
553  }
554  },
555 
556  { // Marocco
557  "MA",
558  CE,
559  2,
560  {
561  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
562  { 36, 4, 24, IDOR, FALSE}, // 5GHz, ch 36~48
563  }
564  },
565 
566  { // Mexico
567  "MX",
568  CE,
569  4,
570  {
571  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
572  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
573  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
574  { 149, 5, 30, IDOR, FALSE}, // 5GHz, ch 149~165
575  }
576  },
577 
578  { // Netherlands
579  "NL",
580  CE,
581  4,
582  {
583  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
584  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
585  { 52, 4, 24, IDOR, TRUE}, // 5GHz, ch 52~64
586  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
587  }
588  },
589 
590  { // New Zealand
591  "NZ",
592  CE,
593  4,
594  {
595  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
596  { 36, 4, 24, BOTH, FALSE}, // 5GHz, ch 36~48
597  { 52, 4, 24, BOTH, FALSE}, // 5GHz, ch 52~64
598  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
599  }
600  },
601 
602  { // Norway
603  "NO",
604  CE,
605  4,
606  {
607  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
608  { 36, 4, 24, IDOR, FALSE}, // 5GHz, ch 36~48
609  { 52, 4, 24, IDOR, TRUE}, // 5GHz, ch 52~64
610  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 149~161
611  }
612  },
613 
614  { // Peru
615  "PE",
616  CE,
617  2,
618  {
619  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
620  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
621  }
622  },
623 
624  { // Portugal
625  "PT",
626  CE,
627  4,
628  {
629  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
630  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
631  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
632  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
633  }
634  },
635 
636  { // Poland
637  "PL",
638  CE,
639  4,
640  {
641  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
642  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
643  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
644  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
645  }
646  },
647 
648  { // Romania
649  "RO",
650  CE,
651  4,
652  {
653  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
654  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
655  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
656  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
657  }
658  },
659 
660  { // Russia
661  "RU",
662  CE,
663  2,
664  {
665  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
666  { 149, 4, 20, IDOR, FALSE}, // 5GHz, ch 149~161
667  }
668  },
669 
670  { // Saudi Arabia
671  "SA",
672  CE,
673  4,
674  {
675  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
676  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
677  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
678  { 149, 4, 23, BOTH, FALSE}, // 5GHz, ch 149~161
679  }
680  },
681 
682  { // Serbia and Montenegro
683  "CS",
684  CE,
685  1,
686  {
687  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
688  }
689  },
690 
691  { // Singapore
692  "SG",
693  CE,
694  4,
695  {
696  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
697  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
698  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
699  { 149, 4, 20, BOTH, FALSE}, // 5GHz, ch 149~161
700  }
701  },
702 
703  { // Slovakia
704  "SK",
705  CE,
706  4,
707  {
708  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
709  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
710  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
711  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
712  }
713  },
714 
715  { // Slovenia
716  "SI",
717  CE,
718  3,
719  {
720  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
721  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
722  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
723  }
724  },
725 
726  { // South Africa
727  "ZA",
728  CE,
729  5,
730  {
731  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
732  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
733  { 52, 4, 23, IDOR, FALSE}, // 5GHz, ch 52~64
734  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
735  { 149, 4, 30, BOTH, FALSE}, // 5GHz, ch 149~161
736  }
737  },
738 
739  { // South Korea
740  "KR",
741  CE,
742  5,
743  {
744  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
745  { 36, 4, 20, BOTH, FALSE}, // 5GHz, ch 36~48
746  { 52, 4, 20, BOTH, FALSE}, // 5GHz, ch 52~64
747  { 100, 8, 20, BOTH, FALSE}, // 5GHz, ch 100~128
748  { 149, 4, 20, BOTH, FALSE}, // 5GHz, ch 149~161
749  }
750  },
751 
752  { // Spain
753  "ES",
754  CE,
755  4,
756  {
757  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
758  { 36, 4, 17, IDOR, FALSE}, // 5GHz, ch 36~48
759  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
760  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
761  }
762  },
763 
764  { // Sweden
765  "SE",
766  CE,
767  4,
768  {
769  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
770  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 36~48
771  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
772  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
773  }
774  },
775 
776  { // Switzerland
777  "CH",
778  CE,
779  3,
780  {
781  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~13
782  { 36, 4, 23, IDOR, TRUE}, // 5GHz, ch 36~48
783  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
784  }
785  },
786 
787  { // Taiwan
788  "TW",
789  CE,
790  2,
791  {
792  { 1, 11, 30, BOTH, FALSE}, // 2.4GHz, ch 1~11
793  { 52, 4, 23, IDOR, FALSE}, // 5GHz, ch 52~64
794  }
795  },
796 
797  { // Turkey
798  "TR",
799  CE,
800  3,
801  {
802  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
803  { 36, 4, 23, BOTH, FALSE}, // 5GHz, ch 36~48
804  { 52, 4, 23, BOTH, FALSE}, // 5GHz, ch 52~64
805  }
806  },
807 
808  { // UK
809  "GB",
810  CE,
811  4,
812  {
813  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
814  { 36, 4, 23, IDOR, FALSE}, // 5GHz, ch 52~64
815  { 52, 4, 23, IDOR, TRUE}, // 5GHz, ch 52~64
816  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
817  }
818  },
819 
820  { // Ukraine
821  "UA",
822  CE,
823  1,
824  {
825  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
826  }
827  },
828 
829  { // United Arab Emirates
830  "AE",
831  CE,
832  1,
833  {
834  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
835  }
836  },
837 
838  { // United States
839  "US",
840  CE,
841  5,
842  {
843  { 1, 11, 30, BOTH, FALSE}, // 2.4GHz, ch 1~11
844  { 36, 4, 17, IDOR, FALSE}, // 5GHz, ch 52~64
845  { 52, 4, 24, BOTH, TRUE}, // 5GHz, ch 52~64
846  { 100, 11, 30, BOTH, TRUE}, // 5GHz, ch 100~140
847  { 149, 5, 30, BOTH, FALSE}, // 5GHz, ch 149~165
848  }
849  },
850 
851  { // Venezuela
852  "VE",
853  CE,
854  2,
855  {
856  { 1, 13, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
857  { 149, 4, 27, BOTH, FALSE}, // 5GHz, ch 149~161
858  }
859  },
860 
861  { // Default
862  "",
863  CE,
864  5,
865  {
866  { 1, 11, 20, BOTH, FALSE}, // 2.4GHz, ch 1~11
867  { 36, 4, 20, BOTH, FALSE}, // 5GHz, ch 52~64
868  { 52, 4, 20, BOTH, FALSE}, // 5GHz, ch 52~64
869  { 100, 11, 20, BOTH, FALSE}, // 5GHz, ch 100~140
870  { 149, 5, 20, BOTH, FALSE}, // 5GHz, ch 149~165
871  }
872  },
873 };
Returns
>=0 means success, <0 means fail
int32_t wifi_config_set_country_region ( uint8_t  band,
uint8_t  region 
)

This function sets the country region that the Wi-Fi driver uses for a specific wireless port.

Various world regions have allocated different amounts of frequency space around 2.4GHz for Wi-Fi and some of them have fewer or more channels available than others. The region setting ensures that the router enables using the Wi-Fi channels valid only in user-specific location.

Parameters
[in]bandindicates the Wi-Fi bandwidth to operate on.
Value Definition
WIFI_BAND_2_4_G 2.4GHz
WIFI_BAND_5_G 5GHz
Parameters
[in]regionindicates different channels in 2.4GHz and 5GHz.
region(2.4GHz) the channel list for different regions in 2.4GHz.
Value Definition
0 CH1-11 active scan
1 CH1-13 active scan
2 CH10-11 active scan
3 CH10-13 active scan
4 CH14 active scan
5 CH1-14 all active scan
6 CH3-9 active scan
7 CH5-13 active scan
31 CH1-11 active scan, CH12-14 passive scan
32 CH1-11 active scan, CH12-13 passive scan
33 CH1-14 all active scan
Parameters
region(5GHz) the channel list for different regions in 5GHz.
Value Definition
0 CH36-64 active scan, CH149-165 active scan
1 CH36-64 active scan, CH100-140 active scan
2 CH36-64 active scan
3 CH52-64 active scan, CH149-161 active scan
4 CH149-165 active scan
5 CH149-161 active scan
6 CH36-48 active scan
7 CH36-64 active scan, CH100-140 active scan, CH149-165 active scan
8 CH52-64 active scan
9 CH36-64 active scan, CH100-116 active scan, CH132-140 active scan, CH149-165 active scan
10 CH36-48 active scan, CH149-165 active scan
11 CH36-64 active scan, CH100-120 active scan, CH149-161 active scan
12 CH36-64 active scan, CH100-140 active scan
13 CH52-64 active scan, CH100-140 active scan, CH149-161 active scan
14 CH36-64 active scan, CH100-116 active scan, CH136-140 active scan, CH149-165 active scan
15 CH149-173 active scan
16 CH52-64 active scan, CH149-165 active scan
17 CH36-48 active scan, CH149-161 active scan
18 CH36-64 active scan, CH100-116 active scan, CH132-140 active scan
19 CH56-64 active scan, CH100-140 active scan, CH149-161 active scan
20 CH36-64 active scan, CH100-124 active scan, CH149-161 active scan
21 CH36-64 active scan, CH100-140 active scan, CH149-161 active scan
22 CH36-64 active scan
30 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan, CH149-165 active scan
31 CH52-64 passive scan, CH100-140 passive scan, CH149-165 active scan
32 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan, CH149-161 active scan
33 CH36-48 active scan, CH52-64 passive scan, CH100-140 passive scan
34 CH36-48 active scan, CH52-64 passive scan, CH149-165 active scan
35 CH36-48 active scan, CH52-64 passive scan
36 CH36-48 active scan, CH100-140 passive scan, CH149-165 active scan
37 CH36-48 active scan, CH52-64 passive scan, CH149-165 active scan, CH173 active scan
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_dtim_interval ( uint8_t  interval)

This function sets the DTIM interval used in the Wi-Fi driver in the SoftAP mode.

Depending on the value set in the SoftAP mode, the AP will buffer broadcast and multicast data and let clients know when to wake up to receive those data. This operation takes effect immediately.

Parameters
[out]intervalis the number in a range of 1 ~ 255 beacon intervals. For more information, please refer to introduction to DTIM in Wikipedia.|
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_listen_interval ( uint8_t  interval)

This function sets the beacon listen interval used in the Wi-Fi driver in a station mode.

Depending on the timing set in the Station, the station in power saving mode resumes to listen to the beacon and receives buffered packets from the AP, if the TIM element in beacon frame indicates the AP has stored packets for specific station. This operation takes effect immediately.

Parameters
[in]intervalis the beacon's interval in a range from 1 to 255. The beacon's interval is usually 100 times the unit (100*1.024 ms), which means, the listen interval range is around (1~255) * 102.4ms.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_opmode ( uint8_t  mode)

This function sets the Wi-Fi operation mode and it takes effect immediately.

Parameters
[in]modethe operation mode to set.
Value Definition
0x01 WIFI_MODE_STA_ONLY
0x02 WIFI_MODE_AP_ONLY
0x03 WIFI_MODE_REPEATER
0x04 WIFI_MODE_MONITOR
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
This function resets the Wi-Fi driver configuration to default values of the target's operation mode (including supplicant and firmware) previously set by Wi-Fi Configuration APIs.
Once the Wi-Fi operation mode is set to station mode, the device will switch to idle state and will try to connect to the AP
only after calling wifi_config_reload_setting().
int32_t wifi_config_set_pmk ( uint8_t  port,
uint8_t *  pmk 
)
Deprecated:
This function is deprecated! This function sets the PMK used in the Wi-Fi driver for a specific wireless port.

This operation only takes effect after wifi_config_reload_setting() is called. If the user have called the following two APIs, wifi_config_set_pmk() or wifi_config_set_wpa_psk_key(), only the last one will take effect. Once wifi_config_reload_setting() is called after wifi_config_set_wpa_psk_key(), the user can get the related PMK value by calling wifi_config_get_pmk(). The PMK value is calculated using the PSK data. The PSK should be ignored, if both PMK and PSK are available.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]pmkis a pointer to the PMK buffer with a length of WIFI_LENGTH_PMK in bytes. PMK is used in WPA-PSK or WPA2-PSK encryption type and the PMK length is WIFI_LENGTH_PMK in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_radio ( uint8_t  on_off)

This function sets the radio status of the Wi-Fi driver.

This operation takes effect immediately.

Parameters
[in]on_offindicates the Wi-Fi radio is on or off.
Value Definition
0 OFF, the Wi-Fi radio is turned off, and Wi-Fi TX/RX is disabled
1 ON, the Wi-Fi radio is turned on, and Wi-Fi TX/RX is enabled
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
This API is only supported in the station mode.
int32_t wifi_config_set_rx_filter ( uint32_t  flag)

This function sets the Wi-Fi RX filter used in the Wi-Fi driver.

The RX filter setting provides the packet format to be received, such as broadcast, multicast, unicast frames. This operation takes effect immediately.

Parameters
[in]flagis defined in wifi_rx_filter_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The flag can be generated the way as follows:
1 #define BIT(x) ((uint32_t)1 << (x))
2 uint32_t filter = 0;
3 wifi_config_get_rx_filter(&filter);
4 filter = filter | BIT(WIFI_RX_FILTER_DROP_FCS_ERR) | BIT(WIFI_RX_FILTER_DROP_VER_NOT_0);
5 wifi_config_set_rx_filter(filter);
int32_t wifi_config_set_security_mode ( uint8_t  port,
wifi_auth_mode_t  auth_mode,
wifi_encrypt_type_t  encrypt_type 
)

This function sets the authentication and encryption modes used in the Wi-Fi driver for a specific wireless port.

This operation only takes effect after wifi_config_reload_setting() is called.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]auth_modeis the authentication mode. For details about this parameter, please refer to wifi_auth_mode_t.
[in]encrypt_typeis the encryption mode. For details about this parameter, please refer to wifi_encrypt_type_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
In station mode, the device can connect to AP without setting any security mode.
If wifi_config_set_security_mode() is not called, the device will change security mode dynamically according to the target AP.
If wifi_config_set_security_mode() is called, the device will set a security mode to connect to the target AP.
Calling wifi_config_set_security_mode() is optional in station mode.
To skip the security mode setting, simply do not call wifi_config_set_security_mode() before wifi_config_reload_setting().
int32_t wifi_config_set_smart_connection_filter ( uint8_t  flag)

This function sets MediaTek Smart Connection RX Filter used in the Wi-Fi driver.

This operation takes effect immediately. When MediaTek smart connection filter is enabled, MediaTek Smart Connection packets will be delivered to the RX queue directly, the other packets will be delivered to the RX filter. For more information, please refer to wifi_config_set_rx_filter().

Parameters
[in]flagis the parameter set to enable or disable smart connection function.
Value Definition
0 DISABLE
1 ENABLE
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_ssid ( uint8_t  port,
uint8_t *  ssid,
uint8_t  ssid_length 
)

This function sets the SSID and SSID length that the Wi-Fi driver uses for a specific wireless port.

This operation only takes effect after wifi_config_reload_setting() is called.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]ssidis the SSID content. If WIFI_PORT_STA or WIFI_PORT_APCLI, the SSID indicates the target AP's SSID. If WIFI_PORT_AP, the SSID indicates the device's own SSID.
[in]ssid_lengthis the length of the SSID, the maximum length is WIFI_MAX_LENGTH_OF_SSID in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_wep_key ( uint8_t  port,
wifi_wep_key_t wep_keys 
)

This function sets the WEP key group used in the Wi-Fi driver for a specific wireless port.

This operation only takes effect after wifi_config_reload_setting() is called.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]wep_keysis a pointer to the WEP keys. For more details, please refer to wifi_wep_key_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_wireless_mode ( uint8_t  port,
wifi_phy_mode_t  mode 
)

This function gets the wireless mode that the Wi-Fi driver uses for a specific wireless port.

This operation takes effect immediately.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]modeis the wireless mode. For more information, please refer to wifi_phy_mode_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_set_wpa_psk_key ( uint8_t  port,
uint8_t *  passphrase,
uint8_t  passphrase_length 
)

This function sets the password of the WPA-PSK or WPA2-PSK encryption type used in the Wi-Fi driver for a specific wireless port.

This operation only takes effect after wifi_config_reload_setting() is called. If the passphrase_length is less than 64, the passphrase is used as
password. If the passphrase_length is 64, the passphrase is used as PMK.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]passphraseis 8 to 63 bytes ASCII or 64 bytes hexadecimal.
[in]passphrase_lengthis the length range from 8 to 64.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_config_unregister_rx_handler ( void  )

This function unregisters the handler to receive 802.11 raw packets from the network processor.

Once the handler is unregistered, the network processor will send the packets to the IP stack.

Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_disconnect_ap ( void  )

This function disconnects the current connection from AP.

It takes effect immediately and the device switches to idle state. After calling wifi_config_reload_setting(), the device switches to scan state and tries to connect to an AP router with an existing Wi-Fi configuration. This API should be used only in the station mode.

Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_disconnect_sta ( uint8_t *  address)

This function disconnects specific station's connection, and takes effect immediately.

This API is available only in the AP mode.

Parameters
[in]addressis station's MAC address.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_get_link_status ( uint8_t *  link_status)

This function gets the current STA port's link up or link down connection status.

Parameters
[out]link_statusindicates the current STA port's link up or link down connection status.
Value Definition
0 WIFI_STATUS_LINK_DISCONNECTED
1 WIFI_STATUS_LINK_CONNECTED
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
WIFI_STATUS_LINK_DISCONNECTED indicates station may be in IDLE/ SCAN/ CONNECTING state.
int32_t wifi_connection_get_max_sta_number ( uint8_t *  sta_number)

This function gets the maximum number of the supported stations in the AP mode or repeater mode.

Parameters
[out]sta_numberreturns the maximum number of the supported stations.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_get_rssi ( int8_t *  rssi)

This function gets the RSSI of the connected AP.

It's only used for the STA mode and while the station is connected to the AP.

Parameters
[out]rssireturns the RSSI of the connected AP.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_get_sta_list ( uint8_t *  number,
wifi_sta_list_t sta_list 
)

This function gets the station list associated with the Wi-Fi, only for SoftAP mode.

Parameters
[out]sta_listis defined in wifi_sta_list_t that includes station information such as RSSI, bandwidth, channel, MAC and TX rate.
[out]numberreturns the number of associated stations.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_parse_beacon ( uint8_t *  pbuf,
uint32_t  len,
wifi_scan_list_item_t ap_data 
)

This function parses the beacon or probe request packets.

Parameters
[in]pbufis a pointer to indicate the payload of beacon or probe request packets.
[in]lenis the length of packet's payload.
[out]ap_datais the buffer to store AP information received from beacon or probe request packet parse result.
Returns
<0 means parse failed, =0 means success.
int32_t wifi_connection_register_event_handler ( wifi_event_t  event,
wifi_event_handler_t  handler 
)

This function registers the Wi-Fi event handler.

Each event can register multiple event handlers with maximum number of 16. In the AP/STA mode, the scan stops automatically when the scan cycle is finished and SCAN COMPLETE event is triggered;
In the AP mode, once the device is disconnected from the station, a DISCONNECT event with station's MAC address is triggered;
In the AP mode, once the station connects to the device, CONNECT event with station's MAC address is triggered;
In the STA mode, once the device disconnects from the AP, DISCONNECT event with BSSID is triggered;
In the STA mode, once the device connect to the AP, CONNECT event with BSSID is triggered.

Parameters
[in]eventis the event ID. For more details, please refer to wifi_event_t.
[in]handleris the event handler. For more details, please refer to wifi_event_handler_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
It is not recommended to call any other Wi-Fi APIs or sleep in any form in the event handler.
int32_t wifi_connection_register_event_notifier ( uint8_t  event,
wifi_event_handler_t  notifier 
)
Deprecated:
This function is deprecated! This is only for compatibility purposes, so that applications implemented with an earlier version of the API can work with the updated API.

Please use wifi_connection_register_event_handler() to replace this function.

Parameters
[in]eventis the event ID. For more details, please refer to wifi_event_t.
[in]notifieris the event handler. For more details, please refer to wifi_event_handler_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_scan_deinit ( void  )

This function deinitializes the scan table.

Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
When the scan is finished, wifi_connection_scan_deinit() should be called to unload the buffer from the driver. After that, the data in the parameter ap_list can be safely processed by user applications, and then another scan can be initialized by calling wifi_connection_scan_init().
int32_t wifi_connection_scan_init ( wifi_scan_list_item_t ap_list,
uint32_t  max_count 
)

This function initializes the scan table to the driver.

Parameters
[in]ap_listis a pointer of the user buffer where the further scanned AP list will be stored.
[in]max_countis the maximum number of ap_list can be stored.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
wifi_connection_scan_init() should be called before calling wifi_connection_start_scan(), and it should be called only once to initialize one scan.
When the scan is done, the scanned AP list is already stored in parameter ap_list with descending order of the RSSI values.
int32_t wifi_connection_send_raw_packet ( uint8_t *  raw_packet,
uint32_t  length 
)

This function sends a raw Wi-Fi packet over the air.

Parameters
[in]raw_packetis a pointer to the raw packet which is a complete 802.11 packet including the 802.11 header and the payload. The FCS will be automatically computed and attached to the end of the raw packet by hardware. Note that some fields are controlled by hardware, such as power management, sequence number and duration. So the value of these fields set by software will be ignored.
[in]lengthis the length of the raw packet.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_start_scan ( uint8_t *  ssid,
uint8_t  ssid_length,
uint8_t *  bssid,
uint8_t  scan_mode,
uint8_t  scan_option 
)

This function starts Wi-Fi Scanning.

Parameters
[in]ssidspecifies the SSID to be included in the probe request packet for scanning the hidden AP. If the SSID is NULL, the SSID field in probe request packet will be NULL.
[in]ssid_lengthspecifies the length of the SSID.
[in]bssidspecifies the BSSID of the AP to be scanned. If the BSSID is specified, the unicast probe request is sent. If the BSSID is NULL, then the broadcast probe request is sent.
[in]scan_modeis the scan mode that can be either a full scan or a partial scan.
Value Definition
0 Full
1 Partial, it's expected to be used in the SoftAP mode and keep stations online.

In the partial scan mode, the scanning is performed as follows. If the AP is currently on channel 5, it jumps to channels (1, 2), and then back to channel 5. After that it scans the channels (3, 4). The number of channels it scans each time is specified in the implementation.

Parameters
[in]scan_optionselects scan options based on one of the following: active scan, passive scan or force active scan.
Value Definition
0 Active scan, (Passive in regulatory channels). The channels that will be scanned are decided by the product's country and region. A probe request will be sent to each of these channels.
1 Passive in all channels. Receives and processes the beacon. No probe request is sent.
2 Force active (active in all channels). Forced to active scan in all channels. A probe request will be sent to each of these channels.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
1. No matter what the SSID and BSSID parameters are, the device will receive all beacon and probe response packets over the air,
and record the result into ap_list buffer registered by wifi_connection_scan_init().
2. The station mode supports only the full scan mode.
3. The AP/repeater/p2p GO mode supports only the partial scan mode.
int32_t wifi_connection_stop_scan ( void  )

This function stops the Wi-Fi Scanning triggered by wifi_connection_start_scan().

If the device in station mode cannot connect to an AP, it keeps scanning till it connects to the target AP.

Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_unregister_event_handler ( wifi_event_t  event,
wifi_event_handler_t  handler 
)

This function unregisters Wi-Fi event handler.

The function wifi_connection_register_event_handler() registers an event and matches it with the corresponding event handler. For the event behavior, please refer to wifi_connection_register_event_handler().

Parameters
[in]eventis the event ID. For more details, please refer to wifi_event_t for more details.
[in]handleris the event handler. For more details, please refer to wifi_event_handler_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_connection_unregister_event_notifier ( uint8_t  event,
wifi_event_handler_t  notifier 
)
Deprecated:
This function is deprecated! This is only for compatibility purposes, so that applications implemented with an earlier version of the API can work with the updated API.

Please use wifi_connection_unregister_event_handler() to replace this function.

Parameters
[in]eventis the event ID. For more details, please refer to wifi_event_t.
[in]notifieris the event handler. For more details, please refer to wifi_event_handler_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
void wifi_init ( wifi_config_t config,
wifi_config_ext_t config_ext 
)

This function initializes the Wi-Fi module.

Parameters
[in]configis the Wi-Fi configuration to be set, it should not be null.
[in]config_extis the extended Wi-Fi configuration to be set, it can be null if no extended features are expected.
Note
Call this function only once at the initialization stage.
int32_t wifi_profile_commit_setting ( char *  profile_section)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function is not implemented.

int32_t wifi_profile_get_bandwidth ( uint8_t  port,
uint8_t *  bandwidth 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets bandwidth from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]bandwidthis the wireless bandwidth.
Value Definition
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ 20MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ 40MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ 20 or 40MHz
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The default value is WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ.
int32_t wifi_profile_get_channel ( uint8_t  port,
uint8_t *  channel 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the channel from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]channelis the channel number used in the Wi-Fi driver for a specific wireless port. The channel number range is about from 1 to 14 for 2.4GHz. The specific channel number is determined by country region.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_country_region ( uint8_t  band,
uint8_t *  region 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi Country Region used in the Wi-Fi driver. Various world regions have allocated different amounts of frequency space around 2.4GHz for Wi-Fi and some of them have fewer or more channels available than others. The region setting ensures that your router will only let you use the Wi-Fi channels valid in your location.

Parameters
[in]bandindicates the Wi-Fi bandwidth that the function will operate on.
Value Definition
WIFI_BAND_2_4_G 2.4GHz
WIFI_BAND_5_G 5GHz
Parameters
[out]regionis the region code that relates to the channel list. For more details, please refer to wifi_config_set_country_region().
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_dtim_interval ( uint8_t *  interval)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi DTIM interval from a profile in the Flash memory.

Parameters
[out]intervalis the interval of a beacon in a range from 1 to 255. For more details, please refer to wifi_config_set_dtim_interval().
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_listen_interval ( uint8_t *  interval)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi Listen Interval from a profile in the Flash memory.

Parameters
[out]intervalis the interval of a beacon in a range from 1 to 255. The beacon's interval is usually 100 times the unit (100*1.024 ms), which means, the DTIM interval range is (1~255) * 102.4ms.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_mac_address ( uint8_t  port,
uint8_t *  address 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the MAC address of the Wi-Fi interface from a profile in the Flash memory.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]addressis the MAC address WIFI_MAC_ADDRESS_LENGTH bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_opmode ( uint8_t *  mode)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the operation mode from a profile in the Flash memory.

Parameters
[out]modeindicates operation mode in the Flash memory.
Value Definition
0x01 WIFI_MODE_STA_ONLY
0x02 WIFI_MODE_AP_ONLY
0x03 WIFI_MODE_REPEATER
0x04 WIFI_MODE_MONITOR
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_pmk ( uint8_t  port,
uint8_t *  pmk 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the PMK from a profile in the Flash memory.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]pmkis the Pairwise Master Key, the shared secret key used in the IEEE 802.11 protocol.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_power_save_mode ( uint8_t *  power_save_mode)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi Power Save mode from a profile in the Flash memory. This profile setting is only loaded during the system boot up.

Parameters
[out]power_save_modeis the three power save mode can be set.
Value Definition
0 CAM: CAM (Constantly Awake Mode) is a power save mode that keeps the radio powered up continuously to ensure there is a minimal lag in response time. This power save setting consumes the most power but offers the highest throughput.
1 LEGACY_POWERSAVE: the access point buffers incoming messages for the radio. The radio occasionally 'wakes up' to determine if any buffered messages are waiting and then returns to sleep mode after it requests each message. This setting conserves the most power but also provides the lowest throughput. It is recommended for radios in which power consumption is the most important (such as small battery-operating devices).
2 FAST_POWERSAVE: Fast is a power save mode that switches between power saving and CAM modes, depending on the network traffic. For example, it switches to CAM when receiving a large number of packets and switches back to PS mode after the packets have been retrieved. Fast is recommended when power consumption and throughput are a concern.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_profile ( uint8_t  port,
wifi_profile_t profile 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function is not implemented.

int32_t wifi_profile_get_security_mode ( uint8_t  port,
wifi_auth_mode_t auth_mode,
wifi_encrypt_type_t encrypt_type 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi authentication mode and encryption type from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]auth_modeis the authentication mode. For more details, please refer to wifi_auth_mode_t.
[out]encrypt_typeis the encryption type. For more details, please refer to wifi_encrypt_type_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_ssid ( uint8_t  port,
uint8_t *  ssid,
uint8_t *  ssid_length 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the SSID from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]ssidis the SSID content. If WIFI_PORT_STA or WIFI_PORT_APCLI, the SSID indicates the target AP's SSID. If WIFI_PORT_AP, the SSID indicates the device's own SSID.
[out]ssid_lengthis the length of the SSID, the maximum is WIFI_MAX_LENGTH_OF_SSID in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_wep_key ( uint8_t  port,
wifi_wep_key_t wep_keys 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi WEP Keys from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]wep_keysare the WEP keys. For more details, please refer to wifi_wep_key_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_wireless_mode ( uint8_t  port,
wifi_phy_mode_t mode 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi Wireless Mode from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]modeis wireless mode. For more details, please refer to wifi_phy_mode_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_get_wpa_psk_key ( uint8_t  port,
uint8_t *  passphrase,
uint8_t *  passphrase_length 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function gets the Wi-Fi WPAPSK/WPA2PSK passphrase from a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]passphraseis from 8 to 63 bytes ASCII or 64bytes hexadecimal.
[out]passphrase_lengthis the length, ranging from 8 to 64.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_bandwidth ( uint8_t  port,
uint8_t  bandwidth 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the bandwidth in a profile in the Flash memory.
It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]bandwidthis the wireless bandwidth.
Value Definition
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ 20MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ 40MHz
WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ 20 or 40MHz
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
The default value is WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ.
int32_t wifi_profile_set_channel ( uint8_t  port,
uint8_t  channel 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the channel in a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]channelis the channel number used in the Wi-Fi driver for a specific wireless port. The channel number range is from 1 to 14 for 2.4GHz. The specific channel number is determined by country region.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_country_region ( uint8_t  band,
uint8_t  region 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function sets the Wi-Fi Country Region in a profile in the Flash memory. Various world regions have allocated different amounts of frequency space around 2.4GHz for Wi-Fi and some of them have fewer or more channels available than others. The region setting ensures that the router only operates on the Wi-Fi channels valid for the specific location. The profile is read to initialize the system at boot up.

Parameters
[in]bandindicates the Wi-Fi bandwidth that the function will operate on.
Value Definition
WIFI_BAND_2_4_G 2.4GHz
WIFI_BAND_5_G 5GHz
Parameters
[in]regionis the region code that related to the channel list. For more details, please refer to wifi_config_set_country_region().
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_dtim_interval ( uint8_t  interval)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function sets the Wi-Fi DTIM interval in a profile in the Flash memory. This API can be used only for STA mode. The profile is read to initialize the system at boot up.

Parameters
[in]intervalis the interval of a beacon in a range from 1 to 255. For more details, please refer to wifi_config_set_dtim_interval().
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_listen_interval ( uint8_t  interval)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function sets the Wi-Fi Listen Interval in a profile in the Flash memory. This API can be used only for STA mode. The profile is read to initialize the system at boot up.

Parameters
[in]intervalis the interval of a beacon in a range from 1 to 255.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_mac_address ( uint8_t  port,
uint8_t *  address 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function sets the MAC address of the Wi-Fi interface in a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. Currently, in the AP mode, the Wi-Fi driver also uses the MAC address in STA profile section. The profile is read to initialize the system at boot up. Note that there is no corresponding wifi_config_set_mac_address(), because the MAC address cannot be modified dynamically.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]addressis the buffer assigned for the MAC Address, with the length of WIFI_MAC_ADDRESS_LENGTH in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_opmode ( uint8_t  mode)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the operation mode in a profile in the Flash memory.
The profile is read to initialize the system at boot up.

Parameters
[in]modeindicates the operation mode to be set.
Value Definition
0x01 WIFI_MODE_STA_ONLY
0x02 WIFI_MODE_AP_ONLY
0x03 WIFI_MODE_REPEATER
0x04 WIFI_MODE_MONITOR
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
This function resets the entire configuration set by previous Wi-Fi Configuration APIs.
int32_t wifi_profile_set_pmk ( uint8_t  port,
uint8_t *  pmk 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the PMK in a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up. PMK is preferred, if the PSK and PMK exist simultaneously.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]pmkis the Pairwise Master Key, the shared secret key used in the IEEE 802.11 protocol.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_power_save_mode ( uint8_t  power_save_mode)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the Wi-Fi Power Save mode in a profile in the Flash memory.
The profile is read to initialize the system at boot up.

Parameters
[in]power_save_modeindicates three power save mode below.
Value Definition
0 CAM: CAM (Constantly Awake Mode) is a power save mode that keeps the radio powered up continuously to ensure there is a minimal lag in response time. This power save setting consumes the most power but offers the highest throughput.
1 LEGACY_POWERSAVE: the access point buffers incoming messages for the radio. The radio occasionally 'wakes up' to determine if any buffered messages are waiting and then returns to sleep mode after it requests each message. This setting conserves the most power but also provides the lowest throughput. It is recommended for radios in which power consumption is the most important (such as small battery-operating devices).
2 FAST_POWERSAVE: Fast is a power save mode that switches between power saving and CAM modes, depending on the network traffic. For example, it switches to CAM when receiving a large number of packets and switches back to PS mode after the packets have been retrieved. Fast is recommended when power consumption and throughput are a concern.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_security_mode ( uint8_t  port,
wifi_auth_mode_t  auth_mode,
wifi_encrypt_type_t  encrypt_type 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the Wi-Fi authentication mode and encryption type in a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port which the function will operate to.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[out]auth_modeis the authentication mode. For more details, please refer to wifi_auth_mode_t.
[out]encrypt_typeis the encryption type. For more details, please refer to wifi_encrypt_type_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_ssid ( uint8_t  port,
uint8_t *  ssid,
uint8_t  ssid_length 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the SSID in a profile in the Flash memory.
It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]ssidis the SSID content. If WIFI_PORT_STA or WIFI_PORT_APCLI, the SSID indicates the target AP's SSID. If WIFI_PORT_AP, the SSID indicates the device's own SSID.
[in]ssid_lengthis the length of the SSID, the maximum is WIFI_MAX_LENGTH_OF_SSID in bytes.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_wep_key ( uint8_t  port,
wifi_wep_key_t wep_keys 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores Wi-Fi WEP Keys in a profile in the Flash memory. It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]wep_keysare the WEP keys. For more details, please refer to wifi_wep_key_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_wireless_mode ( uint8_t  port,
wifi_phy_mode_t  mode 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the Wi-Fi Wireless Mode in a profile in the Flash memory.
It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]modeis wireless mode. For more details, please refer to wifi_phy_mode_t.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_profile_set_wpa_psk_key ( uint8_t  port,
uint8_t *  passphrase,
uint8_t  passphrase_length 
)
Deprecated:
This function is deprecated! For more information, please refer to LinkIt for RTOS Wi-Fi Migration Developer's Guide under the doc folder in the SDK package.

This function stores the Wi-Fi WPAPSK/WPA2PSK passphrase in a profile in the Flash memory.
It uses the same profile section for a specific wireless port, such as WIFI_PORT_STA / WIFI_PORT_APCLI. The profile is read to initialize the system at boot up. PMK is preferred if the PSK and PMK exist simultaneously.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_APCLI AP Client
WIFI_PORT_AP AP
Parameters
[in]passphraseis from 8 to 63 bytes ASCII or 64bytes hexadecimal.
[in]passphrase_lengthis the length, ranging from 8 to 64.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_config_get_auto_connection ( bool *  auto_connection)

This function gets auto connection configuration.

Parameters
[out]auto_connectionindicates whether auto connection is enabled or disabled.
Value Definition
true Auto connection is enabled and the Enrollee will automatically connect to the target AP got from the WPS credential information after WPS process is done.
false Auto connection is disabled and the Enrollee will not automatically connect to the target AP.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_config_get_device_info ( wifi_wps_device_info_t device_info)

This function gets the WPS device information.

Parameters
[out]device_infoindicates the device informaton. For more details, please refer to wifi_wps_device_info_t. device_information can read back by this API after set.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_config_get_pin_code ( uint8_t  port,
uint8_t *  pin_code 
)

This function gets the pin code of a specific wireless port, the pin code may be different for each function call.

This function is only available when device is running in station mode or in AP mode.

Parameters
[in]portis the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_AP AP
Parameters
[out]pin_codeis the pin code with 8 ASCII characters.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_config_set_auto_connection ( bool  auto_connection)

This function controls the auto connection behavior after the WPS credential information is received by the Enrollee.

Parameters
[in]auto_connectionset the auto_connection to true to enable auto connection, otherwise set it to false. When auto connection is enabled, the Enrollee will automatically connect to the target AP obtained from the WPS credential information after WPS process is complete. When auto connection is disabled, the Enrollee will not automatically connect to the target AP after the WPS process is complete.
Value Definition
true Enable WI-FI auto connection.
false Disable WI-FI auto connection.
Returns
>=0 the operation completed successfully, <0 the operation failed.
Note
Auto connection is enabled by default.
int32_t wifi_wps_config_set_device_info ( wifi_wps_device_info_t device_info)

This function sets the WPS device information.

Parameters
[in]device_infoindicates the device informaton. For more details, please refer to wifi_wps_device_info_t. device_information needs to be set each time before starting the WPS process.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_connection_by_pbc ( uint8_t  port,
uint8_t *  bssid 
)

This function triggers a WPS PBC process.

This function is only available when the device is in station mode or AP mode. If port is WIFI_PORT_AP, the device acts as a registrar and the BSSID should be NULL. The registrar will send a credential to enrollee after WPS successfully completes. If port is WIFI_PORT_STA, the device acts as an enrollee. The enrollee will give the credentials from registrar and connect to the AP, then store the credential into the Flash memory using Wi-Fi profile APIs. The credentials include the SSID, wifi_wep_key_t, authentication mode, encryption type and the PSK key. The BSSID is optional when port is set to WIFI_PORT_STA. When the BSSID is set, enrollee will only complete the WPS process with the specific AP having the same BSSID. When the BSSID is NULL, enrollee will do the WPS process with the AP on which the PBC starts at the same time. If there are two or more APs working on WPS PBC, the process will fail according to the specifications. This function is only available when device is running in station mode or AP mode.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_AP AP
Parameters
[in]bssidis the target AP's MAC address, it should be NULL the port is set to WIFI_PORT_AP.
Returns
>=0 the operation completed successfully, <0 the operation failed.
int32_t wifi_wps_connection_by_pin ( uint8_t  port,
uint8_t *  bssid,
uint8_t *  pin_code 
)

This function triggers the WPS PIN process.

If port is WIFI_PORT_AP, the device is a registrar. In the WPS this condition, the BSSID should be NULL, and the pin is the target enrollee's pin code. The registrar will send the credentials to enrollee after WPS process completes successfully. If port is WIFI_PORT_STA, the device is an enrollee. The enrollee credentials from registrar and connects the AP, then store the credential and the PSK into the Flash memory provides by Wi-Fi profile APIs.The provide credentials include the SSID, wifi_wep_key_t, authentication mode, encryption type and the PSK key. The BSSID is mandatory when port is set to WIFI_PORT_STA. Get the pin_code by calling the wifi_wps_config_get_pin_code(). This function is only available when device is running in station mode or AP mode.

Parameters
[in]portindicates the Wi-Fi port that the function will operate on.
Value Definition
WIFI_PORT_STA STA
WIFI_PORT_AP AP
Parameters
[in]bssidis the target AP's MAC address, it should be NULL while the port is WIFI_PORT_AP.
[in]pin_codeis the enrollee's pin code with 8 ASCII characters, when the device is an enrollee, the pin_code should be generated by wifi_wps_config_get_pin_code(), the registrar should input the same pin code. when the device is a registrar, the pin_code should be the enrollee's pin code that's transmitted to the registrar using keypad, UI or other interfaces.
Returns
>=0 the operation completed successfully, <0 the operation failed.