<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QDBusMessage Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDBusMessage Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusMessage class represents one message sent or received over the D-Bus bus. <a href="#details">More...</a></p> <h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdbusmessage.html#MessageType-enum">MessageType</a></b> { InvalidMessage, MethodCallMessage, ReplyMessage, ErrorMessage, SignalMessage }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusmessage.html#QDBusMessage">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusmessage.html#QDBusMessage-2">__init__</a></b> (<i>self</i>, QDBusMessage <i>other</i>)</li><li><div class="fn" />list-of-QVariant <b><a href="qdbusmessage.html#arguments">arguments</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusmessage.html#autoStartService">autoStartService</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createErrorReply">createErrorReply</a></b> (<i>self</i>, QString <i>name</i>, QString <i>msg</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createErrorReply-2">createErrorReply</a></b> (<i>self</i>, QDBusError <i>error</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createErrorReply-3">createErrorReply</a></b> (<i>self</i>, QDBusError.ErrorType <i>type</i>, QString <i>msg</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createReply">createReply</a></b> (<i>self</i>, list-of-QVariant <i>arguments</i> = QList<QVariant>())</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createReply-2">createReply</a></b> (<i>self</i>, QVariant <i>argument</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#errorMessage">errorMessage</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#errorName">errorName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#interface">interface</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusmessage.html#isDelayedReply">isDelayedReply</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusmessage.html#isReplyRequired">isReplyRequired</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#member">member</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#path">path</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#service">service</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusmessage.html#setArguments">setArguments</a></b> (<i>self</i>, list-of-QVariant <i>arguments</i>)</li><li><div class="fn" /><b><a href="qdbusmessage.html#setAutoStartService">setAutoStartService</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qdbusmessage.html#setDelayedReply">setDelayedReply</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" />QString <b><a href="qdbusmessage.html#signature">signature</a></b> (<i>self</i>)</li><li><div class="fn" />MessageType <b><a href="qdbusmessage.html#type">type</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createError">createError</a></b> (QString <i>name</i>, QString <i>msg</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createError-2">createError</a></b> (QDBusError <i>error</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createError-3">createError</a></b> (QDBusError.ErrorType <i>type</i>, QString <i>msg</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createMethodCall">createMethodCall</a></b> (QString <i>service</i>, QString <i>path</i>, QString <i>interface</i>, QString <i>method</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#createSignal">createSignal</a></b> (QString <i>path</i>, QString <i>interface</i>, QString <i>name</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QDBusMessage <b><a href="qdbusmessage.html#__lshift__">__lshift__</a></b> (<i>self</i>, QVariant <i>arg</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusMessage class represents one message sent or received over the D-Bus bus.</p> <p>This object can represent any of the four different types of messages (<a href="qdbusmessage.html#MessageType-enum">MessageType</a>) that can occur on the bus:</p> <ul> <li>Method calls</li> <li>Method return values</li> <li>Signal emissions</li> <li>Error codes</li> </ul> <p>Objects of this type are created with the static <a href="qdbusmessage.html#createError">createError</a>(), <a href="qdbusmessage.html#createMethodCall">createMethodCall</a>() and <a href="qdbusmessage.html#createSignal">createSignal</a>() functions. Use the <a href="qdbusconnection.html#send">QDBusConnection.send</a>() function to send the messages.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="MessageType-enum" />QDBusMessage.MessageType</h3><p>The possible message types:</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QDBusMessage.MethodCallMessage</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">a message representing an outgoing or incoming method call</td> </tr> <tr> <td class="topAlign"><tt>QDBusMessage.SignalMessage</tt></td> <td class="topAlign"><tt>4</tt></td> <td class="topAlign">a message representing an outgoing or incoming signal emission</td> </tr> <tr> <td class="topAlign"><tt>QDBusMessage.ReplyMessage</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">a message representing the return values of a method call</td> </tr> <tr> <td class="topAlign"><tt>QDBusMessage.ErrorMessage</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">a message representing an error condition in response to a method call</td> </tr> <tr> <td class="topAlign"><tt>QDBusMessage.InvalidMessage</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">an invalid message: this is never set on messages received from D-Bus</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusMessage" />QDBusMessage.__init__ (<i>self</i>)</h3><p>Constructs an empty, invalid <a href="qdbusmessage.html">QDBusMessage</a> object.</p> <p><b>See also</b> <a href="qdbusmessage.html#createError">createError</a>(), <a href="qdbusmessage.html#createMethodCall">createMethodCall</a>(), and <a href="qdbusmessage.html#createSignal">createSignal</a>().</p> <h3 class="fn"><a name="QDBusMessage-2" />QDBusMessage.__init__ (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a> <i>other</i>)</h3><p>Constructs a copy of the object given by <i>other</i>.</p> <p>Note: <a href="qdbusmessage.html">QDBusMessage</a> objects are shared. Modifications made to the copy will affect the original one as well. See <a href="qdbusmessage.html#setDelayedReply">setDelayedReply</a>() for more information.</p> <h3 class="fn"><a name="arguments" />list-of-QVariant QDBusMessage.arguments (<i>self</i>)</h3><p>Returns the list of arguments that are going to be sent or were received from D-Bus.</p> <p><b>See also</b> <a href="qdbusmessage.html#setArguments">setArguments</a>().</p> <h3 class="fn"><a name="autoStartService" />bool QDBusMessage.autoStartService (<i>self</i>)</h3><p>Returns the auto start flag, as set by <a href="qdbusmessage.html#setAutoStartService">setAutoStartService</a>(). By default, this flag is true, which means <a href="qtdbus.html">QtDBus</a> will auto start a service, if it is not running already.</p> <p>This function was introduced in Qt 4.7.</p> <p><b>See also</b> <a href="qdbusmessage.html#setAutoStartService">setAutoStartService</a>().</p> <h3 class="fn"><a name="createError" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createError (QString <i>name</i>, QString <i>msg</i>)</h3><p>Constructs a new DBus message representing an error, with the given <i>name</i> and <i>msg</i>.</p> <h3 class="fn"><a name="createError-2" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createError (<a href="qdbuserror.html">QDBusError</a> <i>error</i>)</h3><p>Constructs a new DBus message representing the given <i>error</i>.</p> <h3 class="fn"><a name="createError-3" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createError (<a href="qdbuserror.html#ErrorType-enum">QDBusError.ErrorType</a> <i>type</i>, QString <i>msg</i>)</h3><p>Constructs a new DBus message for the error type <i>type</i> using the message <i>msg</i>. Returns the DBus message.</p> <h3 class="fn"><a name="createErrorReply" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createErrorReply (<i>self</i>, QString <i>name</i>, QString <i>msg</i>)</h3><p>Constructs a new DBus message representing an error reply message, with the given <i>name</i> and <i>msg</i>.</p> <h3 class="fn"><a name="createErrorReply-2" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createErrorReply (<i>self</i>, <a href="qdbuserror.html">QDBusError</a> <i>error</i>)</h3><p>Constructs a new DBus message representing an error reply message, from the given <i>error</i> object.</p> <h3 class="fn"><a name="createErrorReply-3" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createErrorReply (<i>self</i>, <a href="qdbuserror.html#ErrorType-enum">QDBusError.ErrorType</a> <i>type</i>, QString <i>msg</i>)</h3><p>Constructs a new DBus reply message for the error type <i>type</i> using the message <i>msg</i>. Returns the DBus message.</p> <h3 class="fn"><a name="createMethodCall" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createMethodCall (QString <i>service</i>, QString <i>path</i>, QString <i>interface</i>, QString <i>method</i>)</h3><p>Constructs a new DBus message representing a method call. A method call always informs its destination address (<i>service</i>, <i>path</i>, <i>interface</i> and <i>method</i>).</p> <p>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).</p> <p>When using DBus in a peer-to-peer context (i.e., not on a bus), the <i>service</i> parameter is optional.</p> <p>The QDBusObject and <a href="qdbusinterface.html">QDBusInterface</a> classes provide a simpler abstraction to synchronous method calling.</p> <p>This function returns a <a href="qdbusmessage.html">QDBusMessage</a> object that can be sent with <a href="qdbusconnection.html#call">QDBusConnection.call</a>().</p> <h3 class="fn"><a name="createReply" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createReply (<i>self</i>, list-of-QVariant <i>arguments</i> = QList<QVariant>())</h3><p>Constructs a new DBus message representing a reply, with the given <i>arguments</i>.</p> <h3 class="fn"><a name="createReply-2" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createReply (<i>self</i>, QVariant <i>argument</i>)</h3><p>Constructs a new DBus message representing a reply, with the given <i>argument</i>.</p> <h3 class="fn"><a name="createSignal" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.createSignal (QString <i>path</i>, QString <i>interface</i>, QString <i>name</i>)</h3><p>Constructs a new DBus message with the given <i>path</i>, <i>interface</i> and <i>name</i>, representing a signal emission.</p> <p>A DBus signal is emitted from one application and is received by all applications that are listening for that signal from that interface.</p> <p>The <a href="qdbusmessage.html">QDBusMessage</a> object that is returned can be sent using the <a href="qdbusconnection.html#send">QDBusConnection.send</a>() function.</p> <h3 class="fn"><a name="errorMessage" />QString QDBusMessage.errorMessage (<i>self</i>)</h3><p>Returns the human-readable message associated with the error that was received.</p> <p>This function was introduced in Qt 4.3.</p> <h3 class="fn"><a name="errorName" />QString QDBusMessage.errorName (<i>self</i>)</h3><p>Returns the name of the error that was received.</p> <h3 class="fn"><a name="interface" />QString QDBusMessage.interface (<i>self</i>)</h3><p>Returns the interface of the method being called (in the case of a method call) or of the signal being received from.</p> <h3 class="fn"><a name="isDelayedReply" />bool QDBusMessage.isDelayedReply (<i>self</i>)</h3><p>Returns the delayed reply flag, as set by <a href="qdbusmessage.html#setDelayedReply">setDelayedReply</a>(). By default, this flag is false, which means <a href="qtdbus.html">QtDBus</a> will generate automatic replies when necessary.</p> <h3 class="fn"><a name="isReplyRequired" />bool QDBusMessage.isReplyRequired (<i>self</i>)</h3><p>Returns the flag that indicates if this message should see a reply or not. This is only meaningful for <a href="qdbusmessage.html#MessageType-enum">method call messages</a>: any other kind of message cannot have replies and this function will always return false for them.</p> <h3 class="fn"><a name="member" />QString QDBusMessage.member (<i>self</i>)</h3><p>Returns the name of the signal that was emitted or the name of the method that was called.</p> <h3 class="fn"><a name="path" />QString QDBusMessage.path (<i>self</i>)</h3><h3 class="fn"><a name="service" />QString QDBusMessage.service (<i>self</i>)</h3><p>Returns the name of the service or the bus address of the remote method call.</p> <h3 class="fn"><a name="setArguments" />QDBusMessage.setArguments (<i>self</i>, list-of-QVariant <i>arguments</i>)</h3><p>Sets the arguments that are going to be sent over D-Bus to <i>arguments</i>. Those will be the arguments to a method call or the parameters in the signal.</p> <p><b>See also</b> <a href="qdbusmessage.html#arguments">arguments</a>().</p> <h3 class="fn"><a name="setAutoStartService" />QDBusMessage.setAutoStartService (<i>self</i>, bool <i>enable</i>)</h3><p>Sets the auto start flag to <i>enable</i>. 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.</p> <p>By default this flag is true, i.e. a service is autostarted. This means:</p> <p>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.</p> <p>This function was introduced in Qt 4.7.</p> <p><b>See also</b> <a href="qdbusmessage.html#autoStartService">autoStartService</a>().</p> <h3 class="fn"><a name="setDelayedReply" />QDBusMessage.setDelayedReply (<i>self</i>, bool <i>enable</i>)</h3><p>Sets whether the message will be replied later (if <i>enable</i> is true) or if an automatic reply should be generated by <a href="qtdbus.html">QtDBus</a> (if <i>enable</i> is false).</p> <p>In D-Bus, all method calls must generate a reply to the caller, unless the caller explicitly indicates otherwise (see <a href="qdbusmessage.html#isReplyRequired">isReplyRequired</a>()). <a href="qtdbus.html">QtDBus</a> 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.</p> <p><b>See also</b> <a href="qdbusmessage.html#isDelayedReply">isDelayedReply</a>() and <a href="qdbusdeclaringslots.html#delayed-replies">Delayed Replies</a>.</p> <h3 class="fn"><a name="signature" />QString QDBusMessage.signature (<i>self</i>)</h3><p>Returns the signature of the signal that was received or for the output arguments of a method call.</p> <h3 class="fn"><a name="type" /><a href="qdbusmessage.html#MessageType-enum">MessageType</a> QDBusMessage.type (<i>self</i>)</h3><p>Returns the message type.</p> <h3 class="fn"><a name="__lshift__" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusMessage.__lshift__ (<i>self</i>, QVariant <i>arg</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>