Index: sources/StateController.cpp =================================================================== diff -u -ra7b6f962d1c463458114435c0c9eb152b5313864 -r83304892f4b91c5d623012e9f938ea46ff8dd2a7 --- sources/StateController.cpp (.../StateController.cpp) (revision a7b6f962d1c463458114435c0c9eb152b5313864) +++ sources/StateController.cpp (.../StateController.cpp) (revision 83304892f4b91c5d623012e9f938ea46ff8dd2a7) @@ -49,15 +49,15 @@ switch(receivedMsgID) { case ID_UI_RQST_TX: - isCmdValid = true; + isCmdValid = true; _dryDemoCurrentCmd = CMD_TX_PARAMS; break; case ID_UI_TX_PARAMS_RQST: msgBack.clear(); msgBack.append(static_cast(ID_HD_NEW_PARAMS_RESP)); msgBack.append(Can_Id::eChlid_HD_UI); - msgBack.append(1); msgBack.append(0); msgBack.append(275); msgBack.append(250); msgBack.append(60); + msgBack.append(1); msgBack.append(0); msgBack.append(275); msgBack.append(250); msgBack.append(60); msgBack.append(0); msgBack.append(100); msgBack.append(0); msgBack.append(0); msgBack.append(0); msgBack.append(0); msgBack.append(0); msgBack.append(250); msgBack.append(120); msgBack.append(100); msgBack.append(20); msgBack.append(0.000); msgBack.append(0.000); msgBack.append(36.00); @@ -89,7 +89,7 @@ break; case ID_UI_CONFIRM_TX_PARAMS: - isCmdValid = true; + isCmdValid = true; _dryDemoCurrentCmd = CMD_WATER_SAMPLE; break; @@ -110,19 +110,19 @@ break; case ID_UI_CONSUMABLES_INSTALL: - _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; + _hasUserConfirmedToProceed = true; break; case ID_UI_INTALLATION_CONFIRM: - _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; - _dryDemoCurrentCmd = CMD_SYSTEM_PRIME; - isCmdValid = true; + _hasUserConfirmedToProceed = true; + _dryDemoCurrentCmd = CMD_SYSTEM_PRIME; + isCmdValid = true; break; case ID_UI_PATIENT_CONNECTION_RQST: - _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; - _dryDemoCurrentCmd = CMD_BP_HR; - isCmdValid = true; + _hasUserConfirmedToProceed = true; + _dryDemoCurrentCmd = CMD_BP_HR; + isCmdValid = true; break; case ID_UI_SET_UF_VOLUME_RQST: @@ -134,7 +134,7 @@ msgBack.append(1.8); emit _ApplicationController.didActionTransmit(msgBack); _dryDemoCurrentCmd = CMD_CONNECTION; - isCmdValid = true; + isCmdValid = true; break; case ID_UI_PATIENT_CONNECTION_CONF_RQST: @@ -149,7 +149,7 @@ break; case ID_UI_START_TX_RQST: - _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX] = false; + _hasUserConfirmedToProceed = true; break; case ID_NONE: @@ -195,7 +195,6 @@ if (_dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt() == 0) { _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX] = false; _index++; - } } else { @@ -206,7 +205,9 @@ emit _ApplicationController.didActionTransmit(_dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX)); _broadcastMsgCount++; - if (!_dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX].toBool()) { + bool isWaitNeeded = _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX].toBool(); + + if ((!isWaitNeeded) || (isWaitNeeded && _hasUserConfirmedToProceed)) { //qDebug() << "Nex Inedx" << _dryDemoCmds[_dryDemoCurrentCmd][_index]; if (_broadcastMsgCount > NUM_OF_COUNTS_TO_BC_MSG) { @@ -221,7 +222,8 @@ } _index++; - _broadcastMsgCount = 0; + _broadcastMsgCount = 0; + _hasUserConfirmedToProceed = false; } } } @@ -812,14 +814,6 @@ { resetVariables(); - _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; - - _dryDemoCmds[CMD_SYSTEM_PRIME][2][COUNT_DOWN_TIMER_INDEX] = DEFAULT_TIMEOUT_S; - QVariantList list; list.append(static_cast(ID_HD_OP_MODE)); list.append(Can_Id::eChlid_HD_Sync); @@ -830,10 +824,10 @@ void StateController::resetVariables() { - _index = 0; - _broadcastMsgCount = 0; - _timerBroadcastCount = 0; - _isWaitForUserNeeded = false; + _index = 0; + _broadcastMsgCount = 0; + _timerBroadcastCount = 0; + _hasUserConfirmedToProceed = false; } // ----------- State transition methods ---------------- // @@ -851,7 +845,7 @@ } } else { - qDebug() << "Exit"; + qDebug() << "Idle on exit!"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); _index++; @@ -862,12 +856,7 @@ { if (active) { qDebug() << "In treatment params on entry"; - //QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); - //emit _ApplicationController.didActionTransmit(msg); } - else { - qDebug() << "In treatment params inactive"; - } } void StateController::onWaterSampleStateChange(bool active) @@ -876,11 +865,7 @@ qDebug() << "Sample" << _index; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } - else { - - } } void StateController::onConsumablesStateChange(bool active) @@ -895,24 +880,18 @@ void StateController::onDisposablesStateChange(bool active) { if(active) { - qDebug() << "disposables" << _index; + qDebug() << "Disposables" << _index; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } - else { - qDebug() << "exiting disposables"; - } } void StateController::onSystemPrimeStateChange(bool active) { - if (active) - { + if (active) { qDebug() << "Prime active"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } } @@ -922,7 +901,6 @@ qDebug() << "BP_HD active"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } } @@ -939,7 +917,6 @@ qDebug() << "Connection active"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } } @@ -949,7 +926,6 @@ qDebug() << "Start Treatment active"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); - _index++; } } Index: sources/StateController.h =================================================================== diff -u -ra7b6f962d1c463458114435c0c9eb152b5313864 -r83304892f4b91c5d623012e9f938ea46ff8dd2a7 --- sources/StateController.h (.../StateController.h) (revision a7b6f962d1c463458114435c0c9eb152b5313864) +++ sources/StateController.h (.../StateController.h) (revision 83304892f4b91c5d623012e9f938ea46ff8dd2a7) @@ -57,11 +57,17 @@ CMD_DISINFECTION, }; + enum Counter_Type { + COUNTER_NONE = -1, + COUNTER_PRE_TX = 0, + COUNTER_TX, + }; + QHash > _dryDemoCmds; quint16 _index; quint16 _broadcastMsgCount; quint16 _timerBroadcastCount; - bool _isWaitForUserNeeded; + bool _hasUserConfirmedToProceed; User_Command_ID _dryDemoCurrentCmd; drydemoXMLstates _dryDemo;