From: taesub kim Date: Mon, 13 Mar 2017 08:23:05 +0000 (+0900) Subject: Added handling to support TDLS feature X-Git-Tag: accepted/tizen/common/20170316.162017^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fnet-config.git;a=commitdiff_plain;h=6a32461085fdd9131214358af9fbc1c001eb2694 Added handling to support TDLS feature Change-Id: I33510a7236409f28dea53177363fe6a5679e22ce --- diff --git a/include/wifi-tdls.h b/include/wifi-tdls.h index 0caea6a..53057b6 100755 --- a/include/wifi-tdls.h +++ b/include/wifi-tdls.h @@ -31,6 +31,8 @@ void netconfig_wifi_tlds_disconnected_event(GVariant *message); void __netconfig_wifi_notify_tdls_connected_event(const char *peer_mac); gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context, gchar *peer_mac_addr); gboolean handle_tdls_connected_peer(Wifi *wifi, GDBusMethodInvocation *context); +gboolean handle_tdls_connect(Wifi *wifi, GDBusMethodInvocation *context, gchar *peer_mac_Addr); +gboolean handle_tdls_discover(Wifi *wifi, GDBusMethodInvocation *context); #ifdef __cplusplus diff --git a/interfaces/netconfig-iface-wifi.xml b/interfaces/netconfig-iface-wifi.xml index b862adb..cf5fd45 100755 --- a/interfaces/netconfig-iface-wifi.xml +++ b/interfaces/netconfig-iface-wifi.xml @@ -113,12 +113,18 @@ - + + + + + + + diff --git a/src/wifi-tdls.c b/src/wifi-tdls.c index d34dbfa..9c45374 100755 --- a/src/wifi-tdls.c +++ b/src/wifi-tdls.c @@ -79,6 +79,56 @@ static GVariant * __netconfig_wifi_tdls_send_dbus_str(const char* method, const return message; } +gboolean handle_tdls_connect(Wifi *wifi, GDBusMethodInvocation *context, + gchar *peer_mac_Addr) +{ + DBG("[TizenMW-->WPAS]: TDLS Setup Request: [%s]", peer_mac_Addr); + + if (is_connected) { + ERR(" Already active TDLS Connection !!!"); + } else { + GVariant *message = NULL; + message = __netconfig_wifi_tdls_send_dbus_str("TDLSSetup", (const char*)peer_mac_Addr); + + if (message == NULL) { + ERR(" TDLS : failed to connect !!!"); + netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailTdlsConnect"); + return FALSE; + } + + DBG("[TizenMW<--WPAS] TDLS DBUS Command sent successfully"); + g_variant_unref(message); + is_connected = 1; + } + + wifi_complete_tdls_connect(wifi, context, 1); + return TRUE; +} + +gboolean handle_tdls_discover(Wifi *wifi, GDBusMethodInvocation *context) +{ + DBG("[TizenMW-->WPAS]: TDLS Discover Request "); + + if (is_connected) { + ERR(" Already active TDLS Connection !!!"); + } else { + GVariant *message = NULL; + message = __netconfig_wifi_tdls_send_dbus_str("TDLSDiscover", "ff:ff:ff:ff:ff:ff"); + + if (message == NULL) { + ERR(" TDLS : failed to discover !!!"); + netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailTdlsDiscover"); + return FALSE; + } + + DBG("[TizenMW<--WPAS] TDLS DBUS Command sent successfully"); + g_variant_unref(message); + } + + wifi_complete_tdls_discover(wifi, context); + return TRUE; +} + gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context, gchar *peer_mac_Addr) { @@ -89,6 +139,13 @@ gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context, } else { GVariant *message = NULL; message = __netconfig_wifi_tdls_send_dbus_str("TDLSTeardown", (const char*)peer_mac_Addr); + + if (message == NULL) { + ERR(" TDLS : failed to disconnect !!!"); + netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailTdlsDisconnect"); + return FALSE; + } + DBG("[TizenMW<--WPAS] TDLS DBUS Command sent successfully"); g_variant_unref(message); is_connected = 0; diff --git a/src/wifi.c b/src/wifi.c index de24594..889387f 100755 --- a/src/wifi.c +++ b/src/wifi.c @@ -240,6 +240,10 @@ void wifi_object_create_and_init(void) G_CALLBACK(handle_tdls_disconnect), NULL); g_signal_connect(wifi_object, "handle-tdls-connected-peer", G_CALLBACK(handle_tdls_connected_peer), NULL); + g_signal_connect(wifi_object, "handle-tdls-discover", + G_CALLBACK(handle_tdls_discover), NULL); + g_signal_connect(wifi_object, "handle-tdls-connect", + G_CALLBACK(handle_tdls_connect), NULL); if (!g_dbus_interface_skeleton_export(interface_wifi, connection, NETCONFIG_WIFI_PATH, NULL)) {