Modified the dbus error handling for technology reply 85/81285/3
authortaesubkim <taesub.kim@samsung.com>
Mon, 25 Jul 2016 08:13:06 +0000 (17:13 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Mon, 25 Jul 2016 09:00:49 +0000 (18:00 +0900)
Change-Id: Ie2f94985396d287b77a11ac3d2af8ceeae7bb4f5
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
src/wifi-power.c

index b3eae8a..5705b69 100755 (executable)
@@ -98,20 +98,25 @@ static void __technology_reply(GObject *source_object, GAsyncResult *res, gpoint
        GDBusConnection *conn = NULL;
        GError *error = NULL;
 
-       conn = G_DBUS_CONNECTION(source_object);
+       conn = G_DBUS_CONNECTION (source_object);
        reply = g_dbus_connection_call_finish(conn, res, &error);
 
        if (reply == NULL) {
                if (error != NULL) {
-                       if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") == 0)
+                       if (g_strstr_len(error->message, strlen(error->message),
+                                       CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") != NULL) {
                                wifi_state_update_power_state(TRUE);
-                       else if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") == 0)
+                       } else if (g_strstr_len(error->message, strlen(error->message),
+                                       CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") != NULL) {
                                wifi_state_update_power_state(FALSE);
-                       else
+                       } else {
                                ERR("Fail to request status [%d: %s]", error->code, error->message);
+                               wifi_state_update_power_state(FALSE);
+                       }
                        g_error_free(error);
                } else {
-                       ERR("Fail torequest status");
+                       ERR("Fail to request status");
+                       wifi_state_update_power_state(FALSE);
                }
        } else {
                DBG("Successfully requested");
@@ -288,8 +293,8 @@ static int _set_connman_technology_power(gboolean enable)
        params = g_variant_new("(sv)", key, param0);
 
        reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
-                       CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
-                       "SetProperty", params, __technology_reply);
+                                       CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
+                                       "SetProperty", params, __technology_reply);
 
        if (reply != TRUE) {
                ERR("Fail to set technology %s", enable == TRUE ? "enable" : "disable");