![Texas Instruments CC3220 Скачать руководство пользователя страница 42](http://html.mh-extra.com/html/texas-instruments/cc3220/cc3220_programmers-manual_1094609042.webp)
Station (STA)
42
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
4.3.3.2
Preferred Networks (Profiles)
The SimpleLink Wi-Fi device provides users the ability to predefine 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 browser. 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
).
Each profile includes the following information:
•
SSID
•
BSSID
•
Security type
•
Password
•
EAP parameters (enterprise security type)
•
Priority
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 Profile
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);
•
Delete Profile
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: WLAN_DEL_ALL_PROFILES.
An example for deleting all profiles:
_i16 Status;
Status
= sl_WlanProfileDel(SL_WLAN_DEL_ALL_PROFILES);
if
( Status )
{
/* error */
}
•
Get Profile
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.
An example for getting the information on a profile at index 2 follows:
_i16 index, Status;
signed char
Name[32];
_i16 NameLength;
unsigned char
MacAddr[6];
SlWlanSecParams_t SecParams;
SlWlanGetSecParamsExt_t SecExtParams;
_u32 Priority;