Using dbus_message_set_data() and dbus_message_get_data() in conjunction with dbus_connection_send_with_reply

Sahana Vadwa sahanavadwa at gmail.com
Fri Jul 24 06:45:18 PDT 2015


Hi All

I'm new to Dbus and I'm trying to send a particular payload data from my
application to dbus via dbus_message_set_data()with an intention to get the
same data upon calling dbus_message_get_data().

Here is what I do in my code -

   1. Create a new dbus method call using dbus_message_new_method_call()
   2. Allocate a data slot for the DbusMessage using
   dbus_message_allocate_data_slot()
   3. Set application payload using dbus_message_set_data()
   4. Send method call using dbus_connection_send_with_reply() *//this is a
   pending call for which I have a callback registered.*
   5. Upon receiving the response for the pending call, get the data set
   earlier using using dbus_message_get_data()

I have ensured that I'm properly setting the data (by calling
dbus_message_get_data() immediately after setting).
I have ensured that I'm using the same slot number as that allocated before
setting the data.

However I always seem to get data as 0 from dbus.

My query at this point is, is it correct of me to use the DbusMessage
received as response in the callback as an input while invoking
dbus_message_get_data()?

Any help would be greatly appreciated!

Regards
Sahana Vadwa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20150724/8baac27b/attachment.html>


More information about the dbus mailing list