Forget WiFi access point

This is a one-shot snippet to get the the currently connected WiFi access point and forget the data. PRIVILEGES NEEDED: http://tizen.org/privilege/network.get http://tizen.org/privilege/network.profile
//    PRIVILEGES needed to be set in tizen-manifest.xml:
//    http://tizen.org/privilege/network.get
//    http://tizen.org/privilege/network.profile

#include <wifi.h>

void forget_AP()
{
    wifi_ap_h access_point = NULL;
    if (wifi_initialize() == WIFI_ERROR_NONE
        && wifi_get_connected_ap(&access_point) == WIFI_ERROR_NONE
        && wifi_forget_ap(access_point) == WIFI_ERROR_NONE)
    {
        LOGI("Access point disconnected and forgotten!");
        if (wifi_deinitialize() != WIFI_ERROR_NONE)
        {
            LOGI("Error when deinitializing WiFi!");
        }
    }
    else
    {
        LOGE("Error when trying to forget Access Point data!");
    }
}

Responses

0 Replies