Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rc0160362dc799802ec589d5b6cf4c2bd1face77e -r1463d830cefd58198bfc6d4ae3775ad0f2eb1d0b --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c0160362dc799802ec589d5b6cf4c2bd1face77e) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1463d830cefd58198bfc6d4ae3775ad0f2eb1d0b) @@ -829,6 +829,68 @@ /*********************************************************************//** * @brief + * The handleDGSerialNumberRequest function handles a request for DG 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 handleDGSerialNumberRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + DG_SYSTEM_RECORD_T system = getDGSystemRecord(); + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_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_DG_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief + * The handleDGServiceScheduleRequest function handles a request for DG + * 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 handleDGServiceScheduleRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + DG_SERVICE_RECORD_T payload = getDGServiceRecord(); + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_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_DG_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The broadcastConductivityData function sends out conductivity data. * @details Inputs: none * @details Outputs: conductivity data message constructed and queued