diff --git a/canconnectioncontainer.cpp b/canconnectioncontainer.cpp deleted file mode 100644 index 302a3be..0000000 --- a/canconnectioncontainer.cpp +++ /dev/null @@ -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; -} diff --git a/canconnectioncontainer.h b/canconnectioncontainer.h deleted file mode 100644 index 8a4a429..0000000 --- a/canconnectioncontainer.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CANCONNECTIONCONTAINER_H -#define CANCONNECTIONCONTAINER_H - -#include -#include -#include "canconnection.h" - -class CANConnectionContainer : public QObject -{ - Q_OBJECT -public: - CANConnectionContainer(CANConnection *conn); - ~CANConnectionContainer(); - - CANConnection* getRef(); - -private: - CANConnection *connection; - QThread *thread; -}; - -#endif // CANCONNECTIONCONTAINER_H