Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra97fcffbe7b7b2d9543358ac06868829d41cf173 -r1467e388082a0d4c9e4b7e03b689a70ba42862db --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a97fcffbe7b7b2d9543358ac06868829d41cf173) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1467e388082a0d4c9e4b7e03b689a70ba42862db) @@ -497,6 +497,38 @@ return result; } +/*********************************************************************//** + * @brief + * The sendAlarmAudioVolumeSetResponse function constructs an alarm audio + * volume set request response to the UI and queues the msg for transmit on the + * appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Alarm audio volume set. + * @param accepted flag indicating whether request was accepted + * @param rejReason rejection reason code + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendAlarmAudioVolumeSetResponse( U32 accepted, U32 rejReason ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE; + msg.hdr.payloadLen = sizeof( U32 ) * 2; + + memcpy( payloadPtr, &accepted, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &rejReason, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + return result; +} + /*********************************************************************//** * @brief * The sendTreatmentParamsRangesToUI function constructs a treatment parameter @@ -1236,14 +1268,43 @@ payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_TO_ESCALATE) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_SILENCED) : 0 ); payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_LAMP_ON) : 0 ); - payload.alarmsFlags |= ( almStatus.topAlarmConditionnDetected ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_TOP_CONDITION) : 0 ); + payload.alarmsFlags |= ( almStatus.noMinimize ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_MINIMIZE) : 0 ); + payload.alarmsFlags |= ( almStatus.topAlarmConditionDetected ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_TOP_CONDITION) : 0 ); memcpy( payloadPtr, &payload, sizeof( ALARM_COMP_STATUS_PAYLOAD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_ALARM, ACK_NOT_REQUIRED ); return result; +} + +/*********************************************************************//** + * @brief + * The broadcastAlarmInfo function constructs an alarm information msg to + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: alarm information msg constructed and queued. + * @param data alarm information record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastAlarmInfo( ALARM_INFO_PAYLOAD_T data ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_ALARM_INFORMATION; + msg.hdr.payloadLen = sizeof( ALARM_INFO_PAYLOAD_T ); + + memcpy( payloadPtr, &data, sizeof( ALARM_INFO_PAYLOAD_T ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; } /*********************************************************************//** @@ -1507,6 +1568,34 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; +} + +/*********************************************************************//** + * @brief + * The broadcastVoltagesData function constructs a monitored voltages data msg to + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: monitored voltages data msg constructed and queued. + * @param data Latest monitored voltage values. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastVoltagesData( VOLTAGES_DATA_PAYLOAD_T data ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_VOLTAGES_DATA; + msg.hdr.payloadLen = sizeof( VOLTAGES_DATA_PAYLOAD_T ); + + memcpy( payloadPtr, &data, sizeof( VOLTAGES_DATA_PAYLOAD_T ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; } /*********************************************************************//** @@ -2300,14 +2389,24 @@ *************************************************************************/ void handleUIAlarmSilenceRequest( MESSAGE_T *message ) { +#ifndef TEMP_UI_ALARM_SILENCE_FIX if ( message->hdr.payloadLen == sizeof( U32 ) ) +#else + if ( message->hdr.payloadLen == sizeof( U08 ) ) +#endif { U08 *payloadPtr = message->payload; +#ifndef TEMP_UI_ALARM_SILENCE_FIX U32 cmd; memcpy( &cmd, payloadPtr, sizeof( U32 ) ); + signalAlarmSilence( (ALARM_SILENCE_CMD_T)cmd ); +#else + U08 cmd; + memcpy( &cmd, payloadPtr, sizeof( U08 ) ); signalAlarmSilence( (ALARM_SILENCE_CMD_T)cmd ); +#endif } else { @@ -2903,6 +3002,31 @@ /*********************************************************************//** * @brief + * The handleAlarmAudioVolumeSetCmd function handles a alarm audio volume + * set request message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleAlarmAudioVolumeSetCmd( MESSAGE_T *message ) +{ + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + U32 payload; + + memcpy( &payload, &message->payload[0], sizeof( U32 ) ); + + setAlarmAudioVolume( payload ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The handleSalineBolusRequest function handles a saline bolus request * message from the UI. * @details Inputs: none @@ -5611,6 +5735,70 @@ /*********************************************************************//** * @brief + * The handleTestMonitoredVoltagesSendIntervalOverrideRequest function handles a + * request to override the monitored HD voltages data publication interval. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestMonitoredVoltagesSendIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetVoltagesDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetVoltagesDataPublishIntervalOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestMonitoredVoltageOverrideRequest function handles a + * request to override the monitored HD voltage override. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestMonitoredVoltageOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetLineLevelOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetLineLevelOverride( payload.index ); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief * The handleTestValvesCurrentOverrideRequest function handles a * request to override HD valves' current. * @details Inputs: none @@ -5635,6 +5823,8 @@ { result = testResetValvesCurrentOverride( payload.index ); } + + result = testSetValvesCurrentOverride( payload.index, payload.state.f32 ); } // Respond to request @@ -5643,6 +5833,291 @@ /*********************************************************************//** * @brief + * The handleTestAlarmInfoSendIntervalOverrideRequest function handles a + * request to override the HD alarm information broadcast interval. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmInfoSendIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAlarmInfoPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetAlarmInfoPublishIntervalOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmAudioVolumeOverrideRequest function handles a + * request to override the alarm audio volume level. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmAudioVolumeOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAlarmAudioVolumeLevelOverride( payload.state.u32 ); + } + else + { + result = testResetAlarmAudioVolumeLevelOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmAudioCurrentHgOverrideRequest function handles a + * request to override the alarm audio (high gain) current. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmAudioCurrentHgOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetPrimaryAlarmAudioCurrentHGOverride( payload.state.f32 ); + } + else + { + result = testResetPrimaryAlarmAudioCurrentHGOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmAudioCurrentLgOverrideRequest function handles a + * request to override the alarm audio (low gain) current. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmAudioCurrentLgOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetPrimaryAlarmAudioCurrentLGOverride( payload.state.f32 ); + } + else + { + result = testResetPrimaryAlarmAudioCurrentLGOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmBackupAudioCurrentOverrideRequest function handles a + * request to override the backup alarm audio current. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmBackupAudioCurrentOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetBackupAlarmAudioCurrentOverride( payload.state.f32 ); + } + else + { + result = testResetBackupAlarmAudioCurrentOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpStatusOverrideRequest function handles a + * request to override the syringe pump status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpEncoderStatusOverrideRequest function handles a + * request to override the syringe pump encoder status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpEncoderStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpEncoderStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpEncoderStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpADCandDACStatusOverrideRequest function handles a + * request to override the syringe pump ADC & DAC status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpADCandDACStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpADCandDACStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpADCandDACStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpADCReadCtrOverrideRequest function handles a + * request to override the syringe pump ADC read counter. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpADCReadCtrOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpADCReadCounter( payload.state.u32 ); + } + else + { + result = testResetSyringePumpADCReadCounter(); + } + } +} + +/*********************************************************************//** + * @brief * The handleTestValvesPositionCountOverrideRequest function handles a * request to override HD valves' position in counts. * @details Inputs: none