![]() |
MT7687 API Reference
LinkIt SDK v4
|
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...
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_abc() APIs and wifi_wps_config_abc() 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_abc() 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_abc() APIs and wifi_wps_connection_abc() 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_abc() 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) |
| int32_t | wifi_config_set_country_region (uint8_t band, uint8_t region) |
| 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) |
| 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 Wi-Fi driver 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 immediately disconnects the current connection from the connected 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 in the Wi-Fi 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 | |
| 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.
| [in] | port | indicates 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 |
| [out] | bandwidth | is 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 |
| 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.
| [out] | bssid | is 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. |
| 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.
| [in] | port | is 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 |
| [out] | channel | is 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. |
| 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.
| [out] | country_code | contains the country code string, which is already set by wifi_config_set_country_code(), upon the return of this function call. |
| int32_t wifi_config_get_country_region | ( | uint8_t | band, |
| uint8_t * | region | ||
| ) |
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.
| [in] | band | indicates the Wi-Fi bandwidth that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_BAND_2_4_G | 2.4GHz |
| WIFI_BAND_5_G | 5GHz |
| [out] | region | indicates 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 |
| 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 |
| 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.
| [out] | interval | beacon intervals between 1 to 255. For more information, please refer to introduction to DTIM in Wikipedia.| |
| 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.
| [out] | interval | is the beacon's interval in a range from 1 to 20. The beacon's interval is usually 100 times the unit (100*1.024 ms). |
| 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.
| [in] | port | indicates 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 |
| [out] | address | is the MAC address. The length of the MAC address is WIFI_MAC_ADDRESS_LENGTH in bytes. |
| int32_t wifi_config_get_opmode | ( | uint8_t * | mode | ) |
This function receives the wireless operation mode of the Wi-Fi driver.
| [out] | mode | indicates the operation mode. |
| Value | Definition |
|---|---|
| 0x01 | WIFI_MODE_STA_ONLY |
| 0x02 | WIFI_MODE_AP_ONLY |
| 0x03 | WIFI_MODE_REPEATER |
| 0x04 | WIFI_MODE_MONITOR |
| int32_t wifi_config_get_pmk | ( | uint8_t | port, |
| uint8_t * | pmk | ||
| ) |
| [in] | port | is 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 |
| [out] | pmk | is pairwise master key, the shared secret key used in the IEEE 802.11 protocol. |
| int32_t wifi_config_get_radio | ( | uint8_t * | on_off | ) |
This function gets the radio status of the Wi-Fi driver.
| [out] | on_off | indicates 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. |
| 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.
| [out] | flag | is defined in wifi_rx_filter_t. |
| 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.
| [in] | port | indicates 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 |
| [out] | auth_mode | is the authentication mode. For details about this parameter, please refer to wifi_auth_mode_t. |
| [out] | encrypt_type | is the encryption mode. For details about this parameter, please refer to wifi_encrypt_type_t. |
| 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.
| [out] | flag | indicates if the smart connection function is enabled or disabled. |
| Value | Definition |
|---|---|
| 0 | DISABLE |
| 1 | ENABLE |
| 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.
| [in] | port | indicates 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 |
| [out] | ssid | is 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_length | is the length of the SSID. The maximum length is WIFI_MAX_LENGTH_OF_SSID in bytes. |
| 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.
| [in] | port | indicates 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 |
| [out] | wep_keys | is a pointer to the WEP keys. For more details, please refer to wifi_wep_key_t. |
| 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.
| [in] | port | is 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 |
| [out] | mode | is the wireless mode. For more information, please refer to wifi_phy_mode_t. |
| 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.
| [in] | port | is 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 |
| [out] | passphrase | is 8 to 63 bytes ASCII or 64 bytes hexadecimal. |
| [out] | passphrase_length | is the length range from 8 to 64. |
| 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.
| [in] | wifi_rx_handler | is 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. |
| int32_t wifi_config_reload_setting | ( | void | ) |
This function informs the Wi-Fi driver 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, it will continue to scan and try to connect to the target router until the connection is successful. After the connection is established, if the router is powered off, the system will attempt to reconnect in the background. In wireless AP mode, device will load the new SSID and encryption information.
| 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.
| [in] | port | indicates 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 |
| [in] | bandwidth | is 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 |
| 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().
| [in] | bssid | is the target AP's BSSID to connect. |
| 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().
| [in] | port | indicates 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 |
| [in] | channel | is 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. |
| int32_t wifi_config_set_country_code | ( | wifi_country_code_t * | wifi_country_code | ) |
Set the country code.
| [in] | wifi_country_code | is the country code that the Wi-Fi driver uses. For more information, please refer to wifi_country_code_t. |
| int32_t wifi_config_set_country_region | ( | uint8_t | band, |
| uint8_t | region | ||
| ) |
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.
| [in] | band | indicates the Wi-Fi bandwidth to operate on. |
| Value | Definition |
|---|---|
| WIFI_BAND_2_4_G | 2.4GHz |
| WIFI_BAND_5_G | 5GHz |
| [in] | region | indicates 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 |
| 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 |
| 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.
| [out] | interval | is the number in a range of 1 ~ 255 beacon intervals. For more information, please refer to introduction to DTIM in Wikipedia.| |
| 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.
| [in] | interval | is the beacon's interval, and it should be a multiple of AP's DTIM period. The beacon's interval is usually 100 times the unit (100*1.024 ms), which means, the listen interval range is about (1~255) * 102.4ms. |
| int32_t wifi_config_set_opmode | ( | uint8_t | mode | ) |
This function sets the Wi-Fi operation mode and it takes effect immediately.
| [in] | mode | the operation mode to set. |
| Value | Definition |
|---|---|
| 0x01 | WIFI_MODE_STA_ONLY |
| 0x02 | WIFI_MODE_AP_ONLY |
| 0x03 | WIFI_MODE_REPEATER |
| 0x04 | WIFI_MODE_MONITOR |
| int32_t wifi_config_set_pmk | ( | uint8_t | port, |
| uint8_t * | pmk | ||
| ) |
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.
| [in] | port | is 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 |
| [out] | pmk | is 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. |
| 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.
| [in] | on_off | indicates 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 |
| 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.
| [in] | flag | is defined in wifi_rx_filter_t. |
| 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.
| [in] | port | is 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 |
| [in] | auth_mode | is the authentication mode. For details about this parameter, please refer to wifi_auth_mode_t. |
| [in] | encrypt_type | is the encryption mode. For details about this parameter, please refer to wifi_encrypt_type_t. |
| 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().
| [in] | flag | is the parameter set to enable or disable smart connection function. |
| Value | Definition |
|---|---|
| 0 | DISABLE |
| 1 | ENABLE |
| 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.
| [in] | port | indicates 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 |
| [in] | ssid | is 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_length | is the length of the SSID, the maximum length is WIFI_MAX_LENGTH_OF_SSID in bytes. |
| 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.
| [in] | port | indicates 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 |
| [in] | wep_keys | is a pointer to the WEP keys. For more details, please refer to wifi_wep_key_t. |
| 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.
| [in] | port | is 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 |
| [in] | mode | is the wireless mode. For more information, please refer to wifi_phy_mode_t. |
| 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.
| [in] | port | indicates 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 |
| [in] | passphrase | is 8 to 63 bytes ASCII or 64 bytes hexadecimal. |
| [in] | passphrase_length | is the length range from 8 to 64. |
| 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.
| int32_t wifi_connection_disconnect_ap | ( | void | ) |
This function immediately disconnects the current connection from the connected AP.
The device switches to idle state and stops scanning, regardless it's connected to the AP. 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.
| 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.
| [in] | address | is station's MAC address. |
| 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.
| [out] | link_status | indicates the current STA port's link up or link down connection status. |
| Value | Definition |
|---|---|
| 0 | WIFI_STATUS_LINK_DISCONNECTED |
| 1 | WIFI_STATUS_LINK_CONNECTED |
| 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.
| [out] | sta_number | returns the maximum number of the supported stations. |
| 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.
| [out] | rssi | returns the RSSI of the connected AP. |
| 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.
| [out] | sta_list | is defined in wifi_sta_list_t that includes station information such as RSSI, bandwidth, channel, MAC and TX rate. |
| [out] | number | returns the number of associated stations. |
| 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.
| [in] | pbuf | is a pointer to indicate the payload of beacon or probe request packets. |
| [in] | len | is the length of packet's payload. |
| [out] | ap_data | is the buffer to store AP information received from beacon or probe request packet parse result. |
| 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.
| [in] | event | is the event ID. For more details, please refer to wifi_event_t. |
| [in] | handler | is the event handler. For more details, please refer to wifi_event_handler_t. |
| int32_t wifi_connection_register_event_notifier | ( | uint8_t | event, |
| wifi_event_handler_t | notifier | ||
| ) |
Please use wifi_connection_register_event_handler() to replace this function.
| [in] | event | is the event ID. For more details, please refer to wifi_event_t. |
| [in] | notifier | is the event handler. For more details, please refer to wifi_event_handler_t. |
| int32_t wifi_connection_scan_deinit | ( | void | ) |
This function deinitializes the scan table.
| int32_t wifi_connection_scan_init | ( | wifi_scan_list_item_t * | ap_list, |
| uint32_t | max_count | ||
| ) |
This function initializes the scan table in the Wi-Fi driver.
| [in] | ap_list | is a pointer of the user buffer where the further scanned AP list will be stored. |
| [in] | max_count | is the maximum number of ap_list can be stored. |
| 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.
| [in] | raw_packet | is 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] | length | is the length of the raw packet. |
| 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.
| [in] | ssid | specifies 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_length | specifies the length of the SSID. |
| [in] | bssid | specifies 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_mode | is 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.
| [in] | scan_option | selects 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. |
| 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.
| 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().
| [in] | event | is the event ID. For more details, please refer to wifi_event_t for more details. |
| [in] | handler | is the event handler. For more details, please refer to wifi_event_handler_t. |
| int32_t wifi_connection_unregister_event_notifier | ( | uint8_t | event, |
| wifi_event_handler_t | notifier | ||
| ) |
Please use wifi_connection_unregister_event_handler() to replace this function.
| [in] | event | is the event ID. For more details, please refer to wifi_event_t. |
| [in] | notifier | is the event handler. For more details, please refer to wifi_event_handler_t. |
| void wifi_init | ( | wifi_config_t * | config, |
| wifi_config_ext_t * | config_ext | ||
| ) |
This function initializes the Wi-Fi module.
| [in] | config | is the Wi-Fi configuration to be set, it should not be null. |
| [in] | config_ext | is the extended Wi-Fi configuration to be set, it can be null if no extended features are expected. |
| int32_t wifi_profile_commit_setting | ( | char * | profile_section | ) |
This function is not implemented.
| int32_t wifi_profile_get_bandwidth | ( | uint8_t | port, |
| uint8_t * | bandwidth | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | bandwidth | is 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 |
| int32_t wifi_profile_get_channel | ( | uint8_t | port, |
| uint8_t * | channel | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | channel | is 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. |
| int32_t wifi_profile_get_country_region | ( | uint8_t | band, |
| uint8_t * | region | ||
| ) |
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.
| [in] | band | indicates the Wi-Fi bandwidth that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_BAND_2_4_G | 2.4GHz |
| WIFI_BAND_5_G | 5GHz |
| [out] | region | is the region code that relates to the channel list. For more details, please refer to wifi_config_set_country_region(). |
| int32_t wifi_profile_get_dtim_interval | ( | uint8_t * | interval | ) |
This function gets the Wi-Fi DTIM interval from a profile in the Flash memory.
| [out] | interval | is the interval of a beacon in a range from 1 to 255. For more details, please refer to wifi_config_set_dtim_interval(). |
| int32_t wifi_profile_get_listen_interval | ( | uint8_t * | interval | ) |
This function gets the Wi-Fi Listen Interval from a profile in the Flash memory.
| [out] | interval | is 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. |
| int32_t wifi_profile_get_mac_address | ( | uint8_t | port, |
| uint8_t * | address | ||
| ) |
This function gets the MAC address of the Wi-Fi interface from a profile in the Flash memory.
| [in] | port | indicates 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 |
| [out] | address | is the MAC address WIFI_MAC_ADDRESS_LENGTH bytes. |
| int32_t wifi_profile_get_opmode | ( | uint8_t * | mode | ) |
This function gets the operation mode from a profile in the Flash memory.
| [out] | mode | indicates 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 |
| int32_t wifi_profile_get_pmk | ( | uint8_t | port, |
| uint8_t * | pmk | ||
| ) |
This function gets the PMK from a profile in the Flash memory.
| [in] | port | indicates 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 |
| [out] | pmk | is the Pairwise Master Key, the shared secret key used in the IEEE 802.11 protocol. |
| int32_t wifi_profile_get_power_save_mode | ( | uint8_t * | power_save_mode | ) |
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.
| [out] | power_save_mode | is 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. |
| int32_t wifi_profile_get_profile | ( | uint8_t | port, |
| wifi_profile_t * | profile | ||
| ) |
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 | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | auth_mode | is the authentication mode. For more details, please refer to wifi_auth_mode_t. |
| [out] | encrypt_type | is the encryption type. For more details, please refer to wifi_encrypt_type_t. |
| int32_t wifi_profile_get_ssid | ( | uint8_t | port, |
| uint8_t * | ssid, | ||
| uint8_t * | ssid_length | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | ssid | is 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_length | is the length of the SSID, the maximum is WIFI_MAX_LENGTH_OF_SSID in bytes. |
| int32_t wifi_profile_get_wep_key | ( | uint8_t | port, |
| wifi_wep_key_t * | wep_keys | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | wep_keys | are the WEP keys. For more details, please refer to wifi_wep_key_t. |
| int32_t wifi_profile_get_wireless_mode | ( | uint8_t | port, |
| wifi_phy_mode_t * | mode | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | mode | is wireless mode. For more details, please refer to wifi_phy_mode_t. |
| int32_t wifi_profile_get_wpa_psk_key | ( | uint8_t | port, |
| uint8_t * | passphrase, | ||
| uint8_t * | passphrase_length | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | passphrase | is from 8 to 63 bytes ASCII or 64bytes hexadecimal. |
| [out] | passphrase_length | is the length, ranging from 8 to 64. |
| int32_t wifi_profile_set_bandwidth | ( | uint8_t | port, |
| uint8_t | bandwidth | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | bandwidth | is 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 |
| int32_t wifi_profile_set_channel | ( | uint8_t | port, |
| uint8_t | channel | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | channel | is 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. |
| int32_t wifi_profile_set_country_region | ( | uint8_t | band, |
| uint8_t | region | ||
| ) |
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.
| [in] | band | indicates the Wi-Fi bandwidth that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_BAND_2_4_G | 2.4GHz |
| WIFI_BAND_5_G | 5GHz |
| [in] | region | is the region code that related to the channel list. For more details, please refer to wifi_config_set_country_region(). |
| int32_t wifi_profile_set_dtim_interval | ( | uint8_t | interval | ) |
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.
| [in] | interval | is the interval of a beacon in a range from 1 to 255. For more details, please refer to wifi_config_set_dtim_interval(). |
| int32_t wifi_profile_set_listen_interval | ( | uint8_t | interval | ) |
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.
| [in] | interval | is the interval of a beacon in a range from 1 to 255. |
| int32_t wifi_profile_set_mac_address | ( | uint8_t | port, |
| uint8_t * | address | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | address | is the buffer assigned for the MAC Address, with the length of WIFI_MAC_ADDRESS_LENGTH in bytes. |
| int32_t wifi_profile_set_opmode | ( | uint8_t | mode | ) |
This function stores the operation mode in a profile in the Flash memory.
The profile is read to initialize the system at boot up.
| [in] | mode | indicates 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 |
| int32_t wifi_profile_set_pmk | ( | uint8_t | port, |
| uint8_t * | pmk | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | pmk | is the Pairwise Master Key, the shared secret key used in the IEEE 802.11 protocol. |
| int32_t wifi_profile_set_power_save_mode | ( | uint8_t | power_save_mode | ) |
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.
| [in] | power_save_mode | indicates 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. |
| int32_t wifi_profile_set_security_mode | ( | uint8_t | port, |
| wifi_auth_mode_t | auth_mode, | ||
| wifi_encrypt_type_t | encrypt_type | ||
| ) |
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.
| [in] | port | indicates 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 |
| [out] | auth_mode | is the authentication mode. For more details, please refer to wifi_auth_mode_t. |
| [out] | encrypt_type | is the encryption type. For more details, please refer to wifi_encrypt_type_t. |
| int32_t wifi_profile_set_ssid | ( | uint8_t | port, |
| uint8_t * | ssid, | ||
| uint8_t | ssid_length | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | ssid | is 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_length | is the length of the SSID, the maximum is WIFI_MAX_LENGTH_OF_SSID in bytes. |
| int32_t wifi_profile_set_wep_key | ( | uint8_t | port, |
| wifi_wep_key_t * | wep_keys | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | wep_keys | are the WEP keys. For more details, please refer to wifi_wep_key_t. |
| int32_t wifi_profile_set_wireless_mode | ( | uint8_t | port, |
| wifi_phy_mode_t | mode | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | mode | is wireless mode. For more details, please refer to wifi_phy_mode_t. |
| int32_t wifi_profile_set_wpa_psk_key | ( | uint8_t | port, |
| uint8_t * | passphrase, | ||
| uint8_t | passphrase_length | ||
| ) |
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.
| [in] | port | indicates 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 |
| [in] | passphrase | is from 8 to 63 bytes ASCII or 64bytes hexadecimal. |
| [in] | passphrase_length | is the length, ranging from 8 to 64. |
| int32_t wifi_wps_config_get_auto_connection | ( | bool * | auto_connection | ) |
This function gets auto connection configuration.
| [out] | auto_connection | indicates 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. |
| int32_t wifi_wps_config_get_device_info | ( | wifi_wps_device_info_t * | device_info | ) |
This function gets the WPS device information.
| [out] | device_info | indicates the device informaton. For more details, please refer to wifi_wps_device_info_t. device_information can read back by this API after set. |
| 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.
| [in] | port | is the Wi-Fi port that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_PORT_STA | STA |
| WIFI_PORT_AP | AP |
| [out] | pin_code | is the pin code with 8 ASCII characters. |
| 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.
| [in] | auto_connection | set 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. |
| int32_t wifi_wps_config_set_device_info | ( | wifi_wps_device_info_t * | device_info | ) |
This function sets the WPS device information.
| [in] | device_info | indicates 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. |
| 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.
| [in] | port | indicates the Wi-Fi port that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_PORT_STA | STA |
| WIFI_PORT_AP | AP |
| [in] | bssid | is the target AP's MAC address, it should be NULL the port is set to WIFI_PORT_AP. |
| 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.
| [in] | port | indicates the Wi-Fi port that the function will operate on. |
| Value | Definition |
|---|---|
| WIFI_PORT_STA | STA |
| WIFI_PORT_AP | AP |
| [in] | bssid | is the target AP's MAC address, it should be NULL while the port is WIFI_PORT_AP. |
| [in] | pin_code | is 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. |