D-Bus low-lewel API - sending an array of structures

Thiago Macieira thiago at kde.org
Sat May 7 04:33:38 PDT 2011

On Saturday, 7 de May de 2011 11:13:41 Bogdan Lotko wrote:
>      // Open the a structure within an array
>      // Here run-time error  !!!!!!!!!!!!!!!!!!!
>      dbus_message_iter_open_container( &arr,
>                                        DBUS_TYPE_STRUCT,
>                                        NULL,
> &strct );

No, it's not.

The error is actually here:

>    dbus_message_iter_open_container( &iter,
>                                      DBUS_TYPE_ARRAY,
>                                      "r",
> &arr );

It told you:
"process 6585: Array or variant type requires that type struct be 
written, but begin_struct was written"

As you can see, you sent "r". You should pass the actual type of 
the structure you're trying to send. In this case, "(ss)".

By the way, you're using the D-Bus low-level API, but you have glib constructs 
in your code. Why aren't you using dbus-glib or, even better, gdbus?

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/20110507/02aa39b5/attachment.pgp>

More information about the dbus mailing list