The data that I read from the serial port (in Qt, using QtSerialPort / QSerialPort) is separated by the newline characters '\ n' and return '\ r', which I am going to look at it for analysis, the line length can be very strong, but very Easily extract data from each row format.
//signal/slot connection on readyRead() is as follows: connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
where readData () is defined as:
void MainWindow::readData() {
However, the QIODevice::readLine() function is extremely slow and explicitly blocks receiving data at full frequency compared to QIODevice :: readAll ()
Can someone explain how to use the readLine() function correctly, so I don't have to go through readAll() in QByteArray to parse each line? I used the Qt Widgets βTerminalβ example to create this asynchronous serialport read function.
Thanks in advance - this seems to be a common problem that I have not seen here yet.
source share