
Originally Posted by
mania
I mean the data stored in arr_cReadbuffer is ^MK1 instead of the nBytesReceived is 9
How did you determine that your code snippet doesn't show.
Again, using readAll() will give you both the check and the data in one go
const QByteArray data
= m_serialportCoProcessor
->readAll
();
// check if there was data available
if (data.count() > 0){
// do something with the data
qDebug() << "received" << data.count() << "bytes";
}
const QByteArray data = m_serialportCoProcessor->readAll();
// check if there was data available
if (data.count() > 0){
// do something with the data
qDebug() << "received" << data.count() << "bytes";
}
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks