Index: sources/StateController.cpp =================================================================== diff -u -r8dec5fecad6d0be26c22a427ed60c08a9753563a -raf84a44034a877134a53b6b48b016d409f843380 --- sources/StateController.cpp (.../StateController.cpp) (revision 8dec5fecad6d0be26c22a427ed60c08a9753563a) +++ sources/StateController.cpp (.../StateController.cpp) (revision af84a44034a877134a53b6b48b016d409f843380) @@ -100,7 +100,6 @@ int resultIndex = 0; Types::U32 resultParam; GetValue(msg[1].toByteArray(), resultIndex, resultParam); - qDebug() << "Sample reulsts" << resultParam.value; if ( resultParam.value == 1 ) { _dryDemoCurrentCmd = CMD_CONSUMABLES; } @@ -154,8 +153,29 @@ _hasUserConfirmedToProceed = true; break; + case ID_USER_TX_TIME_CHANGES_RQST: { + int IDIndex = 0; + Types::U32 txDurMin; + GetValue(msg[1].toByteArray(), IDIndex, txDurMin); + + qDebug() << "New treat time" << txDurMin.value; + + _prescribedTreatmentTimeS *= MINUTES_TO_SECONDS; + + msgBack.clear(); + msgBack.append(static_cast(ID_USER_TX_TIME_CHANGES_RESP)); + msgBack.append(Can_Id::eChlid_HD_UI); + msgBack.append(1); + msgBack.append(0); + msgBack.append(txDurMin.value); + msgBack.append(DEFAULT_UF_VOLUME_L); + emit _ApplicationController.didActionTransmit(msgBack); + } + break; + case ID_NONE: case ID_TX_TIME_BC: + case ID_HD_TX_PARAMS_RANGES_DATA: case ID_HD_TX_STATES_BC: case ID_HD_OP_MODE: case ID_FILTER_FLUSH_TIME_BC: @@ -167,6 +187,7 @@ case ID_HD_PRIMING_TIME_BC: case ID_HD_SET_UF_VOLUME_RESP: case ID_HD_PATINET_CONNECTION_CONF_RESP: + case ID_USER_TX_TIME_CHANGES_RESP: // Do nothing break; } @@ -220,18 +241,19 @@ break; case COUNTER_TX_TIMER: - if (_currentCounterValue < 0) { - quint32 prescribedTimeS = _dryDemoCmds[_dryDemoCurrentCmd][_index][TIME_PRESCRIBED_S_INDEX].toUInt(); - quint32 elapsedTimeS = _dryDemoCmds[_dryDemoCurrentCmd][_index][TIME_ELAPSED_S_INDEX].toUInt(); - _currentCounterValue = prescribedTimeS - elapsedTimeS; + if ((_currentCounterValue < 0) && (_prescribedTreatmentTimeS < 0)) { + _prescribedTreatmentTimeS = _dryDemoCmds[_dryDemoCurrentCmd][_index][TIME_PRESCRIBED_S_INDEX].toUInt(); + quint32 elapsedTimeS = _dryDemoCmds[_dryDemoCurrentCmd][_index][TIME_ELAPSED_S_INDEX].toUInt(); + _currentCounterValue = _prescribedTreatmentTimeS - elapsedTimeS; } _currentCounterValue--; _timerBroadcastCount = 0; tempVar = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); msg = tempVar.toList(); - msg[TIME_REMAINING_S_INDEX - RESP_MSG_START_INDEX] = _currentCounterValue; + msg[TIME_PRESCRIBED_S_INDEX - RESP_MSG_START_INDEX] = _prescribedTreatmentTimeS; + msg[TIME_REMAINING_S_INDEX - RESP_MSG_START_INDEX] = _currentCounterValue; qDebug() << "Counters Tx" << _currentCounterValue << _dryDemoCmds[_dryDemoCurrentCmd][_index]; emit _ApplicationController.didActionTransmit(msg); break; @@ -250,8 +272,10 @@ } } else { - emit _ApplicationController.didActionTransmit(_dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX)); - _broadcastMsgCount++; + if (_broadcastMsgCount <= NUM_OF_COUNTS_TO_BC_MSG) { + emit _ApplicationController.didActionTransmit(_dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX)); + _broadcastMsgCount++; + } bool isWaitNeeded = _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_WAIT_NEEDED_INDEX].toBool(); @@ -284,7 +308,7 @@ QVariantList temp; temp.append("Transition_2_Tx_Parms"); temp.append(false); // wait for a trigger - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_TPAR); @@ -294,35 +318,35 @@ temp.append("Transition_2_Water_Sample"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_WATER_SAMPLE].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(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); temp.append(0); _dryDemoCmds[CMD_WATER_SAMPLE].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); //(true); // this is the timer + temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_FILTER_FLUSH_TIME_BC)); temp.append(Can_Id::eChlid_DG_Sync); temp.append(DEFAULT_TIMEOUT_S); temp.append(DEFAULT_TIMEOUT_S); _dryDemoCmds[CMD_WATER_SAMPLE].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(0); temp.append(1); temp.append(0); temp.append(0); temp.append(0); @@ -333,56 +357,56 @@ temp.append("Transition_2_Consumables"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_CONSUMABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(1); 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_CONSUMABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(1); temp.append(0); temp.append(1); 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_CONSUMABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(1); temp.append(0); temp.append(2); 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_CONSUMABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(1); temp.append(0); 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); _dryDemoCmds[CMD_CONSUMABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_DISPOSABLES)); // auto transition + temp.append(static_cast(CMD_DISPOSABLES)); // auto transition temp.append(static_cast(ID_PRE_TX_STATES_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); temp.append(0); temp.append(4); temp.append(0); temp.append(0); @@ -393,45 +417,45 @@ temp.append("Transition_2_Disposables"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_DISPOSABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(2); 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); temp.append(0); temp.append(0); _dryDemoCmds[CMD_DISPOSABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); //(true); // this is the timer + temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_SYS_SELF_TEST_TIME_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(DEFAULT_TIMEOUT_S); temp.append(DEFAULT_TIMEOUT_S); _dryDemoCmds[CMD_DISPOSABLES].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait for the user - temp.append(static_cast(CMD_NONE)); // auto transition + 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); // wait for the user - temp.append(static_cast(CMD_NONE)); // auto transition + 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); @@ -442,334 +466,334 @@ temp.append("Transition_2_Sys_Prime"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_SYSTEM_PRIME].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(0); 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(static_cast(COUNTER_PRE_TX_TIMERS)); //(true); // this is the timer + temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(2); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(3); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(4); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(6); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(7); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(8); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(9); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(10); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(11); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(12); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(13); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(14); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(15); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(16); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); 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_SYSTEM_PRIME].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); //(true); // this is the timer + temp.append(static_cast(COUNTER_PRE_TX_TIMERS)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_PRIMING_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(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); 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); _dryDemoCmds[CMD_SYSTEM_PRIME].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(2); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(3); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(4); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(5); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(6); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(7); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(8); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(9); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(10); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(11); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + 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(5); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(0); temp.append(12); 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(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + 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(6); temp.append(0); temp.append(0); temp.append(0); temp.append(0); @@ -780,16 +804,16 @@ temp.append("Transition_2_BP_HR"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_BP_HR].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + 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(7); temp.append(0); temp.append(0); temp.append(0); temp.append(0); @@ -800,16 +824,16 @@ temp.append("Transition_2_Ultrafiltraion"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_ULTRAFILTRATION].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + 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(7); temp.append(0); temp.append(0); temp.append(0); temp.append(0); @@ -820,16 +844,16 @@ temp.append("Transition_2_Patient_Connection"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_CONNECTION].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + 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(7); temp.append(0); temp.append(0); temp.append(0); temp.append(0); @@ -840,55 +864,67 @@ temp.append("Transition_2_Start_Tx"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_PRET); temp.append(0); _dryDemoCmds[CMD_START_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + 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(7); 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(3); temp.append(0); temp.append(0); _dryDemoCmds[CMD_START_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); // Transition to Tx. This is empty because there is no event + temp.append(static_cast(COUNTER_NONE)); // Transition to Tx. This is empty because there is no event temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_TREA); temp.append(0); _dryDemoCmds[CMD_START_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + // NOTE: Tx param ranges are broadcast in firmware but it is sent here only once + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(ID_HD_TX_PARAMS_RANGES_DATA)); + temp.append(Can_Id::eChlid_HD_UI); + temp.append(0); temp.append(DEFAULT_TX_PRESCRIBED_DUR_S / 60); + temp.append(0.0); temp.append(DEFAULT_UF_VOLUME_L); + temp.append(100); temp.append(600); + _dryDemoCmds[CMD_START_TX].append(temp); + temp.clear(); + + temp.append(static_cast(COUNTER_NONE)); // this is the timer + temp.append(false); // wait + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_TX_STATES_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); 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_START_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); //(false); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_TX_STATES_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(2); temp.append(1); 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_START_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_TX_TIMER)); //(false); // this is the timer + temp.append(static_cast(COUNTER_TX_TIMER)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_TX_TIME_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(DEFAULT_TX_PRESCRIBED_DUR_S); @@ -898,28 +934,28 @@ temp.clear(); temp.append("Transition_2_End_Tx"); - temp.append(static_cast(COUNTER_NONE)); // Transition to Tx. This is empty because there is no event + temp.append(static_cast(COUNTER_NONE)); // Transition to Tx. This is empty because there is no event temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_TREA); temp.append(0); _dryDemoCmds[CMD_END_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_TX_STATES_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(1); 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_END_TX].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(true); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_TX_STATES_BC)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(6); temp.append(0); temp.append(0); temp.append(0); temp.append(0); @@ -930,16 +966,16 @@ temp.append("Transition_2_Disinfect"); temp.append(false); - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_STAN); temp.append(0); _dryDemoCmds[CMD_DISINFECTION].append(temp); temp.clear(); - temp.append(static_cast(COUNTER_NONE)); // this is the timer + temp.append(static_cast(COUNTER_NONE)); // this is the timer temp.append(false); // wait - temp.append(static_cast(CMD_NONE)); // auto transition + temp.append(static_cast(CMD_NONE)); // auto transition temp.append(static_cast(ID_HD_OP_MODE)); temp.append(Can_Id::eChlid_HD_Sync); temp.append(MODE_STAN); @@ -967,6 +1003,7 @@ _timerBroadcastCount = 0; _hasUserConfirmedToProceed = false; _currentCounterValue = COUNTER_VAR_DEFAULT_VALUE; + _prescribedTreatmentTimeS = PRESC_TIME_DEFAULT_VALUE; } // ----------- State transition methods ---------------- //