More implementation of iso-tp interpreter. Mostly just defines.
This commit is contained in:
+2
-1
@@ -36,7 +36,8 @@ public:
|
||||
int bus;
|
||||
bool extended;
|
||||
bool isReceived;
|
||||
int len;
|
||||
int len; //# of bytes this message should have (as reported)
|
||||
int actualSize; //# we actually got
|
||||
QVector<unsigned char> data;
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
#include "isotp_decoder.h"
|
||||
|
||||
//in order descriptions based on the list above. But, just in order one after the other
|
||||
QString UDS_SERVICE_DESCRIPT[] =
|
||||
{
|
||||
"Diagnostic session control",
|
||||
"Reset ECU",
|
||||
"Clear diagnostic trouble codes",
|
||||
"Read diagnostic trouble codes",
|
||||
"Read data by ID",
|
||||
"Read data by address",
|
||||
"Read scaling data by ID",
|
||||
"Request security access",
|
||||
"Communication control",
|
||||
"Read data by ID periodically",
|
||||
"Create dynamic data ID",
|
||||
"Write data by ID",
|
||||
"Input/Output control (force)",
|
||||
"Call a service routine",
|
||||
"Request data download (from client to server)",
|
||||
"Request data upload (from server to client)",
|
||||
"Transfer data",
|
||||
"Request that data transfer cease",
|
||||
"Request file transfer",
|
||||
"Write data by address",
|
||||
"Tester is present",
|
||||
"Read or write comm timing parameters",
|
||||
"Secured data transmission",
|
||||
"Control DTC settings",
|
||||
"Request start/stop transmission on event",
|
||||
"Control comm link"
|
||||
};
|
||||
|
||||
ISOTP_DECODER::ISOTP_DECODER(const QVector<CANFrame> *frames, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,50 @@
|
||||
#include <QDebug>
|
||||
#include "can_structs.h"
|
||||
|
||||
enum OBDII_FUNCTS
|
||||
{
|
||||
UDS_OBDII_SHOW_CURRENT = 1,
|
||||
UDS_OBDII_SHOW_FREEZE = 2,
|
||||
UDS_OBDII_SHOW_STORED_DTC = 3,
|
||||
UDS_OBDII_CLEAR_DTC = 4,
|
||||
UDS_OBDII_TEST_O2 = 5,
|
||||
UDS_OBDII_TEST_RESULTS = 6,
|
||||
UDS_OBDII_SHOW_PENDING_DTC = 7,
|
||||
UDS_OBDII_CONTROL_DEVICES = 8,
|
||||
UDS_OBDII_VEH_INFO = 9,
|
||||
UDS_OBDII_PERM_DTC = 0xA
|
||||
};
|
||||
|
||||
enum UDS_FUNCTS
|
||||
{
|
||||
UDS_DIAG_CONTROL=0x10,
|
||||
UDS_ECU_RESET=0x11,
|
||||
UDS_CLEAR_DIAG=0x14,
|
||||
UDS_READ_DTC=0x19,
|
||||
UDS_READ_BY_ID=0x22,
|
||||
UDS_READ_BY_ADDR=0x23,
|
||||
UDS_READ_SCALING_ID=0x24,
|
||||
UDS_SECURITY_ACCESS=0x27,
|
||||
UDS_COMM_CTRL=0x28,
|
||||
UDS_READ_DATA_ID_PERIODIC=0x2A,
|
||||
UDS_DYNAMIC_DATA_DEFINE=0x2C,
|
||||
UDS_WRITE_BY_ID=0x2E,
|
||||
UDS_IO_CTRL=0x2F,
|
||||
UDS_ROUTINE_CTRL=0x31,
|
||||
UDS_REQUEST_DOWNLOAD=0x34,
|
||||
UDS_REQUEST_UPLOAD=0x35,
|
||||
UDS_TRANSFER_DATA=0x36,
|
||||
UDS_REQ_TRANS_EXIT=0x37,
|
||||
UDS_REQ_FILE_TRANS=0x38,
|
||||
UDS_WRITE_BY_ADDR=0x3D,
|
||||
UDS_TESTER_PRESENT=0x3E,
|
||||
UDS_ACCESS_TIMING=0x83,
|
||||
UDS_SECURED_DATA_TRANS=0x84,
|
||||
UDS_CTRL_DTC_SETTINGS=0x85,
|
||||
UDS_RESPONSE_ON_EVENT=0x86,
|
||||
UDS_RESPONSE_LINK_CTRL=0x87
|
||||
};
|
||||
|
||||
class ISOTP_DECODER : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -11,9 +11,12 @@ ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector<CANFrame> *frames
|
||||
|
||||
decoder = new ISOTP_DECODER(modelFrames);
|
||||
|
||||
connect(MainWindow::getReference(), &MainWindow::framesUpdated, this, &ISOTP_InterpreterWindow::updatedFrames);
|
||||
connect(MainWindow::getReference(), &MainWindow::framesUpdated, decoder, &ISOTP_DECODER::updatedFrames);
|
||||
connect(decoder, &ISOTP_DECODER::newISOMessage, this, &ISOTP_InterpreterWindow::newISOMessage);
|
||||
|
||||
connect(ui->tableIsoFrames, &QTableWidget::itemSelectionChanged, this, &ISOTP_InterpreterWindow::showDetailView);
|
||||
|
||||
QStringList headers;
|
||||
headers << "Timestamp" << "ID" << "Bus" << "Dir" << "Length" << "Data";
|
||||
ui->tableIsoFrames->setColumnCount(6);
|
||||
@@ -68,11 +71,65 @@ void ISOTP_InterpreterWindow::writeSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void ISOTP_InterpreterWindow::updatedFrames(int numFrames)
|
||||
{
|
||||
if (numFrames == -1) //all frames deleted. Kill the display
|
||||
{
|
||||
messages.clear();
|
||||
ui->tableIsoFrames->clear();
|
||||
}
|
||||
else if (numFrames == -2) //all new set of frames. Reset
|
||||
{
|
||||
messages.clear();
|
||||
ui->tableIsoFrames->clear();
|
||||
}
|
||||
else //just got some new frames. See if they are relevant.
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ISOTP_InterpreterWindow::showDetailView()
|
||||
{
|
||||
QString buildString;
|
||||
ISOTP_MESSAGE *msg;
|
||||
int rowNum = ui->tableIsoFrames->currentRow();
|
||||
|
||||
ui->txtFrameDetails->clear();
|
||||
if (rowNum == -1) return;
|
||||
|
||||
msg = &messages[rowNum];
|
||||
|
||||
if (msg->len != msg->data.length())
|
||||
{
|
||||
buildString.append("Message didn't have the correct number of bytes.\rExpected "
|
||||
+ QString::number(msg->len) + " got "
|
||||
+ QString::number(msg->data.length()) + "\r\r");
|
||||
}
|
||||
|
||||
buildString.append(tr("Raw Payload: "));
|
||||
for (int i = 0; i < messages[rowNum].data.count(); i++)
|
||||
{
|
||||
buildString.append(Utility::formatNumber(messages[rowNum].data[i]));
|
||||
buildString.append(" ");
|
||||
}
|
||||
buildString.append("\r\r");
|
||||
|
||||
//if (ui->cb->isChecked())
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
ui->txtFrameDetails->setText(buildString);
|
||||
|
||||
}
|
||||
|
||||
void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE &msg)
|
||||
{
|
||||
int rowNum;
|
||||
QString tempString;
|
||||
|
||||
if ((msg.len != msg.data.count()) && !ui->cbShowIncomplete->isChecked()) return;
|
||||
|
||||
messages.append(msg);
|
||||
|
||||
rowNum = ui->tableIsoFrames->rowCount();
|
||||
@@ -85,7 +142,7 @@ void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE &msg)
|
||||
else ui->tableIsoFrames->setItem(rowNum, 3, new QTableWidgetItem("Tx"));
|
||||
ui->tableIsoFrames->setItem(rowNum, 4, new QTableWidgetItem(QString::number(msg.len)));
|
||||
|
||||
for (int i = 0; i < msg.data.length(); i++)
|
||||
for (int i = 0; i < msg.data.count(); i++)
|
||||
{
|
||||
tempString.append(Utility::formatNumber(msg.data[i]));
|
||||
tempString.append(" ");
|
||||
|
||||
@@ -20,6 +20,8 @@ public:
|
||||
|
||||
private slots:
|
||||
void newISOMessage(ISOTP_MESSAGE &msg);
|
||||
void showDetailView();
|
||||
void updatedFrames(int);
|
||||
|
||||
private:
|
||||
Ui::ISOTP_InterpreterWindow *ui;
|
||||
|
||||
+86
-11
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>792</width>
|
||||
<height>571</height>
|
||||
<height>725</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -25,21 +25,96 @@
|
||||
<widget class="QTableWidget" name="tableIsoFrames"/>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QCheckBox" name="cbShowIncomplete">
|
||||
<property name="text">
|
||||
<string>Data Details of Selected Message</string>
|
||||
<string>Show incomplete and/or corrupted messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="txtFrameDetails"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbInterpretUDS">
|
||||
<property name="text">
|
||||
<string>Interpret Data as UDS</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Data Details of Selected Message</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Interpret As:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbRaw">
|
||||
<property name="text">
|
||||
<string>Raw</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbUDS">
|
||||
<property name="text">
|
||||
<string>UDS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbOBDII">
|
||||
<property name="text">
|
||||
<string>OBDII</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="txtFrameDetails"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lblFilter">
|
||||
<property name="text">
|
||||
<string>IDs to Decode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listFilter"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAll">
|
||||
<property name="text">
|
||||
<string>All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnNone">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user