send a very complex stuct by dbus with dbus-glib
ivan fernandez calvo
ivan.fernandez at sacnet.es
Wed Apr 9 01:20:37 PDT 2008
Is a transcription problem the correct type is G_TYPE_UINT , The
objetive of the the code was only show What i want to do and in the
process i make a mistake.
<method name="methodExample">
<arg type="(ua(bb))" name="stcElement" direction="in" />
</method>
GValueArray* IN_stcElement= g_value_array_new(2);
// boolean value
GValue *pbData = g_try_new0(GValue,1);
g_value_init (pbData,G_TYPE_UINT);
g_value_set_uint (pbData,1);
//array of struct
GPtrArray *pArrayValues = g_ptr_array_new();
GValueArray *pStructItem= g_value_array_new(2);
GValue *pbValue1 = g_try_new0(GValue,1);
GValue *pbValue2 = g_try_new0(GValue,1);
g_value_init (pbValue1,G_TYPE_BOOLEAN);
g_value_init (pbValue2,G_TYPE_BOOLEAN);
g_value_set_boolean (pbValue1,TRUE);
g_value_set_boolean (pbValue2,TRUE);
g_value_array_append (pStructItem,pbValue1);
g_value_array_append (pStructItem,pbValue2);
g_ptr_array_add(pArrayValues,pStructItem);
//Gvalue container for a GPtrArray
GValue *pContainer = g_try_new0(GValue,1);
//G_TYPE_POINTER or G_TYPE_VALUE or G_TYPE_VALUE_ARRAY
g_value_init (pContainer,G_TYPE_POINTER);
g_value_set_boxed (pContainer,pArrayValues);
On mar, 2008-04-08 at 15:31 -0400, Colin Walters wrote:
> In that code it looks like you're appending a boolean first, whereas
> it's expecting an unsigned int.
>
--
Un Saludo
Ivan Fernandez Calvo
More information about the dbus
mailing list