Introduce DCMachineEvent ...

... this is an DC-Plugin internal data-structure which can be
transformed to an ATBMachineEvent and sent to ISMAS.

DCMachineEvent is in fact a couple ot DeviceController::State and a
QString eventID.

Thi eventID is necessary to send a state-reset to ISMAS. ISMAS needs
same enventID for set- and reset Events.
This commit is contained in:
2025-05-12 13:26:48 +02:00
parent 4df3a83126
commit 4567aed6d1
2 changed files with 51 additions and 22 deletions

View File

@@ -73,6 +73,30 @@ namespace DeviceController {
}
// ----------------------------- DCMachineEvent -----------------------------------------
class DCMachineEvent {
public:
DCMachineEvent() = default;
DCMachineEvent(DeviceController::State state, const QString& id) : state(state), eventId(id) {}
DeviceController::State state;
QString eventId;
// Equality operator (required for QSet)
bool operator==(const DCMachineEvent& other) const {
return (state == other.state);
}
};
// Hash function (required for QSet)
inline uint qHash(const DCMachineEvent& key, uint seed = 0) {
return qHash(static_cast<int>(key.state), seed);
}
// ------------------------ DeviceControllerDiag --------------------------------------
class DeviceControllerDiag : public QObject
{
Q_OBJECT
@@ -90,7 +114,7 @@ public:
*/
bool isErrorState();
bool isOperatingState();
QSet<DeviceController::State> getCurrentMachineState();
QSet<DCMachineEvent> getCurrentMachineState();
void setTimeout(int timeout);
@@ -132,8 +156,8 @@ private:
int lastVoltage;
DeviceController::State lastState;
QSet<DeviceController::State> machineEventSet;
QSet<DeviceController::State> previousMachineEventSet;
QSet<DCMachineEvent> machineEventSet;
QSet<DCMachineEvent> previousMachineEventSet;
bool _isErrorState;
PersistentData* pData;
@@ -145,7 +169,7 @@ private slots:
void private_startDiag(); // diag entry method
void private_setDiagEvent(DeviceController::State result);
void private_sendDiagEvent(DeviceController::State result, DeviceController::Action action);
void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action);
void sys_superviseSystem();