Exemplo n.º 1
0
        static void TestDbusHelloImpl(Udbus.Serialization.UdbusMessageBuilderTracker builder, Udbus.Core.IUdbusMessageVisitor visitor, Udbus.Serialization.UdbusConnector connector,
            System.Threading.ManualResetEvent stop, PreNextActionDelegate preNextAction)
        {
            int result = -1;
            //Udbus.v4v.v4vConnection connection = new Udbus.v4v.v4vConnection(Console_io_debug);
            //Udbus.Serialization.ManagedDbusIo dbio;
            //connection.PopulateDbio(ref dbio);

            //Udbus.Core.UdbusFunctions.dbus_auth(ref dbio, "Dude");
            //Udbus.Serialization.UdbusConnector connector = Udbus.Serialization.UdbusConnector.CreateAuthorised(connection);

            // Visitors
            preNextAction("Hello");

            // Hello.
            using (var msg = builder.UdbusMethodMessage(
                                "org.freedesktop.DBus", "/org/freedesktop/DBus",
                                "org.freedesktop.DBus", "Hello").Message)
            {
                result = connector.Send(msg);
                Console.WriteLine("Hello send result: {0}", result);
                Udbus.Core.UdbusVisitorFunctions.Visit(result, msg, new Udbus.Core.UdbusMessageVisitorDumpConsole());
            }
            //var recv = connector.Receive(out result);
            Udbus.Serialization.NMessageStruct.UdbusMessageHandle recv;
            result = connector.ReceiveStruct(out recv);
            Console.WriteLine("Hello recv result: {0}. msg: {1}", result, recv);
        }