Index: firmware/App/Modes/ModeTreatment.h =================================================================== diff -u -reb877ae36c28eb83553ee11ccccf42e2c4a5b4d2 -r8e7158d8231435496fcf1d5649e51babf859ccc7 --- firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision eb877ae36c28eb83553ee11ccccf42e2c4a5b4d2) +++ firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision 8e7158d8231435496fcf1d5649e51babf859ccc7) @@ -1,26 +1,97 @@ /************************************************************************** - * - * Copyright (c) 2019-2019 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. - * - **************************************************************************/ +* +* Copyright (c) 2019-2021 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 +* +* @author (last) Sean Nash +* @date (last) 01-Dec-2020 +* +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 +* +***************************************************************************/ #ifndef __MODE_TREATMENT_H__ #define __MODE_TREATMENT_H__ +#include "HDCommon.h" +#include "HDDefs.h" +#include "Dialysis.h" + +/** + * @defgroup HDTreatmentMode HDTreatmentMode + * @brief TreatmentMode module. + * + * @addtogroup HDTreatmentMode + * @{ + */ + +// ********** public definitions ********** + +/// Payload record structure for a treatment time status message. +typedef struct +{ + U32 treatmentTimePrescribedinSec; + U32 treatmentTimeElapsedinSec; + U32 treatmentTimeRemaininginSec; +} TREATMENT_TIME_DATA_T; + +/// Payload record structure for a treatment state message. +typedef struct +{ + U32 treatmentSubMode; + U32 uFState; + U32 salineBolusState; +} TREATMENT_STATE_DATA_T; + +/// Payload record structure for an ultrafiltration volume change confirmation message. +typedef struct +{ + F32 volume_mL; + U32 adjustType; +} UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T; + +/// Payload record structure for the in-line pressure limits change request. +typedef struct +{ + S32 artLowLimit; + S32 artHighLimit; + S32 venLowLimit; + S32 venHighLimit; +} PRESSURE_LIMIT_CHANGE_REQUEST_T; + +/// Payload record structure for the in-line pressure limits change response. +typedef struct +{ + BOOL accepted; + U32 rejReasonCode; + S32 artLowLimit; + S32 artHighLimit; + S32 venLowLimit; + S32 venHighLimit; +} PRESSURE_LIMIT_CHANGE_RESPONSE_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) +void initTreatmentMode( void ); // initialize this module +void transitionToTreatmentMode( void ); // prepares for transition to treatment mode +U32 execTreatmentMode( void ); // execute the treatment mode state machine (call from OperationModes) +TREATMENT_STATE_T getTreatmentState( void ); + +BOOL userRequestEndTreatment( void ); +void broadcastTreatmentTimeAndState( void ); + +BOOL verifyTreatmentDurationSettingChange( U32 treatmentTime ); +BOOL verifyUFSettingsChange( F32 uFVolume ); +BOOL verifyUFSettingsConfirmation( F32 uFVolume, U32 adjustment ); +BOOL verifyBloodAndDialysateRateSettingsChange( U32 bloodRate, U32 dialRate ); +BOOL verifyPressureLimitsChange( PRESSURE_LIMIT_CHANGE_REQUEST_T *data ); + +/**@}*/ + #endif