SimpleBLE
SimpleDBus

Architecture

How SimpleDBus models D-Bus interfaces and proxies in C++, including property storage and the automatic handling of org.freedesktop.DBus.Properties.

The following notes provide an overview of the architecture of some of the higher-level classes in the library, as to facilitate their understanding.

Interface

  • In order to simplify the routing of messages, all interfaces are assumed to have properties, thus skipping the need to have a special implementation of org.freedesktop.DBus.Properties.
  • All properties are stored in the holder in which they came from. This is not the most efficient way of handling properties, but it is the one that minimizes the necessary code for children of the Interface class.

Proxy

  • Messages for org.freedesktop.DBus.Properties are automatically handled by the Proxy class.
  • Proxy::valid() tracks whether the proxy's object path is currently present in the D-Bus object tree. When all interfaces of an object path are removed, the corresponding proxy and all retained descendant proxies are marked invalid. Removing only some of its interfaces leaves it valid. If the path is later added again, the same retained proxy can become valid again.
  • Interfaces a proxy declares in on_registration() count as present until the bus removes them, so a proxy only declares interfaces that its remote object always exports.
  • A retained Proxy object should not be treated as proof that the remote D-Bus object still exists. Callers that keep proxy references across InterfacesRemoved events should check valid() before issuing methods or refreshing state.

On this page