Qt 4.8
Public Types | Public Functions | Static Public Functions | Properties | Friends | List of all members
QDBusMessage Class Reference

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

#include <qdbusmessage.h>

Public Types

enum  MessageType {
  InvalidMessage, MethodCallMessage, ReplyMessage, ErrorMessage,
  SignalMessage
}
 The possible message types: More...
 

Public Functions

QList< QVariantarguments () const
 Returns the list of arguments that are going to be sent or were received from D-Bus. More...
 
bool autoStartService () const
 Returns the auto start flag, as set by setAutoStartService(). More...
 
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. More...
 
QDBusMessage createErrorReply (const QDBusError &err) const
 Constructs a new DBus message representing an error reply message, from the given error object. More...
 
QDBusMessage createErrorReply (QDBusError::ErrorType type, const QString &msg) const
 Constructs a new DBus reply message for the error type type using the message msg. More...
 
QDBusMessage createReply (const QList< QVariant > &arguments=QList< QVariant >()) const
 Constructs a new DBus message representing a reply, with the given arguments. More...
 
QDBusMessage createReply (const QVariant &argument) const
 Constructs a new DBus message representing a reply, with the given argument. More...
 
QString errorMessage () const
 Returns the human-readable message associated with the error that was received. More...
 
QString errorName () const
 Returns the name of the error that was received. More...
 
QString interface () const
 Returns the interface of the method being called (in the case of a method call) or of the signal being received from. More...
 
bool isDelayedReply () const
 Returns the delayed reply flag, as set by setDelayedReply(). More...
 
bool isReplyRequired () const
 Returns the flag that indicates if this message should see a reply or not. More...
 
QString member () const
 Returns the name of the signal that was emitted or the name of the method that was called. More...
 
QDBusMessageoperator<< (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. More...
 
QDBusMessageoperator= (const QDBusMessage &other)
 Copies the contents of the object given by other. More...
 
QString 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). More...
 
 QDBusMessage ()
 Constructs an empty, invalid QDBusMessage object. More...
 
 QDBusMessage (const QDBusMessage &other)
 Constructs a copy of the object given by other. More...
 
QString service () const
 Returns the name of the service or the bus address of the remote method call. More...
 
void setArguments (const QList< QVariant > &arguments)
 Sets the arguments that are going to be sent over D-Bus to arguments. More...
 
void setAutoStartService (bool enable)
 Sets the auto start flag to enable. More...
 
void 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). More...
 
QString signature () const
 Returns the signature of the signal that was received or for the output arguments of a method call. More...
 
MessageType type () const
 Returns the message type. More...
 
 ~QDBusMessage ()
 Disposes of the object and frees any resources that were being held. More...
 

Static Public Functions

static QDBusMessage createError (const QString &name, const QString &msg)
 Constructs a new DBus message representing an error, with the given name and msg. More...
 
static QDBusMessage createError (const QDBusError &err)
 Constructs a new DBus message representing the given error. More...
 
static QDBusMessage createError (QDBusError::ErrorType type, const QString &msg)
 Constructs a new DBus message for the error type type using the message msg. More...
 
static QDBusMessage createMethodCall (const QString &destination, const QString &path, const QString &interface, const QString &method)
 Constructs a new DBus message representing a method call. More...
 
static QDBusMessage createSignal (const QString &path, const QString &interface, const QString &name)
 Constructs a new DBus message with the given path, interface and name, representing a signal emission. More...
 

Properties

QDBusMessagePrivated_ptr
 

Friends

class QDBusMessagePrivate
 

Detailed Description

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

Attention
Module: QtDBus
Since
4.2

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

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

Definition at line 59 of file qdbusmessage.h.

Enumerations

◆ MessageType

The possible message types:

  • MethodCallMessage a message representing an outgoing or incoming method call
  • SignalMessage a message representing an outgoing or incoming signal emission
  • ReplyMessage a message representing the return values of a method call
  • ErrorMessage a message representing an error condition in response to a method call
  • InvalidMessage an invalid message: this is never set on messages received from D-Bus
Enumerator
InvalidMessage 
MethodCallMessage 
ReplyMessage 
ErrorMessage 
SignalMessage 

Definition at line 62 of file qdbusmessage.h.

Constructors and Destructors

◆ QDBusMessage() [1/2]

QDBusMessage::QDBusMessage ( )

Constructs an empty, invalid QDBusMessage object.

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

Definition at line 543 of file qdbusmessage.cpp.

544 {
546 }
friend class QDBusMessagePrivate
Definition: qdbusmessage.h:118
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ QDBusMessage() [2/2]

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.

Definition at line 555 of file qdbusmessage.cpp.

556 {
557  d_ptr = other.d_ptr;
558  d_ptr->ref.ref();
559 }
bool ref()
Atomically increments the value of this QAtomicInt.
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ ~QDBusMessage()

QDBusMessage::~QDBusMessage ( )

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

Definition at line 564 of file qdbusmessage.cpp.

565 {
566  if (!d_ptr->ref.deref())
567  delete d_ptr;
568 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
bool deref()
Atomically decrements the value of this QAtomicInt.

Functions

◆ arguments()

QList< QVariant > QDBusMessage::arguments ( ) const

◆ autoStartService()

bool QDBusMessage::autoStartService ( ) const

Returns the auto start flag, as set by setAutoStartService().

By default, this flag is true, which means QtDBus will auto start a service, if it is not running already.

See also
setAutoStartService()
Since
4.7

Definition at line 714 of file qdbusmessage.cpp.

715 {
716  return d_ptr->autoStartService;
717 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ createError() [1/3]

QDBusMessage QDBusMessage::createError ( const QString name,
const QString msg 
)
static

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

Definition at line 427 of file qdbusmessage.cpp.

Referenced by QDBusConnection::call(), QDBusAbstractInterface::callWithArgumentList(), QDBusPendingCallPrivate::checkReceivedSignature(), QScriptDBusMessageConstructor::createError(), createErrorReply(), QDBusPendingCall::fromError(), QDBusMessagePrivate::makeLocal(), QDBusPendingCall::operator=(), QDBusConnectionPrivate::sendWithReply(), QDBusConnectionPrivate::sendWithReplyAsync(), and QDBusConnectionPrivate::sendWithReplyLocal().

428 {
430  error.d_ptr->type = DBUS_MESSAGE_TYPE_ERROR;
431  error.d_ptr->name = name;
432  error.d_ptr->message = msg;
433 
434  return error;
435 }
#define error(msg)
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
const char * name
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59

◆ createError() [2/3]

QDBusMessage QDBusMessage::createError ( const QDBusError err)
inlinestatic

Constructs a new DBus message representing the given error.

Definition at line 80 of file qdbusmessage.h.

81  { return createError(err.name(), err.message()); }
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
QString name() const
Returns this error&#39;s name.
Definition: qdbuserror.cpp:335
QString message() const
Returns the message that the callee associated with this error.
Definition: qdbuserror.cpp:346

◆ createError() [3/3]

QDBusMessage QDBusMessage::createError ( QDBusError::ErrorType  type,
const QString msg 
)
inlinestatic

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

Returns the DBus message.

Definition at line 82 of file qdbusmessage.h.

83  { return createError(QDBusError::errorString(type), msg); }
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
MessageType type() const
Returns the message type.
static QString errorString(ErrorType error)
Returns the error name associated with error condition error.
Definition: qdbuserror.cpp:368

◆ createErrorReply() [1/3]

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.

Definition at line 486 of file qdbusmessage.cpp.

Referenced by QScriptDBusMessageConstructor::createErrorReply(), QDBusConnectionPrivate::deliverCall(), QDBusConnectionPrivate::handleObjectCall(), interfaceNotFoundError(), propertyNotFoundError(), propertyWriteReply(), and QDBusConnectionPrivate::sendError().

487 {
488  QDBusMessage reply = QDBusMessage::createError(name, msg);
489  if (d_ptr->msg)
490  reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
491  if (d_ptr->localMessage) {
492  reply.d_ptr->localMessage = true;
493  d_ptr->localReply = new QDBusMessage(reply); // keep an internal copy
494  }
495 
496  // the reply must have a msg or be a local-loop optimization
497  Q_ASSERT(reply.d_ptr->reply || reply.d_ptr->localMessage);
498  return reply;
499 }
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
DBusMessage * reply
QDBusMessage()
Constructs an empty, invalid QDBusMessage object.
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
DBusMessage * msg
QDBusMessage * localReply
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59

◆ createErrorReply() [2/3]

QDBusMessage QDBusMessage::createErrorReply ( const QDBusError err) const
inline

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

Definition at line 90 of file qdbusmessage.h.

91  { return createErrorReply(err.name(), err.message()); }
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...
QString name() const
Returns this error&#39;s name.
Definition: qdbuserror.cpp:335
QString message() const
Returns the message that the callee associated with this error.
Definition: qdbuserror.cpp:346

◆ createErrorReply() [3/3]

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.

Definition at line 530 of file qdbusmessage.cpp.

531 {
533  msg.d_ptr->parametersValidated = true;
534  return msg;
535 }
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...
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59
static QString errorString(ErrorType error)
Returns the error name associated with error condition error.
Definition: qdbuserror.cpp:368

◆ createMethodCall()

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().

Definition at line 410 of file qdbusmessage.cpp.

Referenced by QDBusAbstractInterface::asyncCallWithArgumentList(), QDBusAbstractInterface::callWithArgumentList(), QDBusAbstractInterface::callWithCallback(), QScriptDBusMessageConstructor::createMethodCall(), do_dbus_call(), QDBusConnectionPrivate::findMetaObject(), QDBusConnectionPrivate::getNameOwnerNoCache(), QDBusAbstractInterfacePrivate::property(), and QDBusAbstractInterfacePrivate::setProperty().

412 {
413  QDBusMessage message;
414  message.d_ptr->type = DBUS_MESSAGE_TYPE_METHOD_CALL;
415  message.d_ptr->service = service;
416  message.d_ptr->path = path;
417  message.d_ptr->interface = interface;
418  message.d_ptr->name = method;
419 
420  return message;
421 }
QString service() const
Returns the name of the service or the bus address of the remote method call.
QString path() const
Returns the path of the object that this message is being sent to (in the case of a method call) or b...
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
QString interface() const
Returns the interface of the method being called (in the case of a method call) or of the signal bein...
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59

◆ createReply() [1/2]

QDBusMessage QDBusMessage::createReply ( const QList< QVariant > &  arguments = QList<QVariant>()) const

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

Definition at line 465 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::activateInternalFilters(), QScriptDBusMessageConstructor::createReply(), QDBusConnectionPrivate::deliverCall(), propertyWriteReply(), qDBusPropertyGet(), and qDBusPropertyGetAll().

466 {
467  QDBusMessage reply;
468  reply.setArguments(arguments);
469  reply.d_ptr->type = DBUS_MESSAGE_TYPE_METHOD_RETURN;
470  if (d_ptr->msg)
471  reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
472  if (d_ptr->localMessage) {
473  reply.d_ptr->localMessage = true;
474  d_ptr->localReply = new QDBusMessage(reply); // keep an internal copy
475  }
476 
477  // the reply must have a msg or be a local-loop optimization
478  Q_ASSERT(reply.d_ptr->reply || reply.d_ptr->localMessage);
479  return reply;
480 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
DBusMessage * reply
QDBusMessage()
Constructs an empty, invalid QDBusMessage object.
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
DBusMessage * msg
QDBusMessage * localReply
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59
void setArguments(const QList< QVariant > &arguments)
Sets the arguments that are going to be sent over D-Bus to arguments.

◆ createReply() [2/2]

QDBusMessage QDBusMessage::createReply ( const QVariant argument) const
inline

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

Definition at line 86 of file qdbusmessage.h.

87  { return createReply(QList<QVariant>() << argument); }
QDBusMessage createReply(const QList< QVariant > &arguments=QList< QVariant >()) const
Constructs a new DBus message representing a reply, with the given arguments.

◆ createSignal()

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.

Definition at line 379 of file qdbusmessage.cpp.

Referenced by QScriptDBusMessageConstructor::createSignal(), and QDBusConnectionPrivate::relaySignal().

381 {
382  QDBusMessage message;
383  message.d_ptr->type = DBUS_MESSAGE_TYPE_SIGNAL;
384  message.d_ptr->path = path;
385  message.d_ptr->interface = interface;
386  message.d_ptr->name = name;
387 
388  return message;
389 }
QString path() const
Returns the path of the object that this message is being sent to (in the case of a method call) or b...
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
const char * name
QString interface() const
Returns the interface of the method being called (in the case of a method call) or of the signal bein...
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59

◆ errorMessage()

QString QDBusMessage::errorMessage ( ) const

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

Since
4.3

Definition at line 88 of file qdbusmessage.cpp.

Referenced by operator<<(), QDBusError::QDBusError(), and QOfonoPrimaryDataContextInterface::setProp().

89 {
90  if (d_ptr->type == ErrorMessage) {
91  if (!d_ptr->message.isEmpty())
92  return d_ptr->message;
94  return d_ptr->arguments.at(0).toString();
95  }
96  return QString();
97 }
QList< QVariant > arguments
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
if(void) toggleToolbarShown

◆ errorName()

QString QDBusMessage::errorName ( ) const

Returns the name of the error that was received.

Definition at line 622 of file qdbusmessage.cpp.

Referenced by operator<<(), and QDBusError::QDBusError().

623 {
624  if (d_ptr->type == ErrorMessage)
625  return d_ptr->name;
626  return QString();
627 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ interface()

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.

Definition at line 604 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::activateObject(), QDBusConnectionPrivate::handleSignal(), messageToScriptValue(), operator<<(), QDBusConnectionPrivate::send(), QDBusConnectionPrivate::sendError(), QDBusConnectionPrivate::sendWithReply(), and QDBusConnectionPrivate::sendWithReplyAsync().

605 {
606  return d_ptr->interface;
607 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ isDelayedReply()

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.

Definition at line 675 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::deliverCall(), QDBusContext::isDelayedReply(), and messageToScriptValue().

676 {
677  return d_ptr->delayedReply;
678 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ isReplyRequired()

bool QDBusMessage::isReplyRequired ( ) const

Returns the flag that indicates if this message should see a reply or not.

This is only meaningful for MethodCallMessage{method call messages}: any other kind of message cannot have replies and this function will always return false for them.

Definition at line 644 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::deliverCall(), and messageToScriptValue().

645 {
646  if (!d_ptr->msg)
647  return d_ptr->localMessage; // if it's a local message, reply is required
648  return !q_dbus_message_get_no_reply(d_ptr->msg);
649 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
DBusMessage * msg

◆ member()

QString QDBusMessage::member ( ) const

◆ operator<<()

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.

Definition at line 745 of file qdbusmessage.cpp.

746 {
747  // FIXME: should we detach?
748  d_ptr->arguments.append(arg);
749  return *this;
750 }
QList< QVariant > arguments
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ operator=()

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.

Definition at line 577 of file qdbusmessage.cpp.

578 {
579  qAtomicAssign(d_ptr, other.d_ptr);
580  return *this;
581 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119
void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
Definition: qatomic.h:195

◆ path()

QString QDBusMessage::path ( ) const

◆ service()

QString QDBusMessage::service ( ) const

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

Definition at line 586 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::handleSignal(), messageToScriptValue(), operator<<(), QDBusConnectionPrivate::send(), QDBusConnectionPrivate::sendWithReply(), and QDBusConnectionPrivate::sendWithReplyAsync().

587 {
588  return d_ptr->service;
589 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ setArguments()

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()

Definition at line 725 of file qdbusmessage.cpp.

Referenced by QDBusAbstractInterface::asyncCallWithArgumentList(), QDBusAbstractInterface::callWithArgumentList(), QDBusAbstractInterface::callWithCallback(), createReply(), do_dbus_call(), QDBusConnectionInterface::registerService(), QDBusConnectionPrivate::relaySignal(), scriptValueToMessage(), and QDBusConnectionInterface::unregisterService().

726 {
727  // FIXME: should we detach?
729 }
QList< QVariant > arguments
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ setAutoStartService()

void QDBusMessage::setAutoStartService ( bool  enable)

Sets the auto start flag to enable.

This flag only makes sense for method call messages, where it tells the D-Bus server to either auto start the service responsible for the service name, or not to auto start it.

By default this flag is true, i.e. a service is autostarted. This means:

When the service that this method call is sent to is already running, the method call is sent to it. If the service is not running yet, the D-Bus daemon is requested to autostart the service that is assigned to this service name. This is handled by .service files that are placed in a directory known to the D-Bus server. These files then each contain a service name and the path to a program that should be executed when this service name is requested.

Since
4.7

Definition at line 700 of file qdbusmessage.cpp.

701 {
702  d_ptr->autoStartService = enable;
703 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ setDelayedReply()

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
{Delayed Replies}

Definition at line 665 of file qdbusmessage.cpp.

Referenced by scriptValueToMessage(), and QDBusContext::setDelayedReply().

666 {
667  d_ptr->delayedReply = enable;
668 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ signature()

QString QDBusMessage::signature ( ) const

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

Definition at line 633 of file qdbusmessage.cpp.

Referenced by QDBusConnectionPrivate::activateCall(), QDBusConnectionPrivate::activateInternalFilters(), QDBusConnectionPrivate::findMetaObject(), QDBusConnectionPrivate::handleSignal(), messageToScriptValue(), operator<<(), QDBusConnectionPrivate::sendError(), and QDBusConnectionPrivate::sendWithReplyLocal().

634 {
635  return d_ptr->signature;
636 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

◆ type()

QDBusMessage::MessageType QDBusMessage::type ( ) const

Returns the message type.

Definition at line 755 of file qdbusmessage.cpp.

Referenced by QDBusPendingCallWatcherHelper::emitSignals(), QDBusConnectionPrivate::findMetaObject(), QDBusPendingCall::fromCompletedCall(), QDBusConnectionPrivate::getNameOwnerNoCache(), QDBusConnectionPrivate::handleMessage(), messageToScriptValue(), QDBusInterfacePrivate::metacall(), operator<<(), QDBusPendingCall::operator=(), QDBusError::QDBusError(), QDBusPendingCallWatcher::QDBusPendingCallWatcher(), QDBusConnectionInterface::registerService(), QDBusConnectionPrivate::send(), QDBusConnectionPrivate::sendWithReply(), QDBusConnectionPrivate::sendWithReplyLocal(), QOfonoPrimaryDataContextInterface::setProp(), and QDBusConnectionInterface::unregisterService().

756 {
757  switch (d_ptr->type) {
758  case DBUS_MESSAGE_TYPE_METHOD_CALL:
759  return MethodCallMessage;
760  case DBUS_MESSAGE_TYPE_METHOD_RETURN:
761  return ReplyMessage;
762  case DBUS_MESSAGE_TYPE_ERROR:
763  return ErrorMessage;
764  case DBUS_MESSAGE_TYPE_SIGNAL:
765  return SignalMessage;
766  default:
767  break;
768  }
769  return InvalidMessage;
770 }
QDBusMessagePrivate * d_ptr
Definition: qdbusmessage.h:119

Friends and Related Functions

◆ QDBusMessagePrivate

friend class QDBusMessagePrivate
friend

Definition at line 118 of file qdbusmessage.h.

Properties

◆ d_ptr

QDBusMessagePrivate* QDBusMessage::d_ptr
private

The documentation for this class was generated from the following files: