Frame playback via the playback dialog window is now working.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.4.0, 2015-05-06T22:38:23. -->
|
||||
<!-- Written by QtCreator 3.4.0, 2015-05-09T09:40:45. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "frameplaybackwindow.h"
|
||||
#include "ui_frameplaybackwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -202,9 +203,10 @@ void FramePlaybackWindow::updatePosition(bool forward)
|
||||
if (idList.at(0)->checkState() == Qt::Checked)
|
||||
{
|
||||
//index 0 is none, 1 is Bus 0, 2 is bus 1, 3 is both, 4 is from file
|
||||
//if (whichBusSend & 1) parent.SendCANFrame(modelFrames->at(currentPosition), 0);
|
||||
//if (whichBusSend & 2) parent.SendCANFrame(modelFrames->at(currentPosition), 1);
|
||||
//if (whichBusSend & 4) parent.SendCANFrame(modelFrames->at(currentPosition), loadedFrames[playbackPos].bus);
|
||||
const CANFrame *thisFrame = &modelFrames->at(currentPosition);
|
||||
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
||||
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
||||
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
|
||||
updateFrameLabel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ private slots:
|
||||
void btnSelectNoneClick();
|
||||
void timerTriggered();
|
||||
|
||||
signals:
|
||||
void sendCANFrame(const CANFrame *, int);
|
||||
|
||||
private:
|
||||
Ui::FramePlaybackWindow *ui;
|
||||
QList<int> foundID;
|
||||
|
||||
+11
-2
@@ -64,6 +64,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
|
||||
connect(worker, &SerialWorker::receivedFrame, this, &MainWindow::gotFrame, Qt::QueuedConnection);
|
||||
connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection);
|
||||
connect(this, &MainWindow::sendCANFrame, worker, &SerialWorker::sendFrame, Qt::QueuedConnection);
|
||||
serialWorkerThread.start();
|
||||
|
||||
graphingWindow = NULL;
|
||||
@@ -596,12 +597,20 @@ void MainWindow::showGraphingWindow()
|
||||
void MainWindow::showFrameDataAnalysis()
|
||||
{
|
||||
//only create an instance of the object if we dont have one. Otherwise just display the existing one.
|
||||
if (!frameInfoWindow) frameInfoWindow = new FrameInfoWindow(model->getListReference());
|
||||
if (!frameInfoWindow)
|
||||
{
|
||||
frameInfoWindow = new FrameInfoWindow(model->getListReference());
|
||||
}
|
||||
frameInfoWindow->show();
|
||||
}
|
||||
|
||||
void MainWindow::showPlaybackWindow()
|
||||
{
|
||||
if (!playbackWindow) playbackWindow = new FramePlaybackWindow(model->getListReference());
|
||||
if (!playbackWindow)
|
||||
{
|
||||
playbackWindow = new FramePlaybackWindow(model->getListReference());
|
||||
//connect signal to signal to pass the signal through to whoever is handling the slot
|
||||
connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), this, SIGNAL(sendCANFrame(const CANFrame*,int)));
|
||||
}
|
||||
playbackWindow->show();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public slots:
|
||||
signals:
|
||||
void sendSerialPort(QString portName);
|
||||
void updateBaudRates(int, int);
|
||||
void sendCANFrame(const CANFrame *, int);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
+4
-1
@@ -50,12 +50,14 @@ void SerialWorker::readSerialData()
|
||||
}
|
||||
}
|
||||
|
||||
void SerialWorker::sendFrame(CANFrame *frame, int bus = 0)
|
||||
void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
||||
{
|
||||
QByteArray buffer;
|
||||
int c;
|
||||
int ID;
|
||||
|
||||
qDebug() << "Sending out frame with id " << frame->ID;
|
||||
|
||||
ID = frame->ID;
|
||||
if (frame->extended) ID |= 1 << 31;
|
||||
|
||||
@@ -75,6 +77,7 @@ void SerialWorker::sendFrame(CANFrame *frame, int bus = 0)
|
||||
|
||||
if (serial == NULL) return;
|
||||
if (!serial->isOpen()) return;
|
||||
qDebug() << "writing " << buffer.length() << " bytes to serial port";
|
||||
serial->write(buffer);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ private slots: //we receive things in slots
|
||||
|
||||
public slots:
|
||||
void setSerialPort(QString);
|
||||
void sendFrame(CANFrame *, int);
|
||||
void sendFrame(const CANFrame *, int);
|
||||
void updateBaudRates(int, int);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user