}
Connection Using Profiles
A WLAN profile provides the information required to connect to a given AP. This includes the SSID,
security type and security keys. Each profile refers to a certain AP. The profiles are stored in the NVMEM
(nonvolatile memory), and preserved during device reset. The following APIs are available for handling
profiles:
? sl_WlanProfileAdd – Used for adding a new profile. SSID and security information must be provided,
where the returned value refers to the stored index (out of the seven available).
? sl_WlanProfileDel – Used for deleting a certain stored profile, or for deleting all profiles at once. Index
should be the input parameter.
? sl_WlanProfileGet – Used for retrieving information from a specific stored profile. Index should be the
input parameter.
For additional information about these APIs, refer to the doxygen API manual.
Download the latest SDK for the complete example code.
/* Delete all profiles (0xFF) stored */
sl_WlanProfileDel(0xFF);
/* Add unsecured AP profile with priority 0 (lowest) */
sl_WlanProfileAdd(SL_SEC_TYPE_OPEN, (unsigned char*)UNSEC_SSID_NAME, strlen(UNSEC_SSID_NAME),
g_BSSID, 0, 0, 0, 0);
/* Add WPA2 secured AP profile with priority 1 (0 is lowest) */
sl_WlanProfileAdd(SL_SEC_TYPE_WPA, (unsigned char*)SEC_SSID_NAME, strlen(SEC_SSID_NAME), g_BSSID,
1, (unsigned char*)SEC_SSID_KEY, strlen(SEC_SSID_KEY), 0);转载