You can retrieve the list of user configured profiles on the device, as well as information about each profile, such as the profile name and service set identifier (SSID). This information can help you determine if any of the retrieved SSIDs are supported by the aggregator app. If so, the user may want to delete those profiles and use your app to log in to the hotspots automatically.
You must free the memory allocated for the user profiles when the app no longer needs them.
To retrieve user profiles:
bool check_user_profiles()
{
wifi_result_t ret = WIFI_SUCCESS;
wifi_user_profile_list_t *profiles = NULL;
int num = 0;
wifi_security_type_t security;
bool enable = false;
bool user_enable = false;
char ssid[WIFI_MAX_SSID_BUFFER_LEN];
memset(ssid, 0x0, sizeof(ssid));
// read user profiles
ret = wifi_get_user_profiles(&profiles, &num);
if (ret != WIFI_SUCCESS) {
printf("wifi_get_user_profiles(): no available user profiles. [ret=%d]\n", ret);
return false;
} else {
printf("# of user profiles (created from UI): %d\n", num);
if (num > 0) {
for (index = 1; index <= num; index ++) {
ret = wifi_get_user_profile_ssid(profiles, index, ssid);
if (ret != WIFI_SUCCESS) {
// handle error
}
wifi_get_user_profile_security(profiles, index, &security);
if (ret != WIFI_SUCCESS) {
// handle error
}
ret = wifi_get_user_profile_enable(profiles,
index,
&enable,
&user_enable);
if (ret != WIFI_SUCCESS) {
// handle error
}
printf("index: %d\tssid: [%s]\t"
"security: %d\tenable: %d\tuser_enable: %d\n",
index, ssid, security, enable, user_enable);
}
ret = wifi_free_user_profiles(&profiles);
if (ret != WIFI_SUCCESS) {
// handle error
}
}
}
return true;
}