Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5c2e890457bce1c56779ad025cf2636a7b4449bf -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5c2e890457bce1c56779ad025cf2636a7b4449bf) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-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 SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 14-May-2023 +* @date (last) 20-Oct-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -27,9 +27,11 @@ #include "ConsumableSelfTest.h" #include "Fans.h" #include "FPGA.h" +#include "Integrity.h" #include "ModeStandby.h" #include "ModeInitPOST.h" #include "OperationModes.h" +#include "Reservoirs.h" #include "RTC.h" #include "SampleWater.h" #include "SafetyShutdown.h" @@ -855,6 +857,10 @@ { result = signalUserInitiateChemcialDisinfectFlushMode(); } + else if ( DG_DISINFECT_RO_PERMEATE_SAMPLE_STATE == cmd ) // Command 4 = RO permeate sample + { + result = signalUserInitiateROPermeateSampleMode(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); @@ -1009,7 +1015,6 @@ memcpy( &payload, message->payload, sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ) ); uiStates.heatDisinfectUIState = 0; - uiStates.chemDisinfectUIState = payload.chemDisinfectUIState; uiStates.flushUIState = 0; setDGDisinfectsStates( uiStates ); @@ -1715,6 +1720,30 @@ /*********************************************************************//** * @brief + * The sendDGParkConcentratePumpsCommand function constructs a DG concetentrate + * pumps park request msg to the DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG park concentrate pumps command msg constructed and queued.. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGParkConcentratePumpsCommand( void ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_PARK_CONCENTRATE_PUMPS_CMD_REQUEST; + msg.hdr.payloadLen = 0; + + // 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The sendDGStartFlushModeCommand function constructs a DG start/stop * flush mode command message and queues the msg for transmit on the * appropriate CAN channel. @@ -1807,7 +1836,7 @@ /*********************************************************************//** * @brief - * The sendDGStartChemicalDisinfectFlushModeCommand function constructs a DG + * The sendDGStartStopChemicalDisinfectFlushModeCommand function constructs a DG * start/stop chemical disinfect flush mode command message and queues the msg * for transmit on the appropriate CAN channel. * @details Inputs: none @@ -1816,7 +1845,7 @@ * @param start TRUE indicates start chemical disinfect flush mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGStartChemicalDisinfectFlushModeCommand( BOOL start ) +BOOL sendDGStartStopChemicalDisinfectFlushModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; @@ -1863,6 +1892,7 @@ 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.noReTrigger ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RETRIGGER) : 0 ); payload.alarmsFlags |= ( almStatus.noBloodRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_BLOOD_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noDialRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_DIALYSATE_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noMinimize ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_MINIMIZE) : 0 ); @@ -2086,25 +2116,22 @@ *************************************************************************/ void handleAlarmTriggered( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == ( sizeof( U32 ) + sizeof( U32 ) * 2 * 2 ) ) // 2 data records w/ 2 U32s each + if ( message->hdr.payloadLen == sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ) { + ALARM_TRIGGERED_PAYLOAD_T payload; U08 *payloadPtr = message->payload; - U32 alarmID; - ALARM_DATA_T alm1, alm2; - memcpy( &alarmID, payloadPtr, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( &alm1.dataType, payloadPtr, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( &alm1.data, payloadPtr, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( &alm2.dataType, payloadPtr, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( &alm2.data, payloadPtr, sizeof( U32 ) ); + memcpy( &payload, payloadPtr, sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ); - if ( (ALARM_ID_T)alarmID < NUM_OF_ALARM_IDS ) + if ( (ALARM_ID_T)(payload.alarm) < NUM_OF_ALARM_IDS ) { - activateAlarm2Data( (ALARM_ID_T)alarmID, alm1, alm2 ); + ALARM_DATA_T alm1, alm2; + + alm1.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType1); + alm1.data.uInt.data = payload.almData1; + alm2.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType2); + alm2.data.uInt.data = payload.almData2; + activateAlarm2Data( (ALARM_ID_T)(payload.alarm), alm1, alm2, TRUE ); } } } @@ -3028,6 +3055,27 @@ /*********************************************************************//** * @brief + * The handlePostTxNextCmd function handles a post-treatment next request + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handlePostTxNextCmd( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + requestPostTxNext(); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The sendTreatmentRecircCmdResponse function constructs a treatment re-circulation * user action response to the UI and queues the msg for transmit on the appropriate * CAN channel. @@ -3060,6 +3108,38 @@ /*********************************************************************//** * @brief + * The sendPostTxNextCmdResponse function constructs a post-treatment next + * command response to the UI and queues the msg for transmit on the appropriate + * CAN channel. + * @details Inputs: none + * @details Outputs: Post-treatment next command response msg constructed and queued. + * @param accepted T/F - was request accepted? + * @param rejReason reason why request was rejected (or zero if accepted) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPostTxNextCmdResponse( BOOL accepted, U32 rejReason ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_POST_TX_NEXT_CMD_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + 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 handleTreatmentEndCmd function handles a treatment end user action command * message from the UI. * @details Inputs: none @@ -3270,11 +3350,9 @@ { MESSAGE_T msg; HD_SERVICE_RECORD_T service; - DG_SERVICE_AND_USAGE_DATA_T dgData; U08 *payloadPtr = msg.payload; getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( HD_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - getHDVersionDGServiceAndUsageData( &dgData ); // Create a message record blankMessage( &msg ); @@ -3286,11 +3364,8 @@ // Fill message payload memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); + service.serviceIntervalSeconds = ( 0 == service.lastServiceEpochDate ? 0 : service.serviceIntervalSeconds ); memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceEpochDate, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -3362,16 +3437,16 @@ * The sendConfirmationRequest function sends a confirmation request to UI * @details Inputs: none * @details Outputs: none - * @param request_id ID of confirmation being requested - * @param request_type Type of confirmation being requested - * @param reject_reason Reason Reason for reject if type is reject + * @param requestID ID of confirmation being requested + * @param requestType Type of confirmation being requested + * @param rejectReason Reason Reason for reject if type is reject * @return none *************************************************************************/ -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; - U32 temp_request = request_id; + U32 temp_request = requestID; // Create a message record blankMessage( &msg ); @@ -3381,13 +3456,13 @@ memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - temp_request = request_type; + temp_request = requestType; memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &reject_reason, sizeof( U32 ) ); + memcpy( payloadPtr, &rejectReason, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); + serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** @@ -3406,8 +3481,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; - // The payload length is U32 Request ID, U32 Type + msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &status, sizeof( U32 ) ); @@ -3416,7 +3490,107 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_NOT_REQUIRED ); } +/*********************************************************************//** + * @brief + * The sendDGStopActiveCoolModeCommand function sends a request to stop + * active cool mode command + * @details Inputs: none + * @details Outputs: none + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendDGStopActiveCoolModeCommand( void ) +{ + BOOL result; + MESSAGE_T msg; + BOOL start = FALSE; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGStartStopDGROPermeateSampleModeCommand function sends a request + * to start or stop RO permeate sample mode command + * @details Inputs: none + * @details Outputs: none + * @param start TRUE to star the RO permeate sample mode and FALSE to stop + * the RO permeate sample mode + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendRequestROPermeateSampleCollectionToDG function sends a request + * to collect RO permeate sample to DG + * @details Inputs: none + * @details Outputs: none + * @param status which could be dispense or cancel + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendRequestROPermeateSampleCollectionToDG( U32 status ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_RO_PERMEATE_SAMPLE_DISPENSE_REQUEST_TO_DG; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( msg.payload, &status, 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleReceiveROPermeateSampleReadyToDispenseFromDG function receives + * the signal from DG that it is ready to dispnese more in RO permeate sample + * mode + * @details Inputs: none + * @details Outputs: none + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleReceiveROPermeateSampleReadyToDispenseFromDG( MESSAGE_T* message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + signalROPermeateSampleDGReadyToDispense(); + } +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -3493,6 +3667,8 @@ { testerLoggedIn = TRUE; checkInFromUI(); // Allow tasks to begin normal processing when tester has logged in + // Set the dialin checkin time stamp until the first checkin message is received from dailin + setDialinCheckInTimeStamp(); } else { @@ -4229,20 +4405,20 @@ *************************************************************************/ void handleTestArterialPressureOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_PAYLOAD_T payload; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length - if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetArterialPressureOverride( payload.state.f32 ); + result = testSetArterialPressureOverride( payload.state.f32, payload.index ); } else { - result = testResetArterialPressureOverride(); + result = testResetArterialPressureOverride( payload.index ); } } @@ -4261,20 +4437,20 @@ *************************************************************************/ void handleTestVenousPressureOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_PAYLOAD_T payload; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length - if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetVenousPressureOverride( payload.state.f32 ); + result = testSetVenousPressureOverride( payload.state.f32, payload.index ); } else { - result = testResetVenousPressureOverride(); + result = testResetVenousPressureOverride( payload.index ); } } @@ -5271,7 +5447,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetSwitchesStatusOverrideRequest function handles a * request to override the status of a switch in HD. @@ -5303,7 +5479,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestSwitchesPublishIntervalOverrideRequest function handles a * request to override the the switches data publish interval. @@ -5594,16 +5770,20 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + if ( ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) && + ( MODE_SERV == getCurrentOperationMode() ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -5774,16 +5954,20 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + if ( ( message->hdr.payloadLen >= sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) && + ( MODE_SERV == getCurrentOperationMode() ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -5956,16 +6140,20 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + if ( ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) && + ( MODE_SERV == getCurrentOperationMode() ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -6049,7 +6237,6 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; -#ifndef _RELEASE_ // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { @@ -6063,7 +6250,6 @@ result = testResetValvesCurrentOverride( payload.index ); } } -#endif // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); @@ -7395,7 +7581,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_DG_SERVICE_RECORD_REQUEST; + msg.hdr.msgID = MSG_ID_HD_REQUEST_SERVICE_RECORD_FROM_HD; msg.hdr.payloadLen = 0; // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -8181,16 +8367,10 @@ *************************************************************************/ void handleTestHDDialinCheckIn( MESSAGE_T* message ) { - BOOL status = FALSE; - if ( 0 == message->hdr.payloadLen ) { - status = TRUE; setDialinCheckInTimeStamp(); } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** @@ -8226,4 +8406,124 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** + * @brief + * The handleTestHDSetRecoverFromFaultModeSignal function handles a request to + * set the signal to recover from the fault mode. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDSetRecoverFromFaultModeSignal( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + status = TRUE; + + setRecoverFromFaultModeSignal(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDRAMStatusOverrideRequest function handles a request to + * override the RAM status register. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDRAMStatusOverrideRequest( 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 = testSetRAMStatusOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetRAMStatusOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDPendingACKOverrideRequest function handles a + * request to override pending ACKs. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDPendingACKOverrideRequest( 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 = testSetPendingACKOverride( payload.state.u32 ); + } + else + { + result = testResetPendingACKOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDRecirulationPctOverrideRequest function handles a + * request to override recirulation percentage. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDRecirulationPctOverrideRequest( 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 = testSetRecirculationLevelPctOverride( payload.state.f32 ); + } + else + { + result = testResetRecirculationLevelPctOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/