From dbe988539308ae26fc022a1b3245deea59d2c446 Mon Sep 17 00:00:00 2001 From: "shikha.ta" Date: Mon, 27 Mar 2017 16:23:15 +0530 Subject: [PATCH] [Connection] Implemented GetHandle() to get a SafeHandle Change-Id: Ic1288fe18faf87a8638d1743ab0e33e6cf9b0431 Signed-off-by: shikha.ta --- .../Tizen.Network.Connection/ConnectionManager.cs | 37 ++++++++++++++++++++++ packaging/csapi-network-connection.spec | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) mode change 100644 => 100755 packaging/csapi-network-connection.spec diff --git a/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs b/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs index 55bce8f..6a2f380 100755 --- a/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs +++ b/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs @@ -27,6 +27,33 @@ using System.Runtime.InteropServices; namespace Tizen.Network.Connection { /// + /// This class manages the connection handle resources. + /// + public sealed class SafeConnectionHandle : SafeHandle + { + internal SafeConnectionHandle(IntPtr handle) : base(handle, true) + { + } + + /// + /// Checks whether the handle value is valid or not. + /// + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } + + /// /// This class is ConnectionManager. It provides functions to manage data connections. /// public static class ConnectionManager @@ -98,6 +125,16 @@ namespace Tizen.Network.Connection } /// + /// Gets the connection handle. + /// + /// Instance of SafeConnectionHandle + public static SafeConnectionHandle GetConnectionHandle() + { + IntPtr handle = ConnectionInternalManager.Instance.GetHandle(); + return new SafeConnectionHandle(handle); + } + + /// /// Gets the IP address of the current connection. /// /// The address family diff --git a/packaging/csapi-network-connection.spec b/packaging/csapi-network-connection.spec old mode 100644 new mode 100755 index bfb2169..c4d248e --- a/packaging/csapi-network-connection.spec +++ b/packaging/csapi-network-connection.spec @@ -1,6 +1,6 @@ Name: csapi-network-connection Summary: Tizen Connection API for C# -Version: 1.0.11 +Version: 1.0.12 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4