removed canconnectioncontainer
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
#include "canconnection.h"
|
|
||||||
#include "canconnectioncontainer.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
CANConnectionContainer::CANConnectionContainer(CANConnection *conn)
|
|
||||||
{
|
|
||||||
thread = new QThread();
|
|
||||||
connection = conn;
|
|
||||||
connection->moveToThread(thread);
|
|
||||||
|
|
||||||
connect(thread, &QThread::started, conn, &CANConnection::run); //setup timers within the proper thread
|
|
||||||
connect(conn, &CANConnection::frameUpdateRapid, MainWindow::getReference(), &MainWindow::gotFrames, Qt::QueuedConnection);
|
|
||||||
connect(MainWindow::getReference(), &MainWindow::sendCANFrame, conn, &CANConnection::sendFrame, Qt::QueuedConnection);
|
|
||||||
thread->start();
|
|
||||||
thread->setPriority(QThread::HighPriority);
|
|
||||||
}
|
|
||||||
|
|
||||||
CANConnectionContainer::~CANConnectionContainer()
|
|
||||||
{
|
|
||||||
//have to stop the actual execution first before deleting
|
|
||||||
thread->quit();
|
|
||||||
if(!thread->wait()) {
|
|
||||||
qDebug() << "can't stop thread";
|
|
||||||
}
|
|
||||||
delete thread;
|
|
||||||
delete connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
CANConnection* CANConnectionContainer::getRef()
|
|
||||||
{
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef CANCONNECTIONCONTAINER_H
|
|
||||||
#define CANCONNECTIONCONTAINER_H
|
|
||||||
|
|
||||||
#include <Qt>
|
|
||||||
#include <QThread>
|
|
||||||
#include "canconnection.h"
|
|
||||||
|
|
||||||
class CANConnectionContainer : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
CANConnectionContainer(CANConnection *conn);
|
|
||||||
~CANConnectionContainer();
|
|
||||||
|
|
||||||
CANConnection* getRef();
|
|
||||||
|
|
||||||
private:
|
|
||||||
CANConnection *connection;
|
|
||||||
QThread *thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CANCONNECTIONCONTAINER_H
|
|
||||||
Reference in New Issue
Block a user