Frame playback via the playback dialog window is now working.

This commit is contained in:
Collin Kidder
2015-05-09 10:07:23 -04:00
parent d86f539d5a
commit 8ca7b3548f
7 changed files with 26 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
+5 -3
View File
@@ -1,5 +1,6 @@
#include "frameplaybackwindow.h" #include "frameplaybackwindow.h"
#include "ui_frameplaybackwindow.h" #include "ui_frameplaybackwindow.h"
#include <QDebug>
FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) : FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) :
QDialog(parent), QDialog(parent),
@@ -202,9 +203,10 @@ void FramePlaybackWindow::updatePosition(bool forward)
if (idList.at(0)->checkState() == Qt::Checked) 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 //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); const CANFrame *thisFrame = &modelFrames->at(currentPosition);
//if (whichBusSend & 2) parent.SendCANFrame(modelFrames->at(currentPosition), 1); if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
//if (whichBusSend & 4) parent.SendCANFrame(modelFrames->at(currentPosition), loadedFrames[playbackPos].bus); if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
updateFrameLabel(); updateFrameLabel();
} }
} }
+3
View File
@@ -33,6 +33,9 @@ private slots:
void btnSelectNoneClick(); void btnSelectNoneClick();
void timerTriggered(); void timerTriggered();
signals:
void sendCANFrame(const CANFrame *, int);
private: private:
Ui::FramePlaybackWindow *ui; Ui::FramePlaybackWindow *ui;
QList<int> foundID; QList<int> foundID;
+11 -2
View File
@@ -64,6 +64,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection); connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
connect(worker, &SerialWorker::receivedFrame, this, &MainWindow::gotFrame, Qt::QueuedConnection); connect(worker, &SerialWorker::receivedFrame, this, &MainWindow::gotFrame, Qt::QueuedConnection);
connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection); connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection);
connect(this, &MainWindow::sendCANFrame, worker, &SerialWorker::sendFrame, Qt::QueuedConnection);
serialWorkerThread.start(); serialWorkerThread.start();
graphingWindow = NULL; graphingWindow = NULL;
@@ -596,12 +597,20 @@ void MainWindow::showGraphingWindow()
void MainWindow::showFrameDataAnalysis() void MainWindow::showFrameDataAnalysis()
{ {
//only create an instance of the object if we dont have one. Otherwise just display the existing one. //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(); frameInfoWindow->show();
} }
void MainWindow::showPlaybackWindow() 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(); playbackWindow->show();
} }
+1
View File
@@ -37,6 +37,7 @@ public slots:
signals: signals:
void sendSerialPort(QString portName); void sendSerialPort(QString portName);
void updateBaudRates(int, int); void updateBaudRates(int, int);
void sendCANFrame(const CANFrame *, int);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
+4 -1
View File
@@ -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; QByteArray buffer;
int c; int c;
int ID; int ID;
qDebug() << "Sending out frame with id " << frame->ID;
ID = frame->ID; ID = frame->ID;
if (frame->extended) ID |= 1 << 31; if (frame->extended) ID |= 1 << 31;
@@ -75,6 +77,7 @@ void SerialWorker::sendFrame(CANFrame *frame, int bus = 0)
if (serial == NULL) return; if (serial == NULL) return;
if (!serial->isOpen()) return; if (!serial->isOpen()) return;
qDebug() << "writing " << buffer.length() << " bytes to serial port";
serial->write(buffer); serial->write(buffer);
} }
+1 -1
View File
@@ -34,7 +34,7 @@ private slots: //we receive things in slots
public slots: public slots:
void setSerialPort(QString); void setSerialPort(QString);
void sendFrame(CANFrame *, int); void sendFrame(const CANFrame *, int);
void updateBaudRates(int, int); void updateBaudRates(int, int);