Passing structure from Server to Client on DBus

Colin Walters walters at verbum.org
Tue Mar 30 14:28:14 PDT 2010


Hi,

On Tue, Mar 30, 2010 at 2:50 AM, Rakesh <rkumar at celestialsys.com> wrote:
> I am using Glib binding. Please give me some code which explain the
> procedure.

DBus structures are represented in the dbus-glib binding as a
GValueArray.  You need to call
dbus_g_type_get_struct:
http://dbus.freedesktop.org/doc/dbus-glib/dbus-glib-Specializable-GType-System.html#dbus-g-type-get-struct

Then you can pass that to a dbus_g_proxy_call like:
GValueArray *vals = g_value_array_new (3);

// Set vals, see the docs for GValueArray

dbus_g_proxy_call (proxy, "Foo", &error, dbus_g_type_get_struct
(G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), vals, G_TYPE_INVALID,
G_TYPE_INVALID)

There's a full code example in the test suite:

http://cgit.freedesktop.org/dbus/dbus-glib/tree/test/core/test-dbus-glib.c#n1145


More information about the dbus mailing list