Fix coverity issue (1025915).
[platform/core/connectivity/net-config.git] / src / wifi-state.c
index 1df0c37..27c64f1 100755 (executable)
@@ -480,6 +480,7 @@ void wifi_state_update_power_state(gboolean powered)
                /* Inform net-popup to remove the wifi found notification */
                netconfig_send_notification_to_net_popup(NETCONFIG_DEL_FOUND_AP_NOTI, NULL);
                netconfig_send_notification_to_net_popup(NETCONFIG_DEL_PORTAL_NOTI, NULL);
+               netconfig_send_notification_to_net_popup(NETCONFIG_DEL_IP_CONFLICT_NOTI, NULL);
 
                _deregister_network_notification();
        }
@@ -670,6 +671,34 @@ wifi_tech_state_e wifi_state_get_technology_state(void)
        return g_tech_state;
 }
 
+gboolean wifi_state_is_technology_available(void)
+{
+       GVariant *message = NULL;
+       GVariantIter *iter, *next;
+       const char *path;
+       gboolean ret = FALSE;
+
+       message = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
+                       CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
+                       "GetTechnologies", NULL);
+       if (message == NULL) {
+               ERR("Failed to get_technology_state");
+               return FALSE;
+       }
+
+       g_variant_get(message, "(a(oa{sv}))", &iter);
+       while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
+               if (path != NULL && g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) == 0)
+                       ret = TRUE;
+       }
+
+       g_variant_unref(message);
+       g_variant_iter_free(iter);
+
+       DBG("Wi-Fi technology is %s", ret ? "available" : "unavailable");
+       return ret;
+}
+
 void wifi_state_set_connected_essid(void)
 {
        __set_wifi_connected_essid();
@@ -696,7 +725,7 @@ void wifi_state_get_connected_essid(gchar **essid)
  */
 gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context)
 {
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
        GVariant *param = NULL;
        wifi_tech_state_e tech_state = NETCONFIG_WIFI_TECH_UNKNOWN;
        wifi_service_state_e service_state = NETCONFIG_WIFI_UNKNOWN;