Additional implementation of new connection system. The GVRET code can

now connect and run its thread.
This commit is contained in:
Collin Kidder
2016-03-26 20:17:10 -04:00
parent e7ded7737a
commit 0bd3a3b95b
14 changed files with 126 additions and 21 deletions
+14 -1
View File
@@ -1,10 +1,18 @@
#include "canconnection.h"
#include "canconnectioncontainer.h"
CANConnectionContainer::CANConnectionContainer(CANConnection *conn)
{
thread = new QThread();
connection = conn;
connection->moveToThread(thread);
connection->moveToThread(thread);
connect(thread, &QThread::finished, conn, &QObject::deleteLater);
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()
@@ -13,3 +21,8 @@ CANConnectionContainer::~CANConnectionContainer()
delete thread;
delete connection;
}
CANConnection* CANConnectionContainer::getRef()
{
return connection;
}