From: chleun.moon Date: Mon, 12 Jun 2017 00:45:58 +0000 (+0900) Subject: Add an internal API GetHandle() X-Git-Tag: accepted/tizen/unified/20170612.074002^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8737132d040606d4ff53bbbec076dc5b5cbc5289;p=platform%2Fcore%2Fcsapi%2Fwifi.git Add an internal API GetHandle() Change-Id: Ief642128ae05e515aa2034b45142a3e1b06d2e14 Signed-off-by: cheoleun --- diff --git a/Tizen.Network.WiFi/Interop/Interop.WiFi.cs b/Tizen.Network.WiFi/Interop/Interop.WiFi.cs index d541abc..e13bad4 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.csproj b/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj index 7a6e172..b3e36d7 100644 --- a/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj +++ b/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj @@ -1,7 +1,7 @@  - 1.0.17 + 1.0.18 Samsung Electronics © Samsung Electronics Co., Ltd All Rights Reserved Provides the Wi-Fi APIs for Tizen .NET diff --git a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs index 21fa84c..30d95da 100755 --- a/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs +++ b/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs @@ -16,11 +16,43 @@ 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. + /// + /// Represents 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. ///
@@ -148,6 +180,23 @@ namespace Tizen.Network.WiFi } /// + /// Gets the WiFi safe handle. + /// + /// The instance of SafeWiFiManagerHandle + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + [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 05fb87c..10865c4 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 a97ee3d..0a9acd1 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.17 +Version: 1.0.18 Release: 1 Group: Development/Libraries License: Apache-2.0