PDA

View Full Version : qdbusxml2cpp unkown type must add annotation



phil999
7th March 2014, 15:09
While using the qdbusxml2cpp program to convert the following xml to a Qt Class, I am getting this error:


qdbusxml2cpp -c ObjectManager -a ObjectManager:ObjectManager.cpp xml/object_manager.xml
Got unknown type `a{oa{sa{sv}}}'
You should add <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="<type>"/> to the XML description

D-Feet description:

10118

XML:


<!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="org.freedesktop.DBus.Introspectable"><method name="Introspect"><arg name="xml" type="s" direction="out"/>
</method></interface><interface name="org.freedesktop.DBus.ObjectManager"><method name="GetManagedObjects"><arg name="objects" type="a{oa{sa{sv}}}" direction="out"/>
</method><signal name="InterfacesAdded"><arg name="object" type="o"/>
<arg name="interfaces" type="a{sa{sv}}"/>
</signal>
<signal name="InterfacesRemoved"><arg name="object" type="o"/>
<arg name="interfaces" type="as"/>
</signal>
</interface><node name="org"/></node>

From this website ( http://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes ) I understand that I need to add an annotation to the XML for the tool to work properly.


a{oa{sa{sv}}}

https://alteeve.ca/w/List_of_DBus_data_types
o == A UTF-8 string whose value is a valid DBus object path.

array { object_path array { string array { string variant } } }

<arg name="customdata" type="a{sv}" direction="in" />
QVariantMap in the arguments (type "a{sv}")
QMap<QString, QVariant>

However, I'm not sure what the annotation should be for a{oa{sa{sv}}}, can someone please help me understand? Thanks!

anda_skoa
7th March 2014, 19:16
The type you seem to have here is



QMap<QDBusObjectPath, QMap<QString, QMap<QString, QVariant> > >


What you likely need is a class type that implementes the D-Bus stream operators to serialize and deserialize the type into this form and then register it.

Bascially like the Message class in the TechBase article.

Cheers,
_