Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -re7e2fef9fda6c6e876f7aba1c8f837d8aa713392 -rd1abd0eba39f6eb00e7d1022628605cd45a63b32 --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision e7e2fef9fda6c6e876f7aba1c8f837d8aa713392) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision d1abd0eba39f6eb00e7d1022628605cd45a63b32) @@ -42,6 +42,7 @@ static F32 dialysatePressure; ///< Current dialysate pressure reported by DD. static BOOL ddStartCommandSent; ///< Flag indicates command to start DD has been sent. static BOOL ddStarted; ///< Flag indicates whether we have commanded the DD to start or stop. +static BOOL isDialysateGoodtoDeliver; ///< Flag indicating whether dialysate is good to deliver. static BOOL ddOpModeDataFreshFlag; ///< Flag to signal the handleDDOpMode() to process fresh dd op mode data. static BOOL ddDialysatePressureFreshFlag; ///< Flag to signal @@ -71,7 +72,9 @@ ddCurrentOpMode = DD_MODE_INIT; ddSubMode = 0; dialysatePressure = 0.0F; + isDialysateGoodtoDeliver = FALSE; + ddOpModeDataFreshFlag = FALSE; ddDialysatePressureFreshFlag = FALSE; @@ -245,6 +248,38 @@ /*********************************************************************//** * @brief + * The setDialysateData function sets the latest DD dialysate data reported by + * the DD (called by DD published message handler). + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if message is invalid. + * @details \b Inputs: none + * @details \b Outputs: isDialysateGoodtoDeliver + * @param message Pointer to the DD dialysate mode data broadcast message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL setDialysateData( MESSAGE_T *message ) +{ + BOOL result = FALSE; + GEN_DIALYSATE_MODE_DATA_T payload; + + // parse message payload + memcpy( &payload, &message->payload[ 0 ], sizeof( GEN_DIALYSATE_MODE_DATA_T ) ); + + if ( message->hdr.payloadLen == sizeof( GEN_DIALYSATE_MODE_DATA_T ) ) + { + isDialysateGoodtoDeliver = payload.isDialysateGoodtoDeliver; + result = TRUE; + } + else + { +#ifndef TEST_UI_ONLY + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_DD_DIALYSATE_DATA, (U32)message->hdr.payloadLen ); +#endif + } + return result; +} + +/*********************************************************************//** + * @brief * The getDialysatePressure function gets the latest reported dialysate * pressure. * @details \b Inputs: dialysatePressure @@ -258,6 +293,20 @@ /*********************************************************************//** * @brief + * The getDialysateGoodToDeliverStatus function gets the status + * whether dialysate is good to deliver + * pressure. + * @details \b Inputs: isDialysateGoodtoDeliver + * @details \b Outputs: none + * @return Latest dialysate good to delivery status. + *************************************************************************/ +BOOL getDialysateGoodToDeliverStatus( void ) +{ + return isDialysateGoodtoDeliver; +} + +/*********************************************************************//** + * @brief * The setDialysatePressure function sets the latest dialysate pressure * reported by the DD sub-system. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if message invalid. @@ -321,7 +370,6 @@ #ifndef TEST_UI_ONLY sendMessage( MSG_ID_DD_PRE_GEN_DIALYSATE_REQUEST_DATA, COMM_BUFFER_OUT_CAN_TD_2_DD, (U08*)(&preGenDialysateCmdSet), sizeof( PRE_GEN_DIALYSATE_REQ_PAYLOAD_T ) ); #endif -// ddStartCommandSent = TRUE; } /*********************************************************************//**