Some bug fixes, much more work on ISOTP/UDS decoder window.
This commit is contained in:
@@ -124,7 +124,7 @@ void ISOTP_HANDLER::rapidFrames(const CANConnection* conn, const QVector<CANFram
|
||||
Q_UNUSED(conn)
|
||||
if (pFrames.length() <= 0) return;
|
||||
|
||||
qDebug() << "received messages in ISOTP handler";
|
||||
//qDebug() << "received messages in ISOTP handler";
|
||||
|
||||
foreach(const CANFrame& thisFrame, pFrames)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ void ISOTP_HANDLER::processFrame(const CANFrame &frame)
|
||||
msg.timestamp = frame.timestamp;
|
||||
if (useExtendedAddressing) for (int j = 0; j < frameLen; j++) msg.data.append(frame.data[j+2]);
|
||||
else for (int j = 0; j < frameLen; j++) msg.data.append(frame.data[j+1]);
|
||||
qDebug() << "Emitting single frame ISOTP message";
|
||||
//qDebug() << "Emitting single frame ISOTP message";
|
||||
emit newISOMessage(msg);
|
||||
break;
|
||||
case 1: //first frame of a multi-frame message
|
||||
@@ -259,7 +259,7 @@ void ISOTP_HANDLER::processFrame(const CANFrame &frame)
|
||||
}
|
||||
if (pMsg->len <= pMsg->data.count())
|
||||
{
|
||||
qDebug() << "Emitting multiframe ISOTP message";
|
||||
//qDebug() << "Emitting multiframe ISOTP message";
|
||||
emit newISOMessage(*pMsg);
|
||||
}
|
||||
break;
|
||||
@@ -298,7 +298,7 @@ void ISOTP_HANDLER::checkNeedFlush(uint64_t ID)
|
||||
if (messageBuffer[i].ID == ID)
|
||||
{
|
||||
//used to pass by reference but now newISOMessage should pass by value which makes it easier to use cross thread
|
||||
qDebug() << "Flushing a partial frame";
|
||||
//qDebug() << "Flushing a partial frame";
|
||||
emit newISOMessage(messageBuffer[i]);
|
||||
messageBuffer.removeAt(i);
|
||||
return;
|
||||
|
||||
@@ -320,7 +320,13 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
QString buildString;
|
||||
bool isResponse = true;
|
||||
|
||||
if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF)) {
|
||||
if (msg.isErrorReply)
|
||||
{
|
||||
isResponse = true;
|
||||
buildString.append("UDS ERROR Response\n");
|
||||
buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n");
|
||||
}
|
||||
else if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF)) {
|
||||
isResponse = false;
|
||||
buildString.append("UDS Request\n");
|
||||
buildString.append("Service: " + getServiceLongDesc(msg.service) + "\n");
|
||||
@@ -328,7 +334,7 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
else
|
||||
{
|
||||
isResponse = true;
|
||||
buildString.append("UDS Response\n");
|
||||
buildString.append("UDS Positive Response\n");
|
||||
buildString.append("Service: " + getServiceLongDesc(msg.service - 0x40) + "\n");
|
||||
}
|
||||
|
||||
@@ -348,16 +354,16 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
case UDS_SERVICES::DIAG_CONTROL + 0x40: //positive response
|
||||
buildString.append("Session Request: " + getLongDesc(UDS_DIAG_CTRL_SUB, msg.subFunc));
|
||||
//there should be four extra bytes now
|
||||
if (msg.data.length() < 4)
|
||||
if (msg.data.length() < 5) //5 because subfunc codes are left in data so it starts with one subfunc byte
|
||||
{
|
||||
//buildString.append("\nReturned data payload wasn't at least \n4 bytes like it should have been");
|
||||
}
|
||||
else
|
||||
{
|
||||
int p2 = msg.data[0] * 256 + msg.data[1];
|
||||
buildString.append("\nP2MAX: " + QString::number(p2));
|
||||
p2 = msg.data[2] * 256 + msg.data[3];
|
||||
buildString.append("\nP2*MAX: " + QString::number(p2));
|
||||
int p2 = msg.data[1] * 256 + msg.data[2];
|
||||
buildString.append("\nP2MAX: " + QString::number(p2) + "ms");
|
||||
p2 = (msg.data[3] * 256 + msg.data[4]) * 10;
|
||||
buildString.append("\nP2*MAX: " + QString::number(p2) + "ms");
|
||||
}
|
||||
break;
|
||||
case UDS_SERVICES::ECU_RESET:
|
||||
@@ -367,11 +373,11 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
case UDS_SERVICES::ECU_RESET + 0x40:
|
||||
buildString.append("Reset Type: " + getLongDesc(UDS_ECU_RESET_SUB, msg.subFunc));
|
||||
//There should be one additional byte which encodes power down time
|
||||
if (msg.data.length() > 0)
|
||||
if (msg.data.length() > 1)
|
||||
{
|
||||
if (msg.data[0] < 0xFF)
|
||||
if (msg.data[1] < 0xFF)
|
||||
{
|
||||
buildString.append("\nMinimum powered down time: " + QString::number(msg.data[0]));
|
||||
buildString.append("\nMinimum powered down time: " + QString::number(msg.data[1]));
|
||||
}
|
||||
else buildString.append("\nPowerdown time not available");
|
||||
}
|
||||
@@ -385,19 +391,19 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
if ((msg.subFunc % 2) == 1)
|
||||
{
|
||||
buildString.append("Seed request for security level: " + QString::number(msg.subFunc) + "\n");
|
||||
if (msg.data.length()> 0)
|
||||
if (msg.data.length()> 1)
|
||||
{
|
||||
buildString.append("Data payload: ");
|
||||
for (int j = 0; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
for (int j = 1; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buildString.append("Key sending for security level: " + QString::number(msg.subFunc - 1));
|
||||
if (msg.data.length()> 0) //and it sure as hell should be!
|
||||
if (msg.data.length()> 1) //and it sure as hell should be!
|
||||
{
|
||||
buildString.append("KEY: ");
|
||||
for (int j = 0; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
for (int j = 1; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -405,10 +411,10 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
|
||||
if ((msg.subFunc % 2) == 1)
|
||||
{
|
||||
buildString.append("Seed response for security level: " + QString::number(msg.subFunc) + "\n");
|
||||
if (msg.data.length()> 0) //be kinda pointless if it weren't
|
||||
if (msg.data.length()> 1) //be kinda pointless if it weren't
|
||||
{
|
||||
buildString.append("SEED: ");
|
||||
for (int j = 0; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
for (int j = 1; j < msg.data.length(); j++) buildString.append(Utility::formatHexNum(msg.data[j]) + " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user