ContentsIndex
PreviousUpNext
WLAN
Topics | Functions | Macros | Structs, Records, Enums | Types
Description

Provides functions to configure, scan and connect to WiFi.

Introduction

This is the module of WLAN (Wireless LAN). It provides functions, vm_wlan_mode_set(), to set the WiFi mode, such as AP (Access Point) mode and STA (Station) mode. The WiFi mode can also be retrieved by calling vm_wlan_mode_get(). 

The vm_wlan_set_parameter() sets the WiFi parameters, such as SSID, authorization mode and password, under different WiFi operation mode. This function currently only supports the VM_WLAN_MODE_AP and VM_WLAN_MODE_AP_STA modes. 

The default values will be used if the parameters are not set or the setting operation failed. The default SSID is MTK_XXXXXX, where the value of XXXXXX is the last three bytes of mac address. The default authorize mode is WPA2_ONLY_PSK. The default password is 12345678. 

To connect to a WiFi, call vm_wlan_connect() with a callback, which notifies the the application when the connection is established. 

To scan for WiFi, the vm_wlan_scan_set_parameter() is used for setting the scan related parameters, such as dwell time or specific SSID list to scan for. 

The sniffer feature of WiFi can be turned on or off by vm_wlan_sniffer_on() or vm_wlan_sniffer_off(). 

The vm_wlan_register_notification_handler() is provided for application to register a callback for event notifications.

Limitation
  1. The vm_wlan_set_parameter() currently only supports the VM_WLAN_MODE_AP and

VM_WLAN_MODE_AP_STA modes. 

 

  1. For authorization mode, only OPEN and WPA2_ONLY_PSK are supported.

 

  1. The parameters need to be set before the AP is turned on.
Functions
Function 
Description 
Connects to the AP, as specified by the ap_info. DA WLAN service can only support one connection at the same time due to chip constraint. If a new connection request is received, the connecting process of the current request will be aborted. If there is a connection established already, the connection will be disconnected, and then make a new connection. 
Disconnects the current WLAN connection. After the WLAN disconnecting process is complete, the specified callback will be invoked. 
Gets information of the connected AP, such as BSSID, RSSI and the profile ID.
The info_type specifies what kind of information to be retrieved. The caller should ensure enough space for the buffer to store the information as following: info_type info VM_WLAN_AP_INFO_BSSID VMUINT8 array with length at least VM_WLAN_MAC_ADDRESS_LENGTH + 1. VM_WLAN_AP_INFO_PROF_ID VMUINT32* points to a VMUINT32 variable. VM_WLAN_AP_INFO_RSSI VMINT32* points to an VMINT32 variable. VM_WLAN_AP_INFO_ALL vm_wlan_connected_ap_info_t* to an vm_wlan_connected_ap_info_t variable. 
Gets the IP address, Netmask, gateway IP and DNS, when they are available. The IP information will be available only when the WLAN server is in CONNECTED status. There are two situations due to the way of how to obtain the IP. If using static IP when connecting, the IP will be available once the connection succeeds. If using DHCP when connecting, the IP will be available only when ABM notifies the IP by MSG, which will take a little time after connection succeeds. 
Gets the MAC address. The size of the dest buffer must be equal to or greater than VM_WLAN_MAC_ADDRESS_LENGTH, which means the destination_length must be equal to or greater than VM_WLAN_MAC_ADDRESS_LENGTH. Otherwise the WLAN Server will fail, and the required length (VM_WLAN_MAC_ADDRESS_LENGTH) will be set in the request_length, back to the application.
If the dest is NULL and the request_length exists (not NULL), the function will fail with the required length set in request_length for the application. 
Gets the parameter under different modes. Currently, only VM_WLAN_MODE_AP and VM_WLAN_MODE_AP_STA are supported to get AP's SSID, Auth mode and Password.
The caller should prepare the corresponding variables with proper types for parameter. The caller should prepare varible with proper type for "parameter" input parameter. 
Retrieves the WLAN mode. 
Switches the mode. VM_WLAN_SET_MODE_OFF turns off both AP mode and STA mode. VM_WLAN_SET_MODE_AP turns only AP mode on. VM_WLAN_SET_MODE_STA turns only STA mode on. VM_WLAN_SET_MODE_AP_STA turns both AP mode and STA mode on. 
Registers the callback for the notifications, such as IP available notification, or WiFi passive disconnect notification. When the related things happens, notifications will be activated and the callback will be invoked, if the callback has been registered.
Use vm_wlan_deregister_notification_handler() to un-register the callback that was registered prior. 
Gets roaming parameter. 
Sets the roaming parameter. 
Scans for the Access Points. 
Aborts the scan job. 
Sets scan parameters, such as dwell time or specific SSID list. The scan parameters will be initialized to the default values everytime when the WLAN is turned on from inactive. Setting scan parameters is not useful if the WLAN is in INACTIVE state. So it is not allowed to call this function when the WLAN is in INACTIVE state. If the scan parameters are not set, the default will be used. The default dwell time is 60 seconds; the default spec_ssid_list is NULL.
The parameter_type specifies what kind of scan parameters that is expected to be set. The caller... more 
Set the WLAN parameters under different modes. The caller should prepare the corresponding variables with proper types for parameter and parameter_type of the input parameters.
Currently, only VM_WLAN_MODE_AP and VM_WLAN_MODE_AP_STA are supported for setting up the SSID, Authorize Mode and Password.
For Authorize mode, only OPEN and WPA2_ONLY_PSK are supported. The parameter(s) need to be set before the AP is turned on.
The default values will be used if the parameters are not set or the setting operation failed. The default SSID is MTK_XXXXXX, where the value of XXXXXX is the last three bytes of mac address. The default authorize... more 
The function is used to close the sniffer in WLAN STA mode. 
The function is used to open the sniffer in WLAN STA mode. 
Retrieves the status of WLAN STA mode. 
Macros
Macro 
Description 
Maximum length of WLAN profile ID list. 
Maximum length of IP address in WLAN profile. 
Length of the MAC address. 
Maximum length of AP list. 
Maximum length of SSID list. 
WLAN maximum length of passphrase. 
Maximum length of password attribute of all kinds in WLAN profiles. 
Set all fields. 
Maximum length of WLAN profile passphrase attribute in WLAN profile. 
Maximum length of WLAN profile PSK attribute in WLAN profile. 
Maximum length of WLAN profile WEP key attribute in WLAN profile. 
Set authorization type field in WLAN account profile. 
Set password field in WLAN account profile. 
Set SSID field in WLAN account profile. 
Set username field in WLAN account profile. 
Maximum length of WLAN SSID attribute in WLAN profile. 
Maximum length of username attribute in WLAN profile. 
WAPI PSK string length. #endif /* __WAPI_SUPPORT__ */ Maximum length of password attribute in WLAN profile. 
Structs, Records, Enums
Struct, Record, Enum 
Description 
AP information. 
Connected AP info type 
WLAN AP types. 
WLAN authorization mode enum. 
same as supc_abm_cause_enum 
This struct is designed for WLAN SRV to send the connection result to APP. 
Connected AP information. 
supc_connection_type_enum 
WLAN encryption modes. 
This struct is designed for WLAN server to retrieve the IP information. 
WLAN set mode enum. 
WLAN mode status enum. 
WLAN network type enum. 
WLAN Notification structure. 
Notification types. 
WLAN parameters. 
AP mode information. 
This struct is designed for WLAN store query operation. 
Profile settings from Smart Connection broadcasts. Note that the username field is not supported by current version of Smart Connection. 
WLAN request result enum. 
WLAN services result enum. 
Event structure for setting roaming parameter. 
WLAN scan AP info structure. 
Scan parameters 
WLAN scan result enum. 
This struct is designed for WLAN SRV to send the scan result to APP. 
Sniffer ON Callback types. 
Sniffer ON configuration structure, used as parameter. 
Sniffer ON structure , used in callback function. 
Sniffer ON/OFF callback result Enum 
Part of scan parameters -- the specific SSID list. 
This struct is designed for user to pass the specialized SSID for scanning. 
WLAN station mode status. 
MAC address query structure. 
WLAN WEP key formats. 
Types
Type 
Description 
Prototype of WLAN general callback function for no feedback arguments except the additional user data. 
Prototype of WLAN connect result callback function 
Prototype of notification callback function. When notification arrives, the corresponding callback function will be invoked if it has been registered. 
WLAN scan result callback function. APPs need to copy the bss info byself. 
Prototype of WLAN sniffer OFF callback function. 
Prototype of WLAN sniffer on callback function. If successfully, this function will be called again with AP info. 
Links
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.