Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r75ecd5ee8a56b8d9faef07cdeb0a8dc7975ff476 -r5e92cbb2c29854fb60a91dc4abafeb9b08d3272c --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 75ecd5ee8a56b8d9faef07cdeb0a8dc7975ff476) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 5e92cbb2c29854fb60a91dc4abafeb9b08d3272c) @@ -22,6 +22,7 @@ #include "FpgaDD.h" #include "Heaters.h" #include "Level.h" +#include "Messaging.h" #include "ModeGenDialysate.h" #include "ModeStandby.h" #include "OperationModes.h" @@ -51,6 +52,12 @@ #define HYD_CHAMBER_TARGET_NEG_PRESS_MAX_PSI (-12.075F) ///< Hydraulics chamber maximum negative pressure(D9/PHo) in psi. #define GEN_DIALYSATE_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the gen dialysate mode data published. +/// Payload record structure for Gen dialysate execution state set request +typedef struct +{ + U32 execStateSet; ///< Gen dialysate execution state machine set request +} GEND_EXEC_STATE_SET_CMD_PAYLOAD_T; + // ********** private data ********** static DD_GEND_MODE_STATE_T genDialysateState = DD_GEND_STATE_START; ///< Currently active gen dialysate state. @@ -618,6 +625,19 @@ /*********************************************************************//** * @brief + * The setCurrentGenDialysateState function sets the current state of the + * gen dialysate mode. + * @details \b Inputs: genDialysateState + * @details \b Outputs: genDialysateState + * @return the current state of gen dialysate mode + *************************************************************************/ +void setCurrentGenDialysateState( DD_GEND_MODE_STATE_T state ) +{ + genDialysateState = state; +} + +/*********************************************************************//** + * @brief * The setTreatmentParamUpdate function sets the flag to indicate one or more * treatement parameters updated. * gen dialysate mode. @@ -819,4 +839,42 @@ return result; } +/*********************************************************************//** + * @brief + * The testGenDExecStateOverride function sets the Gen dialysate execution state + * machine to given state. + * @details \b Inputs: tester logged in, execStateSet + * @details \b Outputs: genDialysateState + * @param message set message from Dialin which includes the generate dialysate + * execution state to be set. + * @return TRUE if set request is successful, FALSE if not + *************************************************************************/ +BOOL testGenDExecStateOverride( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify tester has logged in with DD + if ( TRUE == isTestingActivated() ) + { + // Verify payload length is valid + if ( sizeof( GEND_EXEC_STATE_SET_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) + { + GEND_EXEC_STATE_SET_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(GEND_EXEC_STATE_SET_CMD_PAYLOAD_T) ); + + // Validate the state to be set + if ( payload.execStateSet < NUM_OF_DD_GEND_MODE_STATES ) + { + //set the GenD exec state machine + setCurrentGenDialysateState( (DD_GEND_MODE_STATE_T)payload.execStateSet); + + result = TRUE; + } + } + } + + return result; +} + /**@}*/