Move hwif to thread
This commit is contained in:
parent
334d67fd22
commit
76ce6e0c26
@ -5,6 +5,7 @@
|
|||||||
#include "src/ATBAPP/support/JSON.h"
|
#include "src/ATBAPP/support/JSON.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QThread>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@ -46,6 +47,11 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
|||||||
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_doorCBinAndAllDoorsClosed()), this, SLOT(onCBinAndAllDoorsClosed()), Qt::QueuedConnection);
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_doorCBinAndAllDoorsClosed()), this, SLOT(onCBinAndAllDoorsClosed()), Qt::QueuedConnection);
|
||||||
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_doorAllDoorsClosed()), this, SLOT(onAllDoorsClosed()), Qt::QueuedConnection); // check for errors, switch to mode IDLE
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_doorAllDoorsClosed()), this, SLOT(onAllDoorsClosed()), Qt::QueuedConnection); // check for errors, switch to mode IDLE
|
||||||
|
|
||||||
|
// move hw object to separate thread:
|
||||||
|
auto hwThread = new QThread;
|
||||||
|
dynamic_cast<QObject*>(hw)->moveToThread(hwThread);
|
||||||
|
hwThread->start();
|
||||||
|
|
||||||
|
|
||||||
this->diag = new DeviceControllerDiag(this);
|
this->diag = new DeviceControllerDiag(this);
|
||||||
connect(this->diag, &DeviceControllerDiag::newVoltage, this, &ATBDeviceControllerPlugin::onNewVoltage);
|
connect(this->diag, &DeviceControllerDiag::newVoltage, this, &ATBDeviceControllerPlugin::onNewVoltage);
|
||||||
|
Loading…
Reference in New Issue
Block a user