#ifndef DEVICECONTROLLERDIAG_H #define DEVICECONTROLLERDIAG_H #include #include #include #include #include "DeviceControllerInterface.h" #include "ATBMachineEvent.h" #include "support/PersistentData.h" class DBusControllerInterface; namespace DeviceController { Q_NAMESPACE enum State { O000, A000, E002, E003, E004, E007, E008, E009, E010, W010, // Coin Escrow E011, E018, E020, E025, E026, E034, M0071, // cashbox change is ongoing M0072, // cardtest is running M0073, // startup-test is running M0252, // cashbox door open M0253, // service or battery door is open M0254, // no valid data from DC E255, W001, W002, W003, W004, W255, INITIAL_STATE }; Q_ENUM_NS(State) enum Action { SET = 1, RESET = 0 }; Q_ENUM_NS(Action) } class DeviceControllerDiag : public QObject { Q_OBJECT public: DeviceControllerDiag(PersistentData *pData, QObject *parent = nullptr); void init(hwinf* hw, DBusControllerInterface *dbus, QObject* eventReceiver); nsDeviceControllerInterface::COIN_PROCESSOR coinProcessorType; nsDeviceControllerInterface::BILL_ACCEPTOR billAcceptor; /** * return true, if machineEventSet contains an error */ bool isErrorState(); bool isOperatingState(); QSet getCurrentMachineState(); void setTimeout(int timeout); public slots: /** * start diag request */ void diagRequest(); /** * reset / re-init diag request. * Called e.g. when doors are closed. */ void diagReInit(); /** * reset / restart / reinit deviceController */ void restartCArun(); signals: void diagResponse(ATBMachineEvent* machineEvent); void newVoltage(uint32_t voltage); private: QObject *eventReceiver; hwinf* hw; DBusControllerInterface* dbus; bool isRequestRunning; bool flagInterruptDiag; bool isDiagBackgroundTask; QTimer *diagRequestTimeoutTimer; void sub_componentAssessment(); // diag exit method int lastVoltage; DeviceController::State lastState; QSet machineEventSet; QSet previousMachineEventSet; bool _isErrorState; PersistentData* pData; int E255counter; private slots: void onDiagRequestTimeoutTimerTimeout(); void private_startDiag(); // diag entry method void private_setDiagEvent(DeviceController::State result); void private_sendDiagEvent(DeviceController::State result, DeviceController::Action action); void sys_superviseSystem(); }; #endif // DEVICECONTROLLERDIAG_H