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 ConvChannel
20 [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_create")]
21 internal static extern int Create(out ConvChannelHandle /* conv_channel_h */ handle);
23 [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_destroy")]
24 internal static extern int Destroy(IntPtr /* conv_channel_h */ handle);
26 [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_get_string")]
27 internal static extern int GetString(ConvChannelHandle /* conv_channel_h */ handle, string key, out IntPtr value);
29 [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_set_string")]
30 internal static extern int SetString(ConvChannelHandle /* conv_channel_h */ handle, string key, string value);
33 internal class ConvChannelHandle : TizenSafeHandle
35 private bool _ownsHandle = true;
37 public ConvChannelHandle(): base()
42 public ConvChannelHandle(IntPtr handle)
47 public ConvChannelHandle(IntPtr handle, bool ownsHandle)
50 _ownsHandle = ownsHandle;
53 public override void Destroy()
55 if (_ownsHandle && handle != IntPtr.Zero)
57 var err = ConvChannel.Destroy(this.handle);
58 if (err != (int)ConvErrorCode.None)
60 Log.Error(ErrorFactory.LogTag, "Failed to destroy conv channel handle");
61 throw ErrorFactory.GetException(err);