Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re3839e10decfadf12a8fb2b9f8c049d8a30e945b -r229c6d4239f101656f99090b81deb28cfd0562b4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e3839e10decfadf12a8fb2b9f8c049d8a30e945b) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 229c6d4239f101656f99090b81deb28cfd0562b4) @@ -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 @@ -1775,13 +1790,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 +1815,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 ); } /*********************************************************************//** @@ -4959,8 +4980,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 +4992,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 ); } /*********************************************************************//**