Foo::readyRead()
{
static const int expectedPacketSize = 9; // your 9 bytes
if (port->bytesAvailable() < expectedPacketSize)
return; // do nothing
// do domething processing of your packet
}
Foo::readyRead()
{
static const int expectedPacketSize = 9; // your 9 bytes
if (port->bytesAvailable() < expectedPacketSize)
return; // do nothing
QByteArray data = port->read(expectedPacketSize);
// do domething processing of your packet
}
To copy to clipboard, switch view to plain text mode
Of course, I'm skip the parsing and synchronization of incoming packets from an incoming data stream.
Bookmarks