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

DBusMessage * QDBusMessage::toDBusMessage (  )  const

Creates a raw DBus message from this Qt3-bindings message.

Marshalls data contained in the message's value list into DBus data format and creates a low level API DBus message for it.

Note:
ownership of the returned message is transferred to the caller, i.e. it has to be deleted using dbus_message_unref()
Returns:
a C API DBus message or 0 if this is an InvalidMessage or marshalling failed

Definition at line 128 of file qdbusmessage.cpp.

Referenced by QDBusConnection::send(), and QDBusConnection::sendWithReply().

{
    DBusMessage *msg = 0;
    switch (d->type) {
    case DBUS_MESSAGE_TYPE_METHOD_CALL:
        msg = dbus_message_new_method_call(d->service.utf8().data(),
                d->path.utf8().data(), d->interface.utf8().data(),
                d->member.utf8().data());
        break;
    case DBUS_MESSAGE_TYPE_SIGNAL:
        msg = dbus_message_new_signal(d->path.utf8().data(),
                d->interface.utf8().data(), d->member.utf8().data());
        break;
    case DBUS_MESSAGE_TYPE_METHOD_RETURN:
        msg = dbus_message_new_method_return(d->reply);
        break;
    case DBUS_MESSAGE_TYPE_ERROR:
        msg = dbus_message_new_error(d->reply, d->error.name().utf8().data(),
                d->error.message().utf8().data());
        break;
    }
    if (!msg)
        return 0;

    QDBusMarshall::listToMessage(*this, msg);
    return msg;
}


Generated by  Doxygen 1.6.0   Back to index