The WICED Feather API allows you to store 'profiles', which contain all of the settings about a specific AP (access point).
This means that you only need to enter your AP details once, and once connected you can store them in non-volatile config memory for later use, simplifying project management and speeding up connection time in certain instances.
This is useful in situations where your project might move from one physical location to another, and the AP will change between locations (for example at home and at the office).
Connecting via Profiles
To connect to an AP using the stored profile data, simply call the bare Feather.connect() function with no parameters. This will attempt to connect to the profiles stored in non-volatile memory from the first entry to the last, and will return false is we were unable to connect to any of the stored APs.
Profiles API
The profile management API includes the following functions (defined as part of the AdafruitFeather class which is normally available as Feather.*):
bool saveConnectedProfile ( void ); // Save currently connected AP bool addProfile ( char* ssid ); // Open bool addProfile ( char* ssid, char* key, wl_enc_type_t enc_type); bool removeProfile ( char* ssid ); bool checkProfile ( char* ssid ); // Check if profile exists void clearProfiles ( void ); char* profileSSID ( uint8_t pos); int32_t profileEncryptionType ( uint8_t pos);
bool saveConnectedProfile (void)
Saves the currently connected access point details as a Profile. You must be connected when calling this functions.
Parameters: None
Returns: 'true' (1) if the profile was successfully added, otherwise 'false' (0).
bool addProfile (char* ssid)
Saves the specified open SSID to the profile list. This function should only be used with open access points that have no security/encoding enabled.
Parameters:
- ssid: A string containing the access point's SSID/name.
Returns: 'true' (1) if the profile was successfully added, otherwise 'false' (0).
bool addProfile (char* ssid, char* key, wl_enc_type_t enc_type)
Saves the specified secure SSID to the profile list. This function should not be used with open access points.
Parameters:
- ssid: A string containing the access point's SSID/name.
- key: A string containing the pass key for the SSID
- enc_type: The security encoding type for the access point, which can be one of the following values:
Encoding Types (wl_enc_type_t):
- ENC_TYPE_WEP
- WEP security with open authentication
-
ENC_TYPE_WEP_SHARED
WEP security with shared authentication - ENC_TYPE_WPA_TKIP
- WPA security with TKIP
-
ENC_TYPE_WPA_AES
WPA security with AES -
ENC_TYPE_WPA_MIXED
WPA security with AES and TKIP -
ENC_TYPE_WPA2_TKIP
WPA2 security with TKIP -
ENC_TYPE_WPA2_AES
WPA2 security with AES -
ENC_TYPE_WPA2_MIXED
WPA2 security with TKIP and AES -
ENC_TYPE_WPA_TKIP_ENT
WPA enterprise security with TKIP -
ENC_TYPE_WPA_AES_ENT
WPA enterprise security with AES -
ENC_TYPE_WPA_MIXED_ENT
WPA enteprise security with TKIP and AES -
ENC_TYPE_WPA2_TKIP_ENT
WPA2 enterprise security with TKIP -
ENC_TYPE_WPA2_AES_ENT
WPA2 enterprise security with AES -
ENC_TYPE_WPA2_MIXED_ENT
WPA2 enterprise security with TKIP and AES -
ENC_TYPE_WPS_OPEN
WPS with open security -
ENC_TYPE_WPS_SECURE
WPS with AES security -
ENC_TYPE_IBSS_OPEN
BSS with open security
Returns: 'true' (1) if the profile was successfully added, otherwise 'false' (0).
bool removeProfile (char* ssid)
Removes the profile with the matching ssid from non-volatile memory.
Parameters:
- ssid: A string containing the access point's SSID/name.
Returns: 'true' (1) if the profile was successfully found and removed, otherwise 'false' (0).
void clearProfiles (void)
Clears all profiles from non-volatile memory.
Parameters: None
Returns: Nothing
char* profileSSID (uint8_t pos);
Returns a string containing the SSID name for the profile stored at the specified position.
Parameters:
- pos: The position in NVM for the profile, which can be a value between 0 and 4 (since the position is a zero-based integer).
Returns: NULL if no profile was found at the specified 'pos', otherwise a string corresponding to SSID name for the stored profile.
int32_t profileEncryptionType (uint8_t pos);
Returns the `wl_enc_type_t` value for the profile stored at the specified position.
Parameters:
- pos: The position in NVM for the profile, which can be a value between 0 and 4 (since the position is a zero-based integer).
Returns: '-1' if no profile was found at the specified 'pos', otherwise an integer corresponding to one of the entries in 'wl_enc_type_t' (see the list of options in addProfile above).