Index: sources/StateController.cpp =================================================================== diff -u -r83304892f4b91c5d623012e9f938ea46ff8dd2a7 -r747a110945a7aa9b45c03107a5b1a7c9c220c71f --- sources/StateController.cpp (.../StateController.cpp) (revision 83304892f4b91c5d623012e9f938ea46ff8dd2a7) +++ sources/StateController.cpp (.../StateController.cpp) (revision 747a110945a7aa9b45c03107a5b1a7c9c220c71f) @@ -62,7 +62,6 @@ 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); emit _ApplicationController.didActionTransmit(msgBack); - break; case ID_UI_CONFIRM_RESP: { @@ -94,7 +93,7 @@ break; case ID_SAMPLE_WATER_RESULT: { - isCmdValid = true; + isCmdValid = true; int resultIndex = 0; Types::U32 resultParam; GetValue(msg[1].toByteArray(), resultIndex, resultParam); @@ -145,7 +144,7 @@ msgBack.append(0); emit _ApplicationController.didActionTransmit(msgBack); _dryDemoCurrentCmd = CMD_START_TX; - isCmdValid = true; + isCmdValid = true; break; case ID_UI_START_TX_RQST: @@ -176,25 +175,31 @@ void StateController::timerEvent(QTimerEvent *) { - int listSize = _dryDemoCmds[_dryDemoCurrentCmd].size(); + quint16 listSize = _dryDemoCmds[_dryDemoCurrentCmd].size(); //qDebug() << "Index" << _index << listSize; if ((listSize > 1) && (_index < listSize)) { if (_dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX].toBool()) { - if(_timerBroadcastCount >= NUM_OF_COUNTS_TIMER_BC_EMIT) { - //qDebug() << "Index 222" << _dryDemoCmds[_dryDemoCurrentCmd][_index]; - _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX] = - _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt() - 1; + if (_currentCounterValue < 0) { + _currentCounterValue = _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt(); + } + + if(_timerBroadcastCount >= NUM_OF_COUNTS_TIMER_BC_EMIT) { + _currentCounterValue--; _timerBroadcastCount = 0; - qDebug() << "Counters" << NUM_OF_COUNTS_TIMER_BC_EMIT << _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][IS_TIMER_INDEX] = false; + QVariant tempVar = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); + QVariantList msg = tempVar.toList(); + msg[3] = _currentCounterValue; + qDebug() << "Counters" << msg << _currentCounterValue << _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt(); + emit _ApplicationController.didActionTransmit(msg); + + if (_currentCounterValue == 0) { _index++; + _currentCounterValue = -1; } } else { @@ -217,7 +222,7 @@ if (nextCmdEnum != CMD_NONE) { qDebug() << "Current Enum" << _dryDemoCurrentCmd; _dryDemoCurrentCmd = nextCmdEnum; - qDebug() << "New transiion" << nextCmdEnum << _dryDemoCurrentCmd << _index; + qDebug() << "New transition" << nextCmdEnum << _dryDemoCurrentCmd << _index; _dryDemo.submitEvent("Transition_back_2_idle"); } @@ -828,6 +833,7 @@ _broadcastMsgCount = 0; _timerBroadcastCount = 0; _hasUserConfirmedToProceed = false; + _currentCounterValue = -1; } // ----------- State transition methods ---------------- // Index: sources/StateController.h =================================================================== diff -u -r83304892f4b91c5d623012e9f938ea46ff8dd2a7 -r747a110945a7aa9b45c03107a5b1a7c9c220c71f --- sources/StateController.h (.../StateController.h) (revision 83304892f4b91c5d623012e9f938ea46ff8dd2a7) +++ sources/StateController.h (.../StateController.h) (revision 747a110945a7aa9b45c03107a5b1a7c9c220c71f) @@ -58,16 +58,18 @@ }; enum Counter_Type { - COUNTER_NONE = -1, - COUNTER_PRE_TX = 0, - COUNTER_TX, + COUNTER_NONE = -1, + COUNTER_PRE_TX_TIMERS = 0, + COUNTER_TX_TIMER, + COUNTER_RINSEBACK_TIMER, }; QHash > _dryDemoCmds; quint16 _index; quint16 _broadcastMsgCount; quint16 _timerBroadcastCount; bool _hasUserConfirmedToProceed; + int _currentCounterValue; User_Command_ID _dryDemoCurrentCmd; drydemoXMLstates _dryDemo;