Merge branch 'WIP' into WIP2
Merge WIP into WIP2 in order to add the connection window and change how connections are done.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport printsupport qml
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport printsupport qml
|
||||||
|
|
||||||
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
CONFIG += c++11 qscintilla2
|
CONFIG += c++11 qscintilla2
|
||||||
@@ -36,6 +37,7 @@ SOURCES += main.cpp\
|
|||||||
mainsettingsdialog.cpp \
|
mainsettingsdialog.cpp \
|
||||||
firmwareuploaderwindow.cpp \
|
firmwareuploaderwindow.cpp \
|
||||||
discretestatewindow.cpp \
|
discretestatewindow.cpp \
|
||||||
|
connectionwindow.cpp \
|
||||||
scriptingwindow.cpp \
|
scriptingwindow.cpp \
|
||||||
scriptcontainer.cpp \
|
scriptcontainer.cpp \
|
||||||
canfilter.cpp \
|
canfilter.cpp \
|
||||||
@@ -65,6 +67,7 @@ HEADERS += mainwindow.h \
|
|||||||
mainsettingsdialog.h \
|
mainsettingsdialog.h \
|
||||||
firmwareuploaderwindow.h \
|
firmwareuploaderwindow.h \
|
||||||
discretestatewindow.h \
|
discretestatewindow.h \
|
||||||
|
connectionwindow.h \
|
||||||
scriptingwindow.h \
|
scriptingwindow.h \
|
||||||
scriptcontainer.h \
|
scriptcontainer.h \
|
||||||
canfilter.h \
|
canfilter.h \
|
||||||
@@ -84,6 +87,7 @@ FORMS += mainwindow.ui \
|
|||||||
mainsettingsdialog.ui \
|
mainsettingsdialog.ui \
|
||||||
firmwareuploaderwindow.ui \
|
firmwareuploaderwindow.ui \
|
||||||
discretestatewindow.ui \
|
discretestatewindow.ui \
|
||||||
|
connectionwindow.ui \
|
||||||
scriptingwindow.ui \
|
scriptingwindow.ui \
|
||||||
rangestatewindow.ui
|
rangestatewindow.ui
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CONFIG
|
#ifndef CONFIG
|
||||||
#define CONFIG
|
#define CONFIG
|
||||||
|
|
||||||
#define VERSION 144
|
#define VERSION 145
|
||||||
|
|
||||||
//try to keep this in sync.
|
//try to keep this in sync.
|
||||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
#include "connectionwindow.h"
|
||||||
|
#include "ui_connectionwindow.h"
|
||||||
|
#include <QtNetwork/QNetworkInterface>
|
||||||
|
|
||||||
|
ConnectionWindow::ConnectionWindow(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::ConnectionWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
//getSerialPorts();
|
||||||
|
getSocketcanPorts();
|
||||||
|
|
||||||
|
ui->cbSpeed0->addItem(tr("<Default>"));
|
||||||
|
ui->cbSpeed0->addItem(tr("Disabled"));
|
||||||
|
ui->cbSpeed0->addItem(tr("125000"));
|
||||||
|
ui->cbSpeed0->addItem(tr("250000"));
|
||||||
|
ui->cbSpeed0->addItem(tr("500000"));
|
||||||
|
ui->cbSpeed0->addItem(tr("1000000"));
|
||||||
|
ui->cbSpeed0->addItem(tr("33333"));
|
||||||
|
|
||||||
|
ui->cbSpeed1->addItem(tr("<Default>"));
|
||||||
|
ui->cbSpeed1->addItem(tr("Disabled"));
|
||||||
|
ui->cbSpeed1->addItem(tr("125000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("250000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("500000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("1000000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("33333"));
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
ui->rbSocketCAN->setEnabled(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
ui->rbKvaser->setEnabled(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
connect(ui->btnOK, SIGNAL(clicked(bool)), this, SLOT(handleOKButton()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnectionWindow::~ConnectionWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
QDialog::showEvent(event);
|
||||||
|
qDebug() << "Show connectionwindow";
|
||||||
|
if (ui->rbGVRET->isChecked()) getSerialPorts();
|
||||||
|
if (ui->rbKvaser->isChecked()) getKvaserPorts();
|
||||||
|
if (ui->rbSocketCAN->isChecked()) getSocketcanPorts();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::handleOKButton()
|
||||||
|
{
|
||||||
|
QString conn;
|
||||||
|
|
||||||
|
if (ui->rbGVRET->isChecked()) conn = "GVRET";
|
||||||
|
if (ui->rbKvaser->isChecked()) conn = "KVASER";
|
||||||
|
if (ui->rbSocketCAN->isChecked()) conn = "SOCKETCAN";
|
||||||
|
|
||||||
|
emit updateConnectionSettings(conn, getPortName(), getSpeed0(), getSpeed1());
|
||||||
|
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::getSerialPorts()
|
||||||
|
{
|
||||||
|
ui->cbPort->clear();
|
||||||
|
ports = QSerialPortInfo::availablePorts();
|
||||||
|
|
||||||
|
for (int i = 0; i < ports.count(); i++)
|
||||||
|
{
|
||||||
|
ui->cbPort->addItem(ports[i].portName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::getKvaserPorts()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::getSocketcanPorts()
|
||||||
|
{
|
||||||
|
QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
|
||||||
|
QString interfaceName;
|
||||||
|
|
||||||
|
ui->cbPort->clear();
|
||||||
|
|
||||||
|
foreach (QNetworkInterface interface, interfaces)
|
||||||
|
{
|
||||||
|
interfaceName = interface.name().toLower();
|
||||||
|
qDebug() << "Interface: " << interface.name();
|
||||||
|
if (interfaceName.contains("can"))
|
||||||
|
{
|
||||||
|
ui->cbPort->addItem(interfaceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::setSpeeds(int speed0, int speed1)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < ui->cbSpeed0->count(); i++)
|
||||||
|
{
|
||||||
|
if (ui->cbSpeed0->itemText(i).toInt() == speed0)
|
||||||
|
{
|
||||||
|
ui->cbSpeed0->setCurrentIndex(i);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
ui->cbSpeed0->addItem(QString::number(speed0));
|
||||||
|
ui->cbSpeed0->setCurrentIndex(ui->cbSpeed0->count() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
found = false;
|
||||||
|
for (int i = 0; i < ui->cbSpeed1->count(); i++)
|
||||||
|
{
|
||||||
|
if (ui->cbSpeed1->itemText(i).toInt() == speed1)
|
||||||
|
{
|
||||||
|
ui->cbSpeed1->setCurrentIndex(i);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
ui->cbSpeed1->addItem(QString::number(speed1));
|
||||||
|
ui->cbSpeed1->setCurrentIndex(ui->cbSpeed1->count() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-1 means leave it at whatever it booted up to. 0 means disable. Otherwise the actual rate we want.
|
||||||
|
int ConnectionWindow::getSpeed0()
|
||||||
|
{
|
||||||
|
switch (ui->cbSpeed0->currentIndex())
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return (ui->cbSpeed0->currentText().toInt());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ConnectionWindow::getSpeed1()
|
||||||
|
{
|
||||||
|
switch (ui->cbSpeed1->currentIndex())
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return (ui->cbSpeed1->currentText().toInt());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ConnectionWindow::getPortName()
|
||||||
|
{
|
||||||
|
return (ui->cbPort->currentText());
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnectionType::ConnectionType ConnectionWindow::getConnectionType()
|
||||||
|
{
|
||||||
|
if (ui->rbGVRET->isChecked()) return ConnectionType::GVRET_SERIAL;
|
||||||
|
if (ui->rbKvaser->isChecked()) return ConnectionType::KVASER;
|
||||||
|
if (ui->rbSocketCAN->isChecked()) return ConnectionType::SOCKETCAN;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef CONNECTIONWINDOW_H
|
||||||
|
#define CONNECTIONWINDOW_H
|
||||||
|
|
||||||
|
#include <QSerialPortInfo>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ConnectionWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ConnectionType
|
||||||
|
{
|
||||||
|
enum ConnectionType
|
||||||
|
{
|
||||||
|
GVRET_SERIAL,
|
||||||
|
KVASER,
|
||||||
|
SOCKETCAN
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConnectionWindow : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConnectionWindow(QWidget *parent = 0);
|
||||||
|
~ConnectionWindow();
|
||||||
|
void showEvent(QShowEvent *);
|
||||||
|
int getSpeed0();
|
||||||
|
int getSpeed1();
|
||||||
|
QString getPortName(); //name of port to connect to
|
||||||
|
ConnectionType::ConnectionType getConnectionType();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setSpeeds(int speed0, int speed1);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleOKButton();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ConnectionWindow *ui;
|
||||||
|
QList<QSerialPortInfo> ports;
|
||||||
|
|
||||||
|
void getSerialPorts();
|
||||||
|
void getKvaserPorts();
|
||||||
|
void getSocketcanPorts();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONNECTIONWINDOW_H
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ConnectionWindow</class>
|
||||||
|
<widget class="QWidget" name="ConnectionWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>335</width>
|
||||||
|
<height>235</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Connection Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Connection Type</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbGVRET">
|
||||||
|
<property name="text">
|
||||||
|
<string>GVRET Serial</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbKvaser">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Kvaser</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbSocketCAN">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>SocketCAN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Port:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cbPort"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>CAN0 Speed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>CAN1 Speed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QComboBox" name="cbSpeed0"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="cbSpeed1"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnOK">
|
||||||
|
<property name="text">
|
||||||
|
<string>Update Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
+75
-48
@@ -61,26 +61,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
//enabling the below line kills performance in every way imaginable. Left here as a warning. Do not do this.
|
//enabling the below line kills performance in every way imaginable. Left here as a warning. Do not do this.
|
||||||
//ui->canFramesView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
//ui->canFramesView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
|
||||||
ports = QSerialPortInfo::availablePorts();
|
|
||||||
|
|
||||||
for (int i = 0; i < ports.count(); i++)
|
|
||||||
{
|
|
||||||
ui->cbSerialPorts->addItem(ports[i].portName());
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->cbSpeed1->addItem(tr("Disabled"));
|
|
||||||
ui->cbSpeed1->addItem(tr("125000"));
|
|
||||||
ui->cbSpeed1->addItem(tr("250000"));
|
|
||||||
ui->cbSpeed1->addItem(tr("500000"));
|
|
||||||
ui->cbSpeed1->addItem(tr("1000000"));
|
|
||||||
ui->cbSpeed1->addItem(tr("33333"));
|
|
||||||
ui->cbSpeed2->addItem(tr("Disabled"));
|
|
||||||
ui->cbSpeed2->addItem(tr("125000"));
|
|
||||||
ui->cbSpeed2->addItem(tr("250000"));
|
|
||||||
ui->cbSpeed2->addItem(tr("500000"));
|
|
||||||
ui->cbSpeed2->addItem(tr("1000000"));
|
|
||||||
ui->cbSpeed2->addItem(tr("33333"));
|
|
||||||
|
|
||||||
worker = new SerialWorker(model);
|
worker = new SerialWorker(model);
|
||||||
worker->moveToThread(&serialWorkerThread);
|
worker->moveToThread(&serialWorkerThread);
|
||||||
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||||
@@ -109,6 +89,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
settingsDialog = NULL;
|
settingsDialog = NULL;
|
||||||
firmwareUploaderWindow = NULL;
|
firmwareUploaderWindow = NULL;
|
||||||
discreteStateWindow = NULL;
|
discreteStateWindow = NULL;
|
||||||
|
connectionWindow = NULL;
|
||||||
scriptingWindow = NULL;
|
scriptingWindow = NULL;
|
||||||
rangeWindow = NULL;
|
rangeWindow = NULL;
|
||||||
dbcHandler = new DBCHandler;
|
dbcHandler = new DBCHandler;
|
||||||
@@ -117,7 +98,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
model->setDBCHandler(dbcHandler);
|
model->setDBCHandler(dbcHandler);
|
||||||
|
|
||||||
connect(ui->btnConnect, &QAbstractButton::clicked, this, &MainWindow::connButtonPress);
|
connect(ui->actionSetup, SIGNAL(triggered(bool)), SLOT(showConnectionSettingsWindow()));
|
||||||
|
connect(ui->actionConnect, SIGNAL(triggered(bool)), this, SLOT(connButtonPress()));
|
||||||
connect(ui->actionOpen_Log_File, &QAction::triggered, this, &MainWindow::handleLoadFile);
|
connect(ui->actionOpen_Log_File, &QAction::triggered, this, &MainWindow::handleLoadFile);
|
||||||
connect(ui->actionGraph_Dta, &QAction::triggered, this, &MainWindow::showGraphingWindow);
|
connect(ui->actionGraph_Dta, &QAction::triggered, this, &MainWindow::showGraphingWindow);
|
||||||
connect(ui->actionFrame_Data_Analysis, &QAction::triggered, this, &MainWindow::showFrameDataAnalysis);
|
connect(ui->actionFrame_Data_Analysis, &QAction::triggered, this, &MainWindow::showFrameDataAnalysis);
|
||||||
@@ -239,6 +221,12 @@ MainWindow::~MainWindow()
|
|||||||
delete discreteStateWindow;
|
delete discreteStateWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (connectionWindow)
|
||||||
|
{
|
||||||
|
connectionWindow->close();
|
||||||
|
delete connectionWindow;
|
||||||
|
}
|
||||||
|
|
||||||
if (scriptingWindow)
|
if (scriptingWindow)
|
||||||
{
|
{
|
||||||
scriptingWindow->close();
|
scriptingWindow->close();
|
||||||
@@ -307,6 +295,56 @@ void MainWindow::writeSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1)
|
||||||
|
{
|
||||||
|
connType = connectionType;
|
||||||
|
portName = port;
|
||||||
|
|
||||||
|
canSpeed0 = speed0;
|
||||||
|
canSpeed1 = speed1;
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
emit updateBaudRates(speed0, speed1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::connButtonPress()
|
||||||
|
{
|
||||||
|
if (!isConnected)
|
||||||
|
{
|
||||||
|
if (connType == "GVRET")
|
||||||
|
{
|
||||||
|
QList<QSerialPortInfo> ports;
|
||||||
|
ports = QSerialPortInfo::availablePorts();
|
||||||
|
|
||||||
|
for (int i = 0; i < ports.count(); i++)
|
||||||
|
{
|
||||||
|
if (ports[i].portName() == portName)
|
||||||
|
{
|
||||||
|
portInfo = ports[i];
|
||||||
|
emit sendSerialPort(&portInfo);
|
||||||
|
lbStatusConnected.setText(tr("Attempting to connect to port ") + portName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (connType == "KVASER")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (connType == "SOCKETCAN")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit closeSerialPort();
|
||||||
|
isConnected = false;
|
||||||
|
lbStatusConnected.setText(tr("Not Connected"));
|
||||||
|
ui->actionConnect->setText(tr("Connect"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::gridClicked(QModelIndex idx)
|
void MainWindow::gridClicked(QModelIndex idx)
|
||||||
{
|
{
|
||||||
if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight)
|
if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight)
|
||||||
@@ -451,8 +489,8 @@ void MainWindow::changeBaudRates()
|
|||||||
{
|
{
|
||||||
int Speed1 = 0, Speed2 = 0;
|
int Speed1 = 0, Speed2 = 0;
|
||||||
|
|
||||||
Speed1 = ui->cbSpeed1->currentText().toInt();
|
//Speed1 = ui->cbSpeed1->currentText().toInt();
|
||||||
Speed2 = ui->cbSpeed2->currentText().toInt();
|
//Speed2 = ui->cbSpeed2->currentText().toInt();
|
||||||
|
|
||||||
emit updateBaudRates(Speed1, Speed2);
|
emit updateBaudRates(Speed1, Speed2);
|
||||||
}
|
}
|
||||||
@@ -833,29 +871,6 @@ Data Bytes: 88 10 00 13 BB 00 06 00
|
|||||||
outFile->close();
|
outFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::connButtonPress()
|
|
||||||
{
|
|
||||||
if (!isConnected)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < ports.count(); x++)
|
|
||||||
{
|
|
||||||
if (ports.at(x).portName() == ui->cbSerialPorts->currentText())
|
|
||||||
{
|
|
||||||
emit sendSerialPort(&ports[x]);
|
|
||||||
lbStatusConnected.setText(tr("Attempting to connect to port ") + ports[x].portName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emit closeSerialPort();
|
|
||||||
isConnected = false;
|
|
||||||
lbStatusConnected.setText(tr("Not Connected"));
|
|
||||||
ui->btnConnect->setText(tr("Connect to GVRET"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::toggleCapture()
|
void MainWindow::toggleCapture()
|
||||||
{
|
{
|
||||||
allowCapture = !allowCapture;
|
allowCapture = !allowCapture;
|
||||||
@@ -876,7 +891,7 @@ void MainWindow::connectionSucceeded(int baud0, int baud1)
|
|||||||
lbStatusConnected.setText(tr("Connected to GVRET"));
|
lbStatusConnected.setText(tr("Connected to GVRET"));
|
||||||
//finally, find the baud rate in the list of rates or
|
//finally, find the baud rate in the list of rates or
|
||||||
//add it to the bottom if needed (that'll be weird though...
|
//add it to the bottom if needed (that'll be weird though...
|
||||||
|
/*
|
||||||
int idx = ui->cbSpeed1->findText(QString::number(baud0));
|
int idx = ui->cbSpeed1->findText(QString::number(baud0));
|
||||||
if (idx > -1) ui->cbSpeed1->setCurrentIndex(idx);
|
if (idx > -1) ui->cbSpeed1->setCurrentIndex(idx);
|
||||||
else
|
else
|
||||||
@@ -892,8 +907,9 @@ void MainWindow::connectionSucceeded(int baud0, int baud1)
|
|||||||
ui->cbSpeed2->addItem(QString::number(baud1));
|
ui->cbSpeed2->addItem(QString::number(baud1));
|
||||||
ui->cbSpeed2->setCurrentIndex(ui->cbSpeed2->count() - 1);
|
ui->cbSpeed2->setCurrentIndex(ui->cbSpeed2->count() - 1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//ui->btnConnect->setEnabled(false);
|
//ui->btnConnect->setEnabled(false);
|
||||||
ui->btnConnect->setText(tr("Disconnect from GVRET"));
|
ui->actionConnect->setText(tr("Disconnect"));
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1081,6 +1097,7 @@ void MainWindow::exitApp()
|
|||||||
if (frameSenderWindow) frameSenderWindow->close();
|
if (frameSenderWindow) frameSenderWindow->close();
|
||||||
if (dbcMainEditor) dbcMainEditor->close();
|
if (dbcMainEditor) dbcMainEditor->close();
|
||||||
if (comparatorWindow) comparatorWindow->close();
|
if (comparatorWindow) comparatorWindow->close();
|
||||||
|
if (connectionWindow) connectionWindow->close();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,3 +1131,13 @@ void MainWindow::showDBCEditor()
|
|||||||
}
|
}
|
||||||
dbcMainEditor->show();
|
dbcMainEditor->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showConnectionSettingsWindow()
|
||||||
|
{
|
||||||
|
if (!connectionWindow)
|
||||||
|
{
|
||||||
|
connectionWindow = new ConnectionWindow();
|
||||||
|
connect(connectionWindow, SIGNAL(updateConnectionSettings(QString,QString,int,int)), this, SLOT(updateConnectionSettings(QString,QString,int,int)));
|
||||||
|
}
|
||||||
|
connectionWindow->show();
|
||||||
|
}
|
||||||
|
|||||||
+14
-2
@@ -19,6 +19,7 @@
|
|||||||
#include "mainsettingsdialog.h"
|
#include "mainsettingsdialog.h"
|
||||||
#include "firmwareuploaderwindow.h"
|
#include "firmwareuploaderwindow.h"
|
||||||
#include "discretestatewindow.h"
|
#include "discretestatewindow.h"
|
||||||
|
#include "connectionwindow.h"
|
||||||
#include "scriptingwindow.h"
|
#include "scriptingwindow.h"
|
||||||
#include "rangestatewindow.h"
|
#include "rangestatewindow.h"
|
||||||
|
|
||||||
@@ -58,7 +59,11 @@ private slots:
|
|||||||
void showComparisonWindow();
|
void showComparisonWindow();
|
||||||
void showSettingsDialog();
|
void showSettingsDialog();
|
||||||
void showFirmwareUploaderWindow();
|
void showFirmwareUploaderWindow();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
void showConnectionSettingsWindow();
|
||||||
|
=======
|
||||||
void showScriptingWindow();
|
void showScriptingWindow();
|
||||||
|
>>>>>>> WIP2
|
||||||
void exitApp();
|
void exitApp();
|
||||||
void handleSaveDecoded();
|
void handleSaveDecoded();
|
||||||
void changeBaudRates();
|
void changeBaudRates();
|
||||||
@@ -81,6 +86,7 @@ public slots:
|
|||||||
void gotFrames(int, int);
|
void gotFrames(int, int);
|
||||||
void updateSettings();
|
void updateSettings();
|
||||||
void gotCenterTimeID(int32_t ID, double timestamp);
|
void gotCenterTimeID(int32_t ID, double timestamp);
|
||||||
|
void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendSerialPort(QSerialPortInfo *port);
|
void sendSerialPort(QSerialPortInfo *port);
|
||||||
@@ -101,8 +107,7 @@ private:
|
|||||||
|
|
||||||
//canbus related data
|
//canbus related data
|
||||||
CANFrameModel *model;
|
CANFrameModel *model;
|
||||||
DBCHandler *dbcHandler;
|
DBCHandler *dbcHandler;
|
||||||
QList<QSerialPortInfo> ports;
|
|
||||||
QThread serialWorkerThread;
|
QThread serialWorkerThread;
|
||||||
SerialWorker *worker;
|
SerialWorker *worker;
|
||||||
QByteArray inputBuffer;
|
QByteArray inputBuffer;
|
||||||
@@ -124,8 +129,12 @@ private:
|
|||||||
MainSettingsDialog *settingsDialog;
|
MainSettingsDialog *settingsDialog;
|
||||||
DiscreteStateWindow *discreteStateWindow;
|
DiscreteStateWindow *discreteStateWindow;
|
||||||
FirmwareUploaderWindow *firmwareUploaderWindow;
|
FirmwareUploaderWindow *firmwareUploaderWindow;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
ConnectionWindow *connectionWindow;
|
||||||
|
=======
|
||||||
ScriptingWindow *scriptingWindow;
|
ScriptingWindow *scriptingWindow;
|
||||||
RangeStateWindow *rangeWindow;
|
RangeStateWindow *rangeWindow;
|
||||||
|
>>>>>>> WIP2
|
||||||
|
|
||||||
//various private storage
|
//various private storage
|
||||||
QLabel lbStatusConnected;
|
QLabel lbStatusConnected;
|
||||||
@@ -133,6 +142,9 @@ private:
|
|||||||
QLabel lbStatusDatabase;
|
QLabel lbStatusDatabase;
|
||||||
int normalRowHeight;
|
int normalRowHeight;
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
|
QSerialPortInfo portInfo;
|
||||||
|
QString connType, portName;
|
||||||
|
int canSpeed0, canSpeed1;
|
||||||
|
|
||||||
//private methods
|
//private methods
|
||||||
void saveDecodedTextFile(QString);
|
void saveDecodedTextFile(QString);
|
||||||
|
|||||||
+16
-106
@@ -46,102 +46,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Serial Port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cbSerialPorts"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnConnect">
|
|
||||||
<property name="text">
|
|
||||||
<string>Connect To GVRET</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>CANBus Speeds:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>First Bus:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cbSpeed1"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>7</number>
|
|
||||||
</property>
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Second Bus:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cbSpeed2"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnBaudSet">
|
|
||||||
<property name="text">
|
|
||||||
<string>Set CANBUS Speeds</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -335,9 +239,17 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit_Application"/>
|
<addaction name="actionExit_Application"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuConnection">
|
||||||
|
<property name="title">
|
||||||
|
<string>Connection</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionSetup"/>
|
||||||
|
<addaction name="actionConnect"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menu_RE_Tools"/>
|
<addaction name="menu_RE_Tools"/>
|
||||||
<addaction name="menuSend_Frames"/>
|
<addaction name="menuSend_Frames"/>
|
||||||
|
<addaction name="menuConnection"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="action_Playback">
|
<action name="action_Playback">
|
||||||
@@ -350,16 +262,6 @@
|
|||||||
<string>Custom</string>
|
<string>Custom</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSingle_Multi_State">
|
|
||||||
<property name="text">
|
|
||||||
<string>Single / Multi State</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionRange_State">
|
|
||||||
<property name="text">
|
|
||||||
<string>Range State</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionFlow_View">
|
<action name="actionFlow_View">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Flow View</string>
|
<string>Flow View</string>
|
||||||
@@ -445,6 +347,14 @@
|
|||||||
<string>Firmware Uploader</string>
|
<string>Firmware Uploader</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSetup">
|
||||||
|
<property name="text">
|
||||||
|
<string>Setup</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionConnect">
|
||||||
|
<property name="text">
|
||||||
|
<string>Connect</string>
|
||||||
<action name="actionScripting_INterface">
|
<action name="actionScripting_INterface">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Scripting Interface</string>
|
<string>Scripting Interface</string>
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@ void SerialWorker::setSerialPort(QSerialPortInfo *port)
|
|||||||
delete serial;
|
delete serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial = new QSerialPort(*port);
|
serial = new QSerialPort(*port);
|
||||||
|
|
||||||
qDebug() << "Serial port name is " << port->portName();
|
qDebug() << "Serial port name is " << port->portName();
|
||||||
//serial->setBaudRate(10000000); //more speed! probably does nothing for USB serial
|
//serial->setBaudRate(10000000); //more speed! probably does nothing for USB serial
|
||||||
|
|||||||
Reference in New Issue
Block a user