QT : Help in constructing complex types for dbus

Thiago Macieira thiago at kde.org
Fri May 27 09:16:28 PDT 2011


On Friday, 27 de May de 2011 19:21:24 sangram.kumar.yerra at accenture.com wrote:
> Hello ,
> 
>       Can anyone tell me how to make a function  call  with multiple out
> parameters and having complex data types  in QT
> 
>             <method name="MyFunc">
>                         <arg direction="in"  type="(a( (ay) s ) q )"
> name="my_data" /> <arg direction="out"   type="y" name="no_of_data" /> <arg
> direction="out"  type="(i)" name="data_val" /> <annotation value="MY_DATA"
> name="com.trolltech.QtDBus.QtTypeName.In0"/> <annotation
> value="DATA_CONTENT" name="com.trolltech.QtDBus.QtTypeName.Out1"/>
> </method>
> 
> 
> I am not able to construct the complex type ="(a( (ay) s ) q )"

First of all, you need to get rid of the spaces. The type is "(a((ay)s)q)"

struct InnerInnerType
{
    QByteArray data;
};

struct InnerType
{
    InnerInnerType data;
    QString str;
};

struct OuterType
{
    QList<InnerType> list;
    ushort value;
};

Q_DECLARE_METATYPE(InnerInnerType)
Q_DECLARE_METATYPE(InnerType)
Q_DECLARE_METATYPE(OuterType)

Then write the streaming operators for all three types:

QDBusArgument &operator<<(QDBusArgument &arg, const Type &t);
const QDBusArgument &operator>>(const QDBusArgument &arg, Type &t);

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110527/82693f81/attachment.pgp>


More information about the dbus mailing list