/************************************************************************** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * * 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 ModeTreatment.h * * @date 19-Sep-2019 * @author S. Nash * * @brief Header file for Treatment Mode. * **************************************************************************/ #ifndef __MODE_TREATMENT_H__ #define __MODE_TREATMENT_H__ #include "HDCommon.h" #include "Dialysis.h" // ********** public definitions ********** /// Sub-mode states while in treatment mode typedef enum Treatment_States { TREATMENT_START_STATE = 0, ///< Start treatment, prime blood side with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. TREATMENT_DIALYSIS_STATE, ///< Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested. TREATMENT_STOP_STATE, ///< Treatment stopped. All pumps off. Dializer bypassed. TREATMENT_RINSEBACK_STATE, ///< Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating. TREATMENT_RINSEBACK_PAUSE_STATE, ///< Rinseback paused. Blood pump off. Dialyzer bypassed. Dialysate recirculating. TREATMENT_RECIRC_SETUP_STATE, ///< Rinseback complete. Blood pump off. Blood lines closed. User to disconnect and shunt blood lines. TREATMENT_RECIRC_STATE, ///< Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed. TREATMENT_RECIRC_PAUSE_STATE, ///< Recirculate paused. Blood pump off. Blood lines closed and shunted. Dialyzer is bypassed. TREATMENT_RECIRC_STOP_STATE, ///< Recirculate stopped. Blood pump off. Blood lines open. Waiting for patient to unshunt and connect and resume treatment. TREATMENT_DIALYSIS_END_STATE, ///< Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback. TREATMENT_END_STATE, ///< Treatment has ended. All pumps off. Dialyzer is bypassed. Blood lines are closed. User to disconnect. NUM_OF_TREATMENT_STATES ///< # of treatment states (sub-modes). } TREATMENT_STATE_T; // ********** private function prototypes ********** void initTreatmentMode( void ); // initialize this module void transitionToTreatmentMode( void ); // prepares for transition to treatment mode void execTreatmentMode( void ); // execute the treatment mode state machine (call from OperationModes) TREATMENT_STATE_T getTreatmentState( void ); BOOL verifyTreatmentDurationSettingChange( U32 treatmentTime ); BOOL verifyUFSettingsChange( F32 uFVolume, UF_ADJ_T adjustment ); BOOL verifyUFSettingsConfirmation( BOOL confirmed, F32 uFVolume, U32 treatmentTime, F32 uFRate ); #endif