Index: sources/MessageGlobals.h =================================================================== diff -u -r38e3ae29c904d9ba0076930d429822260133d7e9 -rb77bb1ccc020bf7ec700ea3e0feda43087516c5f --- sources/MessageGlobals.h (.../MessageGlobals.h) (revision 38e3ae29c904d9ba0076930d429822260133d7e9) +++ sources/MessageGlobals.h (.../MessageGlobals.h) (revision b77bb1ccc020bf7ec700ea3e0feda43087516c5f) @@ -130,6 +130,8 @@ ID_SAMPLE_WATER_RESULT = 0x5f00, ID_FILTER_FLUSH_TIME_BC = 0x6000, ID_HD_SYS_SELF_TEST_TIME_BC = 0x6100, + ID_UI_INTALLATION_CONFIRM = 0x6200, + ID_HD_DRY_SELF_TEST_TIME_BC = 0x6300, ID_UI_CONSUMABLES_INSTALL = 0x6800, ID_HD_UI_CONFIRM_RQST = 0xBA00, ID_UI_CONFIRM_RESP = 0xBB00, Index: sources/StateController.cpp =================================================================== diff -u -r38e3ae29c904d9ba0076930d429822260133d7e9 -rb77bb1ccc020bf7ec700ea3e0feda43087516c5f --- sources/StateController.cpp (.../StateController.cpp) (revision 38e3ae29c904d9ba0076930d429822260133d7e9) +++ sources/StateController.cpp (.../StateController.cpp) (revision b77bb1ccc020bf7ec700ea3e0feda43087516c5f) @@ -126,13 +126,20 @@ _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; break; + case ID_UI_INTALLATION_CONFIRM: + _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; + _dryDemoCurrentCmd = CMD_SYSTEM_PRIME; + isCmdValid = true; + break; + case ID_NONE: case ID_HD_OP_MODE: case ID_FILTER_FLUSH_TIME_BC: case ID_HD_UI_CONFIRM_RQST: case ID_PRE_TX_STATES_BC: case ID_HD_NEW_PARAMS_RESP: case ID_HD_SYS_SELF_TEST_TIME_BC: + case ID_HD_DRY_SELF_TEST_TIME_BC: // Do nothing break; } @@ -147,9 +154,10 @@ { int listSize = _dryDemoCmds[_dryDemoCurrentCmd].size(); - //qDebug() << "Index" << _index << listSize; + qDebug() << "Index" << _index << listSize; - if ((listSize > 1) && (_index < listSize )) { + if ((listSize > 1) && (_index < listSize)) { + bool isTimer = _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX].toBool(); //qDebug() << "Index 222" << _dryDemoCmds[_dryDemoCurrentCmd][_index]; if(isTimer && (_dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt() != 0)) { @@ -158,7 +166,7 @@ qDebug() << "COUnters" << _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt(); emit _ApplicationController.didActionTransmit(_dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX)); if (_dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt() == 0) { - _dryDemoCmds[_dryDemoCurrentCmd][_index][0] = false; + _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX] = false; _index++; } } @@ -214,7 +222,7 @@ temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(0); temp.append(0); temp.append(0); @@ -242,7 +250,7 @@ temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(0); temp.append(1); temp.append(0); @@ -271,7 +279,7 @@ temp.append(true); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); temp.append(0); temp.append(0); @@ -290,7 +298,7 @@ temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); temp.append(0); temp.append(1); @@ -309,7 +317,7 @@ temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); temp.append(0); temp.append(2); @@ -347,7 +355,7 @@ temp.append(false); temp.append(static_cast(CMD_DISPOSABLES)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); temp.append(0); temp.append(4); @@ -376,7 +384,7 @@ temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); - temp.append(Can_Id::eChlid_HD_UI); + temp.append(Can_Id::eChlid_HD_Sync); temp.append(2); temp.append(0); temp.append(0); @@ -400,16 +408,96 @@ temp.append(DEFAULT_TIMEOUT_S); _dryDemoCmds[CMD_DISPOSABLES].append(temp); temp.clear(); + temp.append(false); // this is the timer + temp.append(false); // wait for the user + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_PRE_TX_STATES_BC)); + temp.append(Can_Id::eChlid_HD_Sync); + temp.append(3); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + _dryDemoCmds[CMD_DISPOSABLES].append(temp); + temp.clear(); + temp.append(false); // this is the timer + temp.append(true); // wait for the user + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_PRE_TX_STATES_BC)); + temp.append(Can_Id::eChlid_HD_Sync); + temp.append(3); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + _dryDemoCmds[CMD_DISPOSABLES].append(temp); + temp.clear(); + temp.append("Transition_2_Sys_Prime"); + temp.append(false); + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_HD_OP_MODE)); + temp.append(Can_Id::eChlid_HD_UI); + temp.append(MODE_PRET); + temp.append(0); + _dryDemoCmds[CMD_SYSTEM_PRIME].append(temp); + temp.clear(); + temp.append(false); // this is the timer + temp.append(false); + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_PRE_TX_STATES_BC)); + temp.append(Can_Id::eChlid_HD_Sync); + temp.append(4); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(1); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + temp.append(0); + _dryDemoCmds[CMD_SYSTEM_PRIME].append(temp); + temp.clear(); + temp.append(true); // this is the timer + temp.append(false); + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_HD_DRY_SELF_TEST_TIME_BC)); + temp.append(Can_Id::eChlid_HD_Sync); + temp.append(DEFAULT_TIMEOUT_S); + temp.append(DEFAULT_TIMEOUT_S); + _dryDemoCmds[CMD_SYSTEM_PRIME].append(temp); + temp.clear(); } void StateController::transitionApplicationToStandBy() { _index = 0; _broadcastMsgCount = 0; - initMessagesHashTable(); + _dryDemoCmds[CMD_WATER_SAMPLE][1][IS_WAIT_NEEDED_INDEX] = true; + _dryDemoCmds[CMD_WATER_SAMPLE][2][COUNT_DOWN_TIMER_INDEX] = DEFAULT_TIMEOUT_S; + + _dryDemoCmds[CMD_DISPOSABLES][2][COUNT_DOWN_TIMER_INDEX] = DEFAULT_TIMEOUT_S; + _dryDemoCmds[CMD_DISPOSABLES][4][IS_WAIT_NEEDED_INDEX] = true; + QVariantList list; list.append(static_cast(ID_HD_OP_MODE)); list.append(Can_Id::eChlid_HD_UI); @@ -418,6 +506,8 @@ emit _ApplicationController.didActionTransmit(list); } +// ----------- State transition methods ---------------- // + void StateController::onIdleStateChange(bool active) { if (active) { @@ -480,11 +570,20 @@ emit _ApplicationController.didActionTransmit(msg); _index++; } + else { + qDebug() << "exiting disposables"; + } } void StateController::onSystemPrimeStateChange(bool active) { - Q_UNUSED(active) + if (active) + { + qDebug() << "Prime active"; + QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); + emit _ApplicationController.didActionTransmit(msg); + _index++; + } } Index: sources/StateController.h =================================================================== diff -u -r38e3ae29c904d9ba0076930d429822260133d7e9 -rb77bb1ccc020bf7ec700ea3e0feda43087516c5f --- sources/StateController.h (.../StateController.h) (revision 38e3ae29c904d9ba0076930d429822260133d7e9) +++ sources/StateController.h (.../StateController.h) (revision b77bb1ccc020bf7ec700ea3e0feda43087516c5f) @@ -42,19 +42,19 @@ CMD_WATER_SAMPLE, CMD_CONSUMABLES, CMD_DISPOSABLES, + CMD_SYSTEM_PRIME, }; 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 - QHash _dryDemoMsgTable; // TODO remove - QHash _dryDemoBroadcast; // TODo remove - drydemoXMLstates _dryDemo; // todo REMOVE - Can::MessageID _activeMessageID = Can::ID_NONE; // TODO remove - void initMessagesHashTable(); void transitionApplicationToStandBy();