Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r8492830da5862d7eeaea89d30efb5ea5dcc22572 -ra57af2726f27208a2de96e9331678caf022d927d --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 8492830da5862d7eeaea89d30efb5ea5dcc22572) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision a57af2726f27208a2de96e9331678caf022d927d) @@ -506,6 +506,35 @@ /*********************************************************************//** * @brief + * The handleDDCommandResponseMsg function handles a DD command response + * message received by TD. + * @details \b Inputs: DD command response message. + * @details \b Outputs: DD command response recorded in DDInterface. + * @param message Pointer to the received DD command response message. + * @return TRUE if the response is valid, otherwise FALSE. + *************************************************************************/ +BOOL handleDDCommandResponseMsg( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( sizeof( DD_CMD_RESPONSE_T ) == message->hdr.payloadLen ) + { + DD_CMD_RESPONSE_T response; + + memcpy( &response, + &message->payload[ 0 ], + sizeof( DD_CMD_RESPONSE_T ) ); + + handleDDCommandResponse( &response ); + + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The handleDDCommandResponse function processes the latest DD command response. * @details \b Alarm: ALARM_ID_TD_DD_COMMAND_INVALID_PARAMETER_FAULT if reported * response indicates DD rejected command due to invalid parameter. @@ -628,23 +657,29 @@ /*********************************************************************//** * @brief - * The cmdStartDDHeatDisinfect function sends a Heat Disinfection start - * request to the DD. - * @details \b Inputs: none - * @details \b Outputs: Heat Disinfection start request sent to DD. + * The cmdSendDDCommand function sends a command request to the DD. + * @details \b Inputs: command. + * @details \b Outputs: Previous response for the command cleared and + * command request sent to DD. + * @param command DD command requested by TD. * @return none *************************************************************************/ -void cmdStartDDHeatDisinfect( void ) +void cmdSendDDCommand( DD_COMMAND_T command ) { - DD_COMMAND_T command = DD_CMD_START_DISINFECT_HEAT; + U32 payload = (U32)command; - ddCmdResp[ DD_CMD_START_DISINFECT_HEAT ].commandID = DD_CMD_NONE; + if ( ( DD_CMD_NONE < command ) && ( command < NUM_OF_DD_COMMANDS ) ) + { + // Clear any previous response for this command. + ddCmdResp[ command ].commandID = DD_CMD_NONE; + ddCmdResp[ command ].rejected = TRUE; + ddCmdResp[ command ].rejectCode = DD_CMD_REQUEST_REJECT_REASON_NONE; #ifndef TEST_UI_ONLY - sendMessage( MSG_ID_TD_DD_HEAT_DISINFECT_REQUEST, - COMM_BUFFER_OUT_CAN_TD_2_DD, - (U08 *)&command, sizeof( U32 ) ); + sendMessage( MSG_ID_TD_DD_COMMAND_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_DD, + (U08 *)&payload, sizeof( U32 ) ); #endif + } }