![]() |
CopperSpice DBUS
1.7.4
|
Proxy for interfaces on remote objects. More...
Public Methods | |
QDBusInterface (const QString &serviceName, const QString &path, const QString &interfaceId=QString (), const QDBusConnection &connection=QDBusConnection::sessionBus (), QObject *parent=nullptr) | |
~QDBusInterface () | |
![]() | |
virtual | ~QDBusAbstractInterface () |
QDBusPendingCall | asyncCall (const QString &method, const QVariant &arg1=QVariant (), const QVariant &arg2=QVariant (), const QVariant &arg3=QVariant (), const QVariant &arg4=QVariant (), const QVariant &arg5=QVariant (), const QVariant &arg6=QVariant (), const QVariant &arg7=QVariant (), const QVariant &arg8=QVariant ()) |
Friends | |
class | QDBusConnection |
The QDBusInterface class is a proxy for interfaces on remote objects. QDBusInterface is a generic accessor class that is used to place calls to remote objects, connect to signals exported by remote objects and get/set the value of remote properties. This class is useful for dynamic access to remote objects: that is, when you do not have a generated code that represents the remote interface.
Calls are usually placed by using the call() function, which constructs the message, sends it over the bus, waits for the reply and decodes the reply. Signals are connected to by using the normal QObject::connect() function. Finally, properties are accessed using the QObject::property() and QObject::setProperty() functions.
The following code snippet demonstrates how to perform a mathematical operation of "2 + 2" in a remote application called "com.example.Calculator", accessed via the session bus.
QDBusInterface::QDBusInterface | ( | const QString & | serviceName, |
const QString & | path, | ||
const QString & | interfaceId = QString() , |
||
const QDBusConnection & | connection = QDBusConnection::sessionBus() , |
||
QObject * | parent = nullptr |
||
) |
Creates a dynamic QDBusInterface object associated with the interfaceId on the object at the given path on the serviceName, using the given connection. If interfaceId is an empty string the object created will refer to the merging of all interfaces found in that object. THe parent is passed to the base class constructor.
If the remote service is not present or if an error occurs trying to obtain the description of the remote interface interface, the object created will not be valid.
QDBusInterface::~QDBusInterface | ( | ) |
Destroy the object interface and frees up any resource used.