Add an internal API GetHandle() 38/133338/2 accepted/tizen/unified/20170612.074002 submit/tizen/20170612.051752
authorchleun.moon <chleun.moon@samsung.com>
Mon, 12 Jun 2017 00:45:58 +0000 (09:45 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Mon, 12 Jun 2017 00:49:23 +0000 (09:49 +0900)
Change-Id: Ief642128ae05e515aa2034b45142a3e1b06d2e14
Signed-off-by: cheoleun <chleun.moon@samsung.com>
Tizen.Network.WiFi/Interop/Interop.WiFi.cs
Tizen.Network.WiFi/Tizen.Network.WiFi.csproj
Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs
Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs
packaging/csapi-network-wifi.spec

index d541abc..e13bad4 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 7a6e172..b3e36d7 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>1.0.17</Version>
+    <Version>1.0.18</Version>
     <Authors>Samsung Electronics</Authors>
     <Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
     <Description>Provides the Wi-Fi APIs for Tizen .NET</Description>
index 21fa84c..30d95da 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>
+        /// <value>Represents the validity of the handle.</value>
+        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>
@@ -148,6 +180,23 @@ namespace Tizen.Network.WiFi
         }
 
         /// <summary>
+        /// Gets the WiFi safe handle.
+        /// </summary>
+        /// <returns>The instance of SafeWiFiManagerHandle</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 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>
+        [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 05fb87c..10865c4 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)
             {
index a97ee3d..0a9acd1 100755 (executable)
@@ -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