Add GetWiFiHandle
authorchleun.moon <chleun.moon@samsung.com>
Fri, 12 May 2017 01:56:03 +0000 (10:56 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Fri, 12 May 2017 01:56:12 +0000 (10:56 +0900)
Change-Id: I566b31208a2094f120e645fefe5fdad4e2c51578
Signed-off-by: cheoleun <chleun.moon@samsung.com>
packaging/csapi-network-wifi.spec
src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs

index 16c078c..b12519e 100755 (executable)
@@ -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
index 85f5418..79642e3 100755 (executable)
@@ -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)
index 5767956..9befdaa 100755 (executable)
 
 using System;
 using System.Collections.Generic;
+using System.Runtime.InteropServices;
 using System.Threading.Tasks;
+using System.ComponentModel;
 
 namespace Tizen.Network.WiFi
 {
     /// <summary>
+    /// A class for managing WiFiManager handle.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public sealed class SafeWiFiManagerHandle : SafeHandle
+    {
+        internal SafeWiFiManagerHandle() : base(IntPtr.Zero, true)
+        {
+        }
+
+        /// <summary>
+        /// Checks the validity of the handle.
+        /// </summary>
+        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;
+        }
+    }
+
+    /// <summary>
     /// A manager class which allows applications to connect to a Wireless Local Area Network (WLAN) and to transfer data over the network.<br>
     /// 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.
     /// </summary>
@@ -132,6 +163,16 @@ namespace Tizen.Network.WiFi
         }
 
         /// <summary>
+        /// Gets the WiFi safe handle.
+        /// </summary>
+        /// <returns>The instance of SafeWiFiManagerHandle</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static SafeWiFiManagerHandle GetWiFiHandle()
+        {
+            return WiFiManagerImpl.Instance.GetSafeHandle();
+        }
+
+        /// <summary>
         /// Gets the result of the scan.
         /// </summary>
         /// <returns> A list of WiFiAP objects.</returns>
index 2472463..5625159 100755 (executable)
@@ -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)
             {