/************************************************************************** * * Copyright (c) 2021-2025 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 MessageSupport.c * * @author (last) Sean Nash * @date (last) 12-Nov-2021 * * @author (original) Dara Navaei * @date (original) 10-Sep-2021 * ***************************************************************************/ #include "SystemCommMessages.h" #include "Utilities.h" /** * @addtogroup MessageSupport * @{ */ // ********** private function prototypes ********** /*********************************************************************//** * @brief * The broadcastData function queues a broadcast message for transmission. * @details Inputs: none * @details Outputs: broadcast data msg constructed and queued * @param msgID message ID of the data is broadcast * @param buffer comm buffer ID * @param dataPtr pointer to the start of the buffer * @param length length of the data buffer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastData( MSG_ID_T msgID, COMM_BUFFER_T buffer, U08* dataPtr, U32 length ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = length; if ( ( length > 0 ) && ( dataPtr != 0 ) ) { memcpy( payloadPtr, dataPtr, length ); } // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, buffer, ACK_NOT_REQUIRED ); return result; } /**@}*/