<?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>QDBusUnixFileDescriptor 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">QDBusUnixFileDescriptor Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusUnixFileDescriptor class holds one Unix file descriptor. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusunixfiledescriptor.html#QDBusUnixFileDescriptor">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusunixfiledescriptor.html#QDBusUnixFileDescriptor-2">__init__</a></b> (<i>self</i>, int <i>fileDescriptor</i>)</li><li><div class="fn" /><b><a href="qdbusunixfiledescriptor.html#QDBusUnixFileDescriptor-3">__init__</a></b> (<i>self</i>, QDBusUnixFileDescriptor <i>other</i>)</li><li><div class="fn" />int <b><a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusunixfiledescriptor.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusunixfiledescriptor.html#setFileDescriptor">setFileDescriptor</a></b> (<i>self</i>, int <i>fileDescriptor</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qdbusunixfiledescriptor.html#isSupported">isSupported</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusUnixFileDescriptor class holds one Unix file descriptor.</p> <p>The QDBusUnixFileDescriptor class is used to hold one Unix file descriptor for use with the <a href="qtdbus.html">QtDBus</a> module. This allows applications to send and receive Unix file descriptors over the D-Bus connection, mapping automatically to the D-Bus type 'h'.</p> <p>Objects of type QDBusUnixFileDescriptors can be used also as parameters in signals and slots that get exported to D-Bus by registering with QDBusConnection.registerObject.</p> <p>QDBusUnixFileDescriptor does not take ownership of the file descriptor. Instead, it will use the Unix system call <tt>dup(2)</tt> to make a copy of the file descriptor. This file descriptor belongs to the QDBusUnixFileDescriptor object and should not be stored or closed by the user. Instead, you should make your own copy if you need that.</p> <a id="availability" name="availability" /> <h4>Availability</h4> <p>Unix file descriptor passing is not available in all D-Bus connections. This feature is present with D-Bus library and bus daemon version 1.4 and upwards on Unix systems. <a href="qtdbus.html">QtDBus</a> automatically enables the feature if such a version was found at compile-time and run-time.</p> <p>To verify that your connection does support passing file descriptors, check if the <a href="qdbusconnection.html#ConnectionCapability-enum">QDBusConnection.UnixFileDescriptorPassing</a> capability is set with <a href="qdbusconnection.html#connectionCapabilities">QDBusConnection.connectionCapabilities</a>(). If the flag is not active, then you will not be able to make calls to methods that have QDBusUnixFileDescriptor as arguments or even embed such a type in a variant. You will also not receive calls containing that type.</p> <p>Note also that remote applications may not have support for Unix file descriptor passing. If you make a D-Bus to a remote application that cannot receive such a type, you will receive an error reply. If you try to send a signal containing a D-Bus file descriptor or return one from a method call, the message will be silently dropped.</p> <p>Even if the feature is not available, QDBusUnixFileDescriptor will continue to operate, so code need not have compile-time checks for the availability of this feature.</p> <p>On non-Unix systems, QDBusUnixFileDescriptor will always report an invalid state and <a href="qdbusunixfiledescriptor.html#isSupported">QDBusUnixFileDescriptor.isSupported</a>() will return false.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusUnixFileDescriptor" />QDBusUnixFileDescriptor.__init__ (<i>self</i>)</h3><p>Constructs a <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> without a wrapped file descriptor. This is equivalent to constructing the object with an invalid file descriptor (like -1).</p> <p><b>See also</b> <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() and <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>().</p> <h3 class="fn"><a name="QDBusUnixFileDescriptor-2" />QDBusUnixFileDescriptor.__init__ (<i>self</i>, int <i>fileDescriptor</i>)</h3><p>Constructs a <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> object by copying the <i>fileDescriptor</i> parameter. The original file descriptor is not touched and must be closed by the user.</p> <p>Note that the value returned by <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() will be different from the <i>fileDescriptor</i> parameter passed.</p> <p>If the <i>fileDescriptor</i> parameter is not valid, <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>() will return false and <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() will return -1.</p> <p><b>See also</b> <a href="qdbusunixfiledescriptor.html#setFileDescriptor">setFileDescriptor</a>() and <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>().</p> <h3 class="fn"><a name="QDBusUnixFileDescriptor-3" />QDBusUnixFileDescriptor.__init__ (<i>self</i>, <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> <i>other</i>)</h3><p>Constructs a <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> object by copying <i>other</i>.</p> <h3 class="fn"><a name="fileDescriptor" />int QDBusUnixFileDescriptor.fileDescriptor (<i>self</i>)</h3><p>Returns the Unix file descriptor contained by this <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> object. An invalid file descriptor is represented by the value -1.</p> <p>Note that the file descriptor returned by this function is owned by the <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> object and must not be stored past the lifetime of this object. It is ok to use it while this object is valid, but if one wants to store it for longer use, the file descriptor should be cloned using the Unix <tt>dup(2)</tt>, <tt>dup2(2)</tt> or <tt>dup3(2)</tt> functions.</p> <p><b>See also</b> <a href="qdbusunixfiledescriptor.html#setFileDescriptor">setFileDescriptor</a>() and <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>().</p> <h3 class="fn"><a name="isSupported" />bool QDBusUnixFileDescriptor.isSupported ()</h3><p>Returns true if Unix file descriptors are supported on this platform. In other words, this function returns true if this is a Unix platform.</p> <p>Note that <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> continues to operate even if this function returns false. The only difference is that the <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> objects will always be in the <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>() == false state and <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() will always return -1. The class will not consume any operating system resources.</p> <h3 class="fn"><a name="isValid" />bool QDBusUnixFileDescriptor.isValid (<i>self</i>)</h3><p>Returns true if this Unix file descriptor is valid. A valid Unix file descriptor is not -1.</p> <p><b>See also</b> <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>().</p> <h3 class="fn"><a name="setFileDescriptor" />QDBusUnixFileDescriptor.setFileDescriptor (<i>self</i>, int <i>fileDescriptor</i>)</h3><p>Sets the file descriptor that this <a href="qdbusunixfiledescriptor.html">QDBusUnixFileDescriptor</a> object holds to a copy of <i>fileDescriptor</i>. The original file descriptor is not touched and must be closed by the user.</p> <p>Note that the value returned by <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() will be different from the <i>fileDescriptor</i> parameter passed.</p> <p>If the <i>fileDescriptor</i> parameter is not valid, <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>() will return false and <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</a>() will return -1.</p> <p><b>See also</b> <a href="qdbusunixfiledescriptor.html#isValid">isValid</a>() and <a href="qdbusunixfiledescriptor.html#fileDescriptor">fileDescriptor</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>