#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 TRANSITION_EVENT_INDEX 0 #define RESP_MSG_START_INDEX 1 QHash _dryDemoMsgTable; QHash _dryDemoBroadcast; drydemoXMLstates _dryDemo; Can::MessageID _activeMessageID = Can::ID_NONE; void initReceivedMessagesHash(); void initBroadcastMessagesHash(); void transitionToStandBy(); void onIdleStateChange(bool active); void onTreatmentParamsStateChange(bool active); void onDisinfectStateChange(bool active); };