/*! * * Copyright (c) 2019-2020 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 VHDTreatmentStatesData.cpp * \author (last) Behrouz NematiPour * \date (last) 07-Feb-2021 * \author (original) Behrouz NematiPour * \date (original) 13-Aug-2020 * */ #include "VHDTreatmentStatesData.h" // Project #include "GuiController.h" VIEW_DEF(VHDTreatmentStates, TreatmentStatesData) /*! * \brief VHDTreatmentStates::onActionReceive * \details sets the properties for the received data of Treatment States * \param vData - Treatment States data */ void VHDTreatmentStates::onActionReceive(const TreatmentStatesData &vData) { subMode ( vData.mSubMode ); ufState ( vData.mUFState ); salineState ( vData.mSalineState ); // Ultrafiltration states ufStart ( vData.mUFState == GuiUFStates ::UF_START_STATE ); ufPaused ( vData.mUFState == GuiUFStates ::UF_PAUSED_STATE ); ufRunning ( vData.mUFState == GuiUFStates ::UF_RUNNING_STATE ); // Saline Bolus states sbIdle ( vData.mSalineState == GuiSalineStates ::SALINE_BOLUS_STATE_IDLE ); sbWaitPump ( vData.mSalineState == GuiSalineStates ::SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP ); sbRunning ( vData.mSalineState == GuiSalineStates ::SALINE_BOLUS_STATE_IN_PROGRESS ); sbMaxReached ( vData.mSalineState == GuiSalineStates ::SALINE_BOLUS_STATE_MAX_DELIVERED ); // Heparin States hpOff ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_OFF ); hpStopped ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_STOPPED ); hpPaused ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_PAUSED ); hpInitial_bolus ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_INITIAL_BOLUS ); hpDispensing ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_DISPENSING ); hpCompleted ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_COMPLETED ); hpEmpty ( vData.mHeparinState == GuiHeparinStates ::HEPARIN_STATE_EMPTY ); // Treatment states // Treatment states - Basics txStart ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_START_STATE ); // Treatment states - Dialysis txDialysis ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_DIALYSIS_STATE ); // NOTE: For Rinseback and Recirculate // 1 - it seems we may never need the txRinseback // since in the Rinseback state parameter of the Treatment State the first state of each has the same meaning // it may only be used to know when those parameters have valid values to update the properties. // Kept for now because cannot be sure that it will change later or not. // 2 - if there could be a way to export enums to qml and qml can raise an error if an incorrect enum used, // then it would is absolutely preferred to use enum instead of properties // currently if just one property being defined/used to send the current state to the qml, there is no way to make sure if incorrect/undefined // enum is used or not. // in Qt user/developer can literally type GuiActions.abcdefg and qml will never complain and only if compared with the state will return false. // Treatment states - Rinse back // Rinseback states bool mRinseback = vData.mSubMode == GuiTreatmentStates ::TREATMENT_RINSEBACK_STATE ; if ( mRinseback ) { rbInit ( vData.mRinsebackState == GuiRinsebackStates ::RINSEBACK_STOP_INIT_STATE ); rbRun ( vData.mRinsebackState == GuiRinsebackStates ::RINSEBACK_RUN_STATE ); rbPaused ( vData.mRinsebackState == GuiRinsebackStates ::RINSEBACK_PAUSED_STATE ); rbStop ( vData.mRinsebackState == GuiRinsebackStates ::RINSEBACK_STOP_STATE ); rbAdditional ( vData.mRinsebackState == GuiRinsebackStates ::RINSEBACK_RUN_ADDITIONAL_STATE ); } txRinseback ( mRinseback ); // it's the main rinseback even so moved last to have all the sub-rinseback-states updated prior to. // Recirculate states bool mRecirculate = vData.mSubMode == GuiTreatmentStates ::TREATMENT_RECIRC_STATE ; if ( mRecirculate ) { rcStarted ( vData.mRecirculateState == GuiRecirculateStates ::TREATMENT_RECIRC_RECIRC_STATE ); rcStopped ( vData.mRecirculateState == GuiRecirculateStates ::TREATMENT_RECIRC_STOPPED_STATE ); } txRecirculate ( mRecirculate ); // it's the main recirculate even so moved last to have all the sub-recirculate-states updated prior to. // Blood Prime states bool mBloodPrime = vData.mSubMode == GuiTreatmentStates ::TREATMENT_BLOOD_PRIME_STATE ; if ( mBloodPrime ) { bpRamp ( vData.mBloodPrimeState == GuiBloodPrimeStates ::BLOOD_PRIME_RAMP_STATE ); } txBloodPrime ( mBloodPrime ); // Treatment End states bool mTreatmentEnd = vData.mSubMode == GuiTreatmentStates ::TREATMENT_END_STATE ; if ( mTreatmentEnd ) { teWaitRinseback ( vData.mTreatmentEndState == GuiTreatmentEndStates ::TREATMENT_END_WAIT_FOR_RINSEBACK_STATE ); tePaused ( vData.mTreatmentEndState == GuiTreatmentEndStates ::TREATMENT_END_PAUSED_STATE ); } txEnd ( mTreatmentEnd ); // Treatment Stop states bool mTreatmentStop = vData.mSubMode == GuiTreatmentStates ::TREATMENT_STOP_STATE ; if ( mTreatmentStop ) { tsRecirculate ( vData.mTreatmentStopState == GuiTreatmentStopStates ::TREATMENT_STOP_RECIRC_STATE ); tsRecirculateNo ( vData.mTreatmentStopState == GuiTreatmentStopStates ::TREATMENT_STOP_NO_RECIRC_STATE ); } txStop ( mTreatmentStop ); }