diff --git a/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs b/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs
index 1dbe019ec1b..d966df68f4a 100755
--- a/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs
+++ b/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs
@@ -20,5 +20,6 @@ internal static partial class Libraries
{
public const string WiFi = "libcapi-network-wifi-manager.so.1";
public const string Glib = "libglib-2.0.so.0";
+ public const string Libc = "libc.so.6";
}
}
diff --git a/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs b/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
index 580f0cc0268..8c98b8a041f 100755
--- a/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
+++ b/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
@@ -132,6 +132,8 @@ internal static partial class WiFi
internal static extern int SetScanStateChangedCallback(SafeWiFiManagerHandle wifi, ScanStateChangedCallback callback, IntPtr userData);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_unset_scan_state_changed_cb")]
internal static extern int UnsetScanStateChangedCallback(SafeWiFiManagerHandle wifi);
+ [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_tdls_get_connected_peer")]
+ internal static extern int GetTdlsConnectedPeer(SafeWiFiManagerHandle wifi, out IntPtr peerMacAddress);
internal static class AP
{
@@ -373,4 +375,10 @@ internal static partial class Glib
[DllImport(Libraries.Glib, EntryPoint = "g_free", CallingConvention = CallingConvention.Cdecl)]
public static extern void Free(IntPtr userData);
}
+
+ internal static partial class Libc
+ {
+ [DllImport(Libraries.Libc, EntryPoint = "free")]
+ public static extern void Free(IntPtr userData);
+ }
}
diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
index d7dd257d003..0939ce97360 100755
--- a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
+++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
@@ -536,5 +536,20 @@ static public Task StartMultiScan(int frequency)
WiFiManagerImpl.Instance.SetSpecificScanFreq(frequency);
return WiFiManagerImpl.Instance.StartMultiScan();
}
+
+ ///
+ /// Gets MAC address of peer connected through TDLS.
+ ///
+ /// 11
+ /// MAC address of the TDLS peer if connected on success or an empty string.
+ /// http://tizen.org/privilege/network.get
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ static public string TDLSConnectedPeer
+ {
+ get
+ {
+ return WiFiManagerImpl.Instance.TDLSConnectedPeer;
+ }
+ }
}
}
diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
index 64c2740f7d0..6853444473e 100644
--- a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
+++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
@@ -57,6 +57,7 @@ internal partial class WiFiManagerImpl
private int _requestId = 0;
private string _macAddress;
+ private string _tdlsMacAddress;
private IntPtr _specificScanHandle;
//private string PrivilegeNetworkSet = "http://tizen.org/privilege/network.set";
@@ -724,6 +725,28 @@ internal Task StartMultiScan()
return task.Task;
}
+ internal string TDLSConnectedPeer
+ {
+ get
+ {
+ IntPtr strPtr;
+ int ret = Interop.WiFi.GetTdlsConnectedPeer(GetSafeHandle(), out strPtr);
+ if (ret != (int)WiFiError.None)
+ {
+ _tdlsMacAddress = "";
+ Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiError)ret);
+ }
+ else
+ {
+ _tdlsMacAddress = Marshal.PtrToStringAnsi(strPtr);
+ Interop.Libc.Free(strPtr);
+ }
+
+ Log.Info(Globals.LogTag, "Tdls Mac address: " + _tdlsMacAddress);
+ return _tdlsMacAddress;
+ }
+ }
+
private void CheckReturnValue(int ret, string method, string privilege)
{
if (ret != (int)WiFiError.None)