SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The SimpleLink Wi-Fi device provides users the ability to store up to seven preferred networks. These preferred networks, or profiles, can be used to establish connection automatically according to the connection policy settings. The profiles are stored in the file system (nonvolatile memory), and therefore are preserved during device reset. Profiles can be added, removed, or modified by using the host driver API or internal web server. Each profile has a priority which defines how connection order occurs. This means the SimpleLink Wi-Fi device tries to connect to the highest priority profile stored first (see Section 5.3.3.1).
Each profile includes the following information:
On successful completion of the provisioning process or the WPS process, a new profile is added. Profiles can be added, removed, edited, viewed, or temporarily suspended by using the following APIs:
Add a profile to the next available index. The return value is the profile index with a value from 0 to 6. Negative values indicate an error. This index identifies the profile, and should be used when deleting or editing the profile.
The following are examples of adding a WPA2 secured profile with SSID and BSSID:
_u8 MacAddr[] = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};
SlWlanSecParams_t SecParams;
_i16 Index;
SecParams.Type = SL_WLAN_SEC_TYPE_WPA_WPA2;
SecParams.Key = "123456789";
SecParams.KeyLen = strlen (SecParams.Key);
Index = sl_WlanProfileAdd("Test_AP", strlen("Test_AP"), MacAddr, &SecParams, NULL, 7 /* Priority*/, 0);
A specific profile can be deleted by its index. In addition, all profiles can be deleted at once by using the following value as an index: SL_WLAN_DEL_ALL_PROFILES.
An example for deleting all profiles:
_i16 Status;
Status = sl_WlanProfileDel(SL_WLAN_DEL_ALL_PROFILES);
if( Status )
{
/* error */
}
The driver also lets the user read the information of a stored profile by its index. For security reasons, this information includes only the public information of the profile. The password is not accessible from the host.
The following is an example for getting the information on a profile at index 2:
_i16 index, Status;
signed char Name[32];
_i16 NameLength;
unsigned char MacAddr[6];
SlWlanSecParams_t SecParams;
SlWlanGetSecParamsExt_t SecExtParams;
_u32 Priority;
Index = 2;
Status = sl_WlanProfileGet(Index, Name, &NameLength, MacAddr, &SecParams, &SecExtParams, &Priority);
if( Status )
{
/* error */
}
Adding a profile with an existing SSID, BSSID (if applicable), and security type updates the existing entry. If one of these values is different, it is considered a new profile and is saved as a new entry.
Update one or more of an existing profile's parameters. This API is important especially in order to update the priority of a profile. In case there is no need to update one of the parameters, set it to SL_WLAN_DONT_UPDATE.
If a profile was previously added with bssid, and the bssid must be removed (to connect to a different AP with the same ssid and better rssi), it is possible to remove the bssid from the profile using profile update api with the bssid set to: FF:FF:FF:FF:FF:FF.
Updating the SSID of a profile requires to provide also the security parameters, including the password, because it is considered as a different network.
Example of updating the priority of the profile in index 0:
SlWlanSecParams_t SecParams;
_u32 Priority;
_u32 index;
SecParams.Key = "";
SecParams.KeyLen = 0;
SecParams.Type = SL_WLAN_DONT_UPDATE;
Priority = 4;
index = 0;
Status = sl_WlanProfileUpdate(index, NULL,0,NULL,&SecParams ,NULL, Priority);
if( Status )
{
/* error */
}
Specific profiles can be suspended without deletion. This setting is not persistent, and it is deleted after reset.
An example of suspending a profile with index 1, 4, 6 follows:
_u32 SuspendedProfilesMask;
_i16 Status;
SuspendedProfilesMask = INDEX1 | INDEX4 | INDEX 6 ; /* 0x29 */
Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_SUSPEND_PROFILES, sizeof(suspendedProfilesMask),(_u8*)&suspendedProfilesMask);
if( Status )
{
/* error */
}
Only one enterprise profile is supported. Before adding the profile, write certificate files to the following system files:
An example of adding an enterprise profile follows:
SlWlanSecParams_t SecParams;
SlWlanSecParamsExt_t SecExtParams;
_i16 Index;
SecParams.Type = SL_WLAN_SEC_TYPE_WPA_ENT;
SecParams.Key = "123456789";
SecParams.KeyLen = strlen(SecParams.Key);
SecExtParams.User = "Ent_user";
SecExtParams.UserLen = strlen("Ent_user");
SecExtParams.EapMethod = SL_WLAN_ENT_EAP_METHOD_TTLS_TLS;
Index = sl_WlanProfileAdd("Test_Ent_AP",strlen("Test_Ent_AP"),0, &SecParams ,& SecExtParams,7 /* Priority*/,0);