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

[Tizen.Network.WiFi] Add set auto scan mode and hidden connect apis #2

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Update WiFiManagerImpl.cs
  • Loading branch information
akash1-kumar authored Jun 12, 2024
commit 3a6e7134482b7732ced36d53542a25a3e0a0a91e
56 changes: 56 additions & 0 deletions src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
Original file line number Diff line number Diff line change
@@ -597,6 +597,62 @@ internal Task BssidScanAsync()
return task.Task;
}

internal void SetAutoScanMode(int scanMode)
{
Log.Info(Globals.LogTag, "SetAutoScanMode");
int ret = Interop.WiFi.SetAutoScanMode(GetSafeHandle(), scanMode);
CheckReturnValue(ret, "GetSafeHandle", PrivilegeNetworkGet);
}

internal Task HiddenAPConnectAsync(string essid, int secType, string passphrase)
{
Log.Info(Globals.LogTag, "HiddenAPConnect");
TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
IntPtr id;
lock (_callback_map)
{
id = (IntPtr)_requestId++;
_callback_map[id] = (error, key) =>
{
Log.Info(Globals.LogTag, "HiddenAPConnect Done " + essid);
if (error != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Error occurs during HiddenAPConnect, " + (WiFiError)error);
task.SetException(new InvalidOperationException("Error occurs during HiddenAPConnect, " + (WiFiError)error));
}
else
{
task.SetResult(true);
}
lock (_callback_map)
{
_callback_map.Remove(key);
}
};
}

context.Post((x) =>
{
Log.Info(Globals.LogTag, "Interop.WiFi.HiddenAPConnect");
try
{
int ret = (int)WiFiError.None;
lock (_callback_map)
{
ret = Interop.WiFi.ConnectHiddenAP(GetSafeHandle(), essid, secType, passphrase, _callback_map[id], id);
}
CheckReturnValue(ret, "HiddenAPConnect", "");
}
catch (Exception e)
{
Log.Error(Globals.LogTag, "Exception on HiddenAPConnect\n" + e);
task.SetException(e);
}
}, null);

return task.Task;
}

internal void CreateSpecificScanHandle()
{
Log.Debug(Globals.LogTag, "CreateSpecificScanHandle");