Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -ree84e20f729b0aace2b1728c16de9a89e06eee38 -r25aeff9e9994d2e7aab3b4e6171c56fdac6a01fe --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision ee84e20f729b0aace2b1728c16de9a89e06eee38) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 25aeff9e9994d2e7aab3b4e6171c56fdac6a01fe) @@ -44,6 +44,7 @@ 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 U32 currentGenDState; ///< Current state of DD GenD mode. +static U32 isBalChamberSwitchingActive; ///< Flag indicating whether bc is switching. static BOOL ddOpModeDataFreshFlag; ///< Flag to signal the handleDDOpMode() to process fresh dd op mode data. static BOOL ddDialysatePressureFreshFlag; ///< Flag to signal @@ -288,6 +289,38 @@ /*********************************************************************//** * @brief + * The handleBalancingChamberData function sets the latest DD balancing + * chamber switching status reported by the DD. + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if message is invalid. + * @details \b Inputs: none + * @details \b Outputs: isBalChamberSwitchingActive + * @param message Pointer to the DD balancing chamber data broadcast message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleBalancingChamberData( MESSAGE_T *message ) +{ + BOOL result = FALSE; + BAL_CHAMBER_DATA_T payload; + + if ( message->hdr.payloadLen == sizeof( BAL_CHAMBER_DATA_T ) ) + { + // parse message payload + memcpy( &payload, &message->payload[ 0 ], sizeof( BAL_CHAMBER_DATA_T ) ); + + isBalChamberSwitchingActive = payload.isBalChamberSwitchingActive; + result = TRUE; + } + else + { +#ifndef TEST_UI_ONLY + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_DD_BAL_CHAMBER_DATA, (U32)message->hdr.payloadLen ); +#endif + } + return result; +} + +/*********************************************************************//** + * @brief * The getDialysatePressure function gets the latest reported dialysate * pressure. * @details \b Inputs: dialysatePressure @@ -327,6 +360,19 @@ /*********************************************************************//** * @brief + * The getBalChamberSwitchingStatus function returns whether the DD + * balancing chamber is currently switching. + * @details \b Inputs: isBalChamberSwitchingActive + * @details \b Outputs: none + * @return TRUE if balancing chamber switching is active, FALSE if not + *************************************************************************/ +BOOL getBalChamberSwitchingStatus( void ) +{ + return isBalChamberSwitchingActive; +} + +/*********************************************************************//** + * @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.