Index: sources/view/hd/data/VHDTreatmentStatesData.cpp =================================================================== diff -u -r64d87d540594252e8039ab2595016d98f1e3cc28 -ra2e7e903bf3fdc242ba77d99f3daa9c4208cc1f1 --- sources/view/hd/data/VHDTreatmentStatesData.cpp (.../VHDTreatmentStatesData.cpp) (revision 64d87d540594252e8039ab2595016d98f1e3cc28) +++ sources/view/hd/data/VHDTreatmentStatesData.cpp (.../VHDTreatmentStatesData.cpp) (revision a2e7e903bf3fdc242ba77d99f3daa9c4208cc1f1) @@ -17,11 +17,91 @@ // Project #include "GuiController.h" -VIEW_DEF(VHDTreatmentStates, TreatmentStatesData) +VIEW_DEF_CLASS(VHDTreatmentStates) +/*! + * \brief VTreatmentAdjustmentSaline::initConnections + * \details Initializes the message(s) connection + * \note This class not only listens to its dedicated message TreatmentStatesData, + * But also listens to other messages which affect ultrafiltration and saline bolus state. + * These extra messages are AdjustSalineResponseData , AdjustUltrafiltrationStateResponseData. + * Which ever comes first will set its related properties. + * Since the properties wont set twice if they have the same value it doesn't affect performance so much. + * Also FW suppose to send the TreatmentStatesData related message immediately after the two others. + */ +void VHDTreatmentStates::initConnections() { + ACTION_VIEW_CONNECTION(TreatmentStatesData ); + ACTION_VIEW_CONNECTION(AdjustSalineResponseData ); + ACTION_VIEW_CONNECTION(AdjustUltrafiltrationStateResponseData ); +} + +/*! + * \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 ); + 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 ); + ufOff ( vData.mUFState == GuiUFStates ::UF_OFF_STATE ); + ufCompleted ( vData.mUFState == GuiUFStates ::UF_COMPLETED_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 ); + + // Treatment states + // Treatment states - Basics + txStart ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_START_STATE ); + txStop ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_STOP_STATE ); + txEnd ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_END_STATE ); + // Treatment states - Dialysis + txDialysis_Running ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_DIALYSIS_STATE ); + txDialysis_End ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_DIALYSIS_END_STATE ); + // Treatment states - Rinse back + txRinseback_Running ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RINSEBACK_STATE ); + txRinseback_Pause ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RINSEBACK_PAUSE_STATE ); + // Treatment states - Recirculate + txRecirculate_Setup ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RECIRC_SETUP_STATE ); + txRecirculate_Running ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RECIRC_STATE ); + txRecirculate_Pause ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RECIRC_PAUSE_STATE ); + txRecirculate_Stop ( vData.mSubMode == GuiTreatmentStates ::TREATMENT_RECIRC_STOP_STATE ); } + +/*! + * \brief VHDTreatmentStates::onActionReceive + * \details message handler for the message AdjustUltrafiltrationStateResponse data + * \param vData - AdjustUltrafiltrationStateResponse data + */ +void VHDTreatmentStates::onActionReceive(const AdjustSalineResponseData &vData) +{ + // Saline Bolus states + sbIdle ( vData.mState == GuiSalineStates ::SALINE_BOLUS_STATE_IDLE ); + sbWaitPump ( vData.mState == GuiSalineStates ::SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP ); + sbRunning ( vData.mState == GuiSalineStates ::SALINE_BOLUS_STATE_IN_PROGRESS ); + sbMaxReached ( vData.mState == GuiSalineStates ::SALINE_BOLUS_STATE_MAX_DELIVERED ); +} + +/*! + * \brief VHDTreatmentStates::onActionReceive + * \details message handler for the message AdjustUltrafiltrationStateResponse data + * \param vData - AdjustUltrafiltrationStateResponse data + */ +void VHDTreatmentStates::onActionReceive(const AdjustUltrafiltrationStateResponseData &vData) +{ + // Ultrafiltration states + ufStart ( vData.mState == GuiUFStates ::UF_START_STATE ); + ufPaused ( vData.mState == GuiUFStates ::UF_PAUSED_STATE ); + ufRunning ( vData.mState == GuiUFStates ::UF_RUNNING_STATE ); + ufOff ( vData.mState == GuiUFStates ::UF_OFF_STATE ); + ufCompleted ( vData.mState == GuiUFStates ::UF_COMPLETED_STATE ); +}