OS:Ubuntu 11
QExtSerialport 1.2 beta


I am creating an application to write an instruction to a device and receive its response from the device. I connected the readyread() singal to onReadyRead() slot. but sometime its getting only the partial data from the device to the onReadyRead() slot.

I am writing *Read to device
and getting
*Read<Values>
P=122
C=0.33
sometime I got only the partial result in my onReadyRead()

I tried event driven and Polling methods.Still the issue exist.How I can completely read the device input in my onReadyRead().
I checked this on putty software also. its working perfectly in there.

my code sample is given below

Qt Code:
  1. void Reader::Create()
  2. {
  3. PortSettings settings = {BAUD19200, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 20};
  4. port = new QextSerialPort(m_strPortName, settings, QextSerialPort::EventDriven);
  5.  
  6. timer = new QTimer(this);
  7. timer->setInterval(20);
  8.  
  9.  
  10.  
  11. connect(timer, SIGNAL(timeout()), SLOT(onReadyRead()));
  12. connect(port, SIGNAL(readyRead()), SLOT(onReadyRead()));
  13.  
  14. if (!port->isOpen())
  15. {
  16. port->setPortName(m_strPortName);
  17. port->open(QIODevice::ReadWrite);
  18. }
  19. else {
  20. // port->close();
  21. }
  22.  
  23. if (port->isOpen() && port->queryMode() == QextSerialPort::Polling)
  24. timer->start();
  25. else
  26. timer->stop();
  27.  
  28. }
  29.  
  30. void Reader::onReadyRead()
  31. {
  32. if (port->bytesAvailable())
  33. {
  34. m_strData= port->readAll();
  35. }
  36. }
To copy to clipboard, switch view to plain text mode