Added handling to support TDLS feature 00/118600/3 accepted/tizen/common/20170316.162017 accepted/tizen/ivi/20170316.222644 accepted/tizen/mobile/20170316.222557 accepted/tizen/tv/20170316.222621 accepted/tizen/unified/20170316.222704 accepted/tizen/wearable/20170316.222632 submit/tizen/20170316.113431
authortaesub kim <taesub.kim@samsung.com>
Mon, 13 Mar 2017 08:23:05 +0000 (17:23 +0900)
committertaesub kim <taesub.kim@samsung.com>
Wed, 15 Mar 2017 06:21:05 +0000 (15:21 +0900)
Change-Id: I33510a7236409f28dea53177363fe6a5679e22ce

include/wifi-tdls.h
interfaces/netconfig-iface-wifi.xml
src/wifi-tdls.c
src/wifi.c

index 0caea6a..53057b6 100755 (executable)
@@ -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
index b862adb..cf5fd45 100755 (executable)
                        <arg type="b" name="allowed" direction="out"/>
                </method>
                <method name="TdlsDisconnect">
-                       <arg type="s" name="pee_mac_addr" direction="in"/>
+                       <arg type="s" name="peer_mac_addr" direction="in"/>
                        <arg  type="i" name="result" direction="out" />
                </method>
                <method name="TdlsConnectedPeer">
                        <arg  type="s" name="peer_mac_addr" direction="out" />
                </method>
+               <method name="TdlsConnect">
+                       <arg type="s" name="peer_mac_addr" direction="in"/>
+                       <arg  type="i" name="result" direction="out" />
+               </method>
+               <method name="TdlsDiscover">
+               </method>
                <signal name="PowerOnCompleted"></signal>
                <signal name="PowerOffCompleted"></signal>
                <signal name="PowerOperationFailed"></signal>
index d34dbfa..9c45374 100755 (executable)
@@ -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;
index de24594..889387f 100755 (executable)
@@ -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)) {