Move hwif to thread

This commit is contained in:
Siegfried Siegert 2023-07-10 16:09:16 +02:00
parent 334d67fd22
commit 76ce6e0c26
Signed by: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03

View File

@ -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);