Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r9afca35aabacd4a52a8eb39828e78e25ac4165f9 -r20535cdea80fac7a48eb84d47c9ec4a1968051c5 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 9afca35aabacd4a52a8eb39828e78e25ac4165f9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 20535cdea80fac7a48eb84d47c9ec4a1968051c5) @@ -554,15 +554,18 @@ // has been already checked in POST getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( DG_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SERVICE_SCHEDULE_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + if ( 0 == message->hdr.payloadLen ) + { + // 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, &service.lastServiceEpochDate, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); + // Fill message payload + memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &service.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_HD, ACK_REQUIRED ); @@ -724,49 +727,8 @@ return result; } -#if 0 /*********************************************************************//** * @brief - * The sendDGServiceRecord function sends out the DG service record. - * @details Inputs: none - * @details Outputs: DG system record msg constructed and queued - * @param msgCurrNum: current payload number - * @param msgTotalNum: total number of payloads - * @param length: buffer length to be written - * @param scheduledRcrdAddress: start address of the scheduled runs record - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; - - memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &length, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, scheduledRcrdAddress, length ); - - // 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_PC, ACK_NOT_REQUIRED ); - - return result; -} -#endif - -/*********************************************************************//** - * @brief * The sendPOSTTestResult function constructs an DG POST test result message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -865,41 +827,7 @@ return result; } -#if 0 -// For Phase 1B /*********************************************************************//** - * @brief - * The handleDGScheduledRunsRequest function handles a request for DG - * scheduled runs information. - * @details Inputs: none - * @details Outputs: message handled, response constructed and queued for - * transmit. - * @return none - *************************************************************************/ -void handleDGScheduledRunsRequest( MESSAGE_T *message ) -{ - MESSAGE_T msg; - DG_SCHEDULED_RUN_RECORD_T scheduledService; - - // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record - // has been already checked in POST - getNVRecord2Driver( GET_SRR_RECORD, (U08*)&scheduledService, sizeof( DG_SCHEDULED_RUN_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SCHEDULED_RUNS_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - - // Do nothing this message is for Phase 1B. - - // 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 ); -} -#endif - -/*********************************************************************//** * @brief * The handleStartStopDGFlush function handles a request to start or stop * DG flush mode. @@ -1482,25 +1410,27 @@ { MESSAGE_T msg; DG_USAGE_INFO_RECORD_T usageInfo; + U08 *payloadPtr = msg.payload; // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record // has been already checked in POST getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageInfo, sizeof( DG_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - U08 *payloadPtr = msg.payload; + if ( 0 == message->hdr.payloadLen ) + { + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_USAGE_DATA; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( BOOL ); - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_USAGE_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( BOOL ); + // Fill message payload + memcpy( payloadPtr, &usageInfo.lastHeatDisDateEpoch, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &usageInfo.lastChemicalDisDateEpoch, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &usageInfo.isDisinfected, sizeof( BOOL ) ); + } - // Fill message payload - memcpy( payloadPtr, &usageInfo.lastHeatDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.lastChemicalDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.isDisinfected, sizeof( BOOL ) ); - // 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_HD, ACK_REQUIRED ); } @@ -3131,81 +3061,23 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); -} - -#if 0 -/*********************************************************************//** -* @brief -* The handleGetDGServiceRecord function handles a request to get the DG -* scheduled runs data record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleGetDGScheduledRunsRecord( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // verify payload length if ( 0 == message->hdr.payloadLen ) { - // Tester must be logged in - if ( TRUE == isTestingActivated() ) - { - result = sendRecordToDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD ); - } - } + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); -/*********************************************************************//** -* @brief -* The handleSetDGScheduledRunsRecord function handles a request to set the DG -* scheduled runs data record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleSetDGScheduledRunsRecord( MESSAGE_T *message ) -{ - BOOL status = FALSE; - U08* payloadPtr = message->payload; - U32 currentMessage; - U32 totalMessages; - U32 payloadLength; + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - status = receiveRecordFromDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); - // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } -#endif /*********************************************************************//** * @brief