Modified dbus nonblock method of setting auto connect mode to dbus block 36/171036/2
authortaesub kim <taesub.kim@samsung.com>
Mon, 26 Feb 2018 05:44:26 +0000 (14:44 +0900)
committertaesub kim <taesub.kim@samsung.com>
Mon, 26 Feb 2018 06:05:34 +0000 (15:05 +0900)
Change-Id: I9d5d809bb6dc231c13b0f584284590c74d853b9b
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
src/network_dbus.c

index aeeda67..d3119de 100755 (executable)
@@ -640,33 +640,6 @@ static void __net_set_passpoint_reply(GObject *source_object, GAsyncResult *res,
        __NETWORK_FUNC_EXIT__;
 }
 
-static void __net_set_auto_connect_reply(GObject *source_object, GAsyncResult *res, gpointer user_data)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       GDBusConnection *conn = NULL;
-       GError *error = NULL;
-       net_err_e Error = NET_ERR_NONE;
-
-       WIFI_LOG(WIFI_INFO, "WiFi set auto connection reply");
-
-       conn = G_DBUS_CONNECTION(source_object);
-       g_dbus_connection_call_finish(conn, res, &error);
-       if (error != NULL) {
-               Error = __net_netconfig_error_string_to_enum(error->message);
-               g_error_free(error);
-       }
-
-       if (Error != NET_ERR_NONE)
-               WIFI_LOG(WIFI_ERROR, "set auto connect failed[%d]", Error);
-       else
-               WIFI_LOG(WIFI_INFO, "set auto connect succeeded");
-
-       _net_dbus_pending_call_unref();
-       __NETWORK_FUNC_EXIT__;
-}
-
-
 static char *__net_make_group_name(const char *ssid,
                const char *net_mode, const char *sec)
 {
@@ -2270,6 +2243,7 @@ int _net_dbus_set_auto_connect_mode(int connect_mode)
 {
        __NETWORK_FUNC_ENTER__;
 
+       GVariant *message = NULL;
        GVariant *params = NULL;
        GVariant *param0 = NULL;
        net_err_e Error = NET_ERR_NONE;
@@ -2287,10 +2261,16 @@ int _net_dbus_set_auto_connect_mode(int connect_mode)
 
        params = g_variant_new("(sv)", key, param0);
 
-       Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE,
                        CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
-                       "SetProperty", params, 6 * DBUS_REPLY_TIMEOUT,
-                       __net_set_auto_connect_reply);
+                       "SetProperty", params, &Error);
+       if (message == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Failed to Set AutoConnect");
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_unref(message);
 
        __NETWORK_FUNC_EXIT__;
        return Error;