Important: Please read the Qt Code of Conduct -

How is the "car.xml" file from dbus example called "D-Bus remote controlled car example" generated?

  • I am trying to create programs that take advantage of the D-Bus. I've studied the examples supplied with Qt about the same. In one of them called "D-Bus remote controlled car example" there is a file named "car.xml" with following content:

    @<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    <node name="/com/trollech/examples/car">
    <interface name="org.example.Examples.CarInterface">
    <method name="accelerate"/>
    <method name="decelerate"/>
    <method name="turnLeft"/>
    <method name="turnRight"/>
    <signal name="crashed"/>

    If I'm not mistaken, one is supposed to generate this file using a tool named "qdbuscpp2xml". when i generate an xml using this command:

    @$ qdbuscpp2xml -A car.h -o car2.xml@

    i get the following content in the generated XML file:

    @<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "">
    <interface name="local.Car">
    <signal name="crashed">
    <method name="accelerate">
    <method name="decelerate">
    <method name="turnLeft">
    <method name="turnRight">

    which differs from the car.xml in following lines:

    @<node name="/com/trollech/examples/car">
    <interface name="org.example.Examples.CarInterface">@

    why am I getting a different file? was the included file (car.xml) with the example created manually?

  • so as i have come to conclude, the first line which is:

    @<node name="/com/trollech/examples/car">@

    is edited manually and the second line is automatically generated by including:

    @Q_CLASSINFO("D-Bus Interface", "org.example.Examples.CarInterface")@

    in the header of the class one would like to export before using the qdbuscpp2xml tool.

Log in to reply