Fixed wifi activation failure
[platform/core/connectivity/net-config.git] / src / wifi-state.c
index 40d0a95..304b091 100755 (executable)
@@ -711,6 +711,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();