DBus Low level API - Receiving complex structures

Thiago Macieira thiago at kde.org
Tue Aug 16 01:13:05 PDT 2011


On Monday, 15 de August de 2011 22:49:23 Bogdan Lotko wrote:
> typedef _S1 S1;
[...]
> typedef _S2 S2;

Hint: You're coding in C++, you don't need the above, it's a C-ism that you 
should lose.

> According Q_DECLARE_METATYPE, qDBusRegisterMetatype and
> QRegisterMetatype calls are done.
> 
> Before sending, I populate the S2 structure s and pack it into QVariant
> variable v
> 
> QVariant v;
> S2           s;
> 
> s.i1 = .....
> ...
> v.setValue( s );
> 
> myIf->asyncCall( "myMethod", v );
> 
> So far so good.

ok.

> On the GLib Low Level API side I declare .xml file with following signature:

Wait. Do you mean GLib API or low-level API? They are not the same thing.

> <method name="myMethod">
> <arg type="(iia(ssii))">
> </method>
> 
> dbus-binding-tool with --mode=glib-server generates according include file.
> 
> Now I have to implement
> 
> myPrefix_my_method( MyClass *self, <HELP_WHAT_TYPE???> myStruct, GError
> ** error );
> 
> My question is what is the correct type for my structure parameter
> myStruct? (S2 on Qt side)
> 
> For simple signatures e.g. "i" it is just according type e.g. gint.
> 
> Here I suppose  it shall be a kind of message I have to iterate into. Is
> it just the DBusMessage or pointer to it?
> 
> Please let me know how to unpack the message (if any) and if to clean it
> (how) after usage.

Sorry, I can't help you.

I thought you wanted help with the low-level API, not with the glib API.

I can tell you that the D-Bus type signature you pasted above seems correct 
compared to the C++ types.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      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/20110816/00b1a1c3/attachment.pgp>


More information about the dbus mailing list