The QDBusMessage class represents one message sent or received over the D-Bus bus.
More...
|
static QDBusMessage | createError (const QDBusError &error) |
|
static QDBusMessage | createError (const QString &name, const QString &msg) |
|
static QDBusMessage | createError (QDBusError::ErrorType type, const QString &msg) |
|
static QDBusMessage | createMethodCall (const QString &serviceName, const QString &path, const QString &interfaceId, const QString &method) |
|
static QDBusMessage | createSignal (const QString &path, const QString &interfaceId, const QString &name) |
|
static QDBusMessage | createTargetedSignal (const QString &serviceName, const QString &path, const QString &interfaceId, 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.
- See also
- createError(), createMethodCall(), createSignal()
Constant | Value | Description |
QDBusMessage::MethodCallMessage | 1 | Message representing an outgoing or incoming method call |
QDBusMessage::SignalMessage | 4 | Message representing an outgoing or incoming signal emission |
QDBusMessage::ReplyMessage | 2 | Message representing the return values of a method call |
QDBusMessage::ErrorMessage | 3 | 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 |
( |
| ) |
|
QDBusMessage::QDBusMessage |
( |
const QDBusMessage & |
other | ) |
|
Copy constructs a new QDBusMessage: from other. Since QDBusMessage objects are shared modifications made to the copy will affect the original one as well.
- See also
- setDelayedReply()
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()
bool QDBusMessage::autoStartService |
( |
| ) |
const |
QDBusMessage QDBusMessage::createError |
( |
const QDBusError & |
error | ) |
|
|
inlinestatic |
Constructs a new QDBusMessage representing the given error.
QDBusMessage QDBusMessage::createError |
( |
const QString & |
name, |
|
|
const QString & |
msg |
|
) |
| |
|
static |
Constructs a new QDBusMessage representing an error, with the given name and msg.
Constructs a new QDBusMessage for the error type using the message msg. Returns the new QDBusMessage object.
QDBusMessage QDBusMessage::createErrorReply |
( |
const QDBusError & |
error | ) |
const |
|
inline |
Constructs a new QDBusMessage representing an error reply message, from the given error object.
QDBusMessage QDBusMessage::createErrorReply |
( |
const QString & |
name, |
|
|
const QString & |
msg |
|
) |
| const |
Constructs a new QDBusMessage representing an error reply message, with the given name and msg.
Constructs a new QDBusMessage reply message for the error type using the message msg. Returns the new QDBusMessage object.
QDBusMessage QDBusMessage::createMethodCall |
( |
const QString & |
serviceName, |
|
|
const QString & |
path, |
|
|
const QString & |
interfaceId, |
|
|
const QString & |
method |
|
) |
| |
|
static |
Constructs a new QDBusMessage representing a method call. A method call always informs its destination address (serviceName, path, interfaceId 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, not on a bus, the service parameter is optional. The QDBusInterface class provides 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 QDBusMessage representing a reply, with the given arguments.
QDBusMessage QDBusMessage::createReply |
( |
const QVariant & |
argument | ) |
const |
|
inline |
Constructs a new QDBusMessage representing a reply, with the given argument.
QDBusMessage QDBusMessage::createSignal |
( |
const QString & |
path, |
|
|
const QString & |
interfaceId, |
|
|
const QString & |
name |
|
) |
| |
|
static |
Constructs a new QDBusMessage with the given path, interfaceId, 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.
QDBusMessage QDBusMessage::createTargetedSignal |
( |
const QString & |
serviceName, |
|
|
const QString & |
path, |
|
|
const QString & |
interfaceId, |
|
|
const QString & |
name |
|
) |
| |
|
static |
Constructs a new QDBusMessage with the given path, interfaceId and name, representing a signal emission to a specific destination. A DBus signal is emitted from one application and is received only by the application owning the destination serviceName. 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 which was received.
QString QDBusMessage::errorName |
( |
| ) |
const |
Returns the name of the error which 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 &CsDbus 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.
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 | ) |
|
Copy assigns from other and returns a reference to this object. Since QDBusMessage objects are shared and modifications made to the copy will affect the original one as well. ( broom )
- See also
- setDelayedReply()
QDBusMessage & QDBusMessage::operator= |
( |
QDBusMessage && |
other | ) |
|
|
inlinenoexcept |
Move assigns from other and returns a reference to this object.
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::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.
- See also
- autoStartService()
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 &CsDbus (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()). CsDBus 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(), dbus-delayed-replies
QString QDBusMessage::signature |
( |
| ) |
const |
Returns the signature of the signal that was received or for the output arguments of a method call.
void QDBusMessage::swap |
( |
QDBusMessage & |
other | ) |
|
|
inlinenoexcept |
Swaps other with this object. This operation is very fast and never fails.
Returns the message type.