1 // Copyright 2016 by Samsung Electronics, Inc.,
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
10 using System.Runtime.InteropServices;
12 using Tizen.Convergence;
14 internal static partial class Interop
16 internal static partial class Internal
18 internal static partial class ConvDevice
20 [DllImport(Libraries.Convergence, EntryPoint = "conv_device_clone")]
21 internal static extern int Clone(IntPtr /* conv_device_h */ originalHandle, out ConvDeviceHandle /* conv_device_h */ targetHandle);
23 [DllImport(Libraries.Convergence, EntryPoint = "conv_device_destroy")]
24 internal static extern int Destroy(IntPtr /* conv_device_h */ handle);
26 [DllImport(Libraries.Convergence, EntryPoint = "conv_device_get_property_string")]
27 internal static extern int GetPropertyString(ConvDeviceHandle /* conv_device_h */ handle, string key, out IntPtr value);
29 [DllImport(Libraries.Convergence, EntryPoint = "conv_device_foreach_service")]
30 internal static extern int ForeachService(ConvDeviceHandle /* conv_device_h */ handle, ConvServiceForeachCallback cb, IntPtr /* void */ userData);
32 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
33 internal delegate void ConvServiceForeachCallback(IntPtr serviceHandle, IntPtr /* void */ userData);
36 internal class ConvDeviceHandle : TizenSafeHandle
38 public ConvDeviceHandle() : base()
43 public ConvDeviceHandle(IntPtr handle)
48 public override void Destroy()
50 if (handle != IntPtr.Zero)
52 var err = ConvDevice.Destroy(this.handle);
53 if (err != (int)ConvErrorCode.None)
55 Log.Error(ErrorFactory.LogTag, "Failed to destroy conv device handle");
56 throw ErrorFactory.GetException(err);