⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classposix__qextserialport.html

📁 linux下的串口通讯程序.用于开发串口程序很方便
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</div></div><p><a class="anchor" name="099fb47548a3566ed32d4d878fa57f4c"></a><!-- doxytag: member="Posix_QextSerialPort::isSequential" ref="099fb47548a3566ed32d4d878fa57f4c" args="() const " --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">bool QextSerialBase::isSequential           </td>          <td>(</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"> const<code> [virtual, inherited]</code></td>        </tr>      </table></div><div class="memdoc"><p>Returns true if device is sequential, otherwise returns false. Serial port is sequential device so this function always returns true. Check <a class="elRef" doxygen="qiodevice.tag:http://doc.trolltech.com/" href="http://doc.trolltech.com/qiodevice.html#isSequential">QIODevice::isSequential()</a> documentation for more information. <div class="fragment"><pre class="fragment"><a name="l00177"></a>00177 {<a name="l00178"></a>00178     <span class="keywordflow">return</span> <span class="keyword">true</span>;<a name="l00179"></a>00179 }</pre></div><p></div></div><p><a class="anchor" name="e4029cb49127422b7e76586930366b05"></a><!-- doxytag: member="Posix_QextSerialPort::lastError" ref="e4029cb49127422b7e76586930366b05" args="() const " --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">ulong QextSerialBase::lastError           </td>          <td>(</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"> const<code> [virtual, inherited]</code></td>        </tr>      </table></div><div class="memdoc"><p>Returns the code for the last error encountered by the port, or E_NO_ERROR if the last port operation was successful. Possible error codes are:<p><div class="fragment"><pre class="fragment">Error                           Explanation---------------------------     -------------------------------------------------------------E_NO_ERROR                      No Error has occuredE_INVALID_FD                    Invalid file descriptor (port was not opened correctly)E_NO_MEMORY                     Unable to allocate memory tables (POSIX)E_CAUGHT_NON_BLOCKED_SIGNAL     Caught a non-blocked signal (POSIX)E_PORT_TIMEOUT                  Operation timed out (POSIX)E_INVALID_DEVICE                The file opened by the port is not a character device (POSIX)E_BREAK_CONDITION               The port detected a break conditionE_FRAMING_ERROR                 The port detected a framing error                                (usually caused by incorrect baud rate settings)E_IO_ERROR                      There was an I/O error while communicating with the portE_BUFFER_OVERRUN                Character buffer overrunE_RECEIVE_OVERFLOW              Receive buffer overflowE_RECEIVE_PARITY_ERROR          The port detected a parity error in the received dataE_TRANSMIT_OVERFLOW             Transmit buffer overflowE_READ_FAILED                   General read operation failureE_WRITE_FAILED                  General write operation failure</pre></div> <div class="fragment"><pre class="fragment"><a name="l00248"></a>00248 {<a name="l00249"></a>00249     <span class="keywordflow">return</span> <a class="code" href="classQextSerialBase.html#31816951ba89902fa1dfdb6f18b80f41">lastErr</a>;<a name="l00250"></a>00250 }</pre></div><p></div></div><p><a class="anchor" name="b419544e866cab58b8a3ce6341f6a7e9"></a><!-- doxytag: member="Posix_QextSerialPort::lineStatus" ref="b419544e866cab58b8a3ce6341f6a7e9" args="()" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">unsigned long Posix_QextSerialPort::lineStatus           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"><code> [virtual]</code></td>        </tr>      </table></div><div class="memdoc"><p>returns the line status as stored by the port function. This function will retrieve the states of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned long with specific bits indicating which lines are high. The following constants should be used to examine the states of individual lines:<p><div class="fragment"><pre class="fragment">Mask        Line------      ----LS_CTS      CTSLS_DSR      DSRLS_DCD      DCDLS_RI       RILS_RTS      RTS (POSIX only)LS_DTR      DTR (POSIX only)LS_ST       Secondary TXD (POSIX only)LS_SR       Secondary RXD (POSIX only)</pre></div><p>This function will return 0 if the port associated with the class is not currently open. <p>Implements <a class="el" href="classQextSerialBase.html#28b87dd41160a61e2953dca38aa332d6">QextSerialBase</a>.<div class="fragment"><pre class="fragment"><a name="l01042"></a>01042 {<a name="l01043"></a>01043     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> Status=0, Temp=0;<a name="l01044"></a>01044     LOCK_MUTEX();<a name="l01045"></a>01045     <span class="keywordflow">if</span> (<a class="codeRef" doxygen="qiodevice.tag:http://doc.trolltech.com/" href="http://doc.trolltech.com/qiodevice.html#isOpen">isOpen</a>()) {<a name="l01046"></a>01046         ioctl(<a class="code" href="classPosix__QextSerialPort.html#c4fcc5ae9850c3bc9952a13e4ef82273">Posix_File</a>-&gt;handle(), TIOCMGET, &amp;Temp);<a name="l01047"></a>01047         <span class="keywordflow">if</span> (Temp&amp;TIOCM_CTS) {<a name="l01048"></a>01048             Status|=LS_CTS;<a name="l01049"></a>01049         }<a name="l01050"></a>01050         <span class="keywordflow">if</span> (Temp&amp;TIOCM_DSR) {<a name="l01051"></a>01051             Status|=LS_DSR;<a name="l01052"></a>01052         }<a name="l01053"></a>01053         <span class="keywordflow">if</span> (Temp&amp;TIOCM_RI) {<a name="l01054"></a>01054             Status|=LS_RI;<a name="l01055"></a>01055         }<a name="l01056"></a>01056         <span class="keywordflow">if</span> (Temp&amp;TIOCM_CD) {<a name="l01057"></a>01057             Status|=LS_DCD;<a name="l01058"></a>01058         }<a name="l01059"></a>01059         <span class="keywordflow">if</span> (Temp&amp;TIOCM_DTR) {<a name="l01060"></a>01060             Status|=LS_DTR;<a name="l01061"></a>01061         }<a name="l01062"></a>01062         <span class="keywordflow">if</span> (Temp&amp;TIOCM_RTS) {<a name="l01063"></a>01063             Status|=LS_RTS;<a name="l01064"></a>01064         }<a name="l01065"></a>01065         <span class="keywordflow">if</span> (Temp&amp;TIOCM_ST) {<a name="l01066"></a>01066             Status|=LS_ST;<a name="l01067"></a>01067         }<a name="l01068"></a>01068         <span class="keywordflow">if</span> (Temp&amp;TIOCM_SR) {<a name="l01069"></a>01069             Status|=LS_SR;<a name="l01070"></a>01070         }<a name="l01071"></a>01071     }<a name="l01072"></a>01072     UNLOCK_MUTEX();<a name="l01073"></a>01073     <span class="keywordflow">return</span> Status;<a name="l01074"></a>01074 }</pre></div><p></div></div><p><a class="anchor" name="5585e9e5a60f2d134e2c03e7a8cadeb9"></a><!-- doxytag: member="Posix_QextSerialPort::open" ref="5585e9e5a60f2d134e2c03e7a8cadeb9" args="(OpenMode mode=0)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">bool Posix_QextSerialPort::open           </td>          <td>(</td>          <td class="paramtype">OpenMode&nbsp;</td>          <td class="paramname"> <em>mode</em> = <code>0</code>          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"><code> [virtual]</code></td>        </tr>      </table></div><div class="memdoc"><p>Opens the serial port associated to this class. This function has no effect if the port associated with the class is already open. The port is also configured to the current settings, as stored in the Settings structure. <p>Implements <a class="el" href="classQextSerialBase.html#e7fadc74c97f903f6b499e6155236b3e">QextSerialBase</a>.<div class="fragment"><pre class="fragment"><a name="l00817"></a>00817 {<a name="l00818"></a>00818     LOCK_MUTEX();<a name="l00819"></a>00819     <span class="keywordflow">if</span> (mode == QIODevice::NotOpen)<a name="l00820"></

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -