/*! * * Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file VPreTreatmentStatesData.cpp * \author (last) Behrouz NematiPour * \date (last) 01-Aug-2023 * \author (original) Behrouz NematiPour * \date (original) 11-Apr-2021 * */ #include "VPreTreatmentStatesData.h" // Project #include "GuiController.h" VIEW_DEF(VPreTreatmentStates, PreTreatmentStatesData) /*! * \brief VTDTreatmentStates::onActionReceive * \details sets the properties for the received data of Treatment States * \param vData - Treatment States data */ void VPreTreatmentStates::onActionReceive(const PreTreatmentStatesData &vData) { subMode ( vData.mSubMode ); installationState ( vData.mInstallState ); selfTestDryState ( vData.mSelfTestDryState ); primeState ( vData.mPrimeState ); recirculateState ( vData.mRecirculateState ); confirmRxState ( vData.mConfirmRxState ); heparinState ( vData.mHeparinState ); patientConnectionState ( vData.mPatientConnectionState ); // Consumable and cartridge installation state bool mInstallation = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE ; if ( mInstallation ) { // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. installation_start ( vData.mInstallState == 0 /* There is no other state and it is always 0 for now */ ); } installation(mInstallation); // it's the main even so moved last to have all the sub-states updated prior to. // TODO: Self tests dry state bool mSelfTestDry = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_SELF_TEST_DRY_STATE ; if ( mSelfTestDry ) { selfTestDry_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); } selfTestDry(mSelfTestDry); // it's the main even so moved last to have all the sub-states updated prior to. // TODO: Prime blood and dialysate circuits and run wet self-tests state bool mPrime = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_PRIME_STATE ; if ( mPrime ) { prime_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); } prime(mPrime); // it's the main even so moved last to have all the sub-states updated prior to. // Re-circulate blood and dialysate circuits state bool mRecirculate = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_RECIRCULATE_STATE ; if ( mRecirculate ) { recirculate_start ( vData.mRecirculateState == GuiPreTreatmentRecirculateStates ::PRE_TREATMENT_RECIRC_STATE ); recirculate_stopped ( vData.mRecirculateState == GuiPreTreatmentRecirculateStates ::PRE_TREATMENT_RECIRC_STOPPED_STATE ); } recirculate(mRecirculate); // it's the main even so moved last to have all the sub-states updated prior to. // Confirm Rx state bool mConfirmStae = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_CONFIRM_RX_STATE ; if ( mConfirmStae ) { confirmRx_start ( vData.mConfirmRxState == 0 /* There is no other state and it is always 0 for now */ ); } confirmRx(mConfirmStae); // it's the main even so moved last to have all the sub-states updated prior to. // Heparin state bool mHeparin = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_HEPARIN_SETUP_STATE ; if ( mHeparin ) { heparin_start ( vData.mHeparinState == 0 /* There is no other state and it is always 0 for now */ ); } heparin(mHeparin); // it's the main even so moved last to have all the sub-states updated prior to. // Patient connection state bool mPatientConnection = vData.mSubMode == GuiPreTreatmentStates ::TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE ; if ( mPatientConnection ) { // There is not state(enum) for this and it is always 0 for now. but will be used to notify UI about being in this state. patientConnection_start ( vData.mPatientConnectionState == 0 /* There is no other state and it is always 0 for now */ ); } patientConnection(mPatientConnection); // *** Only for test *** // Be careful it is always triggered on each message. state(true); }