Updated version, added two new windows (not done), fixed more issues

with how connecting works - it now also stores the last connection so
you can resume using it the next time the program is run.
This commit is contained in:
Collin Kidder
2016-01-26 19:53:15 -05:00
parent 427b2cf326
commit f3cccc2231
12 changed files with 447 additions and 13 deletions
+9 -3
View File
@@ -43,7 +43,9 @@ SOURCES += main.cpp\
canfilter.cpp \
rangestatewindow.cpp \
dbc_classes.cpp \
dbcloadsavewindow.cpp
dbcloadsavewindow.cpp \
fuzzingwindow.cpp \
udsscanwindow.cpp
HEADERS += mainwindow.h \
can_structs.h \
@@ -74,7 +76,9 @@ HEADERS += mainwindow.h \
scriptcontainer.h \
canfilter.h \
rangestatewindow.h \
dbcloadsavewindow.h
dbcloadsavewindow.h \
fuzzingwindow.h \
udsscanwindow.h
FORMS += mainwindow.ui \
graphingwindow.ui \
@@ -93,7 +97,9 @@ FORMS += mainwindow.ui \
connectionwindow.ui \
scriptingwindow.ui \
rangestatewindow.ui \
dbcloadsavewindow.ui
dbcloadsavewindow.ui \
fuzzingwindow.ui \
udsscanwindow.ui
DISTFILES +=
+45 -5
View File
@@ -8,8 +8,20 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
{
ui->setupUi(this);
//getSerialPorts();
getSocketcanPorts();
settings = new QSettings();
int temp = settings->value("Main/DefaultConnectionType", 0).toInt();
if (temp == 0) currentConnType = ConnectionType::GVRET_SERIAL;
if (temp == 1) currentConnType = ConnectionType::KVASER;
if (temp == 2) currentConnType = ConnectionType::SOCKETCAN;
currentPortName = settings->value("Main/DefaultConnectionPort", "").toString();
currentSpeed1 = -1;
currentSpeed2 = -1;
ui->ckSingleWire->setChecked(settings->value("Main/SingleWireMode", false).toBool());
ui->cbSpeed0->addItem(tr("<Default>"));
ui->cbSpeed0->addItem(tr("Disabled"));
@@ -40,6 +52,7 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
ConnectionWindow::~ConnectionWindow()
{
delete settings;
delete ui;
}
@@ -55,10 +68,36 @@ void ConnectionWindow::showEvent(QShowEvent* event)
void ConnectionWindow::handleOKButton()
{
QString conn;
int connType = 0;
if (ui->rbGVRET->isChecked()) conn = "GVRET";
if (ui->rbKvaser->isChecked()) conn = "KVASER";
if (ui->rbSocketCAN->isChecked()) conn = "SOCKETCAN";
if (ui->rbGVRET->isChecked())
{
conn = "GVRET";
connType = 0;
currentConnType = ConnectionType::GVRET_SERIAL;
}
if (ui->rbKvaser->isChecked())
{
conn = "KVASER";
connType = 1;
currentConnType = ConnectionType::KVASER;
}
if (ui->rbSocketCAN->isChecked())
{
conn = "SOCKETCAN";
connType = 2;
currentConnType = ConnectionType::SOCKETCAN;
}
currentPortName = getPortName();
currentSpeed1 = getSpeed0();
currentSpeed2 = getSpeed1();
settings->setValue("Main/DefaultConnectionPort", currentPortName);
settings->setValue("Main/DefaultConnectionType", connType);
settings->setValue("Main/SingleWireMode", ui->ckSingleWire->isChecked());
emit updateConnectionSettings(conn, getPortName(), getSpeed0(), getSpeed1());
@@ -73,6 +112,7 @@ void ConnectionWindow::getSerialPorts()
for (int i = 0; i < ports.count(); i++)
{
ui->cbPort->addItem(ports[i].portName());
if (currentPortName == ports[i].portName()) ui->cbPort->setCurrentIndex(i);
}
}
+6
View File
@@ -4,6 +4,7 @@
#include <QSerialPortInfo>
#include <QDialog>
#include <QDebug>
#include <QSettings>
namespace Ui {
class ConnectionWindow;
@@ -46,6 +47,11 @@ private slots:
private:
Ui::ConnectionWindow *ui;
QList<QSerialPortInfo> ports;
QSettings *settings;
ConnectionType::ConnectionType currentConnType;
QString currentPortName;
int currentSpeed1, currentSpeed2;
void getSerialPorts();
void getKvaserPorts();
+17
View File
@@ -0,0 +1,17 @@
#include "fuzzingwindow.h"
#include "ui_fuzzingwindow.h"
FuzzingWindow::FuzzingWindow(const QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent) :
QDialog(parent),
ui(new Ui::FuzzingWindow)
{
ui->setupUi(this);
modelFrames = frames;
serialWorker = worker;
}
FuzzingWindow::~FuzzingWindow()
{
delete ui;
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef FUZZINGWINDOW_H
#define FUZZINGWINDOW_H
#include <QDialog>
#include "can_structs.h"
#include "serialworker.h"
namespace Ui {
class FuzzingWindow;
}
class FuzzingWindow : public QDialog
{
Q_OBJECT
public:
explicit FuzzingWindow(const QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent = 0);
~FuzzingWindow();
private:
Ui::FuzzingWindow *ui;
const QVector<CANFrame> *modelFrames;
QTimer *fuzzTimer;
SerialWorker *serialWorker;
};
#endif // FUZZINGWINDOW_H
+210
View File
@@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FuzzingWindow</class>
<widget class="QDialog" name="FuzzingWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>760</width>
<height>671</height>
</rect>
</property>
<property name="windowTitle">
<string>Fuzzing Window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,3,6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Interframe Timing</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Burst Rate:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_2"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>ID Scanning</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>Seqential</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>Random</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>ID Selection</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Range of IDs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_4">
<property name="text">
<string>Filter List</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Bit Scanning</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QRadioButton" name="radioButton_5">
<property name="text">
<string>Sequential</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_6">
<property name="text">
<string>Random</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>IDs</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Start ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>End ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QListWidget" name="listWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="CANDataGrid" name="bitfield" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CANDataGrid</class>
<extends>QWidget</extends>
<header>candatagrid.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
+60 -4
View File
@@ -18,7 +18,6 @@ Single / Multi state - The goal is to find bits that change based on toggles or
fuzzy scope - Try to find potential places where a given value might be stored - offer guesses and the program tries to find candidates for you
or, try to find things that appear to be multi-byte integers
Finish coding up support for associating a DBC file with a specific bus
Allow scripts to read/write signals from DBC files
allow scripts to load DBC files in support of the script - maybe the graphing system too.
*/
@@ -97,6 +96,8 @@ MainWindow::MainWindow(QWidget *parent) :
scriptingWindow = NULL;
rangeWindow = NULL;
dbcFileWindow = NULL;
fuzzingWindow = NULL;
udsScanWindow = NULL;
dbcHandler = new DBCHandler;
bDirty = false;
inhibitFilterUpdate = false;
@@ -136,6 +137,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->btnFilterNone, &QAbstractButton::clicked, this, &MainWindow::filterClearAll);
connect(ui->actionFirmware_Uploader, &QAction::triggered, this, &MainWindow::showFirmwareUploaderWindow);
connect(ui->actionDBC_File_Manager, &QAction::triggered, this, &MainWindow::showDBCFileWindow);
connect(ui->actionFuzzing, &QAction::triggered, this, &MainWindow::showFuzzingWindow);
connect(ui->actionUDS_Scanner, &QAction::triggered, this, &MainWindow::showUDSScanWindow);
lbStatusConnected.setText(tr("Not connected"));
updateFileStatus();
@@ -161,6 +164,10 @@ MainWindow::MainWindow(QWidget *parent) :
normalRowHeight = ui->canFramesView->rowHeight(0);
qDebug() << "normal row height = " << normalRowHeight;
model->clearFrames();
//Automatically create the connection window so it can be updated even if we never opened it.
connectionWindow = new ConnectionWindow();
connect(connectionWindow, SIGNAL(updateConnectionSettings(QString,QString,int,int)), this, SLOT(updateConnectionSettings(QString,QString,int,int)));
}
MainWindow::~MainWindow()
@@ -247,6 +254,18 @@ MainWindow::~MainWindow()
delete dbcFileWindow;
}
if (fuzzingWindow)
{
fuzzingWindow->close();
delete fuzzingWindow;
}
if (udsScanWindow)
{
udsScanWindow->close();
delete udsScanWindow;
}
delete ui;
delete dbcHandler;
model->clearFrames();
@@ -268,6 +287,8 @@ void MainWindow::exitApp()
if (scriptingWindow) scriptingWindow->close();
if (rangeWindow) rangeWindow->close();
if (dbcFileWindow) dbcFileWindow->close();
if (fuzzingWindow) fuzzingWindow->close();
if (udsScanWindow) udsScanWindow->close();
this->close();
}
@@ -296,6 +317,20 @@ void MainWindow::readSettings()
{
ui->cbAutoScroll->setChecked(true);
}
int cType = settings.value("Main/DefaultConnectionType", 0).toInt();
if (cType == 0) connType = "GVRET";
if (cType == 1) connType = "KVASER";
if (cType == 2) connType = "SOCKETCAN";
portName = settings.value("Main/DefaultConnectionPort", "").toString();
canSpeed0 = -1;
canSpeed1 = -1;
qDebug() << connType;
qDebug() << portName;
//"Main/SingleWireMode"
readUpdateableSettings();
}
@@ -721,7 +756,7 @@ void MainWindow::connectionSucceeded(int baud0, int baud1)
ui->cbSpeed2->setCurrentIndex(ui->cbSpeed2->count() - 1);
}
*/
connectionWindow->setSpeeds(baud0, baud1);
if (connectionWindow) connectionWindow->setSpeeds(baud0, baud1);
//ui->btnConnect->setEnabled(false);
ui->actionConnect->setText(tr("Disconnect"));
isConnected = true;
@@ -777,8 +812,11 @@ void MainWindow::gotDeviceInfo(int build, int swCAN)
msgBox.exec();
}
if (swCAN == 1) connectionWindow->setCAN1SWMode(true);
else connectionWindow->setCAN1SWMode(false);
if (connectionWindow)
{
if (swCAN == 1) connectionWindow->setCAN1SWMode(true);
else connectionWindow->setCAN1SWMode(false);
}
}
void MainWindow::setTargettedID(int id)
@@ -881,6 +919,24 @@ void MainWindow::showSingleMultiWindow()
discreteStateWindow->show();
}
void MainWindow::showFuzzingWindow()
{
if (!fuzzingWindow)
{
fuzzingWindow = new FuzzingWindow(model->getListReference(), worker);
}
fuzzingWindow->show();
}
void MainWindow::showUDSScanWindow()
{
if (!udsScanWindow)
{
udsScanWindow = new UDSScanWindow;
}
udsScanWindow->show();
}
void MainWindow::showScriptingWindow()
{
if (!scriptingWindow)
+6
View File
@@ -23,6 +23,8 @@
#include "scriptingwindow.h"
#include "rangestatewindow.h"
#include "dbcloadsavewindow.h"
#include "fuzzingwindow.h"
#include "udsscanwindow.h"
namespace Ui {
class MainWindow;
@@ -61,6 +63,8 @@ private slots:
void showConnectionSettingsWindow();
void showScriptingWindow();
void showDBCFileWindow();
void showFuzzingWindow();
void showUDSScanWindow();
void exitApp();
void handleSaveDecoded();
void changeBaudRates();
@@ -129,6 +133,8 @@ private:
ScriptingWindow *scriptingWindow;
RangeStateWindow *rangeWindow;
DBCLoadSaveWindow *dbcFileWindow;
FuzzingWindow *fuzzingWindow;
UDSScanWindow *udsScanWindow;
//various private storage
QLabel lbStatusConnected;
+13 -1
View File
@@ -218,6 +218,8 @@
<addaction name="action_Playback"/>
<addaction name="action_Custom"/>
<addaction name="actionScripting_INterface"/>
<addaction name="actionFuzzing"/>
<addaction name="actionUDS_Scanner"/>
</widget>
<widget class="QMenu" name="menuFile">
<property name="title">
@@ -347,7 +349,7 @@
</action>
<action name="actionSetup">
<property name="text">
<string>Setup</string>
<string>Configure Port</string>
</property>
</action>
<action name="actionConnect">
@@ -375,6 +377,16 @@
<string>DBC File Manager</string>
</property>
</action>
<action name="actionFuzzing">
<property name="text">
<string>Fuzzing</string>
</property>
</action>
<action name="actionUDS_Scanner">
<property name="text">
<string>UDS Scanner</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
+14
View File
@@ -0,0 +1,14 @@
#include "udsscanwindow.h"
#include "ui_udsscanwindow.h"
UDSScanWindow::UDSScanWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::UDSScanWindow)
{
ui->setupUi(this);
}
UDSScanWindow::~UDSScanWindow()
{
delete ui;
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef UDSSCANWINDOW_H
#define UDSSCANWINDOW_H
#include <QDialog>
namespace Ui {
class UDSScanWindow;
}
class UDSScanWindow : public QDialog
{
Q_OBJECT
public:
explicit UDSScanWindow(QWidget *parent = 0);
~UDSScanWindow();
private:
Ui::UDSScanWindow *ui;
};
#endif // UDSSCANWINDOW_H
+18
View File
@@ -0,0 +1,18 @@
<ui version="4.0">
<class>UDSScanWindow</class>
<widget name="UDSScanWindow" class="QDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>