Struct in signal

Naveen Verma ernaveenverma at gmail.com
Fri Feb 27 06:57:06 PST 2009


Hi,

Hi,
>  I can send a struct through a signal with the help of some members of
> the list, now i have another question, how can i get this struct when
> reveice get this signal?


-- Well its a bit complicated with the low level apis, I mean you need to
attach a iterator with the message, and then recurse through the arguments
to get the value.i.e if in the message you have a struct of string and int
as s(su) then i will be like:
 dbus_message_iter_init(message, &iter);
 dbus_message_iter_recurse(&iter, &iter1); /* To go inside the struct */
 while (dbus_message_iter_get_arg_type(&iter1) != DBUS_TYPE_INVALID) {
   dbus_message_iter_get_basic(iter, &value);
   dbus_message_iter_next(iter);
}

-- Hope this will give you some idea..

-Br
Naveen



>
> Brenno
>
> Em Qua, 2009-02-18 às 19:21 -0500, Havoc Pennington escreveu:
> > Hi,
> >
> > On Wed, Feb 18, 2009 at 1:08 PM, Brenno Freire <brenno.freire at fucapi.br>
> wrote:
> > > Got the following error. " arguments to
> dbus_message_iter_append_basic()
> > > were incorrect, assertion "dbus_type_is_basic (type)" failed in file
> > > dbus-message.c line 2241.
> > > This is normally a bug in some application using the D-Bus library.
> > >  D-Bus not built with -rdynamic so unable to print a backtrace
> > > "
> > > You could guide me?
> >
> > There is a bug in your application which is that DBUS_TYPE_STRUCT is
> > not dbus_type_is_basic().
> > The documentation for dbus_message_iter_append_basic() should explain.
> > You need to use dbus_message_iter_open_container() to open the struct
> > then append each struct field individually.
> >
> > Havoc
> >
> > !DSPAM:499ca621106241690948120!
> >
> >
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090227/e19b4db5/attachment.htm 


More information about the dbus mailing list