Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1eac55db00559965a7dc6752fc42a2c54d56f4b9 -rabbad386f4cc94f315300dffef321fe8c03fbd52 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1eac55db00559965a7dc6752fc42a2c54d56f4b9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision abbad386f4cc94f315300dffef321fe8c03fbd52) @@ -26,6 +26,7 @@ #include "FPGA.h" #include "ModeStandby.h" #include "ModeTreatmentParams.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "RTC.h" #include "SampleWater.h" @@ -3837,9 +3838,11 @@ /*********************************************************************//** * @brief - * The handleFWVersionRequest function handles a request for HD f/w version. + * The handleFWVersionRequest function handles a request for HD f/w + * version. * @details Inputs: none - * @details Outputs: message handled, response constructed and queued for transmit. + * @details Outputs: message handled, response constructed and queued + * for transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ @@ -3866,6 +3869,96 @@ // 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 handleHDSerialNumberRequest function handles a request for HD serial + * number request. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued + * for transmit. + * @param message a pointer to the message to handle. + * @return none + *************************************************************************/ +void handleHDSerialNumberRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + HD_SYSTEM_RECORD_T system = getHDSystemRecord(); + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SERIAL_NUMBER; + + // Add 1 byte for null terminator + msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; + + // Fill message payload + memcpy( payloadPtr, &system.topLevelSN, MAX_TOP_LEVEL_SN_CHARS ); + payloadPtr += MAX_TOP_LEVEL_SN_CHARS; + *payloadPtr = 0; + + // 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 handleHDServiceScheduleRequest function handles a request for HD + * service information. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @param message a pointer to the message to handle. + * @return none + *************************************************************************/ +void handleHDServiceScheduleRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + HD_SERVICE_RECORD_T payload = getHDServiceRecord(); + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SERVICE_SCHEDULE_DATA; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + // Fill message payload + memcpy( payloadPtr, &payload.lastServiceEpochDate, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &payload.serviceIntervalSeconds, sizeof( U32 ) ); + + // 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 handleHDUsageInfoRequest function handles a request for HD + * usage information. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @param message a pointer to the message to handle. + * @return none + *************************************************************************/ +void handleHDUsageInfoRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + U32 payload = getTreatmentTime(); + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_USAGE_DATA; + msg.hdr.payloadLen = sizeof( U32 ); + + // Fill message payload + memcpy( payloadPtr, &payload, sizeof( U32 ) ); + + // 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 ); }