Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r35de566c96433689821b7a21f731df26b40d67ae -r39841b84f399b7b3233822942c39efba24ffcd12 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 35de566c96433689821b7a21f731df26b40d67ae) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 39841b84f399b7b3233822942c39efba24ffcd12) @@ -1040,15 +1040,18 @@ handleStartStopTrimmerHeaterCmd( message ); break; - case MSG_ID_DG_TESTER_LOGIN_REQUEST: - handleTesterLogInRequest( message ); - break; - case MSG_ID_DG_START_STOP_HEAT_DISINFECT: handleStartStopDGHeatDisinfect( message ); break; + case MSG_ID_UI_DG_SET_RTC_REQUEST: + handleUIClockSyncRequest( message ); + break; + case MSG_ID_DG_TESTER_LOGIN_REQUEST: + handleTesterLogInRequest( message ); + break; + default: // unrecognized message ID received - ok, ignore - may be a test message handled below break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r23120d5201ec71f5bf9597c4951524652e3672ad -r39841b84f399b7b3233822942c39efba24ffcd12 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 23120d5201ec71f5bf9597c4951524652e3672ad) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 39841b84f399b7b3233822942c39efba24ffcd12) @@ -2934,6 +2934,51 @@ } /*********************************************************************//** + * @brief + * The handleUIClockSyncRequest function handles a UI clock sync message. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for transmit. + * @param messagePtr pointer to the message to handle. + * @return none + *************************************************************************/ +void handleUIClockSyncRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + U32 rejReason = REQUEST_REJECT_REASON_NONE; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U32 epoch; + + memcpy( &epoch, message->payload, sizeof( U32 ) ); + result = setRTCEpoch( epoch ); + if ( FALSE == result ) + { + rejReason = REQUEST_REJECT_REASON_INVALID_DATE_OR_TIME; + } + } + else + { + rejReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Create a response message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_UI_SET_RTC_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + memcpy( payloadPtr, &result, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejReason, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_REQUIRED ); + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_UI, result ); +} + +/*********************************************************************//** * @brief * The handleSetDGCalibrationRecord function handles a request to set the DG * calibration data record. Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r23120d5201ec71f5bf9597c4951524652e3672ad -r39841b84f399b7b3233822942c39efba24ffcd12 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 23120d5201ec71f5bf9597c4951524652e3672ad) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 39841b84f399b7b3233822942c39efba24ffcd12) @@ -320,6 +320,9 @@ // MSG_ID_DG_START_STOP_HEAT_DISINFECT BOOL handleStartStopDGHeatDisinfect( MESSAGE_T *message ); +// MSG_ID_UI_DG_SET_RTC_REQUEST +void handleUIClockSyncRequest( MESSAGE_T *message ); + // MSG_ID_DG_SET_CALIBRATION_DATA void handleSetDGCalibrationRecord( MESSAGE_T *message );