Name: csapi-network-wifi
Summary: Tizen Wi-Fi API for C#
-Version: 1.0.15
+Version: 1.0.16
Release: 1
Group: Development/Libraries
License: Apache-2.0
/// <summary>
/// The network information of the access point(AP).
/// </summary>
+ /// <value>WiFiNetwork instance containing network information of AP.</value>
public WiFiNetwork NetworkInformation
{
get
/// <summary>
/// The security information of the access point(AP).
/// </summary>
+ /// <value>WiFiSecurity instance containing security information of AP.</value>
public WiFiSecurity SecurityInformation
{
get
/// Creates an object for the access point.
/// </summary>
/// <param name="essid">The Extended Service Set Identifier of the access point.</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when Essid is passed as null.</exception>
+ /// <exception cref="ArgumentException">Thrown when it is failed due to an invalid parameter.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
public WiFiAP(string essid)
{
Log.Debug(Globals.LogTag, "New WiFiAP. Essid: " + essid);
/// </summary>
/// <param name="essid">The Extended Service Set Identifier of the access point.</param>
/// <param name="hidden">The value to set hidden AP</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when Essid is passed as null.</exception>
+ /// <exception cref="ArgumentException">Thrown when it is failed due to an invalid parameter.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
public WiFiAP(string essid, bool hidden)
{
createHandle(essid, hidden);
private void createHandle(string id, bool hidden)
{
int ret = -1;
+ if (id == null)
+ {
+ throw new ArgumentNullException("Essid is null");
+ }
+
if (hidden)
{
ret = Interop.WiFi.AP.CreateHiddenAP(WiFiManagerImpl.Instance.GetSafeHandle(), id, out _apHandle);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to create handle, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle());
}
}
/// <summary>
/// Refreshes the access point information.
/// </summary>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ObjectDisposedException">Thrown when object instance is disposed or released.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void Refresh()
{
Log.Debug(Globals.LogTag, "Refresh");
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+ }
int ret = Interop.WiFi.AP.Refresh(_apHandle);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to refresh ap handle, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _apHandle);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle, "http://tizen.org/privilege/network.get");
}
}
/// Connects the access point asynchronously.
/// </summary>
/// <returns> A task indicating whether the Connect method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ObjectDisposedException">Thrown when object instance is disposed or released.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public Task ConnectAsync()
{
Log.Debug(Globals.LogTag, "ConnectAsync");
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+ }
TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
IntPtr id;
lock (_callback_map)
}
};
}
+
int ret = Interop.WiFi.Connect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
+
return task.Task;
}
/// </summary>
/// <param name="info">A WpsInfo instance which is of type WpsPbcInfo or WpsPinInfo.</param>
/// <returns>A task indicating whether the ConnectWps method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ObjectDisposedException">Thrown when object instance is disposed or released.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when WpsPinInfo object is constructed with null pin.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when WpsPinInfo object is constructed with pin which is an empty string or more than 7 characters.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public Task ConnectWpsAsync(WpsInfo info)
{
Log.Debug(Globals.LogTag, "ConnectWpsAsync");
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+ }
TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
IntPtr id;
lock (_callback_map)
};
}
+ int ret = -1;
if (info.GetType() == typeof(WpsPbcInfo))
{
- int ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
+ ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id);
}
else if (info.GetType() == typeof(WpsPinInfo))
{
WpsPinInfo pinInfo = (WpsPinInfo)info;
- int ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, pinInfo.GetWpsPin(), _callback_map[id], id);
- if (ret != (int)WiFiError.None)
+ if (pinInfo.GetWpsPin() == null)
{
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ throw new ArgumentNullException("Wps pin should not be null");
}
+
+ if (pinInfo.GetWpsPin().Length == 0 || pinInfo.GetWpsPin().Length > 8)
+ {
+ throw new ArgumentOutOfRangeException("Wps pin should not be empty or more than 7 characters");
+ }
+
+ ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, pinInfo.GetWpsPin(), _callback_map[id], id);
+ }
+
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
return task.Task;
/// </summary>
/// <param name="info">A WpsInfo instance which is of type WpsPbcInfo or WpsPinInfo.</param>
/// <returns>A task which contains Connected access point information.</returns>
+ /// <remarks>
+ /// If WpsPinInfo is used, its object has to be constructed with a pin which must be 4 or 8 characters long.
+ /// </remarks>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when WpsPinInfo object is constructed with null pin.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when WpsPinInfo object is constructed with pin which is not of 4 or 8 characters long.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public static Task<WiFiAP> ConnectWpsWithoutSsidAsync(WpsInfo info)
{
TaskCompletionSource<WiFiAP> task = new TaskCompletionSource<WiFiAP>();
};
}
+ int ret = -1;
if (info.GetType() == typeof(WpsPbcInfo))
{
- int ret = Interop.WiFi.ConnectByWpsPbcWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), s_callbackMap[id], id);
- if (ret != (int)WiFiError.None)
- {
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
- }
+ ret = Interop.WiFi.ConnectByWpsPbcWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), s_callbackMap[id], id);
}
else if (info.GetType() == typeof(WpsPinInfo))
{
WpsPinInfo pinInfo = (WpsPinInfo)info;
- int ret = Interop.WiFi.ConnectByWpsPinWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), pinInfo.GetWpsPin(), s_callbackMap[id], id);
- if (ret != (int)WiFiError.None)
+ if (pinInfo.GetWpsPin() == null)
{
- Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ throw new ArgumentNullException("Wps pin should not be null");
}
+
+ if (pinInfo.GetWpsPin().Length != 4 && pinInfo.GetWpsPin().Length != 8)
+ {
+ throw new ArgumentOutOfRangeException("Wps pin should be of 4 or 8 characters long");
+ }
+
+ ret = Interop.WiFi.ConnectByWpsPinWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), pinInfo.GetWpsPin(), s_callbackMap[id], id);
+ }
+
+ if (ret != (int)WiFiError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle());
}
return task.Task;
/// Disconnects the access point asynchronously.
/// </summary>
/// <returns> A task indicating whether the Disconnect method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ObjectDisposedException">Thrown when object instance is disposed or released.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public Task DisconnectAsync()
{
Log.Debug(Globals.LogTag, "DisconnectAsync");
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+ }
TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
IntPtr id;
lock (_callback_map)
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
return task.Task;
}
/// 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>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ObjectDisposedException">Thrown when object instance is disposed or released.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void ForgetAP()
{
Log.Debug(Globals.LogTag, "ForgetAP");
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");
+ }
int ret = Interop.WiFi.RemoveAP(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to forget AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle);
}
}
}
/// A public constructor which instantiates WpsPinInfo class with the given pin.
/// </summary>
/// <param name="pin">WPS Pin of the access point.</param>
+ /// <remarks>
+ /// Pin should not be null or empty. It should be of less than 8 characters.
+ /// </remarks>
public WpsPinInfo(string pin)
{
_pin = pin;
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set first dns address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set second dns address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set gateway address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set subnet mask, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set ip address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set ip config type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle());
}
}
}
/// <summary>
/// The name of access point(AP).
/// </summary>
+ /// <value>Name assigned to AP in WiFi configuration.</value>
public string Name
{
get
/// <summary>
/// The security type of access point(AP).
/// </summary>
+ /// <value>Security type of AP in WiFi configuration.</value>
public WiFiSecurityType SecurityType
{
get
/// <summary>
/// The proxy address.
/// </summary>
+ /// <value>Proxy address of the access point.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string ProxyAddress
{
get
}
set
{
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid WiFiConfiguration instance (Object may have been disposed or released)");
+ }
int ret = Interop.WiFi.Config.SetProxyAddress(_configHandle, (int)AddressFamily.IPv4, value);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
}
}
}
/// <summary>
/// A property check whether the access point(AP) is hidden or not.
/// </summary>
+ /// <value>Boolean value indicating whether AP is hidden or not.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public bool IsHidden
{
get
}
set
{
+ if (_disposed)
+ {
+ throw new ObjectDisposedException("Invalid WiFiConfiguration instance (Object may have been disposed or released)");
+ }
int ret = Interop.WiFi.Config.SetHiddenAPProperty(_configHandle, value);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set IsHidden, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _configHandle);
}
}
}
/// <summary>
/// The EAP Configuration.
/// </summary>
+ /// <value>EAP configuration assigned to WiFi.</value>
public WiFiEapConfiguration EapConfiguration
{
get
/// <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>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when the object is constructed with name as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
public WiFiConfiguration(string name, string passPhrase, WiFiSecurityType type)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException("Name of the WiFi is null");
+ }
+
int ret = Interop.WiFi.Config.Create(WiFiManagerImpl.Instance.GetSafeHandle(), name, passPhrase, (int)type, out _configHandle);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to create config handle, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle());
}
+
Interop.WiFi.SafeWiFiConfigHandle configHandle = new Interop.WiFi.SafeWiFiConfigHandle(_configHandle);
_eapConfig = new WiFiEapConfiguration(configHandle);
}
/// <summary>
/// The file path of CA Certificate of EAP.
/// </summary>
+ /// <value>CA certification file of EAP.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown while setting this value when file value is null.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string CaCertificationFile
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get caCertFile, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
return "";
}
return Marshal.PtrToStringAnsi(strPtr);
}
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException("File value is null");
+ }
int ret = Interop.WiFi.AP.SetEapCaCertFile(_apHandle, value);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set caCertFile, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The EAP type of wifi.
/// </summary>
+ /// <value>Type of EAP.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiEapType EapType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get eap type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return (WiFiEapType)type;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set eap type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The type of EAP phase2 authentication of Wi-Fi.
/// </summary>
+ /// <value>Authentication type of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiAuthenticationType AuthenticationType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get auth type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return (WiFiAuthenticationType)type;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set eap auth type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// Gets the private key file of EAP.
/// </summary>
/// <returns>The file path of private key.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public string GetPrivateKeyFile()
{
IntPtr strPtr;
/// </summary>
/// <param name="privateKeyFile">The file path of private key.</param>
/// <param name="password">The password.</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when file path of private key is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void SetPrivateKeyFile(string privateKeyFile, string password)
{
+ if (privateKeyFile == null)
+ {
+ throw new ArgumentNullException("File path of private key is null");
+ }
int ret = Interop.WiFi.AP.SetEapPrivateKeyFile(_apHandle, privateKeyFile, password);
if (ret != (int)WiFiError.None)
{
/// Gets the Client Certificate of EAP.
/// </summary>
/// <returns>The file path of Client Certificate.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public string GetClientCertFile()
{
IntPtr strPtr;
/// Sets the CA Certificate of EAP.
/// </summary>
/// <param name="clientCertFile">The file path of Client Certificate.</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when file path of Client Certificate is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void SetClientCertFile(string clientCertFile)
{
+ if (clientCertFile == null)
+ {
+ throw new ArgumentNullException("File path of Client certificate is null");
+ }
int ret = Interop.WiFi.AP.SetEapClientCertFile(_apHandle, clientCertFile);
if (ret != (int)WiFiError.None)
{
/// Gets the username of EAP passphrase.
/// </summary>
/// <returns>The user name</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public string GetUserName()
{
IntPtr strptr;
/// Returns whether the password is set or not.
/// </summary>
/// <returns>True if password is set, false if password is not set.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public bool IsPasswordSet()
{
IntPtr strptr;
/// Sets the user name of EAP.
/// </summary>
/// <param name="userName">The user name</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when the user name is passed as null. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void SetUserName(string userName)
{
+ if (userName == null)
+ {
+ throw new ArgumentNullException("User name is null");
+ }
int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, userName, null);
if (ret != (int)WiFiError.None)
{
/// Sets the password of EAP.
/// </summary>
/// <param name="password">The password</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when the password is passed as null. </exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
public void SetPassword(string password)
{
+ if (password == null)
+ {
+ throw new ArgumentNullException("Password is null");
+ }
int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, null, password);
if (ret != (int)WiFiError.None)
{
/// <summary>
/// The file path of CA Certificate of EAP.
/// </summary>
+ /// <value>CA certification file of EAP.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string CaCertificationFile
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get caCertFile Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
+ return "";
}
return Marshal.PtrToStringAnsi(strPtr);
}
/// <summary>
/// The EAP type of wifi.
/// </summary>
+ /// <value>Type of EAP.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiEapType EapType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to eap type Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
}
return (WiFiEapType)type;
}
/// <summary>
/// The type of EAP phase2 authentication of Wi-Fi.
/// </summary>
+ /// <value>Authentication type of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiAuthenticationType AuthenticationType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get auth type Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
}
return (WiFiAuthenticationType)type;
}
/// <summary>
/// The anonymous identity of access point(AP).
/// </summary>
+ /// <value>Represents the anonymous identity of the access point.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string AnonymousIdentify
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get anonymous identify Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
return "";
}
return Marshal.PtrToStringAnsi(strPtr);
/// <summary>
/// The identity of access point(AP).
/// </summary>
+ /// <value>Represents the identity of the access point.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string Identity
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get identify Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
return "";
}
return Marshal.PtrToStringAnsi(strPtr);
/// <summary>
/// The subject match of access point(AP).
/// </summary>
+ /// <value>Represents the subject match of AP.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this value when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string SubjectMatch
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get subject match Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle());
return "";
}
return Marshal.PtrToStringAnsi(strPtr);
/// Gets access point client cert file from configuration.
/// </summary>
/// <returns>The certification authority(CA) certificates file of access point.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
public string GetClientCertFile()
{
IntPtr strPtr;
/// </summary>
/// <param name="privateKey">The private key file.</param>
/// <param name="clientCert">The certification authority(CA) certificates file of access point.</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
public void SetClientCertFile(string privateKey, string clientCert)
{
int ret = Interop.WiFi.Config.SetEapClientCertFile(_configHandle, privateKey, clientCert);
internal static class WiFiErrorFactory
{
- static internal void ThrowWiFiException(int e)
+ static internal void ThrowWiFiException(int e, IntPtr handle)
{
- ThrowExcption(e, false);
+ ThrowExcption(e, (handle == IntPtr.Zero), false, "");
}
- static internal void ThrowWiFiException(int e, IntPtr handle)
+ static internal void ThrowWiFiException(int e, IntPtr handle1, IntPtr handle2)
+ {
+ ThrowExcption(e, (handle1 == IntPtr.Zero), (handle2 == IntPtr.Zero), "");
+ }
+
+ static internal void ThrowWiFiException(int e, string message)
+ {
+ ThrowExcption(e, false, false, message);
+ }
+
+ static internal void ThrowWiFiException(int e, IntPtr handle, string message)
+ {
+ ThrowExcption(e, (handle == IntPtr.Zero), false, message);
+ }
+
+ static internal void ThrowWiFiException(int e, IntPtr handle1, IntPtr handle2, string message)
{
- ThrowExcption(e, (handle == IntPtr.Zero));
+ ThrowExcption(e, (handle1 == IntPtr.Zero), (handle2 == IntPtr.Zero), message);
}
- static private void ThrowExcption(int e, bool isHandleNull)
+ static private void ThrowExcption(int e, bool isHandle1Null, bool isHandle2Null, string message)
{
WiFiError err = (WiFiError)e;
if (err == WiFiError.NotSupportedError)
{
- throw new NotSupportedException("Not Supported");
+ throw new NotSupportedException("Unsupported feature http://tizen.org/feature/network.wifi");
}
- if (isHandleNull)
+ if (err == WiFiError.PermissionDeniedError)
{
- if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError)
- {
- throw new ArgumentException(err.ToString());
- }
- else
- {
- throw new InvalidOperationException("Invalid instance (object may have been disposed or released)");
- }
+ throw new UnauthorizedAccessException("Permission denied " + message);
}
- if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError)
+ if (err == WiFiError.OutOfMemoryError)
{
- throw new ArgumentException(err.ToString());
+ throw new OutOfMemoryException("Out of memory");
}
- else
+
+ if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError)
{
- throw new InvalidOperationException(err.ToString());
+ if (isHandle1Null || isHandle2Null)
+ {
+ throw new InvalidOperationException("Invalid instance (object may have been disposed or released)");
+ }
+
+ throw new ArgumentException("Invalid parameter");
}
+
+ throw new InvalidOperationException(err.ToString());
}
}
}
/// <summary>
/// The local MAC address.
/// </summary>
+ /// <value>Represents the mac address of the WiFi.</value>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
static public string MacAddress
{
get
/// <summary>
/// The name of the network interface.
/// </summary>
+ /// <value>Interface name of WiFi.</value>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
static public string InterfaceName
{
get
/// <summary>
/// The network connection state.
/// </summary>
+ /// <value>Represents the connection state of WiFi.</value>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
static public WiFiConnectionState ConnectionState
{
get
/// <summary>
/// A property to Check whether Wi-Fi is activated.
/// </summary>
+ /// <value>Boolean value to check whether WiFi is activated or not.</value>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
static public bool IsActive
{
get
/// Gets the result of the scan.
/// </summary>
/// <returns> A list of WiFiAP objects.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public IEnumerable<WiFiAP> GetFoundAPs()
{
return WiFiManagerImpl.Instance.GetFoundAPs();
/// Gets the result of specific AP scan.
/// </summary>
/// <returns> A list contains the WiFiAP objects.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public IEnumerable<WiFiAP> GetFoundSpecificAPs()
{
return WiFiManagerImpl.Instance.GetFoundSpecificAPs();
/// Gets the list of wifi configurations.
/// </summary>
/// <returns>A list contains the WiFiConfiguration objects.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public IEnumerable<WiFiConfiguration> GetWiFiConfigurations()
{
return WiFiManagerImpl.Instance.GetWiFiConfigurations();
/// Saves Wi-Fi configuration of access point.
/// </summary>
/// <param name="configuration">The configuration to be stored</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.profile</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when WiFiConfiguration is passed as null.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public void SaveWiFiConfiguration(WiFiConfiguration configuration)
{
WiFiManagerImpl.Instance.SaveWiFiNetworkConfiguration(configuration);
/// Gets the object of the connected WiFiAP.
/// </summary>
/// <returns> The connected wifi access point(AP) information.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when system is out of memory.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public WiFiAP GetConnectedAP()
{
return WiFiManagerImpl.Instance.GetConnectedAP();
/// Activates Wi-Fi asynchronously.
/// </summary>
/// <returns> A task indicating whether the Activate method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public Task ActivateAsync()
{
return WiFiManagerImpl.Instance.ActivateAsync();
/// Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.
/// </summary>
/// <returns> A task indicating whether the ActivateWithPicker method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public Task ActivateWithPickerAsync()
{
return WiFiManagerImpl.Instance.ActivateWithWiFiPickerTestedAsync();
/// Deactivates Wi-Fi asynchronously.
/// </summary>
/// <returns> A task indicating whether the Deactivate method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public Task DeactivateAsync()
{
return WiFiManagerImpl.Instance.DeactivateAsync();
/// Starts scan asynchronously.
/// </summary>
/// <returns> A task indicating whether the Scan method is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public Task ScanAsync()
{
return WiFiManagerImpl.Instance.ScanAsync();
/// </summary>
/// <returns> A task indicating whether the ScanSpecificAP method is done or not.</returns>
/// <param name="essid">The essid of hidden ap</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <privilege>http://tizen.org/privilege/network.set</privilege>
+ /// <privilege>http://tizen.org/privilege/network.get</privilege>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
static public Task ScanSpecificAPAsync(string essid)
{
return WiFiManagerImpl.Instance.ScanSpecificAPAsync(essid);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to initialize wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, "http://tizen.org/privilege/network.get");
}
return handle;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get all APs, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get");
}
return apList;
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get specific APs, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get");
}
return apList;
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get configurations, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.profile");
}
return configList;
internal void SaveWiFiNetworkConfiguration(WiFiConfiguration config)
{
Log.Debug(Globals.LogTag, "SaveWiFiNetworkConfiguration");
+ if (config == null)
+ {
+ throw new ArgumentNullException("WiFi configuration is null");
+ }
+
IntPtr configHandle = config.GetHandle();
int ret = Interop.WiFi.Config.SaveConfiguration(GetSafeHandle(), configHandle);
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to save configuration, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.profile");
}
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to connect with AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get");
}
WiFiAP ap = new WiFiAP(apHandle);
return ap;
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
return task.Task;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
return task.Task;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to deactivate wifi, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
return task.Task;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to scan all AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
return task.Task;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to scan with specific AP, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle());
}
return task.Task;
}
/// <summary>
/// The Extended Service Set Identifier(ESSID).
/// </summary>
+ /// <value>Essid of the WiFi.</value>
public string Essid
{
get
/// <summary>
/// The Basic Service Set Identifier(BSSID).
/// </summary>
+ /// <value>Bssid of the WiFi.</value>
public string Bssid
{
get
/// <summary>
/// The address informaiton for IPv4.
/// </summary>
+ /// <value>IP address information for IPv4 type.</value>
public IAddressInformation IPv4Setting
{
get
/// <summary>
/// The address ainformation for IPv6.
/// </summary>
+ /// <value>IP address information for IPv6 type.</value>
public IAddressInformation IPv6Setting
{
get
/// <summary>
/// The proxy address.
/// </summary>
+ /// <value>Represents proxy address of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public string ProxyAddress
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The proxy type(IPv6).
/// </summary>
+ /// <value>Represents proxy type of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiProxyType ProxyType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set proxy type, Error - " + (WiFiError)ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The frequency band(MHz).
/// </summary>
+ /// <value>Represents the frequency band value.</value>
public int Frequency
{
get
/// <summary>
/// The Received signal strength indication(RSSI).
/// </summary>
+ /// <value>Represents Rssi level of WiFi.</value>
public WiFiRssiLevel Rssi
{
get
/// <summary>
/// The max speed (Mbps).
/// </summary>
+ /// <value>Represents max speed value.</value>
public int MaxSpeed
{
get
/// <summary>
/// A property to check whether the access point is favorite or not.
/// </summary>
+ /// <value>Boolean value to check if the access point is favorite or not.</value>
public bool IsFavorite
{
get
/// <summary>
/// A property to check whether the access point is passpoint or not.
/// </summary>
+ /// <value>Boolean value to check if the access point is passpoint or not.</value>
public bool IsPasspoint
{
get
/// <summary>
/// The connection state.
/// </summary>
+ /// <value>Represents the connection state of WiFi.</value>
public WiFiConnectionState ConnectionState
{
get
/// <summary>
/// The type of Wi-Fi security.
/// </summary>
+ /// <value>Represents the security type of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiSecurityType SecurityType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return (WiFiSecurityType)type;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set security type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The type of Wi-Fi encryption
/// </summary>
+ /// <value>Represents the encryption type of WiFi.</value>
+ /// <exception cref="NotSupportedException">Thrown while setting this property when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentException">Thrown while setting this property due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown while setting this value due to invalid operation.</exception>
public WiFiEncryptionType EncryptionType
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get encryption type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return (WiFiEncryptionType)type;
}
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to set encryption type, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
+ WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle());
}
}
}
/// <summary>
/// The EAP information
/// </summary>
+ /// <value>Eap information of WiFi.</value>
public WiFiEap EapInformation
{
get
/// <summary>
/// A property to check whether the passphrase is required or not.
/// </summary>
+ /// <value>Boolean value to check if passphrase is required or not.</value>
public bool IsPassphraseRequired
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get isPassportRequired, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return required;
}
/// <summary>
/// A property to check whether the Wi-Fi Protected Setup(WPS) is supported or not.
/// </summary>
+ /// <value>Boolean value to check if wps is supported or not.</value>
public bool IsWpsSupported
{
get
if (ret != (int)WiFiError.None)
{
Log.Error(Globals.LogTag, "Failed to get isWapSupported, Error - " + (WiFiError)ret);
- WiFiErrorFactory.ThrowWiFiException(ret);
}
return supported;
}
/// <summary>
/// Sets the passphrase.
/// </summary>
+ /// <param name="passphrase">The passphrase of the access point.</param>
+ /// <feature>http://tizen.org/feature/network.wifi</feature>
+ /// <exception cref="NotSupportedException">Thrown when WiFi is not supported.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when passphrase is passed as null.</exception>
+ /// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
public void SetPassphrase(string passphrase)
{
+ if (passphrase == null)
+ {
+ throw new ArgumentNullException("Passphrase is null");
+ }
int ret = Interop.WiFi.AP.SetPassphrase(_apHandle, passphrase);
if (ret != (int)WiFiError.None)
{