title: qt serial port - sending data and waiting for response
body: <p>I have written such code (simplified here)</p>
  
  <pre><code>Test::test()
  {
     timer = new QTimer(this);
     timer -&gt; setInterval(300);
     timer -&gt; setSingleShot(true);
     connect(this-&gt;timer, SIGNAL(timeout()),this,SLOT(first_process()));
     char first_request = 0x02;
     serial -&gt; write( &amp;first_request);
     timer -&gt; start();
  }
  Test::first_process()
  {
     QByteArray data = serial-&gt;readAll();
     //process data...
     char second_request = 0x02;
     serial-&gt;write( &amp;second_request  );
     disconnect(this-&gt;timer, SIGNAL( timeout() ), this, SLOT( first_process() ));
     connect( this-&gt;timer, SIGNAL( timeout() ), this, SLOT( second_process() )); 
     timer-&gt;start();  
  }
  </code></pre>
  
  <p>(serial is of course initialized, baud set and so on...) </p>
  
  <p>And so one, 6 processes 'queued' to be executed in a  time. However i see from the responses that the data is being send again and again i.e. in 3rd 'process' i recive half of first response in 4th another half, some other data in between.</p>
  
  <p>I cant see where the mistake is made - device should respond for commands, data should be read to QByteArray</p>
  
  <p>1) Why the data is being send twice (or more) even if not asked for? Is it some kind of buffering issue?</p>
  
  <p>2) Is there any other mechanism to achive such behaviour? (i already tried connecting readyRead() to read function but the problem is that data is torn in pieces and i want ALL OF IT at a time)</p>