Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Network.WiFi] Implement API to get MAC of TDLS connected peer #6481

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 string peerMacAddress);

internal static class AP
{
Expand Down
12 changes: 12 additions & 0 deletions src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,5 +536,17 @@ static public Task StartMultiScan(int frequency)
WiFiManagerImpl.Instance.SetSpecificScanFreq(frequency);
return WiFiManagerImpl.Instance.StartMultiScan();
}

/// <summary>
/// Gets MAC address of peer connected through TDLS.
/// </summary>
/// <since_tizen> 11 </since_tizen>
/// <returns>MAC address of the TDLS peer if connected on success or an empty string.</returns>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
[EditorBrowsable(EditorBrowsableState.Never)]
static public string GetTDLSConnectedPeer()
{
return WiFiManagerImpl.Instance.GetTDLSConnectedPeer();
}
}
}
11 changes: 11 additions & 0 deletions src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,17 @@ internal Task StartMultiScan()
return task.Task;
}

internal string GetTDLSConnectedPeer()
{
string address = "";
int ret = Interop.WiFi.GetTdlsConnectedPeer(GetSafeHandle(), out address);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiError)ret);
}
return String.Copy(address);
}

private void CheckReturnValue(int ret, string method, string privilege)
{
if (ret != (int)WiFiError.None)
Expand Down
Loading