dbus-glib - passing structs as arguments
Stanislav Popov
s.popov at rsc.bg
Fri Apr 17 06:57:25 PDT 2009
Hi all,
I read D-Bus Tutorial and many other documents!
I have only one problem.
I am using dbus-glib and I am trying to invoke a method with parameters.
I would like to pass structures to dbus_g_proxy_call() function.
For example I have (ss) type.
I tried |DBUS_TYPE_STRUCT which is mentioned in |D-Bus Tutorial| but it
seems it is not working with GLIB.
I got:
|
1.
(process:835): GLib-GObject-WARNING **: gtype.c:3312: type id
`115' is invalid
2.
3.
(process:835): GLib-GObject-WARNING **: can't peek value table for
type `<unknown>' which is not currently referenced
4.
Segmentation fault
So I did the following:
#define G_STRUCT_STR_STR (dbus_g_type_get_struct("GValueArray",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID))
GValue *value;
value = g_new0 (GValue, 1);
g_value_init (value, G_STRUCT_STR_STR);
g_value_take_boxed (value, dbus_g_type_specialized_construct
(G_STRUCT_STR_STR));
dbus_g_type_struct_set (value, 0, "192.168.0.1", 1, "1234", G_MAXUINT);
.....
dbus_g_proxy_call (proxy, "SetInfo", &error, G_STRUCT_STR_STR, value,
G_TYPE_INVALID, G_TYPE_INVALID))
------
but I got Segmentation Fault on dbus_g_proxy_call().
Where am I wrong?
Can you help me, please?
Thanks in advance,
Stanislav
More information about the dbus
mailing list