<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to set QSerialPort::PinoutFlags and XonLimit&#x2F;XoffLimit values?]]></title><description><![CDATA[<p dir="auto">@QSerialPort port(port_info.name);<br />
if (port.open(QIODevice::ReadWrite)) {<br />
port.setParity(port_info.parity); //QSerialPort::NoParity<br />
port.setFlowControl(port_info.flow); //QSerialPort::SoftwareControl<br />
port.setBaudRate(port_info.baud_rate, //QSerialPort::Baud19200<br />
QSerialPort::AllDirections);<br />
port.setDataBits(port_info.data_bits); //QSerialPort::Data8<br />
port.setStopBits(port_info.stop_bits); //QSerialPort::OneStop<br />
port.setReadBufferSize(port_info.read_buffer); //8<br />
port.setDataTerminalReady(port_info.data_terminal_ready); //true<br />
port.setRequestToSend(port_info.request_to_send); //false<br />
if (port.isReadable() &amp;&amp; port.isWritable()) {<br />
qDebug() &lt;&lt; port.pinoutSignals();<br />
if (port.error() != QSerialPort::NoError) {<br />
qDebug() &lt;&lt; port.errorString();<br />
}<br />
else {<br />
forever {<br />
if (!allowed_to_work) {<br />
break;<br />
}<br />
else {<br />
readLoop(port);<br />
writeOnceIfNeeded(port);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
port.close();@</p>
<p dir="auto">This skel code of mine is working for many different sets of QSerialPort's properties; I can freely read from and write to some devices I'm using it with. Now I'm trying to use it with new hardware and it needs to be configured in a way I don't know how to bite.</p>
<p dir="auto">The above code returns no errors but also no PinoutFlags. I want my port.pingoutFlags() to return (0x80|0x40) (QSerialPort::ClearToSendSignal, DTS) but:</p>
<h1>I would expect the above example to return (0x40) (DTS only, no RTS) while it's returning no flags,</h1>
<h1>I don't know how to set CTS variable because I can't find method similar to those to set DTS and RTS values,</h1>
<h1>I found some weird output when playing with setRequestToSend() and setDataTerminalReady() methods:</h1>
<ul>
<li>If I set RTS to true then I'm getting (0x40) (RTS only, no DTS) no matter if I'm setting DTS to true or to false,</li>
<li>if I set RTS only, I end up with (0x4|0x40) (RTS and DTR on);</li>
<li>etc. but the isDataTerminalReady() and isRequestToSend() methods return predictable values, different than these viewable by pinoutSignals();</li>
</ul>
<p dir="auto">Using Device Monitoring Studio I can see that the values of PinoutSignals count as "FlowReplace", not values returned by above mentioned methods - that's why I'm looking for the way to change them directly... but pinoutSignals() returns no reference, only a copy so I can't just use operator|= and hope for the best.</p>
<p dir="auto">Also, I can't figure the way to set XonLimit and XoffLimit values...</p>
]]></description><link>https://forum.qt.io/topic/48371/how-to-set-qserialport-pinoutflags-and-xonlimit-xofflimit-values</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 12:51:04 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/48371.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Nov 2014 15:38:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to set QSerialPort::PinoutFlags and XonLimit&#x2F;XoffLimit values? on Thu, 20 Nov 2014 17:55:29 GMT]]></title><description><![CDATA[<ol>
<li>Windows, yes. Device is home-made so I don't think it has a "type"...</li>
<li>They are. There were "if jungle" there but I've deleted the checks before posting to make it more clear to you. Btw. isn't " if (port.error() != QSerialPort::NoError)" enough?</li>
<li>I think I get all these flags wrong. I just deleted the part of code which was trying to set them and now everything is working... sorry for garbage topic.</li>
</ol>
]]></description><link>https://forum.qt.io/post/251733</link><guid isPermaLink="true">https://forum.qt.io/post/251733</guid><dc:creator><![CDATA[qtsms]]></dc:creator><pubDate>Thu, 20 Nov 2014 17:55:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to set QSerialPort::PinoutFlags and XonLimit&#x2F;XoffLimit values? on Thu, 20 Nov 2014 17:09:02 GMT]]></title><description><![CDATA[<ol>
<li>Please provide info about your OS and device type.</li>
<li>Please check that all setXX() methods returns true!</li>
</ol>
<p dir="auto">[quote]<br />
I would expect the above example to return (0×40) (DTS only, no RTS) while it’s returning no flags,<br />
[/quote]</p>
<p dir="auto">Why do you expect it?</p>
<p dir="auto">[quote]<br />
I don’t know how to set CTS variable because I can’t find method similar to those to set DTS and RTS values,<br />
[/quote]</p>
<p dir="auto">Is is impossible, since CTS is an input line.</p>
<p dir="auto">[quote]<br />
bq. If I set RTS to true then I’m getting (0×40) (RTS only, no DTS) no matter if I’m setting DTS to true or to false,<br />
[/quote]</p>
<p dir="auto">How you did " setting DTS to true or to false" ?</p>
<p dir="auto">[quote]<br />
etc. but the isDataTerminalReady() and isRequestToSend() methods return predictable values, different than these viewable by pinoutSignals();<br />
[/quote]</p>
<p dir="auto">the isDataTerminalReady() and isRequestToSend() implicitly calls of pinoutSignals() to query a desired bit.</p>
<p dir="auto">[quote]<br />
that’s why I’m looking for the way to change them directly…<br />
[/quote]</p>
<p dir="auto">You can change only RTS and DTR signals, since it is outgoing signals..</p>
<p dir="auto">[quote]<br />
Also, I can’t figure the way to set XonLimit and XoffLimit values…<br />
[/quote]</p>
<p dir="auto">This is a platform-specific thing (I suppose you talk about Windows). So you can use QSerialPort::handle() -&gt; query the DCB -&gt; change what you want -&gt; update DCB.</p>
]]></description><link>https://forum.qt.io/post/251730</link><guid isPermaLink="true">https://forum.qt.io/post/251730</guid><dc:creator><![CDATA[kuzulis]]></dc:creator><pubDate>Thu, 20 Nov 2014 17:09:02 GMT</pubDate></item></channel></rss>