Preliminaries for new UDS modes, added code to ensure lower and upper
bounds are respected on UDS window.
This commit is contained in:
+50
-8
@@ -26,12 +26,19 @@ UDSScanWindow::UDSScanWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
|||||||
connect(waitTimer, &QTimer::timeout, this, &UDSScanWindow::timeOut);
|
connect(waitTimer, &QTimer::timeout, this, &UDSScanWindow::timeOut);
|
||||||
connect(ui->btnSaveResults, &QPushButton::clicked, this, &UDSScanWindow::saveResults);
|
connect(ui->btnSaveResults, &QPushButton::clicked, this, &UDSScanWindow::saveResults);
|
||||||
connect(ui->ckWildcard, &QCheckBox::toggled, this, &UDSScanWindow::wildcardToggled);
|
connect(ui->ckWildcard, &QCheckBox::toggled, this, &UDSScanWindow::wildcardToggled);
|
||||||
|
connect(ui->ckReadByAddr, &QCheckBox::toggled, this, &UDSScanWindow::readByToggled);
|
||||||
|
connect(ui->ckReadByID, &QCheckBox::toggled, this, &UDSScanWindow::readByToggled);
|
||||||
connect(ui->cbAllowAdaptiveOffset, &QCheckBox::toggled, this, &UDSScanWindow::adaptiveToggled);
|
connect(ui->cbAllowAdaptiveOffset, &QCheckBox::toggled, this, &UDSScanWindow::adaptiveToggled);
|
||||||
connect(ui->spinNumBytes, SIGNAL(valueChanged(int)), this, SLOT(numBytesChanged()));
|
connect(ui->spinNumBytes, SIGNAL(valueChanged(int)), this, SLOT(numBytesChanged()));
|
||||||
|
connect(ui->spinLowerService, SIGNAL(valueChanged(int)), this, SLOT(checkServiceRange()));
|
||||||
|
connect(ui->spinUpperService, SIGNAL(valueChanged(int)), this, SLOT(checkServiceRange()));
|
||||||
|
connect(ui->spinLowerSubfunc, SIGNAL(valueChanged(int)), this, SLOT(checkSubFuncRange()));
|
||||||
|
connect(ui->spinUpperSubfunc, SIGNAL(valueChanged(int)), this, SLOT(checkSubFuncRange()));
|
||||||
|
connect(ui->spinStartID, SIGNAL(valueChanged(int)), this, SLOT(checkIDRange()));
|
||||||
|
connect(ui->spinEndID, SIGNAL(valueChanged(int)), this, SLOT(checkIDRange()));
|
||||||
|
|
||||||
int numBuses = CANConManager::getInstance()->getNumBuses();
|
int numBuses = CANConManager::getInstance()->getNumBuses();
|
||||||
for (int n = 0; n < numBuses; n++) ui->cbBuses->addItem(QString::number(n));
|
for (int n = 0; n < numBuses; n++) ui->cbBuses->addItem(QString::number(n));
|
||||||
ui->cbBuses->addItem(tr("All"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UDSScanWindow::~UDSScanWindow()
|
UDSScanWindow::~UDSScanWindow()
|
||||||
@@ -57,10 +64,14 @@ void UDSScanWindow::wildcardToggled()
|
|||||||
ui->ckSecurity->setEnabled(state);
|
ui->ckSecurity->setEnabled(state);
|
||||||
ui->ckSession->setEnabled(state);
|
ui->ckSession->setEnabled(state);
|
||||||
ui->ckTester->setEnabled(state);
|
ui->ckTester->setEnabled(state);
|
||||||
|
ui->ckReadByAddr->setEnabled(state);
|
||||||
|
ui->ckReadByID->setEnabled(state);
|
||||||
ui->ckReset->setChecked(false);
|
ui->ckReset->setChecked(false);
|
||||||
ui->ckSecurity->setChecked(false);
|
ui->ckSecurity->setChecked(false);
|
||||||
ui->ckSession->setChecked(false);
|
ui->ckSession->setChecked(false);
|
||||||
ui->ckTester->setChecked(false);
|
ui->ckTester->setChecked(false);
|
||||||
|
ui->ckReadByAddr->setChecked(false);
|
||||||
|
ui->ckReadByID->setChecked(false);
|
||||||
|
|
||||||
ui->spinLowerService->setEnabled(!state);
|
ui->spinLowerService->setEnabled(!state);
|
||||||
ui->spinLowerSubfunc->setEnabled(!state);
|
ui->spinLowerSubfunc->setEnabled(!state);
|
||||||
@@ -69,12 +80,43 @@ void UDSScanWindow::wildcardToggled()
|
|||||||
ui->spinUpperSubfunc->setEnabled(!state);
|
ui->spinUpperSubfunc->setEnabled(!state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDSScanWindow::readByToggled()
|
||||||
|
{
|
||||||
|
bool state = false;
|
||||||
|
if (ui->ckReadByAddr->isChecked() || ui->ckReadByID->isChecked()) state = true;
|
||||||
|
else state = false;
|
||||||
|
|
||||||
|
ui->spinLowerService->setEnabled(false);
|
||||||
|
ui->spinLowerSubfunc->setEnabled(state);
|
||||||
|
ui->spinNumBytes->setEnabled(state);
|
||||||
|
ui->spinUpperService->setEnabled(false);
|
||||||
|
ui->spinUpperSubfunc->setEnabled(state);
|
||||||
|
}
|
||||||
|
|
||||||
void UDSScanWindow::numBytesChanged()
|
void UDSScanWindow::numBytesChanged()
|
||||||
{
|
{
|
||||||
uint64_t upperBound = (1 << (8 * ui->spinNumBytes->value())) - 1;
|
uint64_t upperBound = (1 << (8 * ui->spinNumBytes->value())) - 1;
|
||||||
ui->spinUpperSubfunc->setMaximum(upperBound);
|
ui->spinUpperSubfunc->setMaximum(upperBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDSScanWindow::checkIDRange()
|
||||||
|
{
|
||||||
|
ui->spinStartID->setMaximum(ui->spinEndID->value());
|
||||||
|
ui->spinEndID->setMinimum(ui->spinStartID->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDSScanWindow::checkServiceRange()
|
||||||
|
{
|
||||||
|
ui->spinLowerService->setMaximum(ui->spinUpperService->value());
|
||||||
|
ui->spinUpperService->setMinimum(ui->spinLowerService->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDSScanWindow::checkSubFuncRange()
|
||||||
|
{
|
||||||
|
ui->spinLowerSubfunc->setMaximum(ui->spinUpperSubfunc->value());
|
||||||
|
ui->spinUpperSubfunc->setMinimum(ui->spinLowerSubfunc->value());
|
||||||
|
}
|
||||||
|
|
||||||
void UDSScanWindow::saveResults()
|
void UDSScanWindow::saveResults()
|
||||||
{
|
{
|
||||||
QString filename;
|
QString filename;
|
||||||
@@ -123,19 +165,19 @@ void UDSScanWindow::dumpNode(QTreeWidgetItem* item, QFile *file, int indent)
|
|||||||
void UDSScanWindow::sendOnBuses(UDS_MESSAGE test, int buses)
|
void UDSScanWindow::sendOnBuses(UDS_MESSAGE test, int buses)
|
||||||
{
|
{
|
||||||
int busList = buses;
|
int busList = buses;
|
||||||
if (busList < ui->cbBuses->count() - 1)
|
//if (busList < ui->cbBuses->count() - 1)
|
||||||
{
|
//{
|
||||||
test.bus = buses;
|
test.bus = buses;
|
||||||
sendingFrames.append(test);
|
sendingFrames.append(test);
|
||||||
}
|
//}
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
for (int c = 0; c < ui->cbBuses->count() - 1; c++)
|
for (int c = 0; c < ui->cbBuses->count() - 1; c++)
|
||||||
{
|
{
|
||||||
test.bus = c;
|
test.bus = c;
|
||||||
sendingFrames.append(test);
|
sendingFrames.append(test);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDSScanWindow::scanUDS()
|
void UDSScanWindow::scanUDS()
|
||||||
@@ -160,8 +202,8 @@ void UDSScanWindow::scanUDS()
|
|||||||
UDS_MESSAGE test;
|
UDS_MESSAGE test;
|
||||||
int typ, id;
|
int typ, id;
|
||||||
int startID, endID;
|
int startID, endID;
|
||||||
startID = Utility::ParseStringToNum(ui->txtStartID->text());
|
startID = ui->spinStartID->value();
|
||||||
endID = Utility::ParseStringToNum(ui->txtEndID->text());
|
endID = ui->spinEndID->value();
|
||||||
if (endID < startID) {
|
if (endID < startID) {
|
||||||
int temp = startID;
|
int temp = startID;
|
||||||
startID = endID;
|
startID = endID;
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ private slots:
|
|||||||
void timeOut();
|
void timeOut();
|
||||||
void adaptiveToggled();
|
void adaptiveToggled();
|
||||||
void wildcardToggled();
|
void wildcardToggled();
|
||||||
|
void readByToggled();
|
||||||
void numBytesChanged();
|
void numBytesChanged();
|
||||||
|
void checkIDRange();
|
||||||
|
void checkServiceRange();
|
||||||
|
void checkSubFuncRange();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UDSScanWindow *ui;
|
Ui::UDSScanWindow *ui;
|
||||||
|
|||||||
+44
-8
@@ -52,9 +52,18 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="txtStartID">
|
<widget class="QSpinBox" name="spinStartID">
|
||||||
<property name="text">
|
<property name="prefix">
|
||||||
<string>0x7E0</string>
|
<string>0x</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>536870911</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>2016</number>
|
||||||
|
</property>
|
||||||
|
<property name="displayIntegerBase">
|
||||||
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -70,9 +79,18 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="txtEndID">
|
<widget class="QSpinBox" name="spinEndID">
|
||||||
<property name="text">
|
<property name="prefix">
|
||||||
<string>0x7E7</string>
|
<string>0x</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>536870911</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>2024</number>
|
||||||
|
</property>
|
||||||
|
<property name="displayIntegerBase">
|
||||||
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -123,7 +141,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Buses to scan</string>
|
<string>Bus to scan</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -174,7 +192,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="ckSession">
|
<widget class="QCheckBox" name="ckSession">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Session Control</string>
|
<string>Session Ctrl</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -192,6 +210,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="ckReadByID">
|
||||||
|
<property name="text">
|
||||||
|
<string>Read By ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="ckReadByAddr">
|
||||||
|
<property name="text">
|
||||||
|
<string>Read By Addr</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="ckWildcard">
|
<widget class="QCheckBox" name="ckWildcard">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
Reference in New Issue
Block a user