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.WiFiDirect] Implement API for creating group with SSID #6408

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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.WiFiDirect/Interop/Interop.WiFiDirect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ internal static partial class WiFiDirect
internal static extern int GetConnectedPeers(ConnectedPeerCallback callback, IntPtr userData);
[DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_create_group")]
internal static extern int CreateGroup();
[DllImport(Libraries.WiFiDirect, EntryPoint = "wifi_direct_create_group_with_ssid")]
internal static extern int CreateGroupWithSsid(string ssid);
[DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_destroy_group")]
internal static extern int DestroyGroup();
[DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_group_owner")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,38 @@ public static void CreateGroup()
}
}

/// <summary>
/// Creates a Wi-Fi Direct group with given SSID and sets up device as the group owner.
/// </summary>
/// <privilege>
/// http://tizen.org/privilege/wifidirect
/// </privilege>
/// <feature>
/// http://tizen.org/feature/network.wifidirect
/// </feature>
/// <remarks>
/// Wi-Fi Direct must be activated.
/// If this succeeds, ConnectionStatusChanged event will be invoked with GroupCreated.
akash1-kumar marked this conversation as resolved.
Show resolved Hide resolved
/// </remarks>
/// <exception cref="InvalidOperationException">The object is in invalid state.</exception>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method.</exception>
/// <since_tizen> 12 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
public static void CreateGroup(string ssid)
{
if (Globals.IsActivated)
{
WiFiDirectManagerImpl.Instance.CreateGroup(ssid);
}

else
{
Log.Error(Globals.LogTag, "Wifi-direct is not activated");
WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted);
}
}

/// <summary>
/// Destroys the Wi-Fi Direct group owned by a local device.If creating a group is in progress, this API cancels that process.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,16 @@ internal void CreateGroup()
}
}

internal void CreateGroup(string ssid)
{
int ret = Interop.WiFiDirect.CreateGroupWithSsid(ssid);
if (ret != (int)WiFiDirectError.None)
{
Log.Error(Globals.LogTag, "Failed to create a WiFi-Direct group with ssid, Error - " + (WiFiDirectError)ret);
WiFiDirectErrorFactory.ThrowWiFiDirectException(ret);
}
}

internal void DestroyGroup()
{
int ret = Interop.WiFiDirect.DestroyGroup();
Expand Down
Loading