Diag: send operate (O000) only if State has changed
This commit is contained in:
parent
58f50b0ea6
commit
70b488de66
@ -12,6 +12,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
|
|||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
, isRequestRunning(false)
|
, isRequestRunning(false)
|
||||||
, flagInterruptDiag(false)
|
, flagInterruptDiag(false)
|
||||||
|
, lastState(DeviceController::State::INITIAL_STATE)
|
||||||
, pData(pData)
|
, pData(pData)
|
||||||
{
|
{
|
||||||
diagRequestTimeoutTimer = new QTimer(this);
|
diagRequestTimeoutTimer = new QTimer(this);
|
||||||
@ -365,7 +366,6 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
{
|
{
|
||||||
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
|
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
|
||||||
|
|
||||||
|
|
||||||
if (this->eventReceiver == nullptr) {
|
if (this->eventReceiver == nullptr) {
|
||||||
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
||||||
return;
|
return;
|
||||||
@ -388,6 +388,9 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
QString parameter;
|
QString parameter;
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
|
||||||
|
case DeviceController::State::INITIAL_STATE:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
case DeviceController::State::A000: // alarm / intrusion
|
case DeviceController::State::A000: // alarm / intrusion
|
||||||
eventClass = EVENT_CLASS::ALARM;
|
eventClass = EVENT_CLASS::ALARM;
|
||||||
parameter = "alarm / intrusion";
|
parameter = "alarm / intrusion";
|
||||||
@ -480,7 +483,13 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
this->machineEventSet.clear();
|
this->machineEventSet.clear();
|
||||||
eventClass = EVENT_CLASS::OPERATE;
|
eventClass = EVENT_CLASS::OPERATE;
|
||||||
parameter = "";
|
parameter = "";
|
||||||
|
if (this->lastState == DeviceController::State::O000) {
|
||||||
|
qCritical() << " ... everything fine, no state change -> skip sending";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
qCritical() << " ... everything fine";
|
qCritical() << " ... everything fine";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceController::State::W001: // paper low
|
case DeviceController::State::W001: // paper low
|
||||||
@ -501,6 +510,7 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->lastState = result;
|
||||||
|
|
||||||
ATBMachineEvent *machineEvent = new ATBMachineEvent(
|
ATBMachineEvent *machineEvent = new ATBMachineEvent(
|
||||||
eventId,
|
eventId,
|
||||||
|
@ -52,7 +52,9 @@ namespace DeviceController {
|
|||||||
W001,
|
W001,
|
||||||
W002,
|
W002,
|
||||||
W003,
|
W003,
|
||||||
W004
|
W004,
|
||||||
|
|
||||||
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
}
|
}
|
||||||
@ -91,6 +93,7 @@ private:
|
|||||||
|
|
||||||
int lastVoltage;
|
int lastVoltage;
|
||||||
|
|
||||||
|
DeviceController::State lastState;
|
||||||
QSet<DeviceController::State> machineEventSet;
|
QSet<DeviceController::State> machineEventSet;
|
||||||
|
|
||||||
PersistentData* pData;
|
PersistentData* pData;
|
||||||
|
Loading…
Reference in New Issue
Block a user