diff --git a/re/udsscanwindow.cpp b/re/udsscanwindow.cpp index dd70cd6..4ff3f1d 100644 --- a/re/udsscanwindow.cpp +++ b/re/udsscanwindow.cpp @@ -26,12 +26,19 @@ UDSScanWindow::UDSScanWindow(const QVector *frames, QWidget *parent) : connect(waitTimer, &QTimer::timeout, this, &UDSScanWindow::timeOut); connect(ui->btnSaveResults, &QPushButton::clicked, this, &UDSScanWindow::saveResults); 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->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(); for (int n = 0; n < numBuses; n++) ui->cbBuses->addItem(QString::number(n)); - ui->cbBuses->addItem(tr("All")); } UDSScanWindow::~UDSScanWindow() @@ -57,10 +64,14 @@ void UDSScanWindow::wildcardToggled() ui->ckSecurity->setEnabled(state); ui->ckSession->setEnabled(state); ui->ckTester->setEnabled(state); + ui->ckReadByAddr->setEnabled(state); + ui->ckReadByID->setEnabled(state); ui->ckReset->setChecked(false); ui->ckSecurity->setChecked(false); ui->ckSession->setChecked(false); ui->ckTester->setChecked(false); + ui->ckReadByAddr->setChecked(false); + ui->ckReadByID->setChecked(false); ui->spinLowerService->setEnabled(!state); ui->spinLowerSubfunc->setEnabled(!state); @@ -69,12 +80,43 @@ void UDSScanWindow::wildcardToggled() 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() { uint64_t upperBound = (1 << (8 * ui->spinNumBytes->value())) - 1; 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() { QString filename; @@ -123,19 +165,19 @@ void UDSScanWindow::dumpNode(QTreeWidgetItem* item, QFile *file, int indent) void UDSScanWindow::sendOnBuses(UDS_MESSAGE test, int buses) { int busList = buses; - if (busList < ui->cbBuses->count() - 1) - { + //if (busList < ui->cbBuses->count() - 1) + //{ test.bus = buses; sendingFrames.append(test); - } - else + //} + /*else { for (int c = 0; c < ui->cbBuses->count() - 1; c++) { test.bus = c; sendingFrames.append(test); } - } + }*/ } void UDSScanWindow::scanUDS() @@ -160,8 +202,8 @@ void UDSScanWindow::scanUDS() UDS_MESSAGE test; int typ, id; int startID, endID; - startID = Utility::ParseStringToNum(ui->txtStartID->text()); - endID = Utility::ParseStringToNum(ui->txtEndID->text()); + startID = ui->spinStartID->value(); + endID = ui->spinEndID->value(); if (endID < startID) { int temp = startID; startID = endID; diff --git a/re/udsscanwindow.h b/re/udsscanwindow.h index 30b0709..33bea56 100644 --- a/re/udsscanwindow.h +++ b/re/udsscanwindow.h @@ -29,7 +29,11 @@ private slots: void timeOut(); void adaptiveToggled(); void wildcardToggled(); + void readByToggled(); void numBytesChanged(); + void checkIDRange(); + void checkServiceRange(); + void checkSubFuncRange(); private: Ui::UDSScanWindow *ui; diff --git a/ui/udsscanwindow.ui b/ui/udsscanwindow.ui index 99ac0bd..4f51117 100644 --- a/ui/udsscanwindow.ui +++ b/ui/udsscanwindow.ui @@ -52,9 +52,18 @@ - - - 0x7E0 + + + 0x + + + 536870911 + + + 2016 + + + 16 @@ -70,9 +79,18 @@ - - - 0x7E7 + + + 0x + + + 536870911 + + + 2024 + + + 16 @@ -123,7 +141,7 @@ - Buses to scan + Bus to scan @@ -174,7 +192,7 @@ - Session Control + Session Ctrl @@ -192,6 +210,24 @@ + + + + + + + + Read By ID + + + + + + + Read By Addr + + +