<?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>QDBusAbstractInterface 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">QDBusAbstractInterface Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the <a href="qtdbus.html">QtDBus</a> binding, allowing access to remote interfaces <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qdbusconnectioninterface.html">QDBusConnectionInterface</a> and <a href="qdbusinterface.html">QDBusInterface</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusabstractinterface.html#QDBusAbstractInterface">__init__</a></b> (<i>self</i>, QString <i>service</i>, QString <i>path</i>, str <i>interface</i>, QDBusConnection <i>connection</i>, QObject <i>parent</i>)</li><li><div class="fn" />QDBusPendingCall <b><a href="qdbusabstractinterface.html#asyncCall">asyncCall</a></b> (<i>self</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</li><li><div class="fn" />QDBusPendingCall <b><a href="qdbusabstractinterface.html#asyncCallWithArgumentList">asyncCallWithArgumentList</a></b> (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbusabstractinterface.html#call">call</a></b> (<i>self</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</li><li><div class="fn" />QDBusMessage <b><a href="qdbusabstractinterface.html#call-2">call</a></b> (<i>self</i>, QDBus.CallMode <i>mode</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</li><li><div class="fn" />QDBusMessage <b><a href="qdbusabstractinterface.html#callWithArgumentList">callWithArgumentList</a></b> (<i>self</i>, QDBus.CallMode <i>mode</i>, QString <i>method</i>, list-of-QVariant <i>args</i>)</li><li><div class="fn" />bool <b><a href="qdbusabstractinterface.html#callWithCallback">callWithCallback</a></b> (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, QObject <i>receiver</i>, SLOT() <i>returnMethod</i>, SLOT() <i>errorMethod</i>)</li><li><div class="fn" />object <b><a href="qdbusabstractinterface.html#callWithCallback-2">callWithCallback</a></b> (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, callable <i>returnMethod</i>, callable <i>errorMethod</i>)</li><li><div class="fn" />bool <b><a href="qdbusabstractinterface.html#callWithCallback-3">callWithCallback</a></b> (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, QObject <i>receiver</i>, SLOT() <i>slot</i>)</li><li><div class="fn" />object <b><a href="qdbusabstractinterface.html#callWithCallback-4">callWithCallback</a></b> (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, callable <i>slot</i>)</li><li><div class="fn" />QDBusConnection <b><a href="qdbusabstractinterface.html#connection">connection</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusabstractinterface.html#connectNotify">connectNotify</a></b> (<i>self</i>, SIGNAL() <i>signal</i>)</li><li><div class="fn" /><b><a href="qdbusabstractinterface.html#disconnectNotify">disconnectNotify</a></b> (<i>self</i>, SIGNAL() <i>signal</i>)</li><li><div class="fn" />QString <b><a href="qdbusabstractinterface.html#interface">interface</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusabstractinterface.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusError <b><a href="qdbusabstractinterface.html#lastError">lastError</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusabstractinterface.html#path">path</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdbusabstractinterface.html#service">service</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusabstractinterface.html#setTimeout">setTimeout</a></b> (<i>self</i>, int <i>timeout</i>)</li><li><div class="fn" />int <b><a href="qdbusabstractinterface.html#timeout">timeout</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the <a href="qtdbus.html">QtDBus</a> binding, allowing access to remote interfaces</p> <p>Generated-code classes also derive from QDBusAbstractInterface, all methods described here are also valid for generated-code classes. In addition to those described here, generated-code classes provide member functions for the remote methods, which allow for compile-time checking of the correct parameters and return values, as well as property type-matching and signal parameter-matching.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusAbstractInterface" />QDBusAbstractInterface.__init__ (<i>self</i>, QString <i>service</i>, QString <i>path</i>, str <i>interface</i>, <a href="qdbusconnection.html">QDBusConnection</a> <i>connection</i>, <a href="qobject.html">QObject</a> <i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><h3 class="fn"><a name="asyncCall" /><a href="qdbuspendingcall.html">QDBusPendingCall</a> QDBusAbstractInterface.asyncCall (<i>self</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</h3><p>Calls the method <i>method</i> on this interface and passes the parameters to this function to the method.</p> <p>The parameters to <tt>call</tt> are passed on to the remote function via D-Bus as input arguments. The returned <a href="qdbuspendingcall.html">QDBusPendingCall</a> object can be used to find out information about the reply.</p> <p>This function can be used with up to 8 parameters, passed in arguments <i>arg1</i>, <i>arg2</i>, <i>arg3</i>, <i>arg4</i>, <i>arg5</i>, <i>arg6</i>, <i>arg7</i> and <i>arg8</i>. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use <a href="qdbusabstractinterface.html#asyncCallWithArgumentList">asyncCallWithArgumentList</a>().</p> <p>It can be used the following way:</p> <pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> value <span class="operator">=</span> retrieveValue(); <span class="type"><a href="qdbuspendingcall.html">QDBusPendingCall</a></span> pcall <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>asyncCall(QLatin1String(<span class="string">"Process"</span>)<span class="operator">,</span> value); <span class="type"><a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a></span> <span class="operator">*</span>watcher <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a></span>(pcall<span class="operator">,</span> <span class="keyword">this</span>); <span class="type"><a href="qobject.html">QObject</a></span><span class="operator">.</span><a href="qobject.html#connect">connect</a>(watcher<span class="operator">,</span> SIGNAL(finished(<span class="type"><a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a></span><span class="operator">*</span>))<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> SLOT(callFinishedSlot(<span class="type"><a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a></span><span class="operator">*</span>))); </pre> <p>This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to <tt>"ProcessWorkUnicode"</tt> will contain one Unicode string, the second call to <tt>"ProcessWork"</tt> will contain one string and one byte array).</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="asyncCallWithArgumentList" /><a href="qdbuspendingcall.html">QDBusPendingCall</a> QDBusAbstractInterface.asyncCallWithArgumentList (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>)</h3><p>Places a call to the remote method specified by <i>method</i> on this interface, using <i>args</i> as arguments. This function returns a <a href="qdbuspendingcall.html">QDBusPendingCall</a> object that can be used to track the status of the reply and access its contents once it has arrived.</p> <p>Normally, you should place calls using <a href="qdbusabstractinterface.html#asyncCall">asyncCall</a>().</p> <p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="call" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusAbstractInterface.call (<i>self</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</h3><p>Calls the method <i>method</i> on this interface and passes the parameters to this function to the method.</p> <p>The parameters to <tt>call</tt> are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in the <a href="qdbusmessage.html">QDBusMessage</a> reply. If the reply is an error reply, <a href="qdbusabstractinterface.html#lastError">lastError</a>() will also be set to the contents of the error message.</p> <p>This function can be used with up to 8 parameters, passed in arguments <i>arg1</i>, <i>arg2</i>, <i>arg3</i>, <i>arg4</i>, <i>arg5</i>, <i>arg6</i>, <i>arg7</i> and <i>arg8</i>. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use <a href="qdbusabstractinterface.html#callWithArgumentList">callWithArgumentList</a>().</p> <p>It can be used the following way:</p> <pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> value <span class="operator">=</span> retrieveValue(); <span class="type"><a href="qdbusmessage.html">QDBusMessage</a></span> reply; <span class="type"><a href="qdbusreply.html">QDBusReply</a></span><span class="operator"><</span><span class="type">int</span><span class="operator">></span> api <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>call(QLatin1String(<span class="string">"GetAPIVersion"</span>)); <span class="keyword">if</span> (api <span class="operator">></span><span class="operator">=</span> <span class="number">14</span>) reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>call(QLatin1String(<span class="string">"ProcessWorkUnicode"</span>)<span class="operator">,</span> value); <span class="keyword">else</span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>call(QLatin1String(<span class="string">"ProcessWork"</span>)<span class="operator">,</span> QLatin1String(<span class="string">"UTF-8"</span>)<span class="operator">,</span> value<span class="operator">.</span>toUtf8()); </pre> <p>This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to <tt>"ProcessWorkUnicode"</tt> will contain one Unicode string, the second call to <tt>"ProcessWork"</tt> will contain one string and one byte array).</p> <h3 class="fn"><a name="call-2" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusAbstractInterface.call (<i>self</i>, <a href="qdbus.html#CallMode-enum">QDBus.CallMode</a> <i>mode</i>, QString <i>method</i>, QVariant <i>arg1</i> = QVariant(), QVariant <i>arg2</i> = QVariant(), QVariant <i>arg3</i> = QVariant(), QVariant <i>arg4</i> = QVariant(), QVariant <i>arg5</i> = QVariant(), QVariant <i>arg6</i> = QVariant(), QVariant <i>arg7</i> = QVariant(), QVariant <i>arg8</i> = QVariant())</h3><p>This is an overloaded function.</p> <p>Calls the method <i>method</i> on this interface and passes the parameters to this function to the method. If <i>mode</i> is <tt>NoWaitForReply</tt>, then this function will return immediately after placing the call, without waiting for a reply from the remote method. Otherwise, <i>mode</i> indicates whether this function should activate the Qt Event Loop while waiting for the reply to arrive.</p> <p>This function can be used with up to 8 parameters, passed in arguments <i>arg1</i>, <i>arg2</i>, <i>arg3</i>, <i>arg4</i>, <i>arg5</i>, <i>arg6</i>, <i>arg7</i> and <i>arg8</i>. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use <a href="qdbusabstractinterface.html#callWithArgumentList">callWithArgumentList</a>().</p> <p>If this function reenters the Qt event loop in order to wait for the reply, it will exclude user input. During the wait, it may deliver signals and other method calls to your application. Therefore, it must be prepared to handle a reentrancy whenever a call is placed with <a href="qdbusabstractinterface.html#call">call</a>().</p> <h3 class="fn"><a name="callWithArgumentList" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusAbstractInterface.callWithArgumentList (<i>self</i>, <a href="qdbus.html#CallMode-enum">QDBus.CallMode</a> <i>mode</i>, QString <i>method</i>, list-of-QVariant <i>args</i>)</h3><p>Places a call to the remote method specified by <i>method</i> on this interface, using <i>args</i> as arguments. This function returns the message that was received as a reply, which can be a normal <a href="qdbusmessage.html#MessageType-enum">QDBusMessage.ReplyMessage</a> (indicating success) or <a href="qdbusmessage.html#MessageType-enum">QDBusMessage.ErrorMessage</a> (if the call failed). The <i>mode</i> parameter specifies how this call should be placed.</p> <p>If the call succeeds, <a href="qdbusabstractinterface.html#lastError">lastError</a>() will be cleared; otherwise, it will contain the error this call produced.</p> <p>Normally, you should place calls using <a href="qdbusabstractinterface.html#call">call</a>().</p> <p><b>Warning:</b> If you use <tt>UseEventLoop</tt>, your code must be prepared to deal with any reentrancy: other method calls and signals may be delivered before this function returns, as well as other Qt queued signals and events.</p> <p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p> <h3 class="fn"><a name="callWithCallback" />bool QDBusAbstractInterface.callWithCallback (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, <a href="qobject.html">QObject</a> <i>receiver</i>, SLOT() <i>returnMethod</i>, SLOT() <i>errorMethod</i>)</h3><p>Places a call to the remote method specified by <i>method</i> on this interface, using <i>args</i> as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to the <i>returnMethod</i> on object <i>receiver</i>. If an error occurs, the <i>errorMethod</i> on object <i>receiver</i> is called instead.</p> <p>This function returns true if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, the <i>errorMethod</i> is called. If the queueing failed, this function returns false and no slot will be called.</p> <p>The <i>returnMethod</i> must have as its parameters the types returned by the function call. Optionally, it may have a <a href="qdbusmessage.html">QDBusMessage</a> parameter as its last or only parameter. The <i>errorMethod</i> must have a <a href="qdbuserror.html">QDBusError</a> as its only parameter.</p> <p>This function was introduced in Qt 4.3.</p> <p><b>See also</b> <a href="qdbuserror.html">QDBusError</a> and <a href="qdbusmessage.html">QDBusMessage</a>.</p> <h3 class="fn"><a name="callWithCallback-2" />object QDBusAbstractInterface.callWithCallback (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, callable <i>returnMethod</i>, callable <i>errorMethod</i>)</h3><p>This is an overloaded function.</p> <p>This function is deprecated. Please use the overloaded version.</p> <p>Places a call to the remote method specified by <i>method</i> on this interface, using <i>args</i> as arguments. This function returns immediately after queueing the call. The reply from the remote function or any errors emitted by it are delivered to the <i>slot</i> slot on object <i>receiver</i>.</p> <p>This function returns true if the queueing succeeded: it does not indicate that the call succeeded. If it failed, the slot will be called with an error message. <a href="qdbusabstractinterface.html#lastError">lastError</a>() will not be set under those circumstances.</p> <p><b>See also</b> <a href="qdbuserror.html">QDBusError</a> and <a href="qdbusmessage.html">QDBusMessage</a>.</p> <h3 class="fn"><a name="callWithCallback-3" />bool QDBusAbstractInterface.callWithCallback (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, <a href="qobject.html">QObject</a> <i>receiver</i>, SLOT() <i>slot</i>)</h3><h3 class="fn"><a name="callWithCallback-4" />object QDBusAbstractInterface.callWithCallback (<i>self</i>, QString <i>method</i>, list-of-QVariant <i>args</i>, callable <i>slot</i>)</h3><h3 class="fn"><a name="connection" /><a href="qdbusconnection.html">QDBusConnection</a> QDBusAbstractInterface.connection (<i>self</i>)</h3><p>Returns the connection this interface is assocated with.</p> <h3 class="fn"><a name="connectNotify" />QDBusAbstractInterface.connectNotify (<i>self</i>, SIGNAL() <i>signal</i>)</h3><h3 class="fn"><a name="disconnectNotify" />QDBusAbstractInterface.disconnectNotify (<i>self</i>, SIGNAL() <i>signal</i>)</h3><h3 class="fn"><a name="interface" />QString QDBusAbstractInterface.interface (<i>self</i>)</h3><p>Returns the name of this interface.</p> <h3 class="fn"><a name="isValid" />bool QDBusAbstractInterface.isValid (<i>self</i>)</h3><p>Returns true if this is a valid reference to a remote object. It returns false if there was an error during the creation of this interface (for instance, if the remote application does not exist).</p> <p>Note: when dealing with remote objects, it is not always possible to determine if it exists when creating a <a href="qdbusinterface.html">QDBusInterface</a>.</p> <h3 class="fn"><a name="lastError" /><a href="qdbuserror.html">QDBusError</a> QDBusAbstractInterface.lastError (<i>self</i>)</h3><p>Returns the error the last operation produced, or an invalid error if the last operation did not produce an error.</p> <h3 class="fn"><a name="path" />QString QDBusAbstractInterface.path (<i>self</i>)</h3><h3 class="fn"><a name="service" />QString QDBusAbstractInterface.service (<i>self</i>)</h3><p>Returns the name of the service this interface is associated with.</p> <h3 class="fn"><a name="setTimeout" />QDBusAbstractInterface.setTimeout (<i>self</i>, int <i>timeout</i>)</h3><p>Sets the timeout in milliseconds for all future DBus calls to <i>timeout</i>. -1 means the default DBus timeout (usually 25 seconds).</p> <p>This function was introduced in Qt 4.8.</p> <p><b>See also</b> <a href="qdbusabstractinterface.html#timeout">timeout</a>().</p> <h3 class="fn"><a name="timeout" />int QDBusAbstractInterface.timeout (<i>self</i>)</h3><p>Returns the current value of the timeout in milliseconds. -1 means the default DBus timeout (usually 25 seconds).</p> <p>This function was introduced in Qt 4.8.</p> <p><b>See also</b> <a href="qdbusabstractinterface.html#setTimeout">setTimeout</a>().</p> <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>