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

StackOverflow https://stackoverflow.com/questions/23095601

  •  04-07-2023
  •  | 
  •  

Question

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"
 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<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"/>
 </interface>
</node>

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" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <interface name="local.Car">
    <signal name="crashed">
    </signal>
    <method name="accelerate">
    </method>
    <method name="decelerate">
    </method>
    <method name="turnLeft">
    </method>
    <method name="turnRight">
    </method>
  </interface>
</node>

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?

Was it helpful?

Solution

I have figured it out myself. The tool namely qdbuscpp2xml, does not assign a name attribute to the <node> as of now. If one wishes to assign a name attribute to it, she has to type it in by herself but for the <interface> node, it's possible to have the above mentioned tool do it automatically by putting the macro Q_CLASSINFO inside the class one wishes to expose.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top