Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rcf94c3059b220c787cc8eabc691940967c1537e1 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision cf94c3059b220c787cc8eabc691940967c1537e1) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -40,7 +40,8 @@ #define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. -#define LOWEST_ALARM_SUB_RANK 999 ///< Lowest alarm sub-rank that can be set. +#define LOWEST_ALARM_SUB_RANK 999 ///< Lowest alarm sub-rank that can be set. +#define MAX_ALARM_LIST_SIZE 10 ///< Maximum number of active alarms inside alarm list. // *** This declaration will cause a compiler error if ALARM_TABLE does not have same # of alarms as the Alarm_List enumeration. U08 alarmTableSizeAssertion[ ( ( sizeof( ALARM_TABLE ) / sizeof( ALARM_T ) ) == NUM_OF_ALARM_IDS ? 1 : -1 ) ]; @@ -64,27 +65,19 @@ // ********** private data ********** -static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. - -/// Table - current state of each alarm -static BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; -/// Table - current state of each alarm condition (detected or cleared) -static BOOL alarmIsDetected[ NUM_OF_ALARM_IDS ]; -/// Table - when alarm became active for each alarm (if active) or zero (if inactive) -static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; +static BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; ///< Table - current state of each alarm +static BOOL alarmIsDetected[ NUM_OF_ALARM_IDS ]; ///< Table - current state of each alarm condition (detected or cleared) +static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; ///< Table - when alarm became active for each alarm (if active) or zero (if inactive) -/// Record for the current composite alarm status. -static COMP_ALARM_STATUS_T alarmStatus; +static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. +static ALARM_PRIORITY_RANKS_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; ///< FIFO - first activated or highest sub-rank alarm in each alarm priority category. +static U32 activeAlarmList[ MAX_ALARM_LIST_SIZE ]; ///< List of active alarms. -/// FIFO - first activated or highest sub-rank alarm in each alarm priority category. -static ALARM_PRIORITY_RANKS_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; +static BOOL alarmUserRecoveryActionEnabled[ NUMBER_OF_ALARM_USER_ACTIONS ]; ///< Alarm user recovery actions enabled flags. -/// Alarm user recovery actions enabled flags. -static BOOL alarmUserRecoveryActionEnabled[ NUMBER_OF_ALARM_USER_ACTIONS ]; - -static U32 alarmAudioVolumeLevel = 3; //MIN_ALARM_VOLUME_ATTENUATION; ///< Set alarm audio volume attenuation level (0..4 - lower level = higher gain). - -static BOOL allowNewTreatment = TRUE; ///< Allow new treatment persistent flag. +static U32 alarmAudioVolumeLevel = 3; //MIN_ALARM_VOLUME_ATTENUATION; ///< Set alarm audio volume attenuation level (0..4 - lower level = higher gain). +static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. +static BOOL allowNewTreatment = TRUE; ///< Allow new treatment persistent flag. // ********** private function prototypes ********** @@ -112,7 +105,8 @@ void initAlarmMgmt( void ) { ALARM_PRIORITY_T p; - ALARM_ID_T a; + ALARM_ID_T a; + U32 i; // Disable backup audio CLR_BACKUP_AUDIO_ENABLE(); @@ -133,6 +127,11 @@ alarmPriorityFIFO[ p ].alarmID = ALARM_ID_NO_ALARM; alarmPriorityFIFO[ p ].subRank = LOWEST_ALARM_SUB_RANK; alarmPriorityFIFO[ p ].timeSinceTriggeredMS = 0; + } + // Initialize active alarm list + for ( i = 0; i < MAX_ALARM_LIST_SIZE; i++ ) + { + activeAlarmList[ i ] = ALARM_ID_NO_ALARM; } // Initialize composite alarm state alarmStatus.alarmsState = ALARM_PRIORITY_NONE; @@ -586,6 +585,22 @@ { return allowNewTreatment; } + +/*********************************************************************//** + * @brief +* The handleActiveAlarmListRequest function processed the active alarms list +* request from UI. +* @details Inputs: activeAlarmList +* @details Outputs: sent active alarms list to UI +* @return none +*************************************************************************/ +void handleActiveAlarmListRequest( void ) +{ + BOOL accepted = TRUE; + REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; + + sendActiveAlarmsList( accepted, rejReason, activeAlarmList, sizeof( activeAlarmList ) ); +} /*********************************************************************//** * @brief