Index: sources/StateController.h =================================================================== diff -u -r1cfa9a2d55e3bf954e5d02f12b73d3a8deda9e5c -r260229a756a3ee29c681132bdc4d32204c215ceb --- sources/StateController.h (.../StateController.h) (revision 1cfa9a2d55e3bf954e5d02f12b73d3a8deda9e5c) +++ sources/StateController.h (.../StateController.h) (revision 260229a756a3ee29c681132bdc4d32204c215ceb) @@ -2,37 +2,45 @@ #include +#include #include "main.h" #include "MessageGlobals.h" #include "drydemoxmlstates.h" -// TODO maybe the DryDemoStates in the scxml not needed? - #define _StateController StateController::I() +// TODO check illegal state transition + class StateController : public QObject { Q_OBJECT - SINGLETON(StateController) public: - void init(); // TODO these in slots + void init(); // TODO move these in slots void quit(); public slots: - void onStateControllerUnhandledMsgReceived(const QVariantList &msg); + 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; - QString _previoustStateName; + Can::MessageID _activeMessageID = Can::ID_NONE; - quint16 REMOVE_THIS = 0; + void initReceivedMessagesHash(); + void initBroadcastMessagesHash(); + void transitionToStandBy(); - void buildRespondMessage(); - void onIdleStateChange(bool active); - void onTreatmentStateChange(bool active); + void onTreatmentParamsStateChange(bool active); void onDisinfectStateChange(bool active); };