#pragma once #include #include #include "main.h" #include "MessageGlobals.h" #include "drydemoxmlstates.h" #define _StateController StateController::I() // TODO check illegal state transition class StateController : public QObject { Q_OBJECT SINGLETON(StateController) public: void init(); // TODO move these in slots void quit(); public slots: void doStateControllerUnhandledMsgReceived(const QVariantList &msg); protected: void timerEvent(QTimerEvent *) override; private: #define DEFAULT_TIMEOUT_S 10 #define TRANSITION_EVENT_INDEX 0 #define RESP_MSG_START_INDEX 3 #define IS_TIMER_INDEX 0 #define IS_WAIT_NEEDED_INDEX 1 #define NEXT_AUTO_TRANSITION_INDEX 2 #define COUNT_DOWN_TIMER_INDEX 6 enum User_Command_ID { CMD_NONE = -1, CMD_TX_PARAMS = 0 , CMD_WATER_SAMPLE, CMD_CONSUMABLES, CMD_DISPOSABLES, CMD_SYSTEM_PRIME, CMD_BP_HR, CMD_ULTRAFILTRATION, CMD_CONNECTION, CMD_START_TX, CMD_END_TX, CMD_DISINFECTION, }; QHash > _dryDemoCmds; quint16 _index; quint16 _broadcastMsgCount; User_Command_ID _dryDemoCurrentCmd; drydemoXMLstates _dryDemo; //QHash _dryDemoMsgTable; // TODO remove //QHash _dryDemoBroadcast; // TODo remove //Can::MessageID _activeMessageID = Can::ID_NONE; // TODO remove void initMessagesHashTable(); void transitionApplicationToStandBy(); void onIdleStateChange(bool active); void onTreatmentParamsStateChange(bool active); void onWaterSampleStateChange(bool active); void onConsumablesStateChange(bool active); void onDisposablesStateChange(bool active); void onSystemPrimeStateChange(bool active); void onBPHRStateChange(bool active); void onUltrafiltrationStateChange(bool active); void onConnectionStateChange(bool active); void onStartTreatmentStateChange(bool active); void onEndTreatmentStateChange(bool active); void onDisinfectStateChange(bool active); };