Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public static void utc_eldbus_message_info_data_get_p()
        {
            isSuccess = false;

            var app  = Efl.App.AppMain;
            var conn = new eldbus.Connection(eldbus.Connection.Type.Session);

            string methodName = "GetId";

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

            string interfaceMsg = msg.GetInterface();

            AssertEquals(DBusInterface, interfaceMsg);

            string methodMsg = msg.GetMember();

            AssertEquals(methodName, methodMsg);

            string pathMsg = msg.GetPath();

            AssertEquals(DBusPath, pathMsg);

            eldbus.MessageDelegate messageMethodCb = delegate(eldbus.Message m, eldbus.Pending p)
            {
                try
                {
                    string errname, errmsg;
                    if (!m.GetError(out errname, out errmsg))
                    {
                        string txt;
                        if (m.Get(out txt))
                        {
                            if (!String.IsNullOrEmpty(txt))
                            {
                                if (m.GetSender() == DBusBus &&
                                    !String.IsNullOrEmpty(m.GetDestination()))
                                {
                                    isSuccess = true;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    app.Quit(0);
                }
            };

            const int timeoutSendMs = 1000;

            eldbus.Pending pending = conn.Send(msg, messageMethodCb, timeoutSendMs);

            AssertEquals(pending.GetMethod(), methodName);

            var timer = new Efl.LoopTimer(app, 2.0);

            timer.TimerTickEvent += (object sender, EventArgs e) => {
                app.Quit(0);
            };

            app.Begin();

            Assert(isSuccess, $"Method {methodName} is not call");

            timer.Dispose();
            msg.Dispose();
            conn.Dispose();
        }
Ejemplo n.º 3
0
        public static void utc_eldbus_message_info_data_get_p()
        {
            isSuccess = false;

            var conn = new eldbus.Connection(eldbus.Connection.Type.System);

            string methodName = "GetId";

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

            string interfaceMsg = msg.GetInterface();

            AssertEquals(DBusInterface, interfaceMsg);

            string methodMsg = msg.GetMember();

            AssertEquals(methodName, methodMsg);

            string pathMsg = msg.GetPath();

            AssertEquals(DBusPath, pathMsg);

            eldbus.MessageDelegate messageMethodCb = delegate(eldbus.Message m, eldbus.Pending p)
            {
                try
                {
                    if (timeout != IntPtr.Zero)
                    {
                        ecore_timer_del(timeout);
                        timeout = IntPtr.Zero;
                    }

                    string errname, errmsg;
                    if (!m.GetError(out errname, out errmsg))
                    {
                        string txt;
                        if (m.Get(out txt))
                        {
                            if (!String.IsNullOrEmpty(txt))
                            {
                                if (m.GetSender() == DBusBus &&
                                    !String.IsNullOrEmpty(m.GetDestination()))
                                {
                                    isSuccess = true;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    ecore_main_loop_quit();
                }
            };

            const int timeoutSendMs = 1000;

            eldbus.Pending pending = conn.Send(msg, messageMethodCb, timeoutSendMs);

            AssertEquals(pending.GetMethod(), methodName);

            timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero);
            Assert(timeout != IntPtr.Zero);

            ecore_main_loop_begin();

            Assert(isSuccess, $"Method {methodName} is not call");

            msg.Dispose();
            conn.Dispose();
        }