/************************************************************************** * * Copyright (c) 2024-2024 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 TxParams.h * * @author (last) Sean * @date (last) * * @author (original) Sean * @date (original) 17-Nov-2025 * ***************************************************************************/ #ifndef __TX_PARAMS_H__ #define __TX_PARAMS_H__ #include "TDCommon.h" #include "TDDefs.h" #include "Utilities.h" /** * @defgroup TxParams TxParams * @brief Treatment parameters unit provides validation * and confirmation handling for treatment parameters from the UI. * * @addtogroup TxParams * @{ */ // ********** public definitions ********** #define MIN_PRESSURE_ALARM_LIMIT_DELTA_MMHG ( 30 ) ///< Minimum pressure alarm limit delta (in mmHg) #define MAX_UF_RATE_ML_MIN ( 2000.01F / (F32)MIN_PER_HOUR ) ///< Maximum ultrafiltration rate (in mL/min). Added small decimal to prevent float round off issues. #define MIN_UF_RATE_ML_MIN ( 0.0F ) ///< Minimum ultrafiltration rate (in mL/min). #define MAX_UF_VOLUME_ML ( 8 * ML_PER_LITER ) ///< Maximum ultrafiltration volume (in mL). /// Record structure for a treatment parameters payload from UI. typedef struct { U32 bloodFlowRate_mL_min; ///< User set blood flow rate (in mL/min) U32 dialysateFlowRate_mL_min; ///< User set dialysate flow rate (in mL/min) U32 treatmentDuration_min; ///< User set treatment duration (in min) U32 salineBolusVolume_mL; ///< User set saline bolus volume (in mL) U32 hepStopTime_min; ///< User set Heparin stop time (in min) U32 hepType; ///< User set Heparin type option U32 acidConcentrate; ///< User set acid concentrate option U32 bicarbConcentrate; ///< User set bicarbonate concentrate option U32 dialyzerType; ///< User set dialyzer type option U32 bpInterval_min; ///< User set blood pressure measurement interval (in min) U32 rinsebackFlowRate_mL_min; ///< User set rinseback flow rate (in mL/min) U32 rinsebackVolume_mL; ///< User set rinseback volume (in mL) S32 arterialPressureLimitWindow_mmHg; ///< User set alarm limit window for arterial pressure (in mmHg) S32 venousPressureLimitWindow_mmHg; ///< User set alarm limit window for venous pressure (in mmHg) S32 venousPressureLimitAsymmetric_mmHg; ///< User set alarm limit asymmetric for venous pressure (in mmHg) S32 tmpLimitWindow_mmHg; ///< User set alarm limit window for trans-membrane pressure (in mmHg) F32 dialysateTemperature_degC; ///< User set dialysate temperature (in deg C) F32 hepDispenseRate_mL_hr; ///< User set Heparin dispense rate (in mL/hr) F32 hepBolusVolume_mL; ///< User set Heparin bolus volume (in mL) } TREATMENT_PARAMS_DATA_PAYLOAD_T; /// Record structure for reporting all current treatment parameters to Dialin typedef struct { TREATMENT_PARAMS_DATA_PAYLOAD_T treatment_parameters; ///< Record structure of treatment parameters F32 uFVolume_L; ///< Current ultrafiltration volume (in L). } CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T; /// Payload record structure for treatment parameter range broadcast messages. typedef struct { U32 minTreatmentTime; ///< Minimum treatment duration (in minutes) U32 maxTreatmentTime; ///< Maximum treatment duration (in minutes) F32 minUFVolume; ///< Minimum ultrafiltration volume (in mL) F32 maxUFVolume; ///< Maximum ultrafiltration volume (in mL) U32 minDialRate; ///< Minimum dialysate flow rate (in mL/min) U32 maxDialRate; ///< Maximum dialysate flow rate (in mL/min) } TREATMENT_PARAM_RANGE_BROADCAST_PAYLOAD_T; // ********** public function prototypes **************** BOOL setTreatmentParameterU32( TREATMENT_PARAM_T param, U32 value ); // Set a specified unsigned integer treatment parameter value BOOL setTreatmentParameterS32( TREATMENT_PARAM_T param, S32 value ); // Set a specified signed integer treatment parameter value BOOL setTreatmentParameterF32( TREATMENT_PARAM_T param, F32 value ); // Set a specified floating point treatment parameter value U32 getTreatmentParameterU32( TREATMENT_PARAM_T param ); // Get a specified unsigned integer treatment parameter S32 getTreatmentParameterS32( TREATMENT_PARAM_T param ); // Get a specified signed integer treatment parameter F32 getTreatmentParameterF32( TREATMENT_PARAM_T param ); // Get a specified floating point treatment parameter S32 getTreatmentParameterS32DefaultValue( TREATMENT_PARAM_T param ); // Get the default value for a specified signed integer treatment parameter BOOL validateAndSetTreatmentParameters( MESSAGE_T *message ); // User provided treatment params to be set and validated BOOL validateAndSetUFVolume( MESSAGE_T *message ); // User provided ultrafiltration volume to be set and validated void resetTreatmentParameters( void ); // Reset all parameters to defaults BOOL signalUserConfirmationOfTreatmentParameters( MESSAGE_T *message ); // Process UI confirm/reject Treatment parameters void signalAlarmActionToTreatParamsMode( ALARM_ACTION_T action ); // Execute alarm action as appropriate for treatment parameters mode BOOL getValidTreatParamsReceived( void ); // Determine whether valid Treatment Parameters exist BOOL getTreatParamsConfirmed( void ); // Determine whether user confirmed the parameters BOOL isTreatmentParamInRange( TREATMENT_PARAM_T param, CRITICAL_DATAS_T value ); // Check range for a proposed treatment parameter value U32 getDialyzerBloodVolume( DIALYZER_TYPE_T dialyzer ); // Get the blood side volume for a given dialyzer type U32 getDialyzerDialysateVolume( DIALYZER_TYPE_T dialyzer ); // Get the dialysate side volume for a given dialyzer type BOOL testSetTreatmentParameter( MESSAGE_T *message ); // Set a specific treatment parameter value BOOL testTxParamsRequest( MESSAGE_T *message ); // Request to publish current treatment parameters /**@}*/ #endif