[Qt-interest] Using dbus type 'aay' with qdbusxml2cpp
Kybernetik Kollektiv
kybernetikkollektiv at googlemail.com
Tue Jul 20 02:34:06 CEST 2010
Hello!
I need to access the method 'AddServer' from interface
'org.freedesktop.Avahi.EntryGroup'. This method is define in
'/usr/share/dbus-1/interface/org.freedesktop.Avahi.EntryGroup.xml':
> <method name="AddService">
> <annotation name="com.trolltech.QtDBus.QtTypeName.In8" value="BreitArray"/>
> <arg name="interface" type="i" direction="in"/>
> <arg name="protocol" type="i" direction="in"/>
> <arg name="flags" type="u" direction="in"/>
> <arg name="name" type="s" direction="in"/>
> <arg name="type" type="s" direction="in"/>
> <arg name="domain" type="s" direction="in"/>
> <arg name="host" type="s" direction="in"/>
> <arg name="port" type="q" direction="in"/>
> <arg name="txt" type="aay" direction="in"/>
> </method>
As one can see, the argument 'txt' is of type 'aay', means array of
array of byte. To handle this my first attempt was to do the
following:
> <annotation name="com.trolltech.QtDBus.QtTypeName.In8" value="QList<QByteArray>"/>
But qdbusxml2cpp didn't like that, so I created a new header file
'mytypes.h' containing this:
> typedef QList<QByteArray > BreitArray;
> Q_DECLARE_METATYPE(BreitArray)
With this qdbusxml2cpp successfully creates my new interface-class. To
its constructor I added:
> qDBusRegisterMetaType<BreitArray>();
The program compiles and runs, but on calling 'AddService' the method
replies with:
Error name: "org.freedesktop.Avahi.InvalidServiceTypeError"
Error message: "Invalid service type"
Searching google, it turned out that there are a few others with the
same problem unsolved. So, does anyone have a solution for this?
regards
Patrick
More information about the Qt-interest-old
mailing list