Fixed coding rule issues
[platform/core/connectivity/net-config.git] / src / wifi-background-scan.c
index b0e810f..8172fdf 100755 (executable)
@@ -85,6 +85,33 @@ static guint __netconfig_wifi_bgscan_get_mode(void)
        return __netconfig_wifi_bgscan_mode(FALSE, -1);
 }
 
+static void __netconfig_wifi_scan_request_reply(GObject *source_object, GAsyncResult *res, gpointer user_data)
+
+{
+       GVariant *reply;
+       GDBusConnection *conn = NULL;
+       GError *error = NULL;
+
+       conn = G_DBUS_CONNECTION(source_object);
+       reply = g_dbus_connection_call_finish(conn, res, &error);
+
+       if (reply == NULL) {
+               if (error != NULL) {
+                       ERR("Fail to request status [%d: %s]", error->code, error->message);
+                       netconfig_wifi_set_scanning(FALSE);
+                       g_error_free(error);
+               } else {
+                       ERR("Fail to request scan");
+                       netconfig_wifi_set_scanning(FALSE);
+               }
+       } else {
+               DBG("Successfully requested");
+       }
+
+       g_variant_unref(reply);
+       netconfig_gdbus_pending_call_unref();
+}
+
 static gboolean __netconfig_wifi_bgscan_request_connman_scan(int retries)
 {
        gboolean reply = FALSE;
@@ -105,7 +132,7 @@ static gboolean __netconfig_wifi_bgscan_request_connman_scan(int retries)
 
        reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
                        CONNMAN_WIFI_TECHNOLOGY_PREFIX,
-                       CONNMAN_TECHNOLOGY_INTERFACE, "Scan", NULL, NULL);
+                       CONNMAN_TECHNOLOGY_INTERFACE, "Scan", NULL, __netconfig_wifi_scan_request_reply);
        if (reply != TRUE)
                netconfig_wifi_set_scanning(FALSE);
 
@@ -198,7 +225,7 @@ static gboolean __netconfig_wifi_bgscan_next_scan(gpointer data)
                return FALSE;
 
        /* In case of LCD off, we don't need Wi-Fi scan */
-       vconf_get_int(VCONFKEY_PM_STATE, &pm_state);
+       netconfig_vconf_get_int(VCONFKEY_PM_STATE, &pm_state);
        if (pm_state >= VCONFKEY_PM_STATE_LCDOFF)
                return TRUE;
 
@@ -287,7 +314,7 @@ gboolean handle_set_bgscan(Wifi *wifi, GDBusMethodInvocation *context, guint sca
        netconfig_wifi_bgscan_stop();
 
        /* In case of LCD off, we don't need Wi-Fi scan right now */
-       vconf_get_int(VCONFKEY_PM_STATE, &pm_state);
+       netconfig_vconf_get_int(VCONFKEY_PM_STATE, &pm_state);
        if (pm_state >= VCONFKEY_PM_STATE_LCDOFF)
                netconfig_wifi_bgscan_start(FALSE);
        else