Index: sources/StateController.cpp =================================================================== diff -u -r1ac0482d2e0a0baf9d9d7eb7f1223458bd3eced5 -r8dec5fecad6d0be26c22a427ed60c08a9753563a --- sources/StateController.cpp (.../StateController.cpp) (revision 1ac0482d2e0a0baf9d9d7eb7f1223458bd3eced5) +++ sources/StateController.cpp (.../StateController.cpp) (revision 8dec5fecad6d0be26c22a427ed60c08a9753563a) @@ -69,20 +69,23 @@ Types::U32 IDParam; GetValue(msg[1].toByteArray(), IDIndex, IDParam); if (IDParam.value == UI_MSG_BB_PAYLOAD_ID) { - int cmdIndex = 4; + int cmdIndex = UI_MSG_DD_STATUS_INDEX; Types::U32 cmdParam; GetValue(msg[1].toByteArray(), cmdIndex, cmdParam); - _dryDemoCurrentCmd = static_cast(cmdParam.value); - isCmdValid = true; - qDebug() << "Msg Case 2" << receivedMsgID << cmdParam.value << _dryDemoCurrentCmd <(cmdParam.value); + if ((cmdIDEnum > CMD_NONE) && (cmdIDEnum < NUM_OF_USER_CMDS)) { + _dryDemoCurrentCmd = cmdIDEnum; + isCmdValid = true; + qDebug() << "Msg Case 2" << receivedMsgID << cmdParam.value << _dryDemoCurrentCmd <(ID_HD_UI_CONFIRM_RQST)); - msgBack.append(Can_Id::eChlid_HD_UI); - msgBack.append(UI_MSG_BB_PAYLOAD_ID); - msgBack.append(1); - msgBack.append(0); - emit _ApplicationController.didActionTransmit(msgBack); + msgBack.clear(); + msgBack.append(static_cast(ID_HD_UI_CONFIRM_RQST)); + msgBack.append(Can_Id::eChlid_HD_UI); + msgBack.append(UI_MSG_BB_PAYLOAD_ID); + msgBack.append(1); + msgBack.append(0); + emit _ApplicationController.didActionTransmit(msgBack); + } } } break; @@ -185,7 +188,7 @@ int counterType = _dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX].toInt(); Counter_Type counterTypeEnum = static_cast(counterType); - qDebug() << "Counter Type" << _dryDemoCurrentCmd << _index << counterTypeEnum; + //qDebug() << "Counter Type" << _dryDemoCurrentCmd << _index << counterTypeEnum; //if (_dryDemoCmds[_dryDemoCurrentCmd][_index][IS_TIMER_INDEX].toBool()) { if (counterTypeEnum != COUNTER_NONE) { @@ -212,7 +215,7 @@ tempVar = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); msg = tempVar.toList(); msg[COUNT_DOWN_TIMER_INDEX - RESP_MSG_START_INDEX] = _currentCounterValue; - qDebug() << "Counters Pre Tx" << _currentCounterValue << _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt(); + //qDebug() << "Counters Pre Tx" << _currentCounterValue << _dryDemoCmds[_dryDemoCurrentCmd][_index][COUNT_DOWN_TIMER_INDEX].toUInt(); emit _ApplicationController.didActionTransmit(msg); break; @@ -795,6 +798,26 @@ _dryDemoCmds[CMD_BP_HR].append(temp); temp.clear(); + temp.append("Transition_2_Ultrafiltraion"); + 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_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(false); // wait + 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(1); + temp.append(0); temp.append(0); + _dryDemoCmds[CMD_ULTRAFILTRATION].append(temp); + temp.clear(); + temp.append("Transition_2_Patient_Connection"); temp.append(false); temp.append(static_cast(CMD_NONE)); // auto transition @@ -872,6 +895,57 @@ temp.append(DEFAULT_TX_ELAPSED_TIME_S); temp.append(DEFAULT_TX_PRESCRIBED_DUR_S - DEFAULT_TX_ELAPSED_TIME_S); _dryDemoCmds[CMD_START_TX].append(temp); + 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(false); + 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(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_END_TX].append(temp); + temp.clear(); + 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(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); + 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("Transition_2_Disinfect"); + 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_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(false); // wait + 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(2); + _dryDemoCmds[CMD_DISINFECTION].append(temp); + temp.clear(); } void StateController::transitionApplicationToStandBy() @@ -963,7 +1037,7 @@ void StateController::onBPHRStateChange(bool active) { if (active) { - qDebug() << "BP_HD active"; + qDebug() << "BP/HR active"; QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); emit _ApplicationController.didActionTransmit(msg); } @@ -998,13 +1072,17 @@ { if (active) { qDebug() << "Treatment end active"; + QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); + emit _ApplicationController.didActionTransmit(msg); } } void StateController::onDisinfectStateChange(bool active) { if (active) { qDebug() << "Disinfect active"; + QVariantList msg = _dryDemoCmds[_dryDemoCurrentCmd][_index].mid(RESP_MSG_START_INDEX); + emit _ApplicationController.didActionTransmit(msg); } } Index: sources/StateController.h =================================================================== diff -u -r1ac0482d2e0a0baf9d9d7eb7f1223458bd3eced5 -r8dec5fecad6d0be26c22a427ed60c08a9753563a --- sources/StateController.h (.../StateController.h) (revision 1ac0482d2e0a0baf9d9d7eb7f1223458bd3eced5) +++ sources/StateController.h (.../StateController.h) (revision 8dec5fecad6d0be26c22a427ed60c08a9753563a) @@ -28,6 +28,10 @@ void timerEvent(QTimerEvent *) override; private: + // General defines + #define UI_MSG_DD_STATUS_INDEX 4 + #define UI_MSG_BB_PAYLOAD_ID 0x63 + // Pre treatment defines #define DEFAULT_TIMEOUT_S 10 #define TRANSITION_EVENT_INDEX 0 @@ -36,7 +40,6 @@ #define IS_WAIT_NEEDED_INDEX 1 #define NEXT_AUTO_TRANSITION_INDEX 2 #define COUNT_DOWN_TIMER_INDEX 6 - #define UI_MSG_BB_PAYLOAD_ID 0x63 #define COUNTER_VAR_DEFAULT_VALUE -1 // Timer event defines @@ -53,18 +56,19 @@ #define TIME_REMAINING_S_INDEX 7 enum User_Command_ID { - CMD_NONE = -1, - CMD_TX_PARAMS = 0 , - CMD_WATER_SAMPLE, - CMD_CONSUMABLES, - CMD_DISPOSABLES, - CMD_SYSTEM_PRIME, - CMD_BP_HR, - CMD_ULTRAFILTRATION, - CMD_CONNECTION, - CMD_START_TX, - CMD_END_TX, - CMD_DISINFECTION, + CMD_NONE = -1, + CMD_TX_PARAMS = 0 , + CMD_WATER_SAMPLE = 1, + CMD_CONSUMABLES = 2, + CMD_DISPOSABLES = 3, + CMD_SYSTEM_PRIME = 4, + CMD_BP_HR = 5, + CMD_ULTRAFILTRATION = 6, + CMD_CONNECTION = 7, + CMD_START_TX = 8, + CMD_END_TX = 9, + CMD_DISINFECTION = 10, + NUM_OF_USER_CMDS, }; enum Counter_Type {