/// <summary> /// Gets all IPv6 addresses of the access point. /// </summary> /// <since_tizen> 3 </since_tizen> /// <returns>A list of IPv6 addresses of the access point.</returns> /// <feature>http://tizen.org/feature/network.wifi</feature> /// <exception cref="NotSupportedException">Thrown when the Wi-Fi is not supported.</exception> /// <exception cref="ArgumentException">Thrown when the method failed due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception> public IEnumerable <System.Net.IPAddress> GetAllIPv6Addresses() { Log.Debug(Globals.LogTag, "GetAllIPv6Addresses"); List <System.Net.IPAddress> ipList = new List <System.Net.IPAddress>(); Interop.WiFi.HandleCallback callback = (IntPtr ipv6Address, IntPtr userData) => { if (ipv6Address != IntPtr.Zero) { string ipv6 = Marshal.PtrToStringAnsi(ipv6Address); if (ipv6.Length == 0) { ipList.Add(System.Net.IPAddress.Parse("::")); } else { ipList.Add(System.Net.IPAddress.Parse(ipv6)); } return(true); } return(false); }; int ret = Interop.WiFi.AP.GetAllIPv6Addresses(_apHandle, callback, IntPtr.Zero); if (ret != (int)WiFiError.None) { Log.Error(Globals.LogTag, "Failed to get all IPv6 addresses, Error - " + (WiFiError)ret); WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); } return(ipList); }
/// <summary> /// Gets the private key file of EAP. /// </summary> /// <since_tizen> 3 </since_tizen> /// <returns>The file path of private key.</returns> /// <feature>http://tizen.org/feature/network.wifi</feature> /// <exception cref="NotSupportedException">Thrown when the Wi-Fi is not supported.</exception> /// <exception cref="OutOfMemoryException">Thrown when the system is out of memory.</exception> /// <exception cref="ArgumentException">Thrown when the method fails due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method fails due to an invalid operation.</exception> public string GetPrivateKeyFile() { IntPtr strPtr; int ret = Interop.WiFi.AP.GetEapPrivateKeyFile(_apHandle, out strPtr); if (ret != (int)WiFiError.None) { Log.Error(Globals.LogTag, "Failed to get private key file, Error - " + (WiFiError)ret); WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); } return(Marshal.PtrToStringAnsi(strPtr)); }
/// <summary> /// Sets the passphrase. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="passphrase">The passphrase of the access point.</param> /// <feature>http://tizen.org/feature/network.wifi</feature> /// <exception cref="NotSupportedException">Thrown when Wi-Fi is not supported.</exception> /// <exception cref="ArgumentNullException">Thrown when the passphrase is passed as null.</exception> /// <exception cref="ArgumentException">Thrown when the method failed due to an invalid parameter.</exception> /// <exception cref="InvalidOperationException">Thrown when the method failed due to an 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) { Log.Error(Globals.LogTag, "Failed to set passphrase, Error - " + (WiFiError)ret); WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); } }