Add Extended CAN Bus Frame to SLCAN/LAWICEL

This commit is contained in:
Pacerino
2023-04-28 15:36:57 +02:00
parent e89517086f
commit bb1a7623aa
+26
View File
@@ -475,6 +475,32 @@ void LAWICELSerial::readSerialData()
}
break;
case 'T': //extended frame
//TIIIIIIIILDD.
buildFrame.setFrameId(mBuildLine.mid(1, 8).toInt(nullptr, 16));
buildFrame.isReceived = true;
buildFrame.setFrameType(QCanBusFrame::FrameType::DataFrame);
buildFrame.setExtendedFrameFormat(true);
buildData.resize(mBuildLine.mid(9, 1).toInt());
for (int c = 0; c < buildData.size(); c++)
{
buildData[c] = mBuildLine.mid(10 + (c*2), 2).toInt(nullptr, 16);
}
buildFrame.setPayload(buildData);
if (!isCapSuspended())
{
/* get frame from queue */
CANFrame* frame_p = getQueue().get();
if(frame_p) {
//qDebug() << "Lawicel got frame on bus " << frame_p->bus;
/* copy frame */
*frame_p = buildFrame;
checkTargettedFrame(buildFrame);
/* enqueue frame */
getQueue().queue();
}
else
qDebug() << "can't get a frame, ERROR";
}
break;
}
mBuildLine.clear();