Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r968f9908941a8f8ceeacdb6aa40655abf54c1ef4 -rbd738c0705e8640d2c532ecece876aaa3496ee32 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 968f9908941a8f8ceeacdb6aa40655abf54c1ef4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bd738c0705e8640d2c532ecece876aaa3496ee32) @@ -287,7 +287,7 @@ } // *********************************************************************** -// ********************* MSG_ID_OFF_BUTTON_PRESS ************************* +// ***************** Message Sending Helper Functions ******************** // *********************************************************************** /************************************************************************* @@ -319,225 +319,7 @@ } /************************************************************************* - * @brief handleDGCheckIn - * The handleDGCheckIn function handles a check-in from the DG. - * @details - * Inputs : none - * Outputs : check in the DG with the SystemComm module. - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleDGCheckIn( MESSAGE_T *message ) -{ - checkInFromDG(); -} - -/************************************************************************* - * @brief handleUICheckIn - * The handleUICheckIn function handles a check-in from the UI. - * @details - * Inputs : none - * Outputs : check in the UI with the SystemComm module. - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUICheckIn( MESSAGE_T *message ) -{ - checkInFromUI(); -} - -/************************************************************************* - * @brief handleOffButtonConfirmMsgFromUI - * The handleOffButtonConfirmMsgFromUI function handles a response to an \n - * off button message to the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) -{ - OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; - - if ( message->hdr.payloadLen == sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ) - { - memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); - userConfirmOffButton( payload.confirmed ); - } -} - -/************************************************************************* * @brief - * The handleLoadCellReadingsFromDG function handles a load cell readings \n - * broadcast message from the DG. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleLoadCellReadingsFromDG( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == sizeof(LOAD_CELL_READINGS_PAYLOAD_T) ) - { - LOAD_CELL_READINGS_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(LOAD_CELL_READINGS_PAYLOAD_T) ); - result = setNewLoadCellReadings( payload.res1PrimaryLoadCell, payload.res1BackupLoadCell, payload.res2PrimaryLoadCell, payload.res2BackupLoadCell ); - } - // TODO - what to do if invalid payload length? -} - -/************************************************************************* - * @brief - * The handleROPumpData function handles an RO pump data broadcast \n - * message from the DG. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleROPumpData( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(DG_RO_PUMP_DATA_PAYLOAD_T) ) - { - DG_RO_PUMP_DATA_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(DG_RO_PUMP_DATA_PAYLOAD_T) ); - setDGROPumpData( payload.setPtPSI, payload.measFlowRateMlMin ); - } - // TODO - what to do if invalid payload length? -} - -/************************************************************************* - * @brief - * The handleDrainPumpData function handles a drain pump broadcast \n - * message from the DG. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleDrainPumpData( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(DG_DRAIN_PUMP_DATA_PAYLOAD_T) ) - { - DG_DRAIN_PUMP_DATA_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(DG_DRAIN_PUMP_DATA_PAYLOAD_T) ); - setDGDrainPumpData( payload.setPtRPM ); - } - // TODO - what to do if invalid payload length? -} - -/************************************************************************* - * @brief - * The handleDGPressuresData function handles a DG pressure sensor readings \n - * broadcast message from the DG. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleDGPressuresData( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(DG_PRESSURES_DATA_PAYLOAD_T) ) - { - DG_PRESSURES_DATA_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(DG_PRESSURES_DATA_PAYLOAD_T) ); - setDGPressures( payload.roInPSI, payload.roOutPSI, payload.drainInPSI, payload.drainOutPSI ); - } - // TODO - what to do if invalid payload length? -} - -/************************************************************************* - * @brief - * The handleDGReservoirData function handles a reservoir data broadcast \n - * message from the DG. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleDGReservoirData( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ) - { - DG_RESERVOIRS_DATA_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ); - setDGReservoirsData( payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); - } - // TODO - what to do if invalid payload length? -} - -/************************************************************************* - * @brief - * The handleUFPauseResumeRequest function handles a ultrafiltration pause \n - * or resume request message from the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUFPauseResumeRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == sizeof(U32) ) - { - U32 cmd; - - memcpy( &cmd, message->payload, sizeof(U32) ); - if ( UF_CMD_PAUSE == cmd ) - { - result = pauseUF(); - } - else if ( UF_CMD_RESUME == cmd ) - { - result = resumeUF(); - } - } - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); -} - -/************************************************************************* - * @brief - * The handleChangeUFSettingsRequest function handles a ultrafiltration \n - * change settings request message from the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeUFSettingsRequest( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(F32) ) - { - F32 uFVolume; - - memcpy( &uFVolume, message->payload, sizeof(F32) ); - - verifyUFSettingsChange( uFVolume ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/************************************************************************* - * @brief * The sendChangeUFSettingsResponse function constructs a UF change settings \n * response to the UI and queues the msg for transmit on the appropriate CAN \n * channel. @@ -587,58 +369,6 @@ /************************************************************************* * @brief - * The handleChangeUFSettingsConfirmation function handles a ultrafiltration \n - * change setting confirmation message from the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) - { - UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); - - verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/************************************************************************* - * @brief - * The handleChangeTreatmentDurationRequest function handles a treatment \n - * duration setting change message from the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(U32) ) - { - U32 timeInMin; - - memcpy( &timeInMin, message->payload, sizeof(U32) ); - - verifyTreatmentDurationSettingChange( timeInMin ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/************************************************************************* - * @brief * The sendChangeTreatmentDurationResponse function constructs a treatment \n * duration change response to the UI and queues the msg for transmit on the \n * appropriate CAN channel. @@ -679,36 +409,6 @@ /************************************************************************* * @brief - * The handleChangeBloodDialysateRateChangeRequest function handles a blood \n - * and dialysate rate settings change message from the UI. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) -{ - U32 expPayloadSize = sizeof(U32) + sizeof(U32); - - if ( expPayloadSize == message->hdr.payloadLen ) - { - U32 bloodRate; - U32 dialRate; - - memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); - memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); - - verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/************************************************************************* - * @brief * The sendChangeBloodDialysateRateChangeResponse function constructs a change \n * blood and dialysate rate settings response to the UI and queues the msg for \n * transmit on the appropriate CAN channel. @@ -792,63 +492,6 @@ /************************************************************************* * @brief - * The handleDGOpMode function handles a DG broadcast of it's current mode. - * @details - * Inputs : none - * Outputs : message handled, response constructed and queued for transmit. - * @param message : a pointer to the message to handle. - * @return none - *************************************************************************/ -void handleDGOpMode( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(U32) ) - { - U32 mode; - - memcpy( &mode, message->payload, sizeof(U32) ); - - setDGOpMode( mode ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, FALSE ); - } -} - -/************************************************************************* - * @brief - * The handleFWVersionRequest function handles a request for HD f/w version. - * @details - * Inputs : none - * Outputs : message handled, response constructed and queued for transmit. - * @param message : a pointer to the message to handle. - * @return none - *************************************************************************/ -void handleFWVersionRequest( MESSAGE_T *message ) -{ - MESSAGE_T msg; - U08 major = (U08)HD_VERSION_MAJOR; - U08 minor = (U08)HD_VERSION_MINOR; - U16 build = (U16)HD_VERSION_BUILD; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_VERSION; - msg.hdr.payloadLen = sizeof( U08 ) + sizeof( U08 ) + sizeof( U16 ); - - memcpy( payloadPtr, &major, sizeof( U08 ) ); - payloadPtr += sizeof( U08 ); - memcpy( payloadPtr, &minor, sizeof( U08 ) ); - payloadPtr += sizeof( U08 ); - memcpy( payloadPtr, &build, 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_REQUIRED ); -} - -/************************************************************************* - * @brief * The sendDialysateTempTargetsToDG function constructs a dialysate temperature \n * set points message for DG and queues the msg for transmit on the appropriate CAN channel. * @details @@ -1270,8 +913,369 @@ return result; } +// *********************************************************************** +// **************** Message Handling Helper Functions ******************** +// *********************************************************************** /************************************************************************* + * @brief handleDGCheckIn + * The handleDGCheckIn function handles a check-in from the DG. + * @details + * Inputs : none + * Outputs : check in the DG with the SystemComm module. + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGCheckIn( MESSAGE_T *message ) +{ + checkInFromDG(); +} + +/************************************************************************* + * @brief handleUICheckIn + * The handleUICheckIn function handles a check-in from the UI. + * @details + * Inputs : none + * Outputs : check in the UI with the SystemComm module. + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUICheckIn( MESSAGE_T *message ) +{ + checkInFromUI(); +} + +/************************************************************************* + * @brief handleOffButtonConfirmMsgFromUI + * The handleOffButtonConfirmMsgFromUI function handles a response to an \n + * off button message to the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) +{ + OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; + + if ( message->hdr.payloadLen == sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ) + { + memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); + userConfirmOffButton( payload.confirmed ); + } +} + +/************************************************************************* + * @brief + * The handleLoadCellReadingsFromDG function handles a load cell readings \n + * broadcast message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleLoadCellReadingsFromDG( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(LOAD_CELL_READINGS_PAYLOAD_T) ) + { + LOAD_CELL_READINGS_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(LOAD_CELL_READINGS_PAYLOAD_T) ); + result = setNewLoadCellReadings( payload.res1PrimaryLoadCell, payload.res1BackupLoadCell, payload.res2PrimaryLoadCell, payload.res2BackupLoadCell ); + } + // TODO - what to do if invalid payload length? +} + +/************************************************************************* + * @brief + * The handleROPumpData function handles an RO pump data broadcast \n + * message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleROPumpData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DG_RO_PUMP_DATA_PAYLOAD_T) ) + { + DG_RO_PUMP_DATA_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DG_RO_PUMP_DATA_PAYLOAD_T) ); + setDGROPumpData( payload.setPtPSI, payload.measFlowRateMlMin ); + } + // TODO - what to do if invalid payload length? +} + +/************************************************************************* + * @brief + * The handleDrainPumpData function handles a drain pump broadcast \n + * message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDrainPumpData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DG_DRAIN_PUMP_DATA_PAYLOAD_T) ) + { + DG_DRAIN_PUMP_DATA_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DG_DRAIN_PUMP_DATA_PAYLOAD_T) ); + setDGDrainPumpData( payload.setPtRPM ); + } + // TODO - what to do if invalid payload length? +} + +/************************************************************************* + * @brief + * The handleDGPressuresData function handles a DG pressure sensor readings \n + * broadcast message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGPressuresData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DG_PRESSURES_DATA_PAYLOAD_T) ) + { + DG_PRESSURES_DATA_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DG_PRESSURES_DATA_PAYLOAD_T) ); + setDGPressures( payload.roInPSI, payload.roOutPSI, payload.drainInPSI, payload.drainOutPSI ); + } + // TODO - what to do if invalid payload length? +} + +/************************************************************************* + * @brief + * The handleDGReservoirData function handles a reservoir data broadcast \n + * message from the DG. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGReservoirData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ) + { + DG_RESERVOIRS_DATA_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ); + setDGReservoirsData( payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); + } + // TODO - what to do if invalid payload length? +} + +/************************************************************************* + * @brief + * The handleUFPauseResumeRequest function handles a ultrafiltration pause \n + * or resume request message from the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUFPauseResumeRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 cmd; + + memcpy( &cmd, message->payload, sizeof(U32) ); + if ( UF_CMD_PAUSE == cmd ) + { + result = pauseUF(); + } + else if ( UF_CMD_RESUME == cmd ) + { + result = resumeUF(); + } + } + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); +} + +/************************************************************************* + * @brief + * The handleChangeUFSettingsRequest function handles a ultrafiltration \n + * change settings request message from the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(F32) ) + { + F32 uFVolume; + + memcpy( &uFVolume, message->payload, sizeof(F32) ); + + verifyUFSettingsChange( uFVolume ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/************************************************************************* + * @brief + * The handleChangeUFSettingsConfirmation function handles a ultrafiltration \n + * change setting confirmation message from the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) + { + UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); + + verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/************************************************************************* + * @brief + * The handleChangeTreatmentDurationRequest function handles a treatment \n + * duration setting change message from the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 timeInMin; + + memcpy( &timeInMin, message->payload, sizeof(U32) ); + + verifyTreatmentDurationSettingChange( timeInMin ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/************************************************************************* + * @brief + * The handleChangeBloodDialysateRateChangeRequest function handles a blood \n + * and dialysate rate settings change message from the UI. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) +{ + U32 expPayloadSize = sizeof(U32) + sizeof(U32); + + if ( expPayloadSize == message->hdr.payloadLen ) + { + U32 bloodRate; + U32 dialRate; + + memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); + memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); + + verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/************************************************************************* + * @brief + * The handleDGOpMode function handles a DG broadcast of it's current mode. + * @details + * Inputs : none + * Outputs : message handled, response constructed and queued for transmit. + * @param message : a pointer to the message to handle. + * @return none + *************************************************************************/ +void handleDGOpMode( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 mode; + + memcpy( &mode, message->payload, sizeof(U32) ); + + setDGOpMode( mode ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, FALSE ); + } +} + +/************************************************************************* + * @brief + * The handleFWVersionRequest function handles a request for HD f/w version. + * @details + * Inputs : none + * Outputs : message handled, response constructed and queued for transmit. + * @param message : a pointer to the message to handle. + * @return none + *************************************************************************/ +void handleFWVersionRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + U08 major = (U08)HD_VERSION_MAJOR; + U08 minor = (U08)HD_VERSION_MINOR; + U16 build = (U16)HD_VERSION_BUILD; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_VERSION; + msg.hdr.payloadLen = sizeof( U08 ) + sizeof( U08 ) + sizeof( U16 ); + + memcpy( payloadPtr, &major, sizeof( U08 ) ); + payloadPtr += sizeof( U08 ); + memcpy( payloadPtr, &minor, sizeof( U08 ) ); + payloadPtr += sizeof( U08 ); + memcpy( payloadPtr, &build, 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_REQUIRED ); +} + + +/************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/