<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Steve,<br>
Thanks for you reply!<br>
<br>
I see that dbus-glib includes dbus-glib-binding tool.<br>
<pre wrap="">I was not able to find this function
dbus_binding_tool_generated_method() ?
Where can I find it?
Which header files should I include in my application?
Thanks and Regards,
Stanislav</pre>
<br>
Steve Kreyer wrote:
<blockquote cite="mid:49E9173B.6040105@web.de" type="cite">
<pre wrap="">Hi,
to my knowledge structs are represented by the dbus-glib-binding via the
type GValueArray.
Why using dbus_g_proxy_call directly? Theres a little tool which
generates you dbus_g_proxy_call invocations in the right way. It is
called dbus-binding-tool. You feed it with your XML interface
specification and it generates for you easy-to-use wrapper functions
around dbus_g_proxy_call for synchronous and asynchronous method calls.
All you have to do is to allocate the GValueArray and pass it to the
generated function in your application:
GError *error = NULL;
GValueArray *dbus_struct;
GValue dbus_struct_member = {0};
dbus_struct = g_value_array_new(0);
g_value_init (&dbus_struct_member, G_TYPE_STRING);
g_value_set_string (&dbus_struct_member, "value of first member");
g_value_array_append (dbus_struct, &dbus_struct_member);
g_value_set_string (&dbus_struct_member, "value of second member");
g_value_array_append (dbus_struct, &dbus_struct_member);
dbus_binding_tool_generated_method (proxy, dbus_struct, &error);
HTH,
Steve
Stanislav Popov wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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
_______________________________________________
dbus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/dbus">http://lists.freedesktop.org/mailman/listinfo/dbus</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>