Problems with dbus_connection_borrow_message

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Feb 24 04:40:29 PST 2015


Before getting into specifics, did you see the bit in the documentation 
that points out that libdbus is a low-level library and is painful to 
use? You would probably be better off with GDBus (part of GLib) or 
QtDBus (part of Qt), which interoperate with libdbus and are a lot 
easier: in particular, they integrate nicely with the main-loop 
conventions of their respective frameworks.

On 24/02/15 11:54, itchy_2390 wrote:
>    DBusMessage *pMsg = dbus_connection_pop_message(Conn);
...
>    pMsg = dbus_connection_borrow_message(Conn);

These are low-level functions that you probably shouldn't be using, even 
if you are using libdbus. The usual way to receive signals via libdbus 
is to add a "filter function", then "dispatch" the connection by either 
hooking it up to a main loop or calling 
dbus_connection_read_write_dispatch().

>        if (dbus_message_is_signal(pMsg, iface, signal_name))
...
> But now I never get signals.
> What Am I doing wrong?

Are you using the right interface name?

Are you using the right signal name?

Did you ask to receive the signals you wanted, by adding a match rule?

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>



More information about the dbus mailing list