![]() |
CopperSpice DBUS
1.7.4
|
The QDBusPendingCall class refers to one pending asynchronous call. More...
Public Methods | |
QDBusPendingCall (const QDBusPendingCall &other) | |
~QDBusPendingCall () | |
QDBusError | error () const |
bool | isError () const |
bool | isFinished () const |
bool | isValid () const |
QDBusPendingCall & | operator= (const QDBusPendingCall &other) |
QDBusPendingCall & | operator= (QDBusPendingCall &&other) noexcept |
QDBusMessage | reply () const |
void | swap (QDBusPendingCall &other) noexcept |
void | waitForFinished () |
Static Public Methods | |
static QDBusPendingCall | fromCompletedCall (const QDBusMessage &message) |
static QDBusPendingCall | fromError (const QDBusError &error) |
Friends | |
class | QDBusConnection |
class | QDBusPendingCallWatcher |
The QDBusPendingCall class refers to one pending asynchronous call. The object is a reference to a method call which was sent over D-Bus without waiting for a reply. QDBusPendingCall is an opaque type meant to be used as a handle for a pending reply. In most programs, the QDBusPendingCall class will not be used directly. It can be safely replaced with the template-based QDBusPendingReply, in order to access the contents of the reply or wait for it to be complete.
The QDBusPendingCallWatcher class allows one to connect to a signal that will indicate when the reply has arrived or if the call has timed out. It also provides the QDBusPendingCallWatcher::waitForFinished() method which will suspend the execution of the program until the reply has arrived.
QDBusPendingCall::QDBusPendingCall | ( | const QDBusPendingCall & | other | ) |
Creates a copy of the other pending asynchronous call. Note that both objects will refer to the same pending call.
QDBusPendingCall::~QDBusPendingCall | ( | ) |
Destroys this copy of the QDBusPendingCall object. If this copy is also the last copy of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.
QDBusError QDBusPendingCall::error | ( | ) | const |
Retrieves the error content of the reply message, if it has finished processing. If the reply message has not finished processing or if it contains a normal reply message (non-error), this function returns an invalid QDBusError.
|
static |
Creates a QDBusPendingCall object based on the message. The message must be of type QDBusMessage::ErrorMessage or QDBusMessage::ReplyMessage (that is, a message that is typical of a completed call). This method is useful for code that requires simulating a pending call, but that has already finished.
|
static |
Creates a QDBusPendingCall object based on the error condition error. The resulting pending call object will be in the "finished" state and QDBusPendingReply::isError() will return true.
bool QDBusPendingCall::isError | ( | ) | const |
Returns true if the reply contains an error message, false if it contains a normal method reply. If the pending call has not finished processing, this function also returns true.
bool QDBusPendingCall::isFinished | ( | ) | const |
Returns true if the pending call has finished processing and the reply has been received. If this function returns true, the isError(), error() and reply() methods should return valid information.
This method only changes state if you call waitForFinished() or if an external D-Bus event happens, which in general only happens if you return to the event loop execution.
bool QDBusPendingCall::isValid | ( | ) | const |
Returns true if the reply contains a normal reply message, false if it contains anything else. If the pending call has not finished processing, this method return false.
QDBusPendingCall & QDBusPendingCall::operator= | ( | const QDBusPendingCall & | other | ) |
Copy assigns from other and returns a reference to this object.
Drops the reference to the previously-referenced call. BROOM fix here and other places
Both objects will refer to the same pending call after this function. If this object contained the last reference of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.
|
inlinenoexcept |
Move assigns from other and returns a reference to this object.
QDBusMessage QDBusPendingCall::reply | ( | ) | const |
Retrieves the reply message received for the asynchronous call that was sent, if it has finished processing. If the pending call is not finished, this method returns a QDBusMessage of type QDBusMessage::InvalidMessage.
After it has finished processing, the message type will either be an error message or a normal method reply message.
|
inlinenoexcept |
Swaps other with this object. This operation is very fast and never fails.
void QDBusPendingCall::waitForFinished | ( | ) |
Suspends the execution of the calling thread until the reply is received and processed. After this method returns, isFinished() should return true, indicating the reply's contents are ready to be processed.