Increment version number. Now supports pausing and resuming frame capture without disconnecting from the GVRET hardware.

This commit is contained in:
Collin Kidder
2015-06-02 21:53:23 -04:00
parent d03c439ce3
commit e3d67f20fc
5 changed files with 54 additions and 5 deletions
+19
View File
@@ -84,6 +84,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(worker, &SerialWorker::connectionFailure, this, &MainWindow::connectionFailed, Qt::QueuedConnection); connect(worker, &SerialWorker::connectionFailure, this, &MainWindow::connectionFailed, Qt::QueuedConnection);
connect(worker, &SerialWorker::deviceInfo, this, &MainWindow::gotDeviceInfo, Qt::QueuedConnection); connect(worker, &SerialWorker::deviceInfo, this, &MainWindow::gotDeviceInfo, Qt::QueuedConnection);
connect(this, &MainWindow::closeSerialPort, worker, &SerialWorker::closeSerialPort, Qt::QueuedConnection); connect(this, &MainWindow::closeSerialPort, worker, &SerialWorker::closeSerialPort, Qt::QueuedConnection);
connect(this, &MainWindow::startFrameCapturing, worker, &SerialWorker::startFrameCapture);
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
serialWorkerThread.start(); serialWorkerThread.start();
graphingWindow = NULL; graphingWindow = NULL;
@@ -113,6 +115,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->cbInterpret, SIGNAL(toggled(bool)), this, SLOT(interpretToggled(bool))); connect(ui->cbInterpret, SIGNAL(toggled(bool)), this, SLOT(interpretToggled(bool)));
connect(ui->cbOverwrite, SIGNAL(toggled(bool)), this, SLOT(overwriteToggled(bool))); connect(ui->cbOverwrite, SIGNAL(toggled(bool)), this, SLOT(overwriteToggled(bool)));
connect(ui->actionEdit_Messages_Signals, SIGNAL(triggered(bool)), this, SLOT(showDBCEditor())); connect(ui->actionEdit_Messages_Signals, SIGNAL(triggered(bool)), this, SLOT(showDBCEditor()));
connect(ui->btnCaptureToggle, SIGNAL(clicked(bool)), this, SLOT(toggleCapture()));
lbStatusConnected.setText(tr("Not connected")); lbStatusConnected.setText(tr("Not connected"));
updateBaudLabel(0,0); updateBaudLabel(0,0);
@@ -125,6 +128,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->lbNumFrames->setText("0"); ui->lbNumFrames->setText("0");
isConnected = false; isConnected = false;
allowCapture = true;
//create a temporary frame to be able to capture the correct //create a temporary frame to be able to capture the correct
//default height of an item in the table. Need to do this in case //default height of an item in the table. Need to do this in case
@@ -731,6 +735,21 @@ void MainWindow::connButtonPress()
} }
} }
void MainWindow::toggleCapture()
{
allowCapture = !allowCapture;
if (allowCapture)
{
ui->btnCaptureToggle->setText("Suspend Capturing");
emit startFrameCapturing();
}
else
{
ui->btnCaptureToggle->setText("Restart Capturing");
emit stopFrameCapturing();
}
}
void MainWindow::connectionSucceeded(int baud0, int baud1) void MainWindow::connectionSucceeded(int baud0, int baud1)
{ {
lbStatusConnected.setText(tr("Connected to GVRET")); lbStatusConnected.setText(tr("Connected to GVRET"));
+6 -1
View File
@@ -14,7 +14,7 @@
#include "dbchandler.h" #include "dbchandler.h"
#include "dbcmaineditor.h" #include "dbcmaineditor.h"
#define VERSION 105 #define VERSION 106
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@@ -49,6 +49,7 @@ private slots:
void interpretToggled(bool); void interpretToggled(bool);
void overwriteToggled(bool); void overwriteToggled(bool);
void showDBCEditor(); void showDBCEditor();
void toggleCapture();
public slots: public slots:
void gotFrames(int, int); void gotFrames(int, int);
@@ -59,6 +60,9 @@ signals:
void closeSerialPort(); void closeSerialPort();
void updateBaudRates(int, int); void updateBaudRates(int, int);
void sendCANFrame(const CANFrame *, int); void sendCANFrame(const CANFrame *, int);
void stopFrameCapturing();
void startFrameCapturing();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
@@ -69,6 +73,7 @@ private:
QList<QSerialPortInfo> ports; QList<QSerialPortInfo> ports;
QThread serialWorkerThread; QThread serialWorkerThread;
QByteArray inputBuffer; QByteArray inputBuffer;
bool allowCapture;
//References to other windows we can display //References to other windows we can display
GraphingWindow *graphingWindow; GraphingWindow *graphingWindow;
+7
View File
@@ -194,6 +194,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="btnCaptureToggle">
<property name="text">
<string>Suspend Capturing</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="btnClearFrames"> <widget class="QPushButton" name="btnClearFrames">
<property name="text"> <property name="text">
+19 -4
View File
@@ -15,6 +15,7 @@ SerialWorker::SerialWorker(CANFrameModel *model, QObject *parent) : QObject(pare
ticker = NULL; ticker = NULL;
elapsedTime = NULL; elapsedTime = NULL;
framesPerSec = 0; framesPerSec = 0;
capturing = true;
} }
SerialWorker::~SerialWorker() SerialWorker::~SerialWorker()
@@ -246,10 +247,11 @@ void SerialWorker::procRXChar(unsigned char c)
rx_state = IDLE; rx_state = IDLE;
rx_step = 0; rx_step = 0;
//qDebug() << "emit from serial handler to main form id: " << buildFrame->ID; //qDebug() << "emit from serial handler to main form id: " << buildFrame->ID;
//emit receivedFrame(buildFrame); if (capturing)
canModel->addFrame(*buildFrame, false); {
gotFrames++; canModel->addFrame(*buildFrame, false);
//buildFrame = new CANFrame; gotFrames++;
}
} }
break; break;
} }
@@ -368,3 +370,16 @@ void SerialWorker::closeSerialPort()
delete serial; delete serial;
serial = NULL; serial = NULL;
} }
void SerialWorker::stopFrameCapture()
{
qDebug() << "Stopping frame capture";
capturing = false;
}
void SerialWorker::startFrameCapture()
{
qDebug() << "Starting up frame capture";
capturing = true;
}
+3
View File
@@ -48,11 +48,14 @@ public slots:
void closeSerialPort(); void closeSerialPort();
void sendFrame(const CANFrame *, int); void sendFrame(const CANFrame *, int);
void updateBaudRates(int, int); void updateBaudRates(int, int);
void stopFrameCapture();
void startFrameCapture(); //only need to call this if previously stopped. Otherwise it's the default
private: private:
QString portName; QString portName;
bool quit; bool quit;
bool connected; bool connected;
bool capturing;
QSerialPort *serial; QSerialPort *serial;
CANFrameModel *canModel; CANFrameModel *canModel;
QTimer *ticker; QTimer *ticker;