Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r016cc83d64591243957b00c656d607b1fb0f1eb9 -r0b80b72dc375e46a710ebfa97c25e5fa4943b072 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 016cc83d64591243957b00c656d607b1fb0f1eb9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0b80b72dc375e46a710ebfa97c25e5fa4943b072) @@ -3593,7 +3593,41 @@ } } +/*********************************************************************//** + * @brief + * The sendInstitutionalRecordToUI function sends the institutional record to UI + * @details Inputs: none + * @details Outputs: none + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void sendInstitutionalRecordToUI( MESSAGE_T* message ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 accept = 1; + U32 reson = 0; + HD_INSTITUTIONAL_RECORD_T hdInstitutionalRecord; + + getNVRecord2Driver( GET_INSTITUTIONAL_RECORD, (U08*)&hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_INSTITUTIONAL_RECORD_RESPONSE; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( HD_INSTITUTIONAL_RECORD_T ) - sizeof( U32 ) - sizeof( U16 ); + + memcpy( payloadPtr, &accept, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reson, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ) - sizeof( U32 ) - sizeof( U16 ) ); + + // 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 ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/