[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_private_key_file")]
internal static extern int GetEapPrivateKeyFile(IntPtr ap, out IntPtr file);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_private_key_info")]
- internal static extern int SetEapPrivateKeyInfo(IntPtr ap, string file, string password);
+ internal static extern int SetEapPrivateKeyFile(IntPtr ap, string file, string password);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_type")]
internal static extern int GetEapType(IntPtr ap, out int eapType);
[DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_type")]
_state = s;
_ap = new WiFiAP(_apHandle);
}
+
/// <summary>
/// The wifi connection state.
/// </summary>
return _state;
}
}
+
/// <summary>
/// The access point
/// </summary>
/// The file path of CA Certificate of EAP.
/// </summary>
string CaCertificationFile { get; set; }
+
/// <summary>
/// The EAP type of wifi.
/// </summary>
WiFiEapType EapType { get; set; }
+
/// <summary>
- /// The type of EAP phase2 authentication of Wi-Fi.
+ /// The type of EAP phase2 authentication of Wi-Fi.
/// </summary>
WiFiAuthenticationType AuthenticationType { get; set; }
} //WiFiEap
{
_level = l;
}
+
/// <summary>
/// The wifi RSSI level.
/// </summary>
*/
using System;
+using System.Threading.Tasks;
+using System.Collections.Generic;
namespace Tizen.Network.WiFi
{
/// <summary>
- /// A class for manager the network information of the access point(AP). It allows applications to manager network informaiton.
+ /// A class for managing the network information of the access point(AP).
/// </summary>
public class WiFiAP : IDisposable
{
private IntPtr _apHandle = IntPtr.Zero;
+ private Dictionary<IntPtr, Interop.WiFi.VoidCallback> _callback_map = new Dictionary<IntPtr, Interop.WiFi.VoidCallback>();
+ private int _requestId = 0;
private WiFiNetwork _network;
private WiFiSecurity _security;
private bool disposed = false;
return _network;
}
}
+
/// <summary>
/// The security information of the access point(AP).
/// </summary>
_apHandle = handle;
Initialize();
}
+
/// <summary>
- /// Creates a object for the access point.
+ /// Creates an object for the access point.
/// </summary>
- /// <param name="essid">The ESSID (Extended Service Set Identifier) can be UTF-8 encoded </param>
+ /// <param name="essid">The Extended Service Set Identifier of the access point.</param>
public WiFiAP(string essid)
{
Log.Debug(Globals.LogTag, "New WiFiAP. Essid: " + essid);
createHandle(essid, true);
Initialize();
}
+
/// <summary>
- /// Creates a object for the hidden access point.
+ /// Creates an object for the hidden access point.
/// </summary>
- /// <param name="essid">The ESSID (Extended Service Set Identifier) can be UTF-8 encoded </param>
+ /// <param name="essid">The Extended Service Set Identifier of the access point.</param>
/// <param name="hidden">The value to set hidden AP</param>
public WiFiAP(string essid, bool hidden)
{
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy the managed WiFiAP objects.
+ /// </summary>
public void Dispose()
{
Dispose(true);
{
return _apHandle;
}
+
+ /// <summary>
+ /// Connects the access point asynchronously.
+ /// </summary>
+ /// <returns> A task indicating whether the Connect method is done or not.</returns>
+ public Task ConnectAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting finished : " + (WiFiError)error);
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.Connect(WiFiManagerImpl.Instance.GetHandle(), _apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Connects the access point with WPS PBC asynchronously.
+ /// </summary>
+ /// <returns> A task indicating whether the ConnectByWpsPbs method is done or not.</returns>
+ public Task ConnectByWpsPbcAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting by WPS PBC finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetHandle(), _apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Connects the access point with WPS PIN asynchronously.
+ /// </summary>
+ /// <returns> A task indicating whether the ConnectByWpsPin method is done or not.</returns>
+ /// <param name="pin">The WPS PIN is a non-null string with length greater than 0 and less than or equal to 8.</param>
+ public Task ConnectByWpsPinAsync(string pin)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Connecting by WPS PIN finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetHandle(), _apHandle, pin, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Disconnects the access point asynchronously.
+ /// </summary>
+ /// <returns> A task indicating whether the Disconnect method is done or not.</returns>
+ public Task DisconnectAsync()
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id;
+ lock (_callback_map)
+ {
+ id = (IntPtr)_requestId++;
+ _callback_map[id] = (error, key) =>
+ {
+ Log.Debug(Globals.LogTag, "Disconnecting finished");
+ if (error != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Error occurs during WiFi disconnecting, " + (WiFiError)error);
+ task.SetException(new InvalidOperationException("Error occurs during WiFi disconnecting, " + (WiFiError)error));
+ }
+ task.SetResult(true);
+ lock (_callback_map)
+ {
+ _callback_map.Remove(key);
+ }
+ };
+ }
+ int ret = Interop.WiFi.Disconnect(WiFiManagerImpl.Instance.GetHandle(), _apHandle, _callback_map[id], id);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Deletes the information of stored access point and disconnects it when it is connected.<br>
+ /// If an AP is connected, then connection information will be stored. This information is used when a connection to that AP is established automatically.
+ /// </summary>
+ public void RemoveAP()
+ {
+ int ret = Interop.WiFi.RemoveAP(WiFiManagerImpl.Instance.GetHandle(), _apHandle);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to remove with AP, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret);
+ }
+ }
}
}
}
}
}
+
public System.Net.IPAddress Dns2
{
get
}
}
}
+
public System.Net.IPAddress Gateway
{
get
}
}
}
+
public System.Net.IPAddress SubnetMask
{
get
}
}
}
+
public System.Net.IPAddress IP
{
get
}
}
}
+
public IPConfigType IPConfigType
{
get
namespace Tizen.Network.WiFi
{
/// <summary>
- /// A class for managing the configuration of Wi-Fi. It allows applications to manage the configuration information of Wi-Fi.
+ /// A class for managing the configuration of Wi-Fi.
/// </summary>
public class WiFiConfiguration : IDisposable
{
return Marshal.PtrToStringAnsi(strPtr);
}
}
+
/// <summary>
/// The security type of access point(AP).
/// </summary>
- public WiFiSecureType SecurityType
+ public WiFiSecurityType SecurityType
{
get
{
{
Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret);
}
- return (WiFiSecureType)type;
+ return (WiFiSecurityType)type;
}
}
+
/// <summary>
/// The proxy address.
/// </summary>
}
}
}
+
/// <summary>
/// A property check whether the access point(AP) is hidden or not.
/// </summary>
}
}
}
+
/// <summary>
/// The EAP Configuration.
/// </summary>
_eapConfig = new WiFiEapConfiguration(_configHandle);
}
- public WiFiConfiguration(string name, string passPhrase, WiFiSecureType type)
+ /// <summary>
+ /// Creates a WiFiConfiguration object with the given name, passphrase and securetype.
+ /// </summary>
+ /// <param name="name">Name of the WiFi.</param>
+ /// <param name="passPhrase">Password to access the WiFi.</param>
+ /// <param name="type">Security type of the WiFi.</param>
+ public WiFiConfiguration(string name, string passPhrase, WiFiSecurityType type)
{
int ret = Interop.WiFi.Config.Create(WiFiManagerImpl.Instance.GetHandle(), name, passPhrase, (int)type, out _configHandle);
if (ret != (int)WiFiError.None)
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy the managed objects in WiFiConfiguration.
+ /// </summary>
public void Dispose()
{
Dispose(true);
namespace Tizen.Network.WiFi
{
/// <summary>
- /// A class for managing the EAP information of access point(AP). It allows applications to manager EAP information.
- /// This class is not intended to create instance directly from applications.
+ /// A class for managing the EAP information of access point(AP).
/// </summary>
public class WiFiEap : IWiFiEap, IDisposable
{
}
}
}
+
/// <summary>
/// The EAP type of wifi.
/// </summary>
}
}
}
+
/// <summary>
/// The type of EAP phase2 authentication of Wi-Fi.
/// </summary>
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy the managed objects in WiFiEap.
+ /// </summary>
public void Dispose()
{
Dispose(true);
/// </summary>
/// <param name="privateKeyFile">The file path of private key.</param>
/// <param name="password">The password.</param>
- public void SetPrivateKeyInfo(string privateKeyFile, string password)
+ public void SetPrivateKeyFile(string privateKeyFile, string password)
{
- int ret = Interop.WiFi.AP.SetEapPrivateKeyInfo(_apHandle, privateKeyFile, password);
+ int ret = Interop.WiFi.AP.SetEapPrivateKeyFile(_apHandle, privateKeyFile, password);
if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Failed to set private key info, Error - " + (WiFiError)ret);
+ Log.Error(Globals.LogTag, "Failed to set private key file, Error - " + (WiFiError)ret);
WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
}
}
/// Gets the username of EAP passphrase.
/// </summary>
/// <returns>The user name</returns>
- public string GetEapPassphraseUserName()
+ public string GetUserName()
{
IntPtr strptr;
bool passwordSet;
}
return Marshal.PtrToStringAnsi(strptr);
}
+
/// <summary>
- /// Returns whether the password is set for not set.
+ /// Returns whether the password is set or not.
/// </summary>
- /// <returns>ture if password is set, otherwise flase if password is not set.</returns>
- public bool IsEapPassphrasePasswordSet()
+ /// <returns>True if password is set, false if password is not set.</returns>
+ public bool IsPasswordSet()
{
IntPtr strptr;
bool passwordSet;
}
/// <summary>
- /// Sets the passphrase of EAP.
- /// You can set one of user_name and password as NULL.<br>
- /// In this case, the value of a parameter which is set as NULL will be the previous value. But it is not allowed that both user_name and password are set as NULL.
+ /// Sets the user name of EAP.
/// </summary>
/// <param name="userName">The user name</param>
+ public void SetUserName(string userName)
+ {
+ int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, userName, null);
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set username, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ }
+ }
+
+ /// <summary>
+ /// Sets the password of EAP.
+ /// </summary>
/// <param name="password">The password</param>
- public void SetEapPassphrase(string userName, string password)
+ public void SetPassword(string password)
{
- int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, userName, password);
+ int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, null, password);
if (ret != (int)WiFiError.None)
{
- Log.Error(Globals.LogTag, "Failed to set passphrase, Error - " + (WiFiError)ret);
+ Log.Error(Globals.LogTag, "Failed to set password, Error - " + (WiFiError)ret);
WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
}
}
{
/// <summary>
/// A class for managing the EAP configuration.
- /// This class is not intended to create instance directly from applications.
/// </summary>
public class WiFiEapConfiguration : IWiFiEap, IDisposable
{
}
}
}
+
/// <summary>
/// The EAP type of wifi.
/// </summary>
}
}
}
+
/// <summary>
/// The type of EAP phase2 authentication of Wi-Fi.
/// </summary>
}
}
}
+
/// <summary>
/// The anonymous identity of access point(AP).
/// </summary>
}
}
}
+
/// <summary>
/// The identity of access point(AP).
/// </summary>
}
}
}
+
/// <summary>
/// The subject match of access point(AP).
/// </summary>
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy the managed objects in WiFiEapConfiguration.
+ /// </summary>
public void Dispose()
{
Dispose(true);
}
return Marshal.PtrToStringAnsi(strPtr);
}
+
/// <summary>
/// Sets access point client cert file to configuration.
/// </summary>
/// </summary>
Aka = 4
}
+
/// <summary>
/// Enumeration for Wi-Fi RSSI level.
/// </summary>
/// </summary>
Level4 = 4
}
+
/// <summary>
/// Enumeration for Wi-Fi connection state.
/// </summary>
/// </summary>
Connected = 3
}
+
/// <summary>
/// Enumeration for Wi-Fi device state.
/// </summary>
/// </summary>
Activated = 1
}
+
/// <summary>
/// Enumeration for Wi-Fi proxy type.
/// </summary>
/// </summary>
Manual = 2
}
+
/// <summary>
/// Enumeration for Wi-Fi authentication type.
/// </summary>
throw new InvalidOperationException(err.ToString());
}
}
-
}
}
return WiFiManagerImpl.Instance.MacAddress;
}
}
+
/// <summary>
/// The name of the network interface.
/// </summary>
return WiFiManagerImpl.Instance.InterfaceName;
}
}
+
/// <summary>
- /// The networtk connection state.
+ /// The network connection state.
/// </summary>
static public WiFiConnectionState ConnectionState
{
return WiFiManagerImpl.Instance.ConnectionState;
}
}
+
/// <summary>
/// A property to Check whether Wi-Fi is activated.
/// </summary>
}
/// <summary>
- /// (event) DeviceStateChanged is raised when the device state is changed.
+ /// DeviceStateChanged is raised when the device state is changed.
/// </summary>
static public event EventHandler<DeviceStateChangedEventArgs> DeviceStateChanged
{
WiFiManagerImpl.Instance.DeviceStateChanged -= value;
}
}
+
/// <summary>
- /// (event) ConnectionStateChanged is rasied when the connection state is changed.
+ /// ConnectionStateChanged is raised when the connection state is changed.
/// </summary>
static public event EventHandler<ConnectionStateChangedEventArgs> ConnectionStateChanged
{
WiFiManagerImpl.Instance.ConnectionStateChanged -= value;
}
}
+
/// <summary>
- /// (event) RssiLevelChanged is rasied when the RSSI of connected Wi-Fi is changed.
+ /// RssiLevelChanged is raised when the RSSI of connected Wi-Fi is changed.
/// </summary>
static public event EventHandler<RssiLevelChangedEventArgs> RssiLevelChanged
{
WiFiManagerImpl.Instance.RssiLevelChanged -= value;
}
}
+
/// <summary>
- /// (event) BackgroundScanFinished is rasied when the background scan is finished.
+ /// BackgroundScanFinished is raised when the background scan is finished.
/// The background scan starts automatically when wifi is activated. The callback will be invoked periodically.
/// </summary>
static public event EventHandler BackgroundScanFinished
WiFiManagerImpl.Instance.BackgroundScanFinished -= value;
}
}
+
/// <summary>
- /// Gets the result of the scan asynchronously.
+ /// Gets the result of the scan.
/// </summary>
- /// <returns> A task contains the lisf for WiFiAPInformation objects.</returns>
+ /// <returns> A list of WiFiAP objects.</returns>
static public IEnumerable<WiFiAP> GetFoundAPs()
{
return WiFiManagerImpl.Instance.GetFoundAPs();
}
+
/// <summary>
- /// Gets the result of specific ap scan asynchronously.
+ /// Gets the result of specific AP scan.
/// </summary>
- /// <returns> A task contains the WiFiAPInformation object.</returns>
+ /// <returns> A list contains the WiFiAP objects.</returns>
static public IEnumerable<WiFiAP> GetFoundSpecificAPs()
{
return WiFiManagerImpl.Instance.GetFoundSpecificAPs();
}
+
/// <summary>
- /// Gets the list of wifi configuration.
+ /// Gets the list of wifi configurations.
/// </summary>
- /// <returns>A task contains the lisf for WiFiConfiguration objects.</returns>
+ /// <returns>A list contains the WiFiConfiguration objects.</returns>
static public IEnumerable<WiFiConfiguration> GetWiFiConfigurations()
{
return WiFiManagerImpl.Instance.GetWiFiConfigurations();
}
+
/// <summary>
/// Saves Wi-Fi configuration of access point.
/// </summary>
/// <param name="configuration">The configuration to be stored</param>
- static public void SaveWiFiNetworkConfiguration(WiFiConfiguration configuration)
+ static public void SaveWiFiConfiguration(WiFiConfiguration configuration)
{
WiFiManagerImpl.Instance.SaveWiFiNetworkConfiguration(configuration);
}
+
/// <summary>
- /// Gets the handle of the connected access point.
+ /// Gets the object of the connected WiFiAP.
/// </summary>
/// <returns> The connected wifi access point(AP) information.</returns>
static public WiFiAP GetConnectedAP()
{
return WiFiManagerImpl.Instance.GetConnectedAP();
}
- /// <summary>
- /// Deletes the information of stored access point and disconnects it when it connected.<br>
- /// If an AP is connected, then connection information will be stored. This information is used when a connection to that AP is established automatically.
- /// </summary>
- /// <param name="ap">The access point to be removed</param>
- static public void RemoveAP(WiFiAP ap)
- {
- WiFiManagerImpl.Instance.RemoveAP(ap);
- }
+
/// <summary>
/// Activates Wi-Fi asynchronously.
/// </summary>
- /// <returns> A task indicates whether the Activate method is done or not.</returns>
+ /// <returns> A task indicating whether the Activate method is done or not.</returns>
static public Task ActivateAsync()
{
return WiFiManagerImpl.Instance.ActivateAsync();
}
+
/// <summary>
/// Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.
/// </summary>
- /// <returns> A task indicates whether the ActivateWithPickerTested method is done or not.</returns>
- static public Task ActivateWithPickerTestedAsync()
+ /// <returns> A task indicating whether the ActivateWithPicker method is done or not.</returns>
+ static public Task ActivateWithPickerAsync()
{
return WiFiManagerImpl.Instance.ActivateWithWiFiPickerTestedAsync();
}
+
/// <summary>
/// Deactivates Wi-Fi asynchronously.
/// </summary>
- /// <returns> A task indicates whether the Deactivate method is done or not.</returns>
+ /// <returns> A task indicating whether the Deactivate method is done or not.</returns>
static public Task DeactivateAsync()
{
return WiFiManagerImpl.Instance.DeactivateAsync();
}
+
/// <summary>
/// Starts scan asynchronously.
/// </summary>
- /// <returns> A task indicates whether the Scan method is done or not.</returns>
+ /// <returns> A task indicating whether the Scan method is done or not.</returns>
static public Task ScanAsync()
{
return WiFiManagerImpl.Instance.ScanAsync();
}
+
/// <summary>
- /// Starts specific ap scan, asynchronously.
+ /// Starts specific access point scan, asynchronously.
/// </summary>
- /// <returns> A task contains WiFiAPInformation object.</returns>
+ /// <returns> A task indicating whether the ScanSpecificAP method is done or not.</returns>
/// <param name="essid">The essid of hidden ap</param>
static public Task ScanSpecificAPAsync(string essid)
{
return WiFiManagerImpl.Instance.ScanSpecificAPAsync(essid);
}
- /// <summary>
- /// Connects the access point asynchronously.
- /// </summary>
- /// <param name="ap">The access point</param>
- /// <returns> A task indicates whether the Connect method is done or not.</returns>
- static public Task ConnectAsync(WiFiAP ap)
- {
- return WiFiManagerImpl.Instance.ConnectAsync(ap);
- }
- /// <summary>
- /// Connects the access point with WPS PBC asynchronously.
- /// </summary>
- /// <returns> A task indicates whether the ConnectByWpsPbs method is done or not.</returns>
- /// <param name="ap">The access point(AP)</param>
- static public Task ConnectByWpsPbcAsync(WiFiAP ap)
- {
- return WiFiManagerImpl.Instance.ConnectByWpsPbcAsync(ap);
- }
- /// <summary>
- /// Connects the access point with WPS PIN asynchronously.
- /// </summary>
- /// <returns> A task indicates whether the ConnectByWpsPin method is done or not.</returns>
- /// <param name="ap">The access point(AP)</param>
- /// <param name="pin">The WPS PIN is a non-NULL string with length greater than 0 and less than or equal to 8.</param>
- static public Task ConnectByWpsPinAsync(WiFiAP ap, string pin)
- {
- Log.Debug(Globals.LogTag, "ConnectByWpsPinAsync");
- return WiFiManagerImpl.Instance.ConnectByWpsPinAsync(ap, pin);
- }
- /// <summary>
- /// Disconnects the access point asynchronously.
- /// </summary>
- /// <returns> A task indicates whether the Disconnect method is done or not.</returns>
- static public Task DisconnectAsync(WiFiAP ap)
- {
- return WiFiManagerImpl.Instance.DisconnectAsync(ap);
- }
}
}
return _macAddress;
}
}
+
internal string InterfaceName
{
get
return name;
}
}
+
internal WiFiConnectionState ConnectionState
{
get
return (WiFiConnectionState)state;
}
}
+
internal bool IsActive
{
get
return ap;
}
- internal void RemoveAP(WiFiAP ap)
- {
- IntPtr apHandle = ap.GetHandle();
- int ret = Interop.WiFi.RemoveAP(GetHandle(), apHandle);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to remove with AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
- }
-
internal Task ActivateAsync()
{
TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
}
return task.Task;
}
-
- internal Task ConnectAsync(WiFiAP ap)
- {
- TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
- IntPtr id;
- lock (_callback_map)
- {
- id = (IntPtr)_requestId++;
- _callback_map[id] = (error, key) =>
- {
- Log.Debug(Globals.LogTag, "Connecting finished : " + (WiFiError)error);
- if (error != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
- task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
- }
- task.SetResult(true);
- lock (_callback_map)
- {
- _callback_map.Remove(key);
- }
- };
- }
- IntPtr apHandle = ap.GetHandle();
- int ret = Interop.WiFi.Connect(GetHandle(), apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
- return task.Task;
- }
-
- internal Task DisconnectAsync(WiFiAP ap)
- {
- TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
- IntPtr id;
- lock (_callback_map)
- {
- id = (IntPtr)_requestId++;
- _callback_map[id] = (error, key) =>
- {
- Log.Debug(Globals.LogTag, "Disconnecting finished");
- if (error != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Error occurs during WiFi disconnecting, " + (WiFiError)error);
- task.SetException(new InvalidOperationException("Error occurs during WiFi disconnecting, " + (WiFiError)error));
- }
- task.SetResult(true);
- lock (_callback_map)
- {
- _callback_map.Remove(key);
- }
- };
- }
- IntPtr apHandle = ap.GetHandle();
- int ret = Interop.WiFi.Disconnect(GetHandle(), apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
- return task.Task;
- }
-
- internal Task ConnectByWpsPbcAsync(WiFiAP ap)
- {
- TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
- IntPtr id;
- lock (_callback_map)
- {
- id = (IntPtr)_requestId++;
- _callback_map[id] = (error, key) =>
- {
- Log.Debug(Globals.LogTag, "Connecting by WPS PBC finished");
- if (error != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
- task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
- }
- task.SetResult(true);
- lock (_callback_map)
- {
- _callback_map.Remove(key);
- }
- };
- }
- IntPtr apHandle = ap.GetHandle();
- int ret = Interop.WiFi.ConnectByWpsPbc(GetHandle(), apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
- return task.Task;
- }
-
- internal Task ConnectByWpsPinAsync(WiFiAP ap, string pin)
- {
- TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
- IntPtr id;
- lock (_callback_map)
- {
- id = (IntPtr)_requestId++;
- _callback_map[id] = (error, key) =>
- {
- Log.Debug(Globals.LogTag, "Connecting by WPS PIN finished");
- if (error != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error);
- task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error));
- }
- task.SetResult(true);
- lock (_callback_map)
- {
- _callback_map.Remove(key);
- }
- };
- }
- IntPtr apHandle = ap.GetHandle();
- int ret = Interop.WiFi.ConnectByWpsPin(GetHandle(), apHandle, pin, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
- return task.Task;
- }
}
}
namespace Tizen.Network.WiFi
{
/// <summary>
- /// A class for managing the Wi-Fi information. It allows applications to manager network information.
- /// This class is not intended to create instance directly from applications.
+ /// A class for managing the Wi-Fi network information.
/// </summary>
public class WiFiNetwork : IDisposable
{
return _essid;
}
}
+
/// <summary>
/// The Basic Service Set Identifier(BSSID).
/// </summary>
return Marshal.PtrToStringAnsi(strPtr);
}
}
+
/// <summary>
/// The address informaiton for IPv4.
/// </summary>
return _ipv4;
}
}
+
/// <summary>
/// The address ainformation for IPv6.
/// </summary>
return _ipv6;
}
}
+
/// <summary>
/// The proxy address.
/// </summary>
}
}
}
+
/// <summary>
/// The proxy type(IPv6).
/// </summary>
}
}
}
+
/// <summary>
/// The frequency band(MHz).
/// </summary>
return freq;
}
}
+
/// <summary>
/// The Received signal strength indication(RSSI).
/// </summary>
- public int Rssi
+ public WiFiRssiLevel Rssi
{
get
{
{
Log.Error(Globals.LogTag, "Failed to get rssi, Error - " + (WiFiError)ret);
}
- return rssi;
+ return (WiFiRssiLevel)rssi;
}
}
+
/// <summary>
- /// Rhe max speed (Mbps).
+ /// The max speed (Mbps).
/// </summary>
public int MaxSpeed
{
return maxSpeed;
}
}
+
/// <summary>
/// A property to check whether the access point is favorite or not.
/// </summary>
return isFavorite;
}
}
+
/// <summary>
/// A property to check whether the access point is passpoint or not.
/// </summary>
return isPasspoint;
}
}
+
/// <summary>
/// The connection state.
/// </summary>
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy managed WiFiNetwork objects.
+ /// </summary>
public void Dispose()
{
Dispose(true);
handler(sender, e);
}
}
+
internal static void SafeInvoke<T>(this EventHandler<T> evt, object sender, T e) where T : EventArgs
{
var handler = evt;
namespace Tizen.Network.WiFi
{
/// <summary>
- /// A class for managing the security information. It allows applications to manager security information.
- /// This class is not intended to create instance directly from applications.
+ /// A class for managing the WiFi security information.
/// </summary>
public class WiFiSecurity : IDisposable
{
/// <summary>
/// The type of Wi-Fi security.
/// </summary>
- public WiFiSecureType SecurityType
+ public WiFiSecurityType SecurityType
{
get
{
Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret);
WiFiErrorFactory.ThrowWiFiException(ret);
}
- return (WiFiSecureType)type;
+ return (WiFiSecurityType)type;
}
set
{
}
}
}
+
/// <summary>
/// The type of Wi-Fi encryption
/// </summary>
}
}
}
+
/// <summary>
/// The EAP information
/// </summary>
return required;
}
}
+
/// <summary>
/// A property to check whether the Wi-Fi Protected Setup(WPS) is supported or not.
/// </summary>
Dispose(false);
}
+ /// <summary>
+ /// A method to destroy managed WiFiSecurity objects.
+ /// </summary>
public void Dispose()
{
Dispose(true);
Name: csapi-network-wifi
Summary: Tizen Wi-Fi API for C#
-Version: 1.0.6
+Version: 1.0.7
Release: 1
Group: Development/Libraries
License: Apache-2.0