New proposal for DeviceControllerDiag:
Manage two sets of errors and compare to previous run.
This commit is contained in:
parent
10b0e494b2
commit
1c13d92171
@ -104,7 +104,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E255);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
if (this->E255counter > 5) {
|
if (this->E255counter > 5) {
|
||||||
@ -153,7 +153,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E255);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
@ -166,7 +166,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
// es gibt keinerlei gültige Daten vom DC
|
// es gibt keinerlei gültige Daten vom DC
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0254);
|
this->private_setDiagEvent(DeviceController::State::M0254);
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
@ -223,7 +223,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
if (dynMaCond.onAlarm>0) {
|
if (dynMaCond.onAlarm>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::A000);
|
this->private_setDiagEvent(DeviceController::State::A000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for open doors
|
// check for open doors
|
||||||
@ -232,41 +232,41 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
// Service or battery door is open
|
// Service or battery door is open
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() 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::M0253);
|
this->private_setDiagEvent(DeviceController::State::M0253);
|
||||||
}
|
}
|
||||||
if (dynMaCond.middleDoor) {
|
if (dynMaCond.middleDoor) {
|
||||||
// vault door is open
|
// vault door is open
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0252);
|
this->private_setDiagEvent(DeviceController::State::M0252);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for invalid states:
|
// check for invalid states:
|
||||||
|
|
||||||
if (modCond.rtc>=200) {
|
if (modCond.rtc>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E002);
|
this->private_setDiagEvent(DeviceController::State::E002);
|
||||||
}
|
}
|
||||||
if (modCond.printer==200 || modCond.printer==201) { // 200: not connected 201: printer-HW-error 202: no paper
|
if (modCond.printer==200 || modCond.printer==201) { // 200: not connected 201: printer-HW-error 202: no paper
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E020);
|
this->private_setDiagEvent(DeviceController::State::E020);
|
||||||
}
|
}
|
||||||
if (modCond.printer==202) {
|
if (modCond.printer==202) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E018);
|
this->private_setDiagEvent(DeviceController::State::E018);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modCond.coinBlocker>=200) {
|
if (modCond.coinBlocker>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E025);
|
this->private_setDiagEvent(DeviceController::State::E025);
|
||||||
}
|
}
|
||||||
if (modCond.mdbBus>=200) {
|
if (modCond.mdbBus>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E034);
|
this->private_setDiagEvent(DeviceController::State::E034);
|
||||||
}
|
}
|
||||||
if (modCond.intEe>=200) {
|
if (modCond.intEe>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E011);
|
this->private_setDiagEvent(DeviceController::State::E011);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
||||||
@ -276,16 +276,16 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (devPara.kindOfCoinChecker > 0) {
|
if (devPara.kindOfCoinChecker > 0) {
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
// coinEscrow>200 is considered a warning:
|
// coinEscrow>200 is considered a warning:
|
||||||
this->private_sendDiagEvent(DeviceController::State::W010);
|
this->private_setDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
@ -308,15 +308,15 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
// coinEscrow>200 is considered a warning:
|
// coinEscrow>200 is considered a warning:
|
||||||
this->private_sendDiagEvent(DeviceController::State::W010);
|
this->private_setDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (devPara.kindOfCoinChecker==3)
|
if (devPara.kindOfCoinChecker==3)
|
||||||
@ -324,15 +324,15 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (modCond.changer>=200) {
|
if (modCond.changer>=200) {
|
||||||
// Fehler Münzver.
|
// Fehler Münzver.
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E026);
|
this->private_setDiagEvent(DeviceController::State::E026);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe == 200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe == 200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,61 +361,83 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
if (dynMaCond.modeAbrech>0) {
|
if (dynMaCond.modeAbrech>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E011);
|
this->private_setDiagEvent(DeviceController::State::E011);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynMaCond.nowCardTest>0) {
|
if (dynMaCond.nowCardTest>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0072);
|
this->private_setDiagEvent(DeviceController::State::M0072);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynMaCond.startupTestIsRunning>0) {
|
if (dynMaCond.startupTestIsRunning>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0073);
|
this->private_setDiagEvent(DeviceController::State::M0073);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modCond.voltage>=200) {
|
if (modCond.voltage>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E003);
|
this->private_setDiagEvent(DeviceController::State::E003);
|
||||||
}
|
}
|
||||||
if (modCond.temper>=200) {
|
if (modCond.temper>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W004);
|
this->private_setDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for warnings
|
// check for warnings
|
||||||
if (modCond.printer>=100 && modCond.printer<200) {
|
if (modCond.printer>=100 && modCond.printer<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W001);
|
this->private_setDiagEvent(DeviceController::State::W001);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe>=100 && modCond.coinSafe<200) {
|
if (modCond.coinSafe>=100 && modCond.coinSafe<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W002);
|
this->private_setDiagEvent(DeviceController::State::W002);
|
||||||
}
|
}
|
||||||
if (modCond.voltage>=100 && modCond.voltage<200) {
|
if (modCond.voltage>=100 && modCond.voltage<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W003);
|
this->private_setDiagEvent(DeviceController::State::W003);
|
||||||
}
|
}
|
||||||
if (modCond.temper>=100 && modCond.temper<200) {
|
if (modCond.temper>=100 && modCond.temper<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W004);
|
this->private_setDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag_sendOperate) {
|
if (flag_sendOperate) {
|
||||||
this->private_sendDiagEvent(DeviceController::State::O000);
|
this->private_setDiagEvent(DeviceController::State::O000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// compare machineEventSets
|
||||||
|
// New events: present in current but not previous
|
||||||
|
QSet<DeviceController::State> newEvents = this->machineEventSet - this->previousMachineEventSet;
|
||||||
|
|
||||||
|
// Reset events: present in previous but not current
|
||||||
|
QSet<DeviceController::State> resetEvents = this->previousMachineEventSet - this->machineEventSet;
|
||||||
|
|
||||||
|
// Triggering Actions
|
||||||
|
// Iterate through the results
|
||||||
|
for (const DeviceController::State& event : newEvents) {
|
||||||
|
private_sendDiagEvent(event, DeviceController::Action::SET); // New event detected
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const DeviceController::State& event : resetEvents) {
|
||||||
|
private_sendDiagEvent(event, DeviceController::Action::RESET); // Event no longer present
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finish diag
|
// finish diag
|
||||||
|
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
|
|
||||||
|
this->previousMachineEventSet = machineEventSet;
|
||||||
|
this->machineEventSet.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeviceControllerDiag::private_sendDiagEvent
|
* @brief DeviceControllerDiag::private_setDiagEvent
|
||||||
* @param result - result value from 'sub_componentAssessment()',
|
* @param result - result value from 'sub_componentAssessment()',
|
||||||
* - 0x00 everything is fine
|
* - 0x00 everything is fine
|
||||||
* - 0xFF on timer interrupt
|
* - 0xFF on timer interrupt
|
||||||
@ -423,25 +445,21 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
* - 0xFD Service or battery door is open
|
* - 0xFD Service or battery door is open
|
||||||
* - 0xFE vault door is open
|
* - 0xFE vault door is open
|
||||||
*/
|
*/
|
||||||
void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
void DeviceControllerDiag::private_setDiagEvent(DeviceController::State result)
|
||||||
{
|
{
|
||||||
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
|
qCritical() << "DeviceControllerDiag::private_setDiagEvent() result: " << result;
|
||||||
|
|
||||||
if (this->eventReceiver == nullptr) {
|
if (this->eventReceiver == nullptr) {
|
||||||
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (machineEventSet.contains(result)) {
|
machineEventSet.insert(result);
|
||||||
// do not send already sent events
|
}
|
||||||
qCritical() << " ... is in machineEventList";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
machineEventSet.insert(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result, DeviceController::Action action)
|
||||||
|
{
|
||||||
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
||||||
|
|
||||||
QString eventName = QMetaEnum::fromType<DeviceController::State>().valueToKey(result);;
|
QString eventName = QMetaEnum::fromType<DeviceController::State>().valueToKey(result);;
|
||||||
@ -608,7 +626,7 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
"DC",
|
"DC",
|
||||||
eventClass,
|
eventClass,
|
||||||
eventName,
|
eventName,
|
||||||
1, // eventState
|
action, // eventState
|
||||||
parameter,
|
parameter,
|
||||||
"" // second level info
|
"" // second level info
|
||||||
);
|
);
|
||||||
@ -625,6 +643,6 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
void DeviceControllerDiag::restartCArun()
|
void DeviceControllerDiag::restartCArun()
|
||||||
{
|
{
|
||||||
this->E255counter = 0;
|
this->E255counter = 0;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W255);
|
this->private_setDiagEvent(DeviceController::State::W255);
|
||||||
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,14 @@ namespace DeviceController {
|
|||||||
INITIAL_STATE
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
|
|
||||||
|
|
||||||
|
enum Action {
|
||||||
|
SET = 1,
|
||||||
|
RESET = 0
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(Action)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,6 +130,7 @@ private:
|
|||||||
|
|
||||||
DeviceController::State lastState;
|
DeviceController::State lastState;
|
||||||
QSet<DeviceController::State> machineEventSet;
|
QSet<DeviceController::State> machineEventSet;
|
||||||
|
QSet<DeviceController::State> previousMachineEventSet;
|
||||||
bool _isErrorState;
|
bool _isErrorState;
|
||||||
|
|
||||||
PersistentData* pData;
|
PersistentData* pData;
|
||||||
@ -132,7 +141,8 @@ private slots:
|
|||||||
void onDiagRequestTimeoutTimerTimeout();
|
void onDiagRequestTimeoutTimerTimeout();
|
||||||
|
|
||||||
void private_startDiag(); // diag entry method
|
void private_startDiag(); // diag entry method
|
||||||
void private_sendDiagEvent(DeviceController::State result);
|
void private_setDiagEvent(DeviceController::State result);
|
||||||
|
void private_sendDiagEvent(DeviceController::State result, DeviceController::Action action);
|
||||||
|
|
||||||
void sys_superviseSystem();
|
void sys_superviseSystem();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user