Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

qt

dbus

qtdbus

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?

like image 719
moki Avatar asked Oct 01 '22 00:10

moki


1 Answers

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.

like image 66
moki Avatar answered Oct 13 '22 11:10

moki