QtBase
v6.3.1
|
The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the Qt D-Bus binding, allowing access to remote interfaces. More...
#include <qdbusabstractinterface.h>
The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the Qt D-Bus binding, allowing access to remote interfaces.
\inmodule QtDBus
Generated-code classes also derive from QDBusAbstractInterface, all methods described here are also valid for generated-code classes. In addition to those described here, generated-code classes provide member functions for the remote methods, which allow for compile-time checking of the correct parameters and return values, as well as property type-matching and signal parameter-matching.
Definition at line 78 of file qdbusabstractinterface.h.
|
virtual |
Releases this object's resources.
Definition at line 349 of file qdbusabstractinterface.cpp.
|
protected |
Definition at line 336 of file qdbusabstractinterface.cpp.
|
protected |
Definition at line 325 of file qdbusabstractinterface.cpp.
Definition at line 137 of file qdbusabstractinterface.h.
|
inline |
Calls the method method on this interface and passes args to the method. All args must be convertible to QVariant.
The parameters to call
are passed on to the remote function via D-Bus as input arguments. The returned QDBusPendingCall object can be used to find out information about the reply.
It can be used the following way:
This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to "ProcessWorkUnicode"
will contain one Unicode string, the second call to "ProcessWork"
will contain one string and one byte array).
Definition at line 143 of file qdbusabstractinterface.h.
QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList | ( | const QString & | method, |
const QList< QVariant > & | args | ||
) |
Normally, you should place calls using asyncCall().
\threadsafe
Definition at line 516 of file qdbusabstractinterface.cpp.
Definition at line 102 of file qdbusabstractinterface.h.
|
inline |
Calls the method method on this interface and passes args to the method. All args must be convertible to QVariant.
The parameters to call
are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in the QDBusMessage reply. If the reply is an error reply, lastError() will also be set to the contents of the error message.
It can be used the following way:
This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to "ProcessWorkUnicode"
will contain one Unicode string, the second call to "ProcessWork"
will contain one string and one byte array).
Definition at line 108 of file qdbusabstractinterface.h.
|
inline |
Definition at line 114 of file qdbusabstractinterface.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Calls the method method on this interface and passes args to the method. All args must be convertible to QVariant.
If mode is NoWaitForReply
, then this function will return immediately after placing the call, without waiting for a reply from the remote method. Otherwise, mode indicates whether this function should activate the Qt Event Loop while waiting for the reply to arrive.
If this function reenters the Qt event loop in order to wait for the reply, it will exclude user input. During the wait, it may deliver signals and other method calls to your application. Therefore, it must be prepared to handle a reentrancy whenever a call is placed with call().
Definition at line 120 of file qdbusabstractinterface.h.
QDBusMessage QDBusAbstractInterface::callWithArgumentList | ( | QDBus::CallMode | mode, |
const QString & | method, | ||
const QList< QVariant > & | args | ||
) |
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns the message that was received as a reply, which can be a normal QDBusMessage::ReplyMessage (indicating success) or QDBusMessage::ErrorMessage (if the call failed). The mode parameter specifies how this call should be placed.
If the call succeeds, lastError() will be cleared; otherwise, it will contain the error this call produced.
Normally, you should place calls using call().
UseEventLoop
, your code must be prepared to deal with any reentrancy: other method calls and signals may be delivered before this function returns, as well as other Qt queued signals and events.\threadsafe
Definition at line 452 of file qdbusabstractinterface.cpp.
bool QDBusAbstractInterface::callWithCallback | ( | const QString & | method, |
const QList< QVariant > & | args, | ||
QObject * | receiver, | ||
const char * | slot | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This function is deprecated. Please use the overloaded version.
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns immediately after queueing the call. The reply from the remote function or any errors emitted by it are delivered to the slot slot on object receiver.
This function returns true
if the queueing succeeded: it does not indicate that the call succeeded. If it failed, the slot will be called with an error message. lastError() will not be set under those circumstances.
Definition at line 595 of file qdbusabstractinterface.cpp.
bool QDBusAbstractInterface::callWithCallback | ( | const QString & | method, |
const QList< QVariant > & | args, | ||
QObject * | receiver, | ||
const char * | returnMethod, | ||
const char * | errorMethod | ||
) |
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to the returnMethod on object receiver. If an error occurs, the errorMethod on object receiver is called instead.
This function returns true
if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, the errorMethod is called. If the queueing failed, this function returns false
and no slot will be called.
The returnMethod must have as its parameters the types returned by the function call. Optionally, it may have a QDBusMessage parameter as its last or only parameter. The errorMethod must have a QDBusError as its only parameter.
Definition at line 551 of file qdbusabstractinterface.cpp.
QDBusConnection QDBusAbstractInterface::connection | ( | ) | const |
Returns the connection this interface is associated with.
Definition at line 375 of file qdbusabstractinterface.cpp.
|
overrideprotectedvirtual |
This virtual function is called when something has been connected to signal in this object.
If you want to compare signal with a specific signal, you can use QMetaMethod::fromSignal() as follows:
Reimplemented from QObject.
Reimplemented in QDBusConnectionInterface.
Definition at line 607 of file qdbusabstractinterface.cpp.
|
overrideprotectedvirtual |
This virtual function is called when something has been disconnected from signal in this object.
See connectNotify() for an example of how to compare signal with a specific signal.
If all signals were disconnected from this object (e.g., the signal argument to disconnect() was \nullptr), disconnectNotify() is only called once, and the signal will be an invalid QMetaMethod (QMetaMethod::isValid() returns false
).
Reimplemented from QObject.
Reimplemented in QDBusConnectionInterface.
Definition at line 630 of file qdbusabstractinterface.cpp.
QString QDBusAbstractInterface::interface | ( | ) | const |
Returns the name of this interface.
Definition at line 399 of file qdbusabstractinterface.cpp.
|
protected |
Definition at line 782 of file qdbusabstractinterface.cpp.
Definition at line 676 of file qdbusabstractinterface.cpp.
|
protected |
Definition at line 688 of file qdbusabstractinterface.cpp.
bool QDBusAbstractInterface::isValid | ( | ) | const |
Returns true
if this is a valid reference to a remote object. It returns false
if there was an error during the creation of this interface (for instance, if the remote application does not exist).
Note: when dealing with remote objects, it is not always possible to determine if it exists when creating a QDBusInterface.
Definition at line 361 of file qdbusabstractinterface.cpp.
QDBusError QDBusAbstractInterface::lastError | ( | ) | const |
Returns the error the last operation produced, or an invalid error if the last operation did not produce an error.
Definition at line 408 of file qdbusabstractinterface.cpp.
QString QDBusAbstractInterface::path | ( | ) | const |
Returns the object path that this interface is associated with.
Definition at line 391 of file qdbusabstractinterface.cpp.
QString QDBusAbstractInterface::service | ( | ) | const |
Returns the name of the service this interface is associated with.
Definition at line 383 of file qdbusabstractinterface.cpp.
void QDBusAbstractInterface::setTimeout | ( | int | timeout | ) |
Sets the timeout in milliseconds for all future DBus calls to timeout. -1 means the default DBus timeout (usually 25 seconds).
Definition at line 419 of file qdbusabstractinterface.cpp.
int QDBusAbstractInterface::timeout | ( | ) | const |
Returns the current value of the timeout in milliseconds. -1 means the default DBus timeout (usually 25 seconds).
Definition at line 430 of file qdbusabstractinterface.cpp.