From: taesubkim Date: Mon, 25 Jul 2016 08:13:06 +0000 (+0900) Subject: Modified the dbus error handling for technology reply X-Git-Tag: submit/tizen/20160805.043523~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F81285%2F3;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Modified the dbus error handling for technology reply Change-Id: Ie2f94985396d287b77a11ac3d2af8ceeae7bb4f5 Signed-off-by: Taesub Kim --- diff --git a/src/wifi-power.c b/src/wifi-power.c index b3eae8a..5705b69 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -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");