From 6c9aab38c2e52305814d82a32ff217035a8fb68a Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Thu, 1 Nov 2018 17:55:56 +0900 Subject: [PATCH] Disconnect and forget the AP when removing the AP configuration. Change-Id: I2daf6e343e796012eee2d48e322b73c1d6463c74 Signed-off-by: Jaehyun Kim --- src/wifi_internal.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/wifi_internal.c b/src/wifi_internal.c index b8262e4..f54af56 100755 --- a/src/wifi_internal.c +++ b/src/wifi_internal.c @@ -2934,6 +2934,7 @@ int _wifi_foreach_configuration(wifi_manager_config_list_cb callback, void *user int _wifi_remove_configuration(const gchar *config_id) { int rv; + GSList *list; rv = net_config_remove_configurations(config_id); if (rv == NET_ERR_ACCESS_DENIED) { @@ -2942,6 +2943,34 @@ int _wifi_remove_configuration(const gchar *config_id) } else if (rv != NET_ERR_NONE) return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE + rv = __update_profile_iterator(); + if (rv == NET_ERR_ACCESS_DENIED) { + WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE + return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE + } + + if ((int)g_slist_length(profile_iterator) == 0) { + WIFI_LOG(WIFI_WARN, "There is no AP"); //LCOV_EXCL_LINE + return WIFI_MANAGER_ERROR_NONE; //LCOV_EXCL_LINE + } + + for (list = profile_iterator; list; list = list->next) { + net_profile_info_s *prof_info = (net_profile_info_s *)list->data; + if (g_str_has_suffix((gchar*)(prof_info->ProfileName), config_id) == TRUE) { + + rv = net_delete_profile(prof_info->ProfileName); //LCOV_EXCL_LINE + if (rv == NET_ERR_ACCESS_DENIED) { + WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE + return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE + } else if (rv != NET_ERR_NONE) { + return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE + } + + prof_info->Favourite = (char)FALSE; //LCOV_EXCL_LINE + break; + } + } + return WIFI_MANAGER_ERROR_NONE; } -- 2.7.4