/************************************************************************** * * 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 AlarmMgmt.h * * @author (last) Sean * @date (last) 30-Jul-2024 * * @author (original) Sean * @date (original) 30-Jul-2024 * ***************************************************************************/ #ifndef __ALARM_MGMT_H__ #define __ALARM_MGMT_H__ #ifdef _TD_ #include "TDCommon.h" #endif #ifdef _DD_ #include "DDCommon.h" #endif #ifdef _RO_ #include "FPCommon.h" #endif #include "AlarmDefs.h" #include "AlarmMgmtSWFaults.h" #include "MessageSupport.h" /** * @defgroup AlarmManagement AlarmManagement * @brief Alarm Management service unit. Provides general alarm management * functionality including support functions for triggering and clearing * specific alarms. * * @addtogroup AlarmManagement * @{ */ #pragma pack(push, 4) /// Record structure for detailing the properties of the current composite alarm status. typedef struct { ALARM_PRIORITY_T alarmsState; ///< Current alarm priority level /* BOOL alarmsSilenced; ///< Alarms are currently silenced? // TODO - Determine if silence is needed U32 alarmsSilenceStart; ///< Time stamp for when alarms were silenced (ms) U32 alarmsSilenceExpiresIn; ///< Time until alarm silence expires (seconds) BOOL alarmsToEscalate; ///< Are any active alarms due to escalate (should UI show count down timer?) U32 alarmsEscalatesIn; ///< Time until alarm will escalate (seconds) */ ALARM_ID_T alarmTop; ///< ID of current top alarm that will drive lamp/audio and UI should be displaying right now BOOL topAlarmConditionDetected; ///< Condition for top alarm is still being detected BOOL systemFault; ///< A system fault is active? BOOL stop; ///< We should be in controlled stop right now BOOL noClear; ///< No recovery will be possible BOOL noResume; ///< Treatment may not be resumed at this time BOOL noRinseback; ///< Rinseback may not be initiated at this time BOOL noEndTreatment; ///< Ending the treatment is not an option at this time BOOL noBloodRecirc; ///< No blood re-circulation allowed at this time BOOL noDialRecirc; ///< No dialysate re-circulation allowed at this time BOOL ok; ///< Display OK button instead of other options BOOL noMinimize; ///< Prevent user from minimizing the alarm window BOOL lampOn; ///< The alarm lamp is on BOOL noReTrigger; ///< Alarm flag to block re-trigger is set } COMP_ALARM_STATUS_T; /// Record structure for unsigned integer alarm data. typedef struct { U32 data; ///< Alarm data of unsigned integer type. } ALARM_DATA_U32_T; /// Record structure for signed integer alarm data. typedef struct { S32 data; ///< Alarm data of signed integer type. } ALARM_DATA_S32_T; /// Record structure for floating point alarm data. typedef struct { F32 data; ///< Alarm data of floating point type. } ALARM_DATA_F32_T; /// Record structure for boolean alarm data. typedef struct { BOOL data; ///< Alarm data of boolean type. } ALARM_DATA_BOOL_T; /// Record structure for alarm data of any supported type. typedef union { ALARM_DATA_U32_T uInt; ///< Alarm data of unsigned integer type. ALARM_DATA_S32_T sInt; ///< Alarm data of signed integer type. ALARM_DATA_F32_T flt; ///< Alarm data of floating point type. ALARM_DATA_BOOL_T bln; ///< Alarm data of boolean type. } ALARM_DATAS_T; /// Record structure for alarm data including the data type to aid in interpretation. typedef struct { ALARM_DATA_TYPES_T dataType; ///< The type of alarm data provided. ALARM_DATAS_T data; ///< The alarm data of specified type. } ALARM_DATA_T; /// Payload record structure for the alarm triggered message. typedef struct { U32 alarm; ///< ID of alarm that was triggered U32 almDataType1; ///< Supporting data type #1 U32 almData1; ///< Supporting data #1 U32 almDataType2; ///< Supporting data type #2 U32 almData2; ///< Supporting data #2 U32 almPriority; ///< Alarm priority U32 almRank; ///< Alarm rank BOOL almClrTopOnly; ///< Alarm clear (when on top) should only clear top alarm } ALARM_TRIGGERED_PAYLOAD_T; #pragma pack(pop) /// Alarm ID data publish typedef struct { U32 alarmID; ///< Alarm ID. } ALARM_ID_DATA_PUBLISH_T; // ********** public function prototypes ********** void initAlarmMgmt( void ); #if defined (__ALARM_MGMT_C__) || defined(__ALARM_MGMT_DD_C__) || defined(__ALARM_MGMT_TD_C__) || defined(__ALARM_MGMT_FP_C__) ALARM_T getAlarmProperties( ALARM_ID_T alarm ); ALARM_RANK_T getAlarmRank( U32 index ); #endif void activateAlarm( ALARM_ID_T alarm ); void clearAlarm( ALARM_ID_T alarm ); void clearAlarmCondition( ALARM_ID_T alarm ); void setAlarmActive( ALARM_ID_T alarm, BOOL active ); void setAlarmConditionDetected( ALARM_ID_T alarm, BOOL detected ); BOOL isAlarmActive( ALARM_ID_T alarm ); BOOL isAlarmConditionDetected( ALARM_ID_T alarm ); BOOL isAlarmRecoverable( ALARM_ID_T alarm ); BOOL testAlarmStateOverride( MESSAGE_T *message ); /**@}*/ #endif