From 6e8bce216e064fa55703f205d82952c1e5e78bb6 Mon Sep 17 00:00:00 2001 From: taesubkim Date: Mon, 25 Jul 2016 17:13:06 +0900 Subject: [PATCH] Modified the dbus error handling for technology reply Change-Id: Ie2f94985396d287b77a11ac3d2af8ceeae7bb4f5 Signed-off-by: Taesub Kim --- src/wifi-power.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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"); -- 2.34.1