コード例 #1
0
ファイル: eldbus_proxy.cs プロジェクト: Ali-Alzyoud/efl-1
        eldbus.Pending Send(eldbus.Message msg, eldbus.MessageDelegate dlgt = null, double timeout = -1)
        {
            CheckHandle();

            if (msg == null)
            {
                throw new ArgumentNullException(nameof(msg));
            }

            // Native send() takes ownership of the message. We ref here to keep the IDisposable
            // behavior simpler and keeping the original object alive in case the user wants.
            msg.Ref();

            IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr();
            IntPtr cb_data    = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt);

            var pending_hdl = eldbus_proxy_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout);

            if (pending_hdl == IntPtr.Zero)
            {
                throw new SEHException("Eldbus: could not get `Pending' object from eldbus_proxy_send");
            }

            return(new eldbus.Pending(pending_hdl, false));
        }
コード例 #2
0
        public static void utc_eldbus_message_ref_unref_p()
        {
            var conn = new eldbus.Connection(eldbus.Connection.Type.Session);

            eldbus.Message msg = eldbus.Message.NewMethodCall(DBusBus, DBusPath, DBusInterface, "GetId");

            msg.Ref();
            msg.Unref();

            string pathMsg = msg.GetPath();

            AssertEquals(DBusPath, pathMsg);

            msg.Unref();
            msg.Own = false;

            msg.Dispose();
            conn.Dispose();
        }
コード例 #3
0
ファイル: eldbus_connection.cs プロジェクト: y01k/TizenFX
        public eldbus.Pending Send(eldbus.Message msg, eldbus.MessageDelegate dlgt = null, double timeout = -1)
        {
            CheckHandle();

            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }

            IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
            IntPtr cb_data    = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));

            var pending_hdl = eldbus_connection_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout);

            if (pending_hdl == IntPtr.Zero)
            {
                throw new SEHException("Eldbus: could not get `Pending' object from eldbus_connection_send");
            }

            msg.Ref();

            return(new eldbus.Pending(pending_hdl, false));
        }