/*! * * 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 VHDTreatmentStatesData.h * \author (last) Behrouz NematiPour * \date (last) 20-Jul-2023 * \author (original) Behrouz NematiPour * \date (original) 11-Apr-2021 * */ #pragma once // Qt #include // Project #include "main.h" // Doxygen : do not remove #include "VView.h" #include "MTreatmentStatesData.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustSalineResponse.h" #include "MTreatmentAdjustHeparinResponse.h" // namespace namespace View { /*! * \brief The VHDTreatmentStates class * \details View for Model's data representation. * * \sa Model::MTreatmentStates * */ class VHDTreatmentStates : public QObject { Q_OBJECT // This property should not be used in QML since it need exposed enum // exposed enum usage in QML is not suggested since QML will not error out on any issue PROPERTY( quint32, subMode , 0) PROPERTY( quint32, ufState , 0) PROPERTY( quint32, salineState , 0) // these groups of properties are mutually exclusive // and if one becomes true the other ones become false at the same time // so on each change we were going to have multiple signal emits. // but since it is not happening more often Property is used. // otherwise it should be implemented as a single signal with these properties as parameters.\n // also start UF_START_STATE should not be used often // because it's only useful in FW implementation and it immediately changes to another state. // ---- Treatment states // ---- Treatment states - Basics // not used yet since the Treatment Start/stop/end has not been implemented yet. PROPERTY( bool , txStart , false) ///< TREATMENT_START_STATE = 0 # Start treatment - initialize treatment and go to blood prime state PROPERTY( bool , txBloodPrime , false) ///< TREATMENT_BLOOD_PRIME_STATE = 1 # Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. PROPERTY( bool , txDialysis , false) ///< TREATMENT_DIALYSIS_STATE = 2 # Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested PROPERTY( bool , txStop , false) ///< TREATMENT_STOP_STATE = 3 # Treatment stopped. All pumps off. Dializer bypassed PROPERTY( bool , txTreatment , false) ///< TREATMENT_STOP_STATE = 3 || TREATMENT_DIALYSIS_STATE = 2 PROPERTY( bool , txRinseback , false) ///< TREATMENT_RINSEBACK_STATE = 4 # Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating PROPERTY( bool , txRecirculate , false) ///< TREATMENT_RECIRC_STATE = 5 # Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed PROPERTY( bool , txEnd , false) ///< TREATMENT_END_STATE = 6 # Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback // ---- Ultrafiltration states PROPERTY( bool , ufPaused , false) ///< UF_PAUSED_STATE = 1 # Paused state of the ultrafiltration state machine PROPERTY( bool , ufRunning , false) ///< UF_RUNNING_STATE = 2 # Running state of the ultrafiltration state machine // ---- Saline Bolus states PROPERTY( bool , sbIdle , true ) ///< SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress PROPERTY( bool , sbWaitPump , false) ///< SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP = 1 # Wait for pumps to stop before starting bolus PROPERTY( bool , sbRunning , false) ///< SALINE_BOLUS_STATE_IN_PROGRESS = 2 # A saline bolus delivery is in progress PROPERTY( bool , sbMaxReached , false) ///< SALINE_BOLUS_STATE_MAX_DELIVERED = 3 # Maximum saline bolus volume reached - no more saline bolus deliveries allowed // ---- Heparin states PROPERTY( bool , hpOff , true ) ///< HEPARIN_STATE_OFF = 0 # No heparin delivery is in progress PROPERTY( bool , hpStopped , false) ///< HEPARIN_STATE_STOPPED = 1 # Heparin delivery stopped by alarm or not yet started PROPERTY( bool , hpPaused , false) ///< HEPARIN_STATE_PAUSED = 2 # Heparin delivery paused PROPERTY( bool , hpInitial_bolus , false) ///< HEPARIN_STATE_INITIAL_BOLUS = 3 # Initial heparin bolus delivery in progress PROPERTY( bool , hpDispensing , false) ///< HEPARIN_STATE_DISPENSING = 4 # Gradual heparin dispensing in progress PROPERTY( bool , hpCompleted , false) ///< HEPARIN_STATE_COMPLETED = 5 # Heparin delivery stopped due to the set stop time before treatment end PROPERTY( bool , hpEmpty , false) ///< HEPARIN_STATE_EMPTY = 6 # Heparin Syringe empty PROPERTY( bool , heparin , false) ///< The heparin state is an asynchronous state // Dialysis States PROPERTY( bool , dyStart , true ) ///< Start state of the dialysis sub-mode state machine PROPERTY( bool , dyUltrafiltration , false) ///< Ultrafiltration state of the dialysis sub-mode state machine PROPERTY( bool , dySalineBolus , false) ///< Saline bolus state of the dialysis sub-mode state machine // Rinseback States PROPERTY( bool , rbInit , true ) ///< RINSEBACK_STOP_INIT_STATE = 0 # Start state (stopped) of the rinseback sub-mode state machine PROPERTY( bool , rbRun , false) ///< RINSEBACK_RUN_STATE = 1 # Rinseback running state of the rinseback sub-mode state machine PROPERTY( bool , rbPaused , false) ///< RINSEBACK_PAUSED_STATE = 2 # Rinseback paused state of the rinseback sub-mode state machine PROPERTY( bool , rbStop , false) ///< RINSEBACK_STOP_STATE = 3 # Rinseback stopped (done) state of the rinseback sub-mode state machine PROPERTY( bool , rbAdditional , false) ///< RINSEBACK_RUN_ADDITIONAL_STATE = 4 # Additional rinseback volume (10 mL) state of the rinseback sub-mode state machine PROPERTY( bool , rbReconnect , false) ///< RINSEBACK_RECONNECT_PATIENT_STATE = 5 # Rinseback reconnect state of the rinseback sub-mode state machine // Recirculate states PROPERTY( bool , rcDisconnect , true ) ///< TREATMENT_RECIRC_DISCONNECT_PATIENT_STATE = 0 # Disconnect patient state of the treatment re-circulate sub-mode state machine PROPERTY( bool , rcStarted , false) ///< TREATMENT_RECIRC_RECIRC_STATE = 1 # Re-circulate Dialysate state of the treatment re-circulate sub-mode state machine PROPERTY( bool , rcStopped , false) ///< TREATMENT_RECIRC_STOPPED_STATE = 2 # Stopped state of the treatment re-circulate sub-mode state machine PROPERTY( bool , rcReconnect , false) ///< TREATMENT_RECIRC_RECONNECT_PATIENT_STATE = 3 # Reconnect patient state of the treatment re-circulate sub-mode state machine // Blood Prime PROPERTY( bool , bpRamp , true ) ///< BLOOD_PRIME_RAMP_STATE = 0 # Ramp state of the blood prime sub-mode state machine // Treatment End PROPERTY( bool , teWaitRinseback , true ) ///< TREATMENT_END_WAIT_FOR_RINSEBACK_STATE = 0 # Wait for rinseback state of the treatment end sub-mode state machine PROPERTY( bool , tePaused , false) ///< TREATMENT_END_PAUSED_STATE = 1 # Paused state of the treatment end sub-mode state machine // Treatment Stop PROPERTY( bool , tsRecirculate , true ) ///< TREATMENT_STOP_RECIRC_STATE = 0, Dialysate and Blood re-circulation state of the treatment stop sub-mode state machine PROPERTY( bool , tsRecirculateDialysate , false) ///< TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE= 1, Re-circulate Dialysate only state of the treatment re-circulate sub-mode state machine PROPERTY( bool , tsRecirculateBlood , false) ///< TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE = 2, Re-circulate Blood only state of the treatment re-circulate sub-mode state machine PROPERTY( bool , tsRecirculateNo , false) ///< TREATMENT_STOP_NO_RECIRC_STATE = 3, No re-circulation state of the treatment stop sub-mode state machine PROPERTY( bool , tsRecoverBloodDetect , false) ///< TREATMENT_STOP_RECOVER_BLOOD_DETECT_STATE = 4, Treatment stop recover blood detect state // class definition VIEW_DEC_CLASS(VHDTreatmentStates) // slots for received data messages (onActionReceive) VIEW_DEC_SLOT (TreatmentStatesData ) // Treatment States Broadcast messages (This class original receiver) VIEW_DEC_SLOT (AdjustUltrafiltrationStateResponseData ) // Ultrafiltration state Adjustment response message }; }