dbus message not received at client from server

Simon McVittie smcv at collabora.com
Tue Nov 21 17:45:43 UTC 2017


On Tue, 21 Nov 2017 at 12:49:06 +0000, Anitha Chandrasekar wrote:
> We are working on BLE devices using bluez stack. These are list of steps which
> are happening,
> 1) The dbus_connection_set_dispatch_status_function is used to register a
> function, to display the status.
> 2) We see that during one of our operation (i.e read), we see that the message
> sent from server(verified via dbus-monitor --system) but not dispatched to
> client.

You appear to be using libdbus, the low-level reference implementation
of the D-Bus protocol. The front page of the libdbus API documentation says:

    This manual documents the *low-level* D-Bus C API. **If you use this
    low-level API directly, you're signing up for some pain.**

libdbus is designed to be used by the reference dbus-daemon and by
language bindings. The unusual requirements imposed by those uses make
it rather unpleasant to use for application code. I would strongly
recommend considering alternatives. The popular and maintained ones for
C-based languages are:

* GDBus, part of the Gio library in GLib
  <https://developer.gnome.org/gio/stable/gdbus-convenience.html>
  <https://developer.gnome.org/gio/stable/gdbus-lowlevel.html>
  (Thread-safe, GObject/C, full reimplementation)

* QtDBus, part of Qt
  <https://doc.qt.io/qt-5/qtdbus-index.html>
  (Believed to be thread-safe, Qt/C++, wrapper around libdbus)

* sd-bus, part of systemd
  <http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html>
  (Not thread-safe, C, full reimplementation)

If you have to use libdbus and you are not able to switch to something
more user-friendly, I would recommend connecting it to an event
loop implementation like the ones in GLib, Qt, libsystemd or libevent,
preferably using code maintained by someone who is familiar with the
requirements of both that event loop implementation and libdbus.
<https://sources.debian.net/src/pyqt5/5.7%2Bdfsg-5/dbus/dbus.cpp/> and
<https://sources.debian.net/src/avahi/0.6.32-2/avahi-common/simple-watch.c/>
are examples of what this would typically look like.

Regards,
    smcv


More information about the dbus mailing list