Hi people,

using Qt4 plus qextserialport 1.1, I am trying to do couple of things. In the Constructor of my "Motor" class, which is to be controlled using the serial port, I have these two lines pertaining to the serial port. The port settings are correct, and I am also opening the correct device.

Qt Code:
  1. port = new QextSerialPort( portFile, portsettings );
  2. connect(port, SIGNAL(readyRead()),this,SLOT(onReceive()));
To copy to clipboard, switch view to plain text mode 

This is my onReceive():

Qt Code:
  1. void Motor::onReceive()
  2. {
  3. QMutexLocker locker(&m);
  4. if(port->canReadLine()) {
  5.  
  6. // ("data" is a QByteArray)
  7. // this doesn't work: data = port->readLine(); although QIODevice has it?
  8. char tmp[RX_BUF_SIZE];
  9. qint64 len = port->readLine(tmp, RX_BUF_SIZE);
  10. data.fromRawData(tmp,len);
  11.  
  12. quint8 fault = 0;
  13.  
  14. // do something with the data before
  15. // clearing the buffer
  16.  
  17. data.clear();
  18.  
  19. rxcnt++;
  20. }
  21. }
To copy to clipboard, switch view to plain text mode 

What I want is that it reads the output of the serial controller board for the motor until it hits '\n' and then interprets the results. I noticed there are a variety of methods available to read data from the port, this seemed (intuitively) to be the most straight-forward, but I might be totally off the mark.

Any help would be greatly appreciated.

Thanks,
Stephan