Index: sources/drydemo/StateController.cpp =================================================================== diff -u -r6e845078107f7d15a3e471be421d5bce31fc51da -ra271469db538bfc35eba9a56308760893ecbc68e --- sources/drydemo/StateController.cpp (.../StateController.cpp) (revision 6e845078107f7d15a3e471be421d5bce31fc51da) +++ sources/drydemo/StateController.cpp (.../StateController.cpp) (revision a271469db538bfc35eba9a56308760893ecbc68e) @@ -73,6 +73,7 @@ case ID_UI_DURATION_CONFIRM_RQST: case ID_UI_ALARM_USER_ACTION_REQUEST: case ID_UI_RINSEBACK_CMD_RQST: + case ID_UI_RECIRCULATE_RQST: _treatmentRcvdMessages[receivedMsgID] = msg[1]; break; @@ -121,6 +122,8 @@ case ID_TD_RINSEBACK_CMD_RESP: case ID_TD_RINSEBACK_DATA: case ID_TD_UI_GENERIC_CONFIRMATION_REQUEST: + case ID_TD_RECIRCULATE_RESP: + case ID_TD_RECIRCULATE_DATA: // Do nothing break; } @@ -398,6 +401,8 @@ handleTreatmentTimeChangeConfirm(); if ((_treatmentStatus.treatmentElapsedTimeMS / MILLISECONDS_PER_SECOND) > (_treatmentParams.treatmentDurationMin * SECONDS_PER_MINUTE)) { + // Treatment is complete + _treatmentStatus.isTreatmentComplete = true; _treatmentStatus.stateTransitionEvent = "T_Tx_2_TE"; status = STATE_ON_EXIT; } @@ -470,11 +475,11 @@ // Start with UF state in dialysis _treatmentStatus.dialysisSubState = DIALYSIS_UF_PAUSED_STATE; _treatmentStatus.txState = TREAT_RINSEBACK_STATE; - _treatmentStatus.rinsebackStates = RINSEBACK_STOP_INIT_STATE; + _treatmentStatus.rinsebackState = RINSEBACK_STOP_INIT_STATE; handleTDOpModeTransitionBroadcastData(MODE_TREA, 0, BC_IMMEDIATELY); txStates = {TREAT_START_STATE, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, 0, 0, 0, 0}; handleTreatmentStatesBroadcastData(txStates, BC_IMMEDIATELY); - txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, _treatmentStatus.rinsebackStates, 0, 0, 0, 0}; + txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, _treatmentStatus.rinsebackState, 0, 0, 0, 0}; initializeRinseback(); handleTreatmentStatesBroadcastData(txStates, BC_IMMEDIATELY); handleRinsebackBroadcastData(BC_IMMEDIATELY); @@ -486,12 +491,17 @@ status = STATE_ON_ACTION; handleBackToStandbyEvent(status); handleTDOpModeTransitionBroadcastData(MODE_TREA, 0, BC_DELAYED); - txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, _treatmentStatus.rinsebackStates, 0, 0, 0, 0}; + txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, _treatmentStatus.rinsebackState, 0, 0, 0, 0}; handleTreatmentStatesBroadcastData(txStates, BC_DELAYED); handleRinsebackRequestMessage(); handleRinsebackDelivery(); handleRinsebackBroadcastData(BC_DELAYED); handleTDPressureProcessAndBroadcastData(BC_DELAYED); + handleUIConfirmMessage(GENERIC_CONFIRM_ID_TREATMENT_END, status); + if (_treatmentStatus.hasRecircBeenRequested) { + _treatmentStatus.stateTransitionEvent = "T_RB_2_RC"; + status = STATE_ON_EXIT; + } }; auto onExit = [=](){ @@ -514,26 +524,27 @@ auto onEntry = [=](){ // Start with UF state in dialysis _treatmentStatus.dialysisSubState = DIALYSIS_UF_STATE; - _treatmentStatus.txState = TREAT_DIALYSIS_STATE; + _treatmentStatus.txState = TREAT_RECIRC_STATE; + _treatmentStatus.recircState = TREATMENT_RECIRC_DISCONNECT_PATIENT_STATE; handleTDOpModeTransitionBroadcastData(MODE_TREA, 0, BC_IMMEDIATELY); txStates = {TREAT_START_STATE, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, 0, 0, 0, 0}; handleTreatmentStatesBroadcastData(txStates, BC_IMMEDIATELY); - txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, 0, 0, 0, 0}; + txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, _treatmentStatus.recircState, 0, 0, 0}; handleTreatmentStatesBroadcastData(txStates, BC_IMMEDIATELY); status = STATE_ON_ACTION; - qDebug() << "Tx pause on entry"; + qDebug() << "Tx recric on entry"; }; auto onAction = [=](){ status = STATE_ON_ACTION; handleBackToStandbyEvent(status); handleTDOpModeTransitionBroadcastData(MODE_TREA, 0, BC_DELAYED); - txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, 0, 0, _treatmentStatus.fluidBolusState, 0}; + txStates = {_treatmentStatus.txState, 0, _treatmentStatus.dialysisSubState, 0, 0, 0, _treatmentStatus.recircState, 0, 0, 0}; handleTreatmentStatesBroadcastData(txStates, BC_DELAYED); }; auto onExit = [=](){ - qDebug() << "Tx pasue in exit"; + qDebug() << "Tx recric in exit"; _dryDemo.submitEvent(_treatmentStatus.stateTransitionEvent); status = STATE_ON_ENTRY; };