@manel-sam said in Serial data received:
So the append I should do it where§?
Create a member variable in your imu class.
// _packetData member variable of imu _packetData.append(serialPort->readAll()); if(_packetData.size()>=PACKET_LENGTH) { // packet complete qInfo() << QStringLiteral("data size is : ") << _packetData.size() << " octets"; qDebug() << "Serial received " << _packetData.toHex(); // go ahead with this packet QDataStream stream(_packetData); // Read The BigIndian value stream.setByteOrder(QDataStream::BigEndian); qint16 headerSignature; stream >> headerSignature; }You may also check the data received don't exceed PACKET_LENGTH, cause it means you have already received data from the next packet. (it may be irrelevant in your case, I don't kown)