Logo Search packages:      
Sourcecode: kdbus version File versions  Download package

QDBusMessage QDBusConnection::sendWithReply ( const QDBusMessage message,
QDBusError error = 0 
) const

Sends a message over the bus and waits for the reply.

Sends a message composed through the QDBusMessage API to the bus. It then blocks and waits until the associated reply is received. Any message received in between is stored and can be processed by calling dispatch() or scheduleDispatch()

Note:
for doing method calls it is more convenient to use QDBusProxy, see QDBusProxy::sendWithReply()
Parameters:
message the message to send
error an optional parameter to directly get any error that might occur during processing of the call
Returns:
a message containing either the call's reply or an invalid message in case the call failed
See also:
lastError()

Definition at line 263 of file qdbusconnection.cpp.

References QDBusMessage::fromDBusMessage(), and QDBusMessage::toDBusMessage().

{
    if (!d || !d->connection)
        return QDBusMessage::fromDBusMessage(0);

    DBusMessage *msg = message.toDBusMessage();
    if (!msg)
        return QDBusMessage::fromDBusMessage(0);
    DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg,
                                                -1, &d->error);
    if (d->handleError() && error)
        *error = d->lastError;

    dbus_message_unref(msg);

    return QDBusMessage::fromDBusMessage(reply);
}


Generated by  Doxygen 1.6.0   Back to index