|
|
|
@@ -5,6 +5,8 @@
|
|
|
|
|
#include <QUuid>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
|
|
#include "support/JSON.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -18,6 +20,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
|
|
|
|
|
, lastState(DeviceController::State::INITIAL_STATE)
|
|
|
|
|
, _isErrorState(false)
|
|
|
|
|
, pData(pData)
|
|
|
|
|
, E255counter(0)
|
|
|
|
|
{
|
|
|
|
|
diagRequestTimeoutTimer = new QTimer(this);
|
|
|
|
|
diagRequestTimeoutTimer->setInterval(1000*45);
|
|
|
|
@@ -104,14 +107,20 @@ void DeviceControllerDiag::private_startDiag()
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E255);
|
|
|
|
|
this->isRequestRunning = false;
|
|
|
|
|
this->flagInterruptDiag = false;
|
|
|
|
|
if (this->E255counter > 5) {
|
|
|
|
|
this->restartCArun();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->E255counter++;
|
|
|
|
|
|
|
|
|
|
// try it again, until success:
|
|
|
|
|
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
|
|
|
|
/**
|
|
|
|
|
* But please note:
|
|
|
|
|
* - diag does currently not stop suspend (start a background task)
|
|
|
|
|
* - diag is called again in ModeOOO wokeup()
|
|
|
|
|
*/
|
|
|
|
|
// try it again, until success:
|
|
|
|
|
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
|
|
|
|
/**
|
|
|
|
|
* But please note:
|
|
|
|
|
* - diag does currently not stop suspend (start a background task)
|
|
|
|
|
* - diag is called again in ModeOOO wokeup()
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -146,6 +155,8 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E255);
|
|
|
|
|
this->flagInterruptDiag = false;
|
|
|
|
|
this->isRequestRunning = false;
|
|
|
|
|
if (this->E255counter > 5) { this->restartCArun(); }
|
|
|
|
|
else { this->E255counter++; }
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -156,6 +167,8 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E254);
|
|
|
|
|
this->diagRequestTimeoutTimer->stop();
|
|
|
|
|
this->isRequestRunning = false;
|
|
|
|
|
if (this->E255counter > 5) { this->restartCArun(); }
|
|
|
|
|
else { this->E255counter++; }
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -168,7 +181,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|
|
|
|
{
|
|
|
|
|
// noch keine Testergebnisse
|
|
|
|
|
if (dynMaCond.startupTestIsRunning) {
|
|
|
|
|
// TODO?
|
|
|
|
|
qCritical() << " startupTestIsRunning --> call again";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -178,18 +191,6 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// all doors: 99: undefined 0:closed 1:open
|
|
|
|
|
if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
|
|
|
|
|
// Service or battery door is open, goto INTRUSION MODE
|
|
|
|
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E253);
|
|
|
|
|
}
|
|
|
|
|
if (dynMaCond.middleDoor) {
|
|
|
|
|
// vault door is open, goto INTRUSION MODE
|
|
|
|
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E252);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qCritical() << " --> call sub_componentAssessment()";
|
|
|
|
|
|
|
|
|
|
sub_componentAssessment();
|
|
|
|
@@ -223,6 +224,21 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::A000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for open doors
|
|
|
|
|
// all doors: 99: undefined 0:closed 1:open
|
|
|
|
|
if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
|
|
|
|
|
// Service or battery door is open
|
|
|
|
|
flag_sendOperate = false;
|
|
|
|
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E253);
|
|
|
|
|
}
|
|
|
|
|
if (dynMaCond.middleDoor) {
|
|
|
|
|
// vault door is open
|
|
|
|
|
flag_sendOperate = false;
|
|
|
|
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::E252);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check for invalid states:
|
|
|
|
|
|
|
|
|
|
if (modCond.rtc>=200) {
|
|
|
|
@@ -567,6 +583,10 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|
|
|
|
eventClass = EVENT_CLASS::WARNING;
|
|
|
|
|
parameter = "temperatur warning";
|
|
|
|
|
break;
|
|
|
|
|
case DeviceController::State::W255: // restart carun
|
|
|
|
|
eventClass = EVENT_CLASS::WARNING;
|
|
|
|
|
parameter = "restart carun";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->lastState = result;
|
|
|
|
@@ -596,3 +616,13 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* reset / restart / reinit deviceController
|
|
|
|
|
*/
|
|
|
|
|
void DeviceControllerDiag::restartCArun()
|
|
|
|
|
{
|
|
|
|
|
this->E255counter = 0;
|
|
|
|
|
this->private_sendDiagEvent(DeviceController::State::W255);
|
|
|
|
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
|
|
|
|
}
|
|
|
|
|