Additional implementation of the new connection scheme. It is now possible to send frames to CANConnection objects indirectly based on registered bus number.
This further abstracts the interface. Things are reasonably stable now for frame reception. Initial work has been done to support frame transmission as well. This is currently less stable but mostly working.
This commit is contained in:
+74
-3
@@ -10,6 +10,10 @@ ConnectionWindow::ConnectionWindow(CANFrameModel *cModel, QWidget *parent) :
|
|||||||
|
|
||||||
settings = new QSettings();
|
settings = new QSettings();
|
||||||
|
|
||||||
|
qRegisterMetaType<CAN_Bus *>("CAN_Bus *");
|
||||||
|
qRegisterMetaType<const CANFrame *>("const CANFrame *");
|
||||||
|
qRegisterMetaType<const QList<CANFrame> *>("const QList<CANFrame> *");
|
||||||
|
|
||||||
connModel = new CANConnectionModel();
|
connModel = new CANConnectionModel();
|
||||||
ui->tableConnections->setModel(connModel);
|
ui->tableConnections->setModel(connModel);
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ ConnectionWindow::ConnectionWindow(CANFrameModel *cModel, QWidget *parent) :
|
|||||||
connect(ui->rbSocketCAN, &QAbstractButton::toggled, this, &ConnectionWindow::handleConnTypeChanged);
|
connect(ui->rbSocketCAN, &QAbstractButton::toggled, this, &ConnectionWindow::handleConnTypeChanged);
|
||||||
connect(ui->btnRevert, &QPushButton::clicked, this, &ConnectionWindow::handleRevert);
|
connect(ui->btnRevert, &QPushButton::clicked, this, &ConnectionWindow::handleRevert);
|
||||||
connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ConnectionWindow::handleConnSelectionChanged);
|
connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ConnectionWindow::handleConnSelectionChanged);
|
||||||
|
connect(ui->btnNewConn, &QPushButton::clicked, this, &ConnectionWindow::handleNewConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionWindow::~ConnectionWindow()
|
ConnectionWindow::~ConnectionWindow()
|
||||||
@@ -68,6 +73,13 @@ void ConnectionWindow::showEvent(QShowEvent* event)
|
|||||||
handleConnTypeChanged();
|
handleConnTypeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::handleNewConn()
|
||||||
|
{
|
||||||
|
ui->tableConnections->selectionModel()->clearSelection();
|
||||||
|
ui->tableConnections->selectionModel()->clearCurrentIndex();
|
||||||
|
handleConnSelectionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void ConnectionWindow::handleConnTypeChanged()
|
void ConnectionWindow::handleConnTypeChanged()
|
||||||
{
|
{
|
||||||
if (ui->rbGVRET->isChecked()) getSerialPorts();
|
if (ui->rbGVRET->isChecked()) getSerialPorts();
|
||||||
@@ -79,10 +91,29 @@ void ConnectionWindow::handleOKButton()
|
|||||||
{
|
{
|
||||||
QString conn;
|
QString conn;
|
||||||
int connType = 0;
|
int connType = 0;
|
||||||
|
int whichRow = ui->tableConnections->selectionModel()->currentIndex().row();
|
||||||
|
qDebug() << whichRow;
|
||||||
|
|
||||||
if (ui->tableConnections->selectionModel()->currentIndex().row() >= 0)
|
if (whichRow > -1)
|
||||||
{
|
{
|
||||||
|
//load settings from GUI into appropriate CAN_Bus entry and then send it off to the appropriate
|
||||||
|
//CANConnection object
|
||||||
|
CAN_Bus *bus = connModel->getBus(whichRow);
|
||||||
|
bus->setListenOnly(ui->ckListenOnly->isChecked());
|
||||||
|
bus->setSingleWire(ui->ckSingleWire->isChecked());
|
||||||
|
if (ui->cbSpeed->currentIndex() == 1)
|
||||||
|
{
|
||||||
|
bus->speed = 0;
|
||||||
|
bus->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (ui->cbSpeed->currentIndex() > 1)
|
||||||
|
{
|
||||||
|
bus->setSpeed(ui->cbSpeed->currentText().toInt());
|
||||||
|
}
|
||||||
|
//call through signal/slot interface without using connect
|
||||||
|
QMetaObject::invokeMethod(bus->connection, "updateBusSettings",
|
||||||
|
Qt::QueuedConnection,
|
||||||
|
Q_ARG(CAN_Bus *, bus));
|
||||||
}
|
}
|
||||||
else //new connection
|
else //new connection
|
||||||
{
|
{
|
||||||
@@ -162,13 +193,34 @@ void ConnectionWindow::receiveBusStatus(int bus, int speed, int status)
|
|||||||
void ConnectionWindow::handleConnSelectionChanged()
|
void ConnectionWindow::handleConnSelectionChanged()
|
||||||
{
|
{
|
||||||
int selIdx = ui->tableConnections->selectionModel()->currentIndex().row();
|
int selIdx = ui->tableConnections->selectionModel()->currentIndex().row();
|
||||||
if (selIdx == 0)
|
qDebug() << selIdx;
|
||||||
|
if (selIdx == -1)
|
||||||
{
|
{
|
||||||
ui->btnOK->setText(tr("Create New Connection"));
|
ui->btnOK->setText(tr("Create New Connection"));
|
||||||
|
ui->cbPort->setEnabled(true);
|
||||||
|
ui->rbGVRET->setEnabled(true);
|
||||||
|
ui->rbKvaser->setEnabled(true);
|
||||||
|
ui->rbSocketCAN->setEnabled(true);
|
||||||
|
ui->cbPort->setCurrentIndex(0);
|
||||||
|
ui->ckListenOnly->setChecked(false);
|
||||||
|
ui->ckSingleWire->setChecked(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->btnOK->setText(tr("Update Connection Settings"));
|
ui->btnOK->setText(tr("Update Connection Settings"));
|
||||||
|
ui->cbPort->setEnabled(false);
|
||||||
|
ui->rbGVRET->setEnabled(false);
|
||||||
|
ui->rbKvaser->setEnabled(false);
|
||||||
|
ui->rbSocketCAN->setEnabled(false);
|
||||||
|
CAN_Bus *bus = connModel->getBus(selIdx);
|
||||||
|
if (bus->connection->getConnTypeName() == "GVRET") ui->rbGVRET->setChecked(true);
|
||||||
|
if (bus->connection->getConnTypeName() == "KVASER") ui->rbKvaser->setChecked(true);
|
||||||
|
if (bus->connection->getConnTypeName() == "SOCKETCAN") ui->rbSocketCAN->setChecked(true);
|
||||||
|
ui->ckListenOnly->setChecked(bus->isListenOnly());
|
||||||
|
ui->ckSingleWire->setChecked(bus->isSingleWire());
|
||||||
|
int speed = bus->getSpeed();
|
||||||
|
setSpeed(speed);
|
||||||
|
connModel->refreshView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,3 +336,22 @@ void ConnectionWindow::handleRevert()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::sendFrame(const CANFrame *frame)
|
||||||
|
{
|
||||||
|
CAN_Bus *bus = connModel->getBus(frame->bus);
|
||||||
|
if (bus == NULL) return;
|
||||||
|
QMetaObject::invokeMethod(bus->connection, "sendFrame",
|
||||||
|
Qt::QueuedConnection,
|
||||||
|
Q_ARG(const CANFrame *, frame));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionWindow::sendFrameBatch(const QList<CANFrame> *frames)
|
||||||
|
{
|
||||||
|
if (frames->count() == 0) return;
|
||||||
|
CAN_Bus *bus = connModel->getBus(frames->at(0).bus);
|
||||||
|
if (bus == NULL) return;
|
||||||
|
QMetaObject::invokeMethod(bus->connection, "sendFrameBatch",
|
||||||
|
Qt::QueuedConnection,
|
||||||
|
Q_ARG(const QList<CANFrame> *, frames));
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void setSpeed(int speed0);
|
void setSpeed(int speed0);
|
||||||
void setSWMode(bool mode);
|
void setSWMode(bool mode);
|
||||||
|
void sendFrame(const CANFrame *);
|
||||||
|
void sendFrameBatch(const QList<CANFrame> *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleOKButton();
|
void handleOKButton();
|
||||||
@@ -53,6 +55,7 @@ private slots:
|
|||||||
void handleConnSelectionChanged();
|
void handleConnSelectionChanged();
|
||||||
void handleRemoveConn();
|
void handleRemoveConn();
|
||||||
void handleRevert();
|
void handleRevert();
|
||||||
|
void handleNewConn();
|
||||||
void receiveBusStatus(int bus, int speed, int status);
|
void receiveBusStatus(int bus, int speed, int status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -33,6 +33,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnNewConn">
|
||||||
|
<property name="text">
|
||||||
|
<string>New Connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ void FirmwareUploaderWindow::sendFirmwareChunk()
|
|||||||
int xorByte = 0;
|
int xorByte = 0;
|
||||||
output->extended = false;
|
output->extended = false;
|
||||||
output->len = 7;
|
output->len = 7;
|
||||||
|
output->bus = bus;
|
||||||
output->ID = baseAddress + 0x16;
|
output->ID = baseAddress + 0x16;
|
||||||
output->data[0] = currentSendingPosition & 0xFF;
|
output->data[0] = currentSendingPosition & 0xFF;
|
||||||
output->data[1] = (currentSendingPosition >> 8) & 0xFF;
|
output->data[1] = (currentSendingPosition >> 8) & 0xFF;
|
||||||
@@ -134,7 +135,7 @@ void FirmwareUploaderWindow::sendFirmwareChunk()
|
|||||||
output->data[5] = firmwareData[firmwareLocation++];
|
output->data[5] = firmwareData[firmwareLocation++];
|
||||||
for (int i = 0; i < 6; i++) xorByte = xorByte ^ output->data[i];
|
for (int i = 0; i < 6; i++) xorByte = xorByte ^ output->data[i];
|
||||||
output->data[6] = xorByte;
|
output->data[6] = xorByte;
|
||||||
sendCANFrame(output, bus);
|
sendCANFrame(output);
|
||||||
timer->start();
|
timer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,13 +143,14 @@ void FirmwareUploaderWindow::sendFirmwareEnding()
|
|||||||
{
|
{
|
||||||
CANFrame *output = new CANFrame;
|
CANFrame *output = new CANFrame;
|
||||||
output->extended = false;
|
output->extended = false;
|
||||||
|
output->bus = bus;
|
||||||
output->len = 4;
|
output->len = 4;
|
||||||
output->ID = baseAddress + 0x30;
|
output->ID = baseAddress + 0x30;
|
||||||
output->data[0] = 0xC0;
|
output->data[0] = 0xC0;
|
||||||
output->data[1] = 0xDE;
|
output->data[1] = 0xDE;
|
||||||
output->data[2] = 0xFA;
|
output->data[2] = 0xFA;
|
||||||
output->data[3] = 0xDE;
|
output->data[3] = 0xDE;
|
||||||
sendCANFrame(output, bus);
|
sendCANFrame(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwareUploaderWindow::handleStartStopTransfer()
|
void FirmwareUploaderWindow::handleStartStopTransfer()
|
||||||
@@ -167,6 +169,7 @@ void FirmwareUploaderWindow::handleStartStopTransfer()
|
|||||||
CANFrame *output = new CANFrame;
|
CANFrame *output = new CANFrame;
|
||||||
output->extended = false;
|
output->extended = false;
|
||||||
output->len = 8;
|
output->len = 8;
|
||||||
|
output->bus = bus;
|
||||||
output->ID = baseAddress;
|
output->ID = baseAddress;
|
||||||
output->data[0] = 0xDE;
|
output->data[0] = 0xDE;
|
||||||
output->data[1] = 0xAD;
|
output->data[1] = 0xAD;
|
||||||
@@ -176,7 +179,7 @@ void FirmwareUploaderWindow::handleStartStopTransfer()
|
|||||||
output->data[5] = (token >> 8) & 0xFF;
|
output->data[5] = (token >> 8) & 0xFF;
|
||||||
output->data[6] = (token >> 16) & 0xFF;
|
output->data[6] = (token >> 16) & 0xFF;
|
||||||
output->data[7] = (token >> 24) & 0xFF;
|
output->data[7] = (token >> 24) & 0xFF;
|
||||||
sendCANFrame(output, bus);
|
sendCANFrame(output);
|
||||||
}
|
}
|
||||||
else //stop anything in process
|
else //stop anything in process
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
~FirmwareUploaderWindow();
|
~FirmwareUploaderWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void gotTargettedFrame(int frameLoc);
|
void gotTargettedFrame(int frameLoc);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent) :
|
FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FramePlaybackWindow)
|
ui(new Ui::FramePlaybackWindow)
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,6 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, Serial
|
|||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
modelFrames = frames;
|
modelFrames = frames;
|
||||||
serialWorker = worker;
|
|
||||||
|
|
||||||
playbackTimer = new QTimer();
|
playbackTimer = new QTimer();
|
||||||
|
|
||||||
@@ -70,9 +69,6 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, Serial
|
|||||||
|
|
||||||
playbackTimer->setInterval(ui->spinPlaySpeed->value()); //set the timer to the default value of the control
|
playbackTimer->setInterval(ui->spinPlaySpeed->value()); //set the timer to the default value of the control
|
||||||
|
|
||||||
connect(this, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)), Qt::QueuedConnection);
|
|
||||||
connect(this, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), worker, SLOT(sendFrameBatch(const QList<CANFrame>*)), Qt::QueuedConnection);
|
|
||||||
|
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
headers << "Source" << "Loops";
|
headers << "Source" << "Loops";
|
||||||
ui->tblSequence->setColumnCount(2);
|
ui->tblSequence->setColumnCount(2);
|
||||||
@@ -85,8 +81,6 @@ FramePlaybackWindow::~FramePlaybackWindow()
|
|||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
disconnect(serialWorker);
|
|
||||||
|
|
||||||
playbackTimer->stop();
|
playbackTimer->stop();
|
||||||
delete playbackTimer;
|
delete playbackTimer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class FramePlaybackWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FramePlaybackWindow(const QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent = 0);
|
explicit FramePlaybackWindow(const QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||||
~FramePlaybackWindow();
|
~FramePlaybackWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -54,7 +54,7 @@ private slots:
|
|||||||
void loadFilters();
|
void loadFilters();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
void sendFrameBatch(const QList<CANFrame> *);
|
void sendFrameBatch(const QList<CANFrame> *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -65,7 +65,6 @@ private:
|
|||||||
const QVector<CANFrame> *modelFrames;
|
const QVector<CANFrame> *modelFrames;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
QTimer *playbackTimer;
|
QTimer *playbackTimer;
|
||||||
SerialWorker *serialWorker;
|
|
||||||
bool playbackActive;
|
bool playbackActive;
|
||||||
bool playbackForward;
|
bool playbackForward;
|
||||||
int whichBusSend;
|
int whichBusSend;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void FrameSenderWindow::processIncomingFrame(CANFrame *frame)
|
|||||||
sendingData[sd].count++;
|
sendingData[sd].count++;
|
||||||
doModifiers(sd);
|
doModifiers(sd);
|
||||||
updateGridRow(sd);
|
updateGridRow(sd);
|
||||||
sendCANFrame(&sendingData[sd], sendingData[sd].bus);
|
sendCANFrame(&sendingData[sd]);
|
||||||
}
|
}
|
||||||
else //delayed sending frame
|
else //delayed sending frame
|
||||||
{
|
{
|
||||||
@@ -354,7 +354,7 @@ void FrameSenderWindow::handleTick()
|
|||||||
doModifiers(i);
|
doModifiers(i);
|
||||||
updateGridRow(i);
|
updateGridRow(i);
|
||||||
qDebug() << "About to try to send a frame";
|
qDebug() << "About to try to send a frame";
|
||||||
emit sendCANFrame(&sendingData[i], sendingData[i].bus);
|
emit sendCANFrame(&sendingData[i]);
|
||||||
if (trigger->ID > 0) trigger->readyCount = false; //reset flag if this is a timed ID trigger
|
if (trigger->ID > 0) trigger->readyCount = false; //reset flag if this is a timed ID trigger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ private slots:
|
|||||||
void updatedFrames(int);
|
void updatedFrames(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FrameSenderWindow *ui;
|
Ui::FrameSenderWindow *ui;
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ public:
|
|||||||
~FuzzingWindow();
|
~FuzzingWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
void sendFrameBatch(const QList<CANFrame> *);
|
void sendFrameBatch(const QList<CANFrame> *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
+22
-19
@@ -184,8 +184,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
serialWorkerThread.quit();
|
//serialWorkerThread.quit();
|
||||||
serialWorkerThread.wait();
|
//serialWorkerThread.wait();
|
||||||
//delete worker;
|
//delete worker;
|
||||||
|
|
||||||
if (graphingWindow)
|
if (graphingWindow)
|
||||||
@@ -339,16 +339,16 @@ void MainWindow::readSettings()
|
|||||||
ui->cbAutoScroll->setChecked(true);
|
ui->cbAutoScroll->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int cType = settings.value("Main/DefaultConnectionType", 0).toInt();
|
int cType = settings.value("Main/DefaultConnectionType", 0).toInt();
|
||||||
if (cType == 0) connType = "GVRET";
|
if (cType == 0) connType = "GVRET";
|
||||||
if (cType == 1) connType = "KVASER";
|
if (cType == 1) connType = "KVASER";
|
||||||
if (cType == 2) connType = "SOCKETCAN";
|
if (cType == 2) connType = "SOCKETCAN";
|
||||||
portName = settings.value("Main/DefaultConnectionPort", "").toString();
|
portName = settings.value("Main/DefaultConnectionPort", "").toString();
|
||||||
canSpeed0 = -1;
|
*/
|
||||||
canSpeed1 = -1;
|
|
||||||
|
|
||||||
qDebug() << connType;
|
//qDebug() << connType;
|
||||||
qDebug() << portName;
|
//qDebug() << portName;
|
||||||
|
|
||||||
//"Main/SingleWireMode"
|
//"Main/SingleWireMode"
|
||||||
|
|
||||||
@@ -379,11 +379,11 @@ void MainWindow::writeSettings()
|
|||||||
|
|
||||||
void MainWindow::updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1)
|
void MainWindow::updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1)
|
||||||
{
|
{
|
||||||
connType = connectionType;
|
//connType = connectionType;
|
||||||
portName = port;
|
//portName = port;
|
||||||
|
|
||||||
canSpeed0 = speed0;
|
//canSpeed0 = speed0;
|
||||||
canSpeed1 = speed1;
|
//canSpeed1 = speed1;
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
{
|
{
|
||||||
//emit updateBaudRates(speed0, speed1);
|
//emit updateBaudRates(speed0, speed1);
|
||||||
@@ -863,7 +863,7 @@ void MainWindow::showFrameSenderWindow()
|
|||||||
else
|
else
|
||||||
frameSenderWindow = new FrameSenderWindow(model->getFilteredListReference());
|
frameSenderWindow = new FrameSenderWindow(model->getFilteredListReference());
|
||||||
|
|
||||||
connect(frameSenderWindow, &FrameSenderWindow::sendCANFrame, worker, &SerialWorker::sendFrame);
|
connect(frameSenderWindow, &FrameSenderWindow::sendCANFrame, connectionWindow, &ConnectionWindow::sendFrame);
|
||||||
}
|
}
|
||||||
frameSenderWindow->show();
|
frameSenderWindow->show();
|
||||||
}
|
}
|
||||||
@@ -873,9 +873,12 @@ void MainWindow::showPlaybackWindow()
|
|||||||
if (!playbackWindow)
|
if (!playbackWindow)
|
||||||
{
|
{
|
||||||
if (!useFiltered)
|
if (!useFiltered)
|
||||||
playbackWindow = new FramePlaybackWindow(model->getListReference(), worker);
|
playbackWindow = new FramePlaybackWindow(model->getListReference());
|
||||||
else
|
else
|
||||||
playbackWindow = new FramePlaybackWindow(model->getFilteredListReference(), worker);
|
playbackWindow = new FramePlaybackWindow(model->getFilteredListReference());
|
||||||
|
|
||||||
|
connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)), Qt::QueuedConnection);
|
||||||
|
connect(playbackWindow, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), connectionWindow, SLOT(sendFrameBatch(const QList<CANFrame>*)), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
playbackWindow->show();
|
playbackWindow->show();
|
||||||
}
|
}
|
||||||
@@ -885,8 +888,8 @@ void MainWindow::showFirmwareUploaderWindow()
|
|||||||
if (!firmwareUploaderWindow)
|
if (!firmwareUploaderWindow)
|
||||||
{
|
{
|
||||||
firmwareUploaderWindow = new FirmwareUploaderWindow(model->getListReference());
|
firmwareUploaderWindow = new FirmwareUploaderWindow(model->getListReference());
|
||||||
connect(firmwareUploaderWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)));
|
connect(firmwareUploaderWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)));
|
||||||
connect(worker, SIGNAL(gotTargettedFrame(int)), firmwareUploaderWindow, SLOT(gotTargettedFrame(int)));
|
//connect(worker, SIGNAL(gotTargettedFrame(int)), firmwareUploaderWindow, SLOT(gotTargettedFrame(int)));
|
||||||
}
|
}
|
||||||
firmwareUploaderWindow->show();
|
firmwareUploaderWindow->show();
|
||||||
}
|
}
|
||||||
@@ -914,8 +917,8 @@ void MainWindow::showFuzzingWindow()
|
|||||||
if (!fuzzingWindow)
|
if (!fuzzingWindow)
|
||||||
{
|
{
|
||||||
fuzzingWindow = new FuzzingWindow(model->getListReference());
|
fuzzingWindow = new FuzzingWindow(model->getListReference());
|
||||||
connect(fuzzingWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)));
|
connect(fuzzingWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)));
|
||||||
connect(fuzzingWindow, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), worker, SLOT(sendFrameBatch(const QList<CANFrame>*)));
|
connect(fuzzingWindow, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), connectionWindow, SLOT(sendFrameBatch(const QList<CANFrame>*)));
|
||||||
}
|
}
|
||||||
fuzzingWindow->show();
|
fuzzingWindow->show();
|
||||||
}
|
}
|
||||||
@@ -925,7 +928,7 @@ void MainWindow::showUDSScanWindow()
|
|||||||
if (!udsScanWindow)
|
if (!udsScanWindow)
|
||||||
{
|
{
|
||||||
udsScanWindow = new UDSScanWindow(model->getListReference());
|
udsScanWindow = new UDSScanWindow(model->getListReference());
|
||||||
connect(udsScanWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)));
|
connect(udsScanWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), connectionWindow, SLOT(sendFrame(const CANFrame*)));
|
||||||
}
|
}
|
||||||
udsScanWindow->show();
|
udsScanWindow->show();
|
||||||
}
|
}
|
||||||
@@ -935,7 +938,7 @@ void MainWindow::showScriptingWindow()
|
|||||||
if (!scriptingWindow)
|
if (!scriptingWindow)
|
||||||
{
|
{
|
||||||
scriptingWindow = new ScriptingWindow(model->getListReference());
|
scriptingWindow = new ScriptingWindow(model->getListReference());
|
||||||
connect(scriptingWindow, &ScriptingWindow::sendCANFrame, worker, &SerialWorker::sendFrame);
|
connect(scriptingWindow, &ScriptingWindow::sendCANFrame, connectionWindow, &ConnectionWindow::sendFrame);
|
||||||
}
|
}
|
||||||
scriptingWindow->show();
|
scriptingWindow->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,8 +108,6 @@ private:
|
|||||||
//canbus related data
|
//canbus related data
|
||||||
CANFrameModel *model;
|
CANFrameModel *model;
|
||||||
DBCHandler *dbcHandler;
|
DBCHandler *dbcHandler;
|
||||||
QThread serialWorkerThread;
|
|
||||||
SerialWorker *worker;
|
|
||||||
QByteArray inputBuffer;
|
QByteArray inputBuffer;
|
||||||
QTimer updateTimer;
|
QTimer updateTimer;
|
||||||
QTime *elapsedTime;
|
QTime *elapsedTime;
|
||||||
@@ -147,9 +145,6 @@ 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);
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ void ScriptContainer::sendFrame(QJSValue bus, QJSValue id, QJSValue length, QJSV
|
|||||||
if (frame.ID > 0x7FF) frame.extended = true;
|
if (frame.ID > 0x7FF) frame.extended = true;
|
||||||
|
|
||||||
//qDebug() << "Sending frame from script";
|
//qDebug() << "Sending frame from script";
|
||||||
emit sendCANFrame(&frame, frame.bus);
|
emit sendCANFrame(&frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptContainer::gotFrame(const CANFrame &frame)
|
void ScriptContainer::gotFrame(const CANFrame &frame)
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ private slots:
|
|||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QJSEngine scriptEngine;
|
QJSEngine scriptEngine;
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ private slots:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|||||||
@@ -564,4 +564,7 @@ void SerialWorker::updateBusSettings(CAN_Bus *bus)
|
|||||||
if (busNum < 0) return;
|
if (busNum < 0) return;
|
||||||
if (busNum >= numBuses) return;
|
if (busNum >= numBuses) return;
|
||||||
qDebug() << "About to update bus " << busNum << " on GVRET";
|
qDebug() << "About to update bus " << busNum << " on GVRET";
|
||||||
|
if (busNum == 0) can0Baud = bus->getSpeed();
|
||||||
|
if (busNum == 1) can1Baud = bus->getSpeed();
|
||||||
|
updateBaudRates(can0Baud,can1Baud);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -210,7 +210,7 @@ void UDSScanWindow::sendNextMsg()
|
|||||||
currIdx++;
|
currIdx++;
|
||||||
if (currIdx < sendingFrames.count())
|
if (currIdx < sendingFrames.count())
|
||||||
{
|
{
|
||||||
emit sendCANFrame(&sendingFrames[currIdx], sendingFrames[currIdx].bus);
|
emit sendCANFrame(&sendingFrames[currIdx]);
|
||||||
waitTimer->start();
|
waitTimer->start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ public:
|
|||||||
~UDSScanWindow();
|
~UDSScanWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatedFrames(int numFrames);
|
void updatedFrames(int numFrames);
|
||||||
|
|||||||
Reference in New Issue
Block a user