Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rcf94c3059b220c787cc8eabc691940967c1537e1 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision cf94c3059b220c787cc8eabc691940967c1537e1) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -239,7 +239,7 @@ BOOL result = FALSE; REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; - if ( TRUE != getAlarmNewTreatmentStatus() ) + if ( TRUE != getAllowNewTreatmentStatus() ) { rejReason = REQUEST_REJECT_REASON_NO_NEW_TREATMENT_ALARM_TRIGGERED; } 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 Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -rcf94c3059b220c787cc8eabc691940967c1537e1 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision cf94c3059b220c787cc8eabc691940967c1537e1) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -151,7 +151,8 @@ BOOL isAlarmRecoverable( ALARM_ID_T alarm ); void setAlarmAudioVolume( U32 volumeLevel ); -BOOL getAllowNewTreatmentStatus( void ); +BOOL getAllowNewTreatmentStatus( void ); +void handleActiveAlarmListRequest( void ); BOOL testSetAlarmStateOverride( U32 alarmID, BOOL value ); BOOL testResetAlarmStateOverride( U32 alarmID ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r9feea867113c62088f0ce91750127972dbd9bf53 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 9feea867113c62088f0ce91750127972dbd9bf53) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -1269,6 +1269,10 @@ handleDGCmdResp( message ); break; + case MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST: + handleUIActiveAlarmsListRequest( message ); + break; + case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r40e0116bbada6d1780bfa832a9c4684ba9fcfcc8 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 40e0116bbada6d1780bfa832a9c4684ba9fcfcc8) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -580,8 +580,10 @@ { signalUserConfirmPatientDisconnection(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -599,8 +601,10 @@ { signalUserConfirmDisposableRemoval(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -633,8 +637,10 @@ { handleTreatmentLogDataRequest(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -643,6 +649,8 @@ * for UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment log data msg constructed and queued. + * @param accepted T/F - was treatment log request accepted? + * @param reason reason why request was rejected (or zero if accepted) * @param logDataPtr treatment log data record pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -665,6 +673,58 @@ // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } + +/*********************************************************************//** + * @brief + * The handleUIActiveAlarmsListRequest function handles UI active alarms list request. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none. + *************************************************************************/ +void handleUIActiveAlarmsListRequest( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + handleActiveAlarmListRequest(); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The sendTreatmentLogData function constructs a treatment log data message + * for UI and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Treatment log data msg constructed and queued. + * @details Outputs: Treatment log data msg constructed and queued. + * @param accepted T/F - was treatment log request accepted? + * @param alarmList pointer to active alarms list record + * @param size the size of active alarms list + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendActiveAlarmsList( BOOL accepted, U32 reason, U32 *alarmList, U32 size ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_ACTIVE_ALARMS_LIST_REQUEST_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + size; + + memcpy( payloadPtr, &accepted, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reason, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, alarmList, size ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); +} /*********************************************************************//** * @brief @@ -684,8 +744,10 @@ memcpy( &cmd, &message->payload[0], sizeof( U32 ) ); signalSampleWaterUserAction( (REQUESTED_SAMPLE_WATER_USER_ACTIONS_T)cmd ); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -720,8 +782,10 @@ memcpy( &result, &message->payload[0], sizeof( U32 ) ); setSampleWaterResult( (BOOL) result ); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -739,8 +803,10 @@ { signalUserConfirmConsumableInstall(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -758,8 +824,10 @@ { signalUserConfirmInstallation(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -777,8 +845,10 @@ { signalStartPrime(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -811,8 +881,10 @@ { signalUserContinueToTreatment(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -845,8 +917,10 @@ { signalUserConfirmPatientConnection(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** @@ -878,8 +952,10 @@ { signalUserStartTreatment(); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r40e0116bbada6d1780bfa832a9c4684ba9fcfcc8 -red6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 40e0116bbada6d1780bfa832a9c4684ba9fcfcc8) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision ed6e1e131ccb7a9a586cfb766ea270fc3cbdc1c9) @@ -248,6 +248,12 @@ // MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE BOOL sendTreatmentLogData( BOOL accepted, U32 reason, TREATMENT_LOG_DATA_PAYLOAD_T *logDataPtr ); +// MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST +void handleUIActiveAlarmsListRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ACTIVE_ALARMS_LIST_REQUEST_RESPONSE +BOOL sendActiveAlarmsList( BOOL accepted, U32 reason, U32 *alarmList, U32 size ); + // *********** public DG command functions ********** // MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS