From: chleun.moon Date: Fri, 12 May 2017 01:56:03 +0000 (+0900) Subject: Add GetWiFiHandle X-Git-Tag: accepted/tizen/unified/20170512.023909^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5540f974fb12c658da9b93016929e3cb2fd68d4;p=platform%2Fcore%2Fcsapi%2Fwifi.git Add GetWiFiHandle Change-Id: I566b31208a2094f120e645fefe5fdad4e2c51578 Signed-off-by: cheoleun --- diff --git a/Tizen.Network.WiFi/Interop/Interop.WiFi.cs b/Tizen.Network.WiFi/Interop/Interop.WiFi.cs index 85f5418..79642e3 100755 --- a/Tizen.Network.WiFi/Interop/Interop.WiFi.cs +++ b/Tizen.Network.WiFi/Interop/Interop.WiFi.cs @@ -16,6 +16,8 @@ using System; using System.Runtime.InteropServices; +using Tizen.Network.WiFi; +using Tizen.Network.Connection; internal static partial class Interop { @@ -265,28 +267,6 @@ internal static partial class Interop internal static extern int SetEapSubjectMatch(SafeWiFiConfigHandle config, string subjectMatch); } - internal sealed class SafeWiFiManagerHandle : SafeHandle - { - public SafeWiFiManagerHandle() : base(IntPtr.Zero, true) - { - } - - public override bool IsInvalid - { - get - { - return this.handle == IntPtr.Zero; - } - } - - protected override bool ReleaseHandle() - { - WiFi.Deinitialize(this.handle); - this.SetHandle(IntPtr.Zero); - return true; - } - } - internal sealed class SafeWiFiAPHandle : SafeHandle { public SafeWiFiAPHandle() : base(IntPtr.Zero, true) diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs index 5767956..9befdaa 100755 --- a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs +++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs @@ -16,11 +16,42 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using System.Threading.Tasks; +using System.ComponentModel; namespace Tizen.Network.WiFi { /// + /// A class for managing WiFiManager handle. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class SafeWiFiManagerHandle : SafeHandle + { + internal SafeWiFiManagerHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Checks the validity of the handle. + /// + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + Interop.WiFi.Deinitialize(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + /// /// A manager class which allows applications to connect to a Wireless Local Area Network (WLAN) and to transfer data over the network.
/// The Wi-Fi Manager enables your application to activate and deactivate a local Wi-Fi device, and to connect to a WLAN network in the infrastructure mode. ///
@@ -132,6 +163,16 @@ namespace Tizen.Network.WiFi } /// + /// Gets the WiFi safe handle. + /// + /// The instance of SafeWiFiManagerHandle + [EditorBrowsable(EditorBrowsableState.Never)] + public static SafeWiFiManagerHandle GetWiFiHandle() + { + return WiFiManagerImpl.Instance.GetSafeHandle(); + } + + /// /// Gets the result of the scan. /// /// A list of WiFiAP objects. diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs index 2472463..5625159 100755 --- a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs +++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs @@ -29,7 +29,7 @@ namespace Tizen.Network.WiFi internal class HandleHolder { - private Interop.WiFi.SafeWiFiManagerHandle _handle; + private SafeWiFiManagerHandle _handle; internal HandleHolder() { @@ -37,7 +37,7 @@ namespace Tizen.Network.WiFi Log.Debug(Globals.LogTag, "Handle: " + _handle); } - internal Interop.WiFi.SafeWiFiManagerHandle GetSafeHandle() + internal SafeWiFiManagerHandle GetSafeHandle() { Log.Debug(Globals.LogTag, "Handleholder safehandle = " + _handle); return _handle; @@ -141,14 +141,14 @@ namespace Tizen.Network.WiFi { } - internal Interop.WiFi.SafeWiFiManagerHandle GetSafeHandle() + internal SafeWiFiManagerHandle GetSafeHandle() { return s_threadName.Value.GetSafeHandle(); } - internal Interop.WiFi.SafeWiFiManagerHandle Initialize() + internal SafeWiFiManagerHandle Initialize() { - Interop.WiFi.SafeWiFiManagerHandle handle; + SafeWiFiManagerHandle handle; int ret = Interop.WiFi.Initialize(out handle); if (ret != (int)WiFiError.None) { diff --git a/packaging/csapi-network-wifi.spec b/packaging/csapi-network-wifi.spec index 16c078c..b12519e 100755 --- a/packaging/csapi-network-wifi.spec +++ b/packaging/csapi-network-wifi.spec @@ -1,6 +1,6 @@ Name: csapi-network-wifi Summary: Tizen Wi-Fi API for C# -Version: 1.0.13 +Version: 1.0.14 Release: 1 Group: Development/Libraries License: Apache-2.0