Question

When exposing some code to D-Bus using Qt D-Bus bindings, when should one use a Qt Adaptor over a Qt Interface? I'm having a difficult time understanding how exactly they differ since it seems like they provide the same functionality.

Was it helpful?

Solution

Per http://doc.trolltech.com/4.3/qdbusabstractinterface.html, "QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding", while, per http://doc.trolltech.com/4.3/qdbusabstractadaptor.html, "QDBusAbstractAdaptor class is the starting point for all objects intending to provide interfaces to the external world using D-Bus". So, the former is used in the interface itself, the latter is used to provide the interface, i.e., for "exposing some code to D-Bus" you'd write a class inheriting the adaptor and "define the D-Bus interface it is implementing using the Q_CLASSINFO macro in the class definition" (also a quote from the second of the above URLs).

OTHER TIPS

The consumer is to use the QDBusAbstractInterface, while the producer is to use QDBusAbstractAdaptor. That is, the adaptor (producer) implements some methods, exposes some properties, and sends some signals, while the consumer calls/receives these things.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top