Station (STA)
44
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
Example:
SlWlanSecParams_t SecParams;
_i16 Status;
SecParams.Type = SL_WLAN_SEC_TYPE_WPA_WPA2;
SecParams.Key =
"123456789"
;
SecParams.KeyLen = strlen(SecParams.Key);
Status = sl_WlanConnect(
"Test_Ent_AP"
,strlen(
"Test_Ent_AP"
),0 ,&SecParams ,0,);
if
( Status )
{
/* error */
}
4.3.4 Events and Errors
The host can receive an indication of specific states through events or errors.
Asynchronous events can be sent to the host at any given time with an indication of specific states and
specific data for each event. To listen to these events and determine the needed information, a handler
must be implemented in the user application and registered under the user.h header file. The following
event may be received in relation to a WLAN connection:
•
SL_WLAN_EVENT_CONNECT
Indicates the connection is successful and includes the following information:
–
SSID
–
SSID length
–
BSSID
•
SL_WLAN_EVENT_DISCONNECT
Indicates the disconnection is successful and includes the following information:
–
SSID
–
SSID length
–
BSSID
–
Disconnect reason code
Errors are indicated by the return value of the API. Each error code is unique.
lists common
errors that require user action (a complete list of errors is under the error.h file in the host driver).
Table 4-3. Common Errors
Error
Value
Comments
SL_ERROR_ROLE_STA_ERR
–4107
Initialization failure in STA mode
SL_ERROR_WLAN_INVALID_ROLE
–2050
Action applied does not match the current mode.
SL_ERROR_WLAN_KEY_ERROR
–2049
One of the security parameters or SSID supplied is
wrong (invalid length or not supported).
SL_ERROR_WLAN_INVALID_SECURITY_TYPE
–2054
SL_ERROR_WLAN_PASSPHRASE_TOO_LONG
–2055
SL_ERROR_WLAN_PASSWORD_ERROR
–2058
SL_ERROR_WLAN_SSID_LEN_ERROR
–2060
SL_ERROR_WLAN_ILLEGAL_WEP_KEY_INDEX
–2064
SL_ERROR_WLAN_EAP_WRONG_METHOD
–2057
One of the EAP security parameters supplied is wrong
(invalid length or not supported).
SL_ERROR_WLAN_EAP_ANONYMOUS_LEN_ERROR
–2059
SL_ERROR_WLAN_USER_ID_LEN_ERROR
–2061
SL_ERROR_WLAN_PREFERRED_NETWORK_LIST_FULL
–2062
No free profile
SL_ERROR_WLAN_INVALID_POLICY_TYPE
–2066
Invalid policy type. Value is not supported.
SL_ERROR_WLAN_WIFI_ALREADY_DISCONNECTED
–2071
Applying disconnect command when disconnected