From: Saurav Babu Date: Tue, 19 Jan 2016 04:56:40 +0000 (+0530) Subject: [net-config] Notify WiFi Connect failure to libnet-client X-Git-Tag: submit/tizen/20160211.015108~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd99f63257bb9b0b58a1fdc0cc680097c07abe0c;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git [net-config] Notify WiFi Connect failure to libnet-client Sometimes connman may fail to start WiFi connection, this failure should be notified to libnet-client so that it can clear its connection flags. This patch sends a new signal WiFiConnectFail when failure is received from connman at the time of starting WiFi connection. Change-Id: I17ec729647ddcd0a045fb3571c4863e4c63fdf58 Signed-off-by: Saurav Babu --- diff --git a/include/wifi.h b/include/wifi.h index 9163ab7..f72d12e 100755 --- a/include/wifi.h +++ b/include/wifi.h @@ -34,6 +34,9 @@ extern "C" { #define WIFI_CERT_STORAGEDIR "/var/lib/wifi/cert" #define CONNMAN_STORAGEDIR "/var/lib/connman" +void __netconfig_wifi_connect_reply(GObject *source_object, GAsyncResult *res, + gpointer user_data); + void wifi_object_create_and_init(void); void wifi_object_deinit(void); diff --git a/src/wifi-agent.c b/src/wifi-agent.c index c4456c7..57f8bf0 100755 --- a/src/wifi-agent.c +++ b/src/wifi-agent.c @@ -282,7 +282,8 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, if (updated == TRUE) { reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE, - service, CONNMAN_SERVICE_INTERFACE, "Connect", NULL, NULL); + service, CONNMAN_SERVICE_INTERFACE, "Connect", + NULL, __netconfig_wifi_connect_reply); if (reply == TRUE) { g_dbus_method_invocation_return_value (context, NULL); } else { diff --git a/src/wifi-eap-config.c b/src/wifi-eap-config.c index 72b0636..adaa63d 100755 --- a/src/wifi-eap-config.c +++ b/src/wifi-eap-config.c @@ -515,7 +515,8 @@ gboolean handle_create_eap_config(Wifi *wifi, GDBusMethodInvocation *context, } result = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE, - service, CONNMAN_SERVICE_INTERFACE, "Connect", NULL, NULL); + service, CONNMAN_SERVICE_INTERFACE, "Connect", + NULL, __netconfig_wifi_connect_reply); if (netconfig_eap_notifier.user_data != NULL) { g_free(netconfig_eap_notifier.user_data); diff --git a/src/wifi.c b/src/wifi.c index 796849c..ea1b2d7 100755 --- a/src/wifi.c +++ b/src/wifi.c @@ -69,6 +69,32 @@ static void _set_wifi_mac_address(void) } } +void __netconfig_wifi_connect_reply(GObject *source_object, GAsyncResult *res, + gpointer user_data) +{ + GDBusConnection *conn = NULL; + GError *error = NULL; + + DBG("WiFi Connection Reply"); + + conn = G_DBUS_CONNECTION(source_object); + g_dbus_connection_call_finish(conn, res, &error); + if (error != NULL) { + ERR("WiFi Connection Error [%s]", error->message); + g_error_free(error); + if (netconfig_dbus_emit_signal(NULL, NETCONFIG_WIFI_PATH, + NETCONFIG_WIFI_INTERFACE, "WiFiConnectFail", + NULL) == FALSE) + ERR("Failed to emit WiFiConnectFail signal"); + else + DBG("Successfully sent WiFiConnectFail signal"); + } else + DBG("WiFi Connection has been initiated successfully"); + + netconfig_gdbus_pending_call_unref(); + return; +} + void wifi_object_create_and_init(void) { DBG("Create wifi object.");