<?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 synchronize QTcpSocket data and timer data in the GUI]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<ol>
<li>I used <code>QwtPlot</code>'s x axis as<code>QwtSystemClock</code> object (seconds) it will keep running on the GUI.</li>
<li>I will get 256 <code>QPointF</code> points through <code>QTCPSocket</code> per second in <code>Socket.cpp</code>  by socket.</li>
<li>How to synchronize received 256 <code>QPointF</code>'s <code>SetX()</code>  values according to <code>QwtSystemClock</code>'s  per second .</li>
<li>Each point's <code>x</code> should have a difference  (1/256=0.00390625)</li>
</ol>
]]></description><link>https://forum.qt.io/topic/98751/how-to-synchronize-qtcpsocket-data-and-timer-data-in-the-gui</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 08:17:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/98751.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Jan 2019 10:22:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Tue, 22 Jan 2019 09:56:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a> Thank you,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a> said in <a href="/post/506360">How to synchronize QTcpSocket data and timer data in the GUI</a>:</p>
<blockquote>
<p dir="auto">Best you try it with a small example. Within the thread, you need to read the system clock and output.</p>
</blockquote>
<p dir="auto">Doing this .</p>
]]></description><link>https://forum.qt.io/post/506363</link><guid isPermaLink="true">https://forum.qt.io/post/506363</guid><dc:creator><![CDATA[thippu]]></dc:creator><pubDate>Tue, 22 Jan 2019 09:56:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Tue, 22 Jan 2019 09:49:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/thippu">@<bdi>thippu</bdi></a></p>
<p dir="auto">Best you try it with a small example. Within the thread you need to read the system clock and output.<br />
At the day's end all depends on the actual thread scheduling of your computer and device. The weakest link in the chain determines the accuracy.<br />
You will probably need to do a lot of testing. Also you need to consider what you actually want to have. One thing could be the even scaling for plotting or is it the precise and accurate knowledge of when the values are taken.</p>
]]></description><link>https://forum.qt.io/post/506360</link><guid isPermaLink="true">https://forum.qt.io/post/506360</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Tue, 22 Jan 2019 09:49:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Tue, 22 Jan 2019 09:51:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a><br />
Will this help me?</p>
<pre><code>double elapsed=clock.elapsed();
int no_of_interval=256;
double msecs=no_of_interval-(clock.elapsed()-elapsed);
if(msecs&gt;0.0)
QThread::usleep(qRound(msecs*1000));
</code></pre>
]]></description><link>https://forum.qt.io/post/506328</link><guid isPermaLink="true">https://forum.qt.io/post/506328</guid><dc:creator><![CDATA[thippu]]></dc:creator><pubDate>Tue, 22 Jan 2019 09:51:09 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Tue, 22 Jan 2019 06:24:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a><br />
My server does send only y values of the points.<br />
I have to calculate x values while they arrive and display only 256 samples.<br />
please help me.</p>
]]></description><link>https://forum.qt.io/post/506265</link><guid isPermaLink="true">https://forum.qt.io/post/506265</guid><dc:creator><![CDATA[thippu]]></dc:creator><pubDate>Tue, 22 Jan 2019 06:24:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Mon, 21 Jan 2019 13:31:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/thippu">@<bdi>thippu</bdi></a></p>
<p dir="auto">If this is your only option, you can try. Note, gut feeling on my side is that you will have varying time intervals between your "measured values". If this is acceptable, you need to decide.</p>
]]></description><link>https://forum.qt.io/post/506139</link><guid isPermaLink="true">https://forum.qt.io/post/506139</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Mon, 21 Jan 2019 13:31:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Mon, 21 Jan 2019 11:27:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/koahnig">@<bdi>koahnig</bdi></a> said in <a href="/post/506110">How to synchronize QTCPSOCKET data and timer data in the GUI</a>:</p>
<blockquote>
<p dir="auto">there might be possibility to run a thread checking the contents of the buffer very quickly.</p>
</blockquote>
<p dir="auto">I can go with a thread.<br />
if I connect  <code>readyRead()</code> to <code>collectData()</code> and store the data in buffer.<br />
after that by using <code>QwtSystemClock</code> clock in <code>socket.cpp</code>  and calling  <code>sendToGui()</code> every second and passing the data, Can I go with it?.</p>
]]></description><link>https://forum.qt.io/post/506118</link><guid isPermaLink="true">https://forum.qt.io/post/506118</guid><dc:creator><![CDATA[thippu]]></dc:creator><pubDate>Mon, 21 Jan 2019 11:27:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to synchronize QTcpSocket data and timer data in the GUI on Mon, 21 Jan 2019 10:59:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/thippu">@<bdi>thippu</bdi></a></p>
<p dir="auto">IMHO you will need time tags from device sending through tcp/ip. That is the most accurate possibility.</p>
<p dir="auto">QTcpSocket has a buffer and all in-coming data will be accumulated there. Typically sometime at the beginning you will receive a readyRead signal. At which time your application will react on the signal is dependend on a couple of factors (e.g. cpu load, time retrieve each data record, time to plot, ...).</p>
<p dir="auto">If you have a fast machine with a couple of cores, there might be possibility to run a thread checking the contents of the buffer very quickly. This would allow for assigning a time-tag for each value, but probably not too close to actual measuring time.</p>
]]></description><link>https://forum.qt.io/post/506110</link><guid isPermaLink="true">https://forum.qt.io/post/506110</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Mon, 21 Jan 2019 10:59:01 GMT</pubDate></item></channel></rss>