Qt:Документация 4.3.2/qdbusmessage

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QDBusMessage Class Reference
[ QtDBus module]

The QDBusMessage class represents one message sent or received over the D-Bus bus. Далее...

 #include <QDBusMessage>

Класс был добавлен в Qt 4.2.

[править] Открытые типы

  • enum MessageType { MethodCallMessage, SignalMessage, ReplyMessage, ErrorMessage, InvalidMessage }

[править] Открытые функции

[править] Статические открытые члены

  • QDBusMessage createError ( const QString & name, const QString & msg )
  • QDBusMessage createError ( const QDBusError & error )
  • QDBusMessage createError ( QDBusError::ErrorType type, const QString & msg )
  • QDBusMessage createMethodCall ( const QString & service, const QString & path, const QString & interface, const QString & method )
  • QDBusMessage createSignal ( const QString & path, const QString & interface, const QString & name )

[править] Подробное описание

The QDBusMessage class represents one message sent or received over the D-Bus bus.

This object can represent any of the four different types of messages ( MessageType) that can occur on the bus:

  • Method calls
  • Method return values
  • Signal emissions
  • Error codes

Objects of this type are created with the static createError(), createMethodCall() and createSignal() functions. Use the QDBusConnection::send() function to send the messages.


[править] Описание типов

[править]
enum QDBusMessage::MessageType

The possible message types:


Константа Значение Описание
QDBusMessage::MethodCallMessage 1 a message representing an outgoing or incoming method call
QDBusMessage::SignalMessage 4 a message representing an outgoing or incoming signal emission
QDBusMessage::ReplyMessage 2 a message representing the return values of a method call
QDBusMessage::ErrorMessage 3 a message representing an error condition in response to a method call
QDBusMessage::InvalidMessage 0 an invalid message: this is never set on messages received from D-Bus

[править] Описание функций-членов

[править]
QDBusMessage::QDBusMessage ()

Constructs an empty, invalid QDBusMessage object.

See also createError(), createMethodCall(), and createSignal().

[править]
QDBusMessage::QDBusMessage ( const QDBusMessage & other )

Constructs a copy of the object given by other.

Note: QDBusMessage objects are shared. Modifications made to the copy will affect the original one as well. See setDelayedReply() for more information.

[править]
QDBusMessage::~QDBusMessage ()

Disposes of the object and frees any resources that were being held.

[править]
QList< QVariant> QDBusMessage::arguments () const

Returns the list of arguments that are going to be sent or were received from D-Bus.

See also setArguments().

[править]
QDBusMessage QDBusMessage::createError ( const QString & name, const QString & msg ) [static]

Constructs a new DBus message representing an error, with the given name and msg.

[править]
QDBusMessage QDBusMessage::createError ( const QDBusError & error ) [static]

Эта перегруженная функция предоставлена для удобства.

Constructs a new DBus message representing the given error.

[править]
QDBusMessage QDBusMessage::createError ( QDBusError::ErrorType type, const QString & msg ) [static]

Эта перегруженная функция предоставлена для удобства.

Constructs a new DBus message for the error type type using the message msg. Returns the DBus message.

[править]
QDBusMessage QDBusMessage::createErrorReply ( const QString name, const QString & msg ) const

Constructs a new DBus message representing an error reply message, with the given name and msg.

[править]
QDBusMessage QDBusMessage::createErrorReply ( const QDBusError & error ) const

Эта перегруженная функция предоставлена для удобства.

Constructs a new DBus message representing an error reply message, from the given error object.

[править]
QDBusMessage QDBusMessage::createErrorReply ( QDBusError::ErrorType type, const QString & msg ) const

Эта перегруженная функция предоставлена для удобства.

Constructs a new DBus reply message for the error type type using the message msg. Returns the DBus message.

[править]
QDBusMessage QDBusMessage::createMethodCall ( const QString & service, const QString & path, const QString & interface, const QString & method ) [static]

Constructs a new DBus message representing a method call. A method call always informs its destination address (service, path, interface and method).

The DBus bus allows calling a method on a given remote object without specifying the destination interface, if the method name is unique. However, if two interfaces on the remote object export the same method name, the result is undefined (one of the two may be called or an error may be returned).

When using DBus in a peer-to-peer context (i.e., not on a bus), the service parameter is optional.

The QDBusObject and QDBusInterface classes provide a simpler abstraction to synchronous method calling.

This function returns a QDBusMessage object that can be sent with QDBusConnection::call().

[править]
QDBusMessage QDBusMessage::createReply ( const QList< QVariant> & arguments = QList<QVariant> () ) const

Constructs a new DBus message representing a reply, with the given arguments.

[править]
QDBusMessage QDBusMessage::createReply ( const QVariant & argument ) const

Эта перегруженная функция предоставлена для удобства.

Constructs a new DBus message representing a reply, with the given argument.

[править]
QDBusMessage QDBusMessage::createSignal ( const QString & path, const QString & interface, const QString & name ) [static]

Constructs a new DBus message with the given path, interface and name, representing a signal emission.

A DBus signal is emitted from one application and is received by all applications that are listening for that signal from that interface.

The QDBusMessage object that is returned can be sent using the QDBusConnection::send() function.

[править]
QString QDBusMessage::errorMessage () const

Returns the human-readable message associated with the error that was received.

Эта функция была введена в Qt 4.3.

[править]
QString QDBusMessage::errorName () const

Returns the name of the error that was received.

[править]
QString QDBusMessage::interface () const

Returns the interface of the method being called (in the case of a method call) or of the signal being received from.

[править]
bool QDBusMessage::isDelayedReply () const

Returns the delayed reply flag, as set by setDelayedReply(). By default, this flag is false, which means QtDBus will generate automatic replies when necessary.

[править]
bool QDBusMessage::isReplyRequired () const

Returns the flag that indicates if this message should see a reply or not. This is only meaningful for method call messages: any other kind of message cannot have replies and this function will always return false for them.

[править]
QString QDBusMessage::member () const

Returns the name of the signal that was emitted or the name of the method that was called.

[править]
QString QDBusMessage::path () const

Returns the path of the object that this message is being sent to (in the case of a method call) or being received from (for a signal).

[править]
QString QDBusMessage::service () const

Returns the name of the service or the bus address of the remote method call.

[править]
void QDBusMessage::setArguments ( const QList< QVariant> & arguments )

Sets the arguments that are going to be sent over D-Bus to arguments. Those will be the arguments to a method call or the parameters in the signal.

See also arguments().

[править]
void QDBusMessage::setDelayedReply ( bool enable ) const

Sets whether the message will be replied later (if enable is true) or if an automatic reply should be generated by QtDBus (if enable is false).

In D-Bus, all method calls must generate a reply to the caller, unless the caller explicitly indicates otherwise (see isReplyRequired()). QtDBus automatically generates such replies for any slots being called, but it also allows slots to indicate whether they will take responsibility of sending the reply at a later time, after the function has finished processing.

See also isDelayedReply() and Delayed Replies.

[править]
QString QDBusMessage::signature () const

Returns the signature of the signal that was received or for the output arguments of a method call.

[править]
MessageType QDBusMessage::type () const

Returns the message type.

[править]
QDBusMessage & QDBusMessage::operator<< ( const QVariant & arg )

Appends the argument arg to the list of arguments to be sent over D-Bus in a method call or signal emission.

[править]
QDBusMessage & QDBusMessage::operator= ( const QDBusMessage & other )

Copies the contents of the object given by other.

Note: QDBusMessage objects are shared. Modifications made to the copy will affect the original one as well. See setDelayedReply() for more information.



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2