Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rd2df61eaf8d65a95eb20ff96137d1b60fca55d99 -re6c60e07b450ec8d58e87bf13d45f96efab54d8b --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d2df61eaf8d65a95eb20ff96137d1b60fca55d99) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e6c60e07b450ec8d58e87bf13d45f96efab54d8b) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 20-Oct-2023 +* @date (last) 23-Jul-2024 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -99,7 +99,7 @@ static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); -static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ); +static BOOL sendUIResponseMsg( MSG_ID_T msgID, UI_RESPONSE_PAYLOAD_T *uiResponse ); /*********************************************************************//** * @brief @@ -247,18 +247,18 @@ * @details Inputs: none * @details Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to - * @param accepted T/F - request accepted? - * @param reason reason code if rejected + * @param ui response pointer to the UI response payload * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ -static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ) +static BOOL sendUIResponseMsg( MSG_ID_T msgID, UI_RESPONSE_PAYLOAD_T *uiResponse ) { BOOL result; MESSAGE_T msg; UI_RESPONSE_PAYLOAD_T cmd; - cmd.accepted = accepted; - cmd.rejectionReason = reason; + cmd.fwValue = uiResponse->fwValue; + cmd.accepted = uiResponse->accepted; + cmd.rejectionReason = uiResponse->rejectionReason; // Create a message record blankMessage( &msg ); @@ -562,8 +562,14 @@ *************************************************************************/ void handleDGSerialNumberRequest( void ) { + typedef struct + { + U08 topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; + } LOCAL_TOP_SN_T; MESSAGE_T msg; DG_SYSTEM_RECORD_T system; + U08 i; + LOCAL_TOP_SN_T localTopLevelSN; // Get the system's record. There are no arrays of system to check and also, raise no alarm since the system record // has been already checked in POST @@ -578,8 +584,15 @@ // Add 1 byte for null terminator msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; + for ( i = 0; i < MAX_TOP_LEVEL_SN_CHARS; i++ ) + { + // NOTE: A local variable was created to avoid system.topLevelSN in the messages list + // NOTE: For loop was used instead of memory copy to ensure it is not parsed in the messages list script + localTopLevelSN.topLevelSN[ i ] = system.topLevelSN[ i ]; + } + // Fill message payload - memcpy( payloadPtr, &system.topLevelSN, sizeof( U08 ) * MAX_TOP_LEVEL_SN_CHARS ); + memcpy( payloadPtr, &localTopLevelSN, sizeof( LOCAL_TOP_SN_T ) ); payloadPtr += MAX_TOP_LEVEL_SN_CHARS; *payloadPtr = 0; @@ -613,10 +626,12 @@ if ( 0 == message->hdr.payloadLen ) { - memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); + U32 lastServiceEpochDate = service.lastServiceEpochDate; + U32 serviceIntervalSeconds = ( 0 == service.lastServiceEpochDate ? 0 : service.serviceIntervalSeconds ); + + memcpy( payloadPtr, &lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - service.serviceIntervalSeconds = ( 0 == service.lastServiceEpochDate ? 0 : service.serviceIntervalSeconds ); - memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); + memcpy( payloadPtr, &serviceIntervalSeconds, sizeof( U32 ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -1250,14 +1265,14 @@ /*********************************************************************//** * @brief - * The handleStartStopDGHeatDisinfect function handles a request start or - * stop DG heat disifect mode. + * The handleStartStopDGActiveCoolHeatDisinfect function handles a request start or + * stop DG active cool heat disifect mode. * @details Inputs: none * @details Outputs: message handled * @param message: a pointer to the message to handle * @return result *************************************************************************/ -BOOL handleStartStopDGHeatDisinfect( MESSAGE_T *message ) +BOOL handleStartStopDGActiveCoolHeatDisinfect( MESSAGE_T *message ) { BOOL status = FALSE; @@ -1269,7 +1284,8 @@ if ( TRUE == startingDGHeatDisinfect ) { - status = startDGHeatDisinfect(); + setActiveOrPassiveHeatDisinfectStatus( FALSE ); + status = startDGHeatDisinfect( FALSE ); } else { @@ -1775,13 +1791,13 @@ *************************************************************************/ void handleSetROOnlyMode( MESSAGE_T* message ) { + UI_RESPONSE_PAYLOAD_T uiResponse; + BOOL result = FALSE; REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_DG_RO_ONLY_MODE_INVALID_PAYLOAD_LENGTH; BOOL accepted = FALSE; if ( message->hdr.payloadLen == sizeof(U32) ) { - BOOL result; - rejReason = REQUEST_REJECT_REASON_NONE; memcpy( &result, message->payload, sizeof(BOOL) ); @@ -1800,17 +1816,23 @@ break; default: + result = isROOnlyModeEnabled(); rejReason = REQUEST_REJECT_REASON_DG_RO_ONLY_MODE_DG_BUSY; break; } } else { + result = isROOnlyModeEnabled(); rejReason = REQUEST_REJECT_REASON_DG_RO_ONLY_MODE_INVALID_PARAMETER; } } - sendUIResponseMsg( MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE, accepted, rejReason ); + uiResponse.accepted = accepted; + uiResponse.rejectionReason = rejReason; + uiResponse.fwValue = (U32)result; + + sendUIResponseMsg( MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE, &uiResponse ); } /*********************************************************************//** @@ -1947,7 +1969,29 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_HD, ACK_REQUIRED ); } +/*********************************************************************//** + * @brief + * The handleStartStopDGPassiveHeatDisifnect function handles a request to + * start or stop DG passive cool heat disinfect. + * @details Inputs: none + * @details Outputs: message handled + * @param message: a pointer to the message to handle + * @return result + *************************************************************************/ +void handleStartStopDGPassiveCoolHeatDisifnect( MESSAGE_T* message ) +{ + BOOL status = FALSE; + if ( message->hdr.payloadLen == sizeof(U32) ) + { + setActiveOrPassiveHeatDisinfectStatus( TRUE ); + status = startDGHeatDisinfect( TRUE ); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); +} + + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -4959,8 +5003,9 @@ *************************************************************************/ void handleDGROStatusRequest( MESSAGE_T* message ) { + UI_RESPONSE_PAYLOAD_T uiResponse; REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; - BOOL roMode = FALSE; + BOOL roMode = FALSE; if ( 0 == message->hdr.payloadLen ) { @@ -4970,7 +5015,12 @@ { rejReason = REQUEST_REJECT_REASON_DG_RO_ONLY_MODE_INVALID_PAYLOAD_LENGTH; } - sendUIResponseMsg( MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE, roMode, rejReason ); + + uiResponse.accepted = roMode; + uiResponse.rejectionReason = rejReason; + uiResponse.fwValue = (U32)roMode; + + sendUIResponseMsg( MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE, &uiResponse ); } /*********************************************************************//** @@ -5164,4 +5214,32 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + +/*********************************************************************//** + * @brief + * The handleTestRunModeFillForCalibrationCheck function handles a request + * to run the mode fill for calibration check (0 = prime, 1 = bicarb test, + * 2 = acid test) + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestRunModeFillForCalibrationCheck( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + if ( sizeof(U32) == message->hdr.payloadLen ) + { + U32 modeFillForCalibrationState; + + memcpy( &modeFillForCalibrationState, message->payload, sizeof(U32) ); + + result = testSetModeFillForCal( modeFillForCalibrationState ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/