1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
<?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>QDBusInterface 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">QDBusInterface Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusInterface class is a proxy for interfaces on remote
objects. <a href="#details">More...</a></p>
<p>Inherits <a href="qdbusabstractinterface.html">QDBusAbstractInterface</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusinterface.html#QDBusInterface">__init__</a></b> (<i>self</i>, QString <i>service</i>, QString <i>path</i>, QString <i>interface</i> = '', QDBusConnection <i>connection</i> = QDBusConnection.sessionBus(), QObject <i>parent</i> = None)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusInterface class is a proxy for interfaces on remote
objects.</p>
<p>QDBusInterface is a generic accessor class that is used to place
calls to remote objects, connect to signals exported by remote
objects and get/set the value of remote properties. This class is
useful for dynamic access to remote objects: that is, when you do
not have a generated code that represents the remote interface.</p>
<p>Calls are usually placed by using the <a href="qdbusabstractinterface.html#call">call</a>() function, which
constructs the message, sends it over the bus, waits for the reply
and decodes the reply. Signals are connected to by using the normal
<a href="qobject.html#connect">QObject.connect</a>() function.
Finally, properties are accessed using the <a href="qobject.html#property">QObject.property</a>() and <a href="qobject.html#setProperty">QObject.setProperty</a>()
functions.</p>
<p>The following code snippet demonstrates how to perform a
mathematical operation of <tt>"2 + 2"</tt> in a remote application
called <tt>com.example.Calculator</tt>, accessed via the session
bus.</p>
<pre class="cpp">
<span class="type">QDBusInterface</span> remoteApp( <span class="string">"com.example.Calculator"</span><span class="operator">,</span> <span class="string">"/Calculator/Operations"</span><span class="operator">,</span>
<span class="string">"org.mathematics.RPNCalculator"</span> );
remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PushOperand"</span><span class="operator">,</span> <span class="number">2</span> );
remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PushOperand"</span><span class="operator">,</span> <span class="number">2</span> );
remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"ExecuteOperation"</span><span class="operator">,</span> <span class="string">"+"</span> );
<span class="type"><a href="qdbusreply.html">QDBusReply</a></span><span class="operator"><</span><span class="type">int</span><span class="operator">></span> reply <span class="operator">=</span> remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PopOperand"</span> );
<span class="keyword">if</span> ( reply<span class="operator">.</span>isValid() )
printf( <span class="string">"%d"</span><span class="operator">,</span> reply<span class="operator">.</span>value() ); <span class="comment">// prints 4</span>
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusInterface" />QDBusInterface.__init__ (<i>self</i>, QString <i>service</i>, QString <i>path</i>, QString <i>interface</i> = '', <a href="qdbusconnection.html">QDBusConnection</a> <i>connection</i> = QDBusConnection.sessionBus(), <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>Creates a dynamic <a href="qdbusinterface.html">QDBusInterface</a> object associated with the
interface <i>interface</i> on object at path <i>path</i> on service
<i>service</i>, using the given <i>connection</i>. If
<i>interface</i> is an empty string, the object created will refer
to the merging of all interfaces found in that object.</p>
<p><i>parent</i> is passed to the base class constructor.</p>
<p>If the remote service <i>service</i> is not present or if an
error occurs trying to obtain the description of the remote
interface <i>interface</i>, the object created will not be valid
(see <a href="qdbusabstractinterface.html#isValid">isValid</a>()).</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|