Many changes to improve UDS decoding.

This commit is contained in:
Collin Kidder
2017-10-11 22:19:38 -04:00
parent 0f9584eaea
commit cee299b552
6 changed files with 205 additions and 31 deletions
+9 -3
View File
@@ -23,7 +23,7 @@ ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector<CANFrame> *frames
connect(udsDecoder, &UDS_HANDLER::newUDSMessage, this, &ISOTP_InterpreterWindow::newUDSMessage);
connect(ui->tableIsoFrames, &QTableWidget::itemSelectionChanged, this, &ISOTP_InterpreterWindow::showDetailView);
connect(ui->btnClearList, &QAbstractButton::click, this, &ISOTP_InterpreterWindow::clearList);
connect(ui->btnClearList, &QPushButton::clicked, this, &ISOTP_InterpreterWindow::clearList);
QStringList headers;
headers << "Timestamp" << "ID" << "Bus" << "Dir" << "Length" << "Data";
@@ -85,7 +85,9 @@ void ISOTP_InterpreterWindow::writeSettings()
void ISOTP_InterpreterWindow::clearList()
{
ui->tableIsoFrames->clear();
qDebug() << "Clearing the table";
while (ui->tableIsoFrames->rowCount() > 0)
ui->tableIsoFrames->removeRow(0);
}
void ISOTP_InterpreterWindow::updatedFrames(int numFrames)
@@ -144,6 +146,7 @@ void ISOTP_InterpreterWindow::newUDSMessage(UDS_MESSAGE msg)
buildText = ui->txtFrameDetails->toPlainText();
/*
buildText.append("UDS Message:\n");
if (msg.isErrorReply)
{
@@ -156,7 +159,10 @@ void ISOTP_InterpreterWindow::newUDSMessage(UDS_MESSAGE msg)
buildText.append("Request for service " + udsDecoder->getServiceShortDesc(msg.service) + " Sub Func: " + QString::number(msg.subFunc));
else
buildText.append("Response on service " + udsDecoder->getServiceShortDesc(msg.service - 0x40) + " Sub Func: " + QString::number(msg.subFunc));
}
}*/
//Much more detailed analysis than the code above. You'll like it.
buildText.append(udsDecoder->getDetailedMessageAnalysis(msg));
ui->txtFrameDetails->setPlainText(buildText);
}
+13 -6
View File
@@ -97,6 +97,7 @@ void UDSScanWindow::readByToggled()
void UDSScanWindow::numBytesChanged()
{
uint64_t upperBound = (1 << (8 * ui->spinNumBytes->value())) - 1;
if (upperBound > 0x7FFFFFFF) upperBound = 0x7FFFFFFF;
ui->spinUpperSubfunc->setMaximum(upperBound);
}
@@ -232,16 +233,22 @@ void UDSScanWindow::scanUDS()
if (ui->ckReset->isChecked()) //try to command a reset of the ECU. You're likely to know if it works. ;)
{
test.service = UDS_SERVICES::ECU_RESET;
test.subFunc = 1;
sendOnBuses(test, buses);
for (typ = 1; typ < 4; typ++) //try each type of session access
{
test.service = UDS_SERVICES::ECU_RESET;
test.subFunc = typ;
sendOnBuses(test, buses);
}
}
if (ui->ckSecurity->isChecked()) //try to enter security mode - very likely to get a response if an ECU exists.
{
test.service = UDS_SERVICES::SECURITY_ACCESS;
test.subFunc = 1;
sendOnBuses(test, buses);
for (typ = 1; typ < 0x42; typ = typ + 2) //try each type of session access. In practice only the first 1-3 are likely to work
{
test.service = UDS_SERVICES::SECURITY_ACCESS;
test.subFunc = typ;
sendOnBuses(test, buses);
}
}
if (ui->ckReadByAddr->isChecked())