Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r992dce16d63424ddd30fe9ac2f819e9a53b21977 -rdcd360fb4dc37db2dcbeb7fb14fb327fe68235f4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 992dce16d63424ddd30fe9ac2f819e9a53b21977) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision dcd360fb4dc37db2dcbeb7fb14fb327fe68235f4) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file SystemCommMessages.c +* @file SystemCommMessages.c * -* @author (last) Quang Nguyen -* @date (last) 26-Aug-2020 +* @author (last) Dara Navaei +* @date (last) 11-Nov-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -22,14 +22,17 @@ #include "Accel.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" +#include "Fans.h" #include "FPGA.h" #include "Heaters.h" #include "ModeFlush.h" #include "ModeGenIdle.h" +#include "ModeInitPOST.h" #include "ModeStandby.h" #include "MsgQueues.h" #include "NVDataMgmt.h" #include "OperationModes.h" +#include "DialysateFlow.h" #include "Pressures.h" #include "Reservoirs.h" #include "RTC.h" @@ -51,21 +54,29 @@ // ********** private definitions ********** -#define ACK_REQUIRED TRUE ///< Require an ACK. -#define ACK_NOT_REQUIRED FALSE ///< Not require an ACK. - #ifdef DEBUG_ENABLED #define DEBUG_EVENT_MAX_TEXT_LEN 40 #endif - -// ********** private data ********** - -static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether tester logged in or not. + +#define MAX_MSGS_BLOCKED_FOR_XMIT 8 ///< Maximum number of messages to block transmission for. + +#pragma pack(push,1) +/// Payload record structure for block message transmission request. +typedef struct +{ + U16 blockedMessages[ MAX_MSGS_BLOCKED_FOR_XMIT ]; +} BLOCKED_MSGS_DATA_T; +#pragma pack(pop) + +// ********** private data ********** + +static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether tester logged in or not. static volatile U16 nextSeqNo = 1; ///< Next sequence number. +/// List of message IDs that are requested not to be transmitted. +static BLOCKED_MSGS_DATA_T blockedMessagesForXmit = { 0, 0, 0, 0, 0, 0, 0, 0 }; // ********** private function prototypes ********** -static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); @@ -83,7 +94,7 @@ * @param ackReq is an acknowledgement from receiver required? * @return size (in bytes) of serialized message populated in given data array. *************************************************************************/ -static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) +U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) { BOOL result = FALSE; BOOL error = FALSE; @@ -215,6 +226,49 @@ /*********************************************************************//** * @brief + * The sendEvent function constructs an DG event message to the UI and + * queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG event msg constructed and queued. + * @param event Enumeration of event type that occurred + * @param dat1 First data associated with event + * @param dat2 Second data associated with event + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendEvent( DG_EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 e = (U32)event; + // Convert the two data types enums to U32. The enums are interpreted as a U08 by the compiler + U32 dataType1 = (U32)dat1.dataType; + U32 dataType2 = (U32)dat2.dataType; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_EVENT; + // The payload length is the event ID, 2 event datas and the events data types for each of the event data + msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( EVENT_DATAS_T ) + 2 * sizeof( U32 ); + + memcpy( payloadPtr, &e, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dataType1, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dat1.data, sizeof( EVENT_DATAS_T ) ); + payloadPtr += sizeof( EVENT_DATAS_T ); + memcpy( payloadPtr, &dataType2, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dat2.data, sizeof( EVENT_DATAS_T ) ); + + // 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_DG_2_UI, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The broadcastAlarmTriggered function constructs an alarm triggered msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -304,431 +358,7 @@ return result; } -/*********************************************************************//** - * @brief - * The broadcastAccelData function constructs an accelerometer data msg to - * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: accelerometer data broadcast msg constructed and queued. - * @param x X axis vector magnitude (in g) - * @param y Y axis vector magnitude (in g) - * @param z Z axis vector magnitude (in g) - * @param xm max X axis vector magnitude (in g) - * @param ym max Y axis vector magnitude (in g) - * @param zm max Z axis vector magnitude (in g) - * @param xt X axis tilt (in degrees) - * @param yt Y axis tilt (in degrees) - * @param zt Z axis tilt (in degrees) - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastAccelData( F32 x, F32 y, F32 z, F32 xm, F32 ym, F32 zm, F32 xt, F32 yt, F32 zt ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - ACCEL_DATA_PAYLOAD_T payload; - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_ACCELEROMETER_DATA; - msg.hdr.payloadLen = sizeof( ACCEL_DATA_PAYLOAD_T ); - payload.x = x; - payload.y = y; - payload.z = z; - payload.xMax = xm; - payload.yMax = ym; - payload.zMax = zm; - payload.xTilt = xt; - payload.yTilt = yt; - payload.zTilt = zt; - - memcpy( payloadPtr, &payload, sizeof( ACCEL_DATA_PAYLOAD_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastRTCEpoch function constructs an epoch msg to be broadcast - * and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: RTC time and date in epoch - * @param epoch Current time and date in epoch - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastRTCEpoch( U32 epoch ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_RTC_EPOCH; - msg.hdr.payloadLen = sizeof( U32 ); - - memcpy( payloadPtr, &epoch, sizeof( U32 ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastLoadCellData function sends out load cell data. - * @details Inputs: none - * @details Outputs: load cell data msg constructed and queued - * @param loadCell which is the loadcells data structure pointer - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastLoadCellData( LOAD_CELL_DATA_T *loadCell ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_LOAD_CELL_READINGS; - msg.hdr.payloadLen = sizeof( LOAD_CELL_DATA_T ); - - memcpy( payloadPtr, loadCell, sizeof( LOAD_CELL_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastValvesStates function sends out DG valves states. - * @details Inputs: none - * @details Outputs: Valves states msg constructed and queued - * @param valvesStates valves states - * refer to setFPGAValveStates function in FPGA.c for details - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastValvesStates( U16 valvesStates ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_VALVES_STATES; - msg.hdr.payloadLen = sizeof( U16 ); - - memcpy( payloadPtr, &valvesStates, sizeof( U16 ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastHeatersData function sends out DG heaters data - * @details Inputs: none - * @details Outputs: heaters data msg constructed and queued - * @param heatersData which is the heaters data structure pointer - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastHeatersData ( HEATERS_DATA_T *heatersData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_HEATERS_DATA; - msg.hdr.payloadLen = sizeof( HEATERS_DATA_T ); - - memcpy( payloadPtr, heatersData, sizeof( HEATERS_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastDrainPumpData function sends out the drain pump data. - * @details Inputs: none - * @details Outputs: Drain pump data msg constructed and queued - * @param drainPumpData which is the drain pump data structure pointer - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastDrainPumpData( DRAIN_PUMP_DATA_T *drainPumpData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DRAIN_PUMP_DATA; - msg.hdr.payloadLen = sizeof( DRAIN_PUMP_DATA_T ); - - memcpy( payloadPtr, drainPumpData, sizeof( DRAIN_PUMP_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastDGHDOperationMode function constructs a DG operation mode - * broadcast message and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: DG operation mode msg constructed and queued - * @param mode current operation mode of the DG. - * @param subMode current sub-mode of the current operation mode of the DG. - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastDGOperationMode( U32 mode, U32 subMode ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_OP_MODE; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - - memcpy( payloadPtr, &mode, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &subMode, sizeof( U32 ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastROPumpData function sends out RO pump data. - * @details Inputs: none - * @details Outputs: RO pump data msg constructed and queued - * @param tgtPressure target pressure for RO pump in PSI - * @param measFlow measure RO flow rate in LPM - * @param setPWM set PWM duty cycle in % - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastROPumpData( RO_PUMP_DATA_T *pumpData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_RO_PUMP_DATA; - msg.hdr.payloadLen = sizeof( RO_PUMP_DATA_T ); - - memcpy( payloadPtr, pumpData, sizeof( RO_PUMP_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastConcentratePumpData function sends out concentrate pumps' data. - * @details Inputs: none - * @details Outputs: concentrate pump data msg constructed and queued - * @param cp1TgtSpeed target speed for concentrate pump CP1 - * @param measuredCP1Speed measured speed for concentrate pump CP1 using hall sense - * @param cp2TgtSpeed target speed for concentrate pump CP2 - * @param measuredCP2Speed measured speed for concentrate pump CP2 using hall sense - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastConcentratePumpData( void * concentratePumpDataPtr ) -{ - BOOL result; - MESSAGE_T msg; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CONCENTRATE_PUMP_DATA; - msg.hdr.payloadLen = sizeof( CONCENTRATE_PUMP_DATA_T ); - - memcpy( &msg.payload, concentratePumpDataPtr, sizeof( CONCENTRATE_PUMP_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastPressureSensorsData function sends out DG pressure data. - * @details Inputs: none - * @details Outputs: Pressure data msg constructed and queued - * @param measROIn measured RO pump inlet pressure in PSI - * @param measROOut measured RO pump outlet pressure in PSI - * @param measDrainIn measured Drain pump inlet pressure in PSI - * @param measDrainOut measured Drain pump outlet pressure in PSI - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastPressureSensorsData( F32 measROIn, F32 measROOut, F32 measDrainIn, F32 measDrainOut ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - PRESSURES_DATA_T payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_PRESSURES_DATA; - msg.hdr.payloadLen = sizeof( PRESSURES_DATA_T ); - - payload.roPumpInletPressure = measROIn; - payload.roPumpOutletPressure = measROOut; - payload.drainPumpInletPressure = measDrainIn; - payload.drainPumpOutletPressure = measDrainOut; - - memcpy( payloadPtr, &payload, sizeof( PRESSURES_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastReservoirData function broadcasts the DG reservoir data. - * @details Inputs: none - * @details Outputs: Reservoir data msg constructed and queued - * @param resID ID of currently active reservoir - * @param fillToVol Current target fill to volume for inactive reservoir - * @param drainToVol Current target drain to volume for inactive reservoir - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastReservoirData( U32 resID, U32 fillToVol, U32 drainToVol ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - RESERVOIR_DATA_T payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_RESERVOIR_DATA; - msg.hdr.payloadLen = sizeof( RESERVOIR_DATA_T ); - - payload.activeReservoir = resID; - payload.fillToVolumeMl = fillToVol; - payload.drainToVolumeMl = drainToVol; - - memcpy( payloadPtr, &payload, sizeof( RESERVOIR_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastTemperatureSensorsData function sends out DG temperature - * sensors data. - * @details Inputs: none - * @details Outputs: temperature sensors data message constructed and queued - * @param tempSensorsData which is constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastTemperatureSensorsData ( TEMPERATURE_SENSORS_DATA_T* tempSensorsData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_TEMPERATURE_DATA; - msg.hdr.payloadLen = sizeof( TEMPERATURE_SENSORS_DATA_T ); - - memcpy( payloadPtr, tempSensorsData, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastThermistorsData function sends out the thermistors data. - * @details - * @details Inputs: none - * @details Outputs: thermistors data msg constructed and queued - * @param thermistorsData which is constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastThermistorsData( THERMISTORS_DATA_T *thermistorsData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_THERMISTORS_DATA; - msg.hdr.payloadLen = sizeof( THERMISTORS_DATA_T ); - - memcpy( payloadPtr, thermistorsData, sizeof( THERMISTORS_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastFansData function sends out the fans data. - * @details Inputs: none - * @details Outputs: fans data msg constructed and queued - * @param fansData which is constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastFansData( FANS_DATA_T *fansData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_FANS_DATA; - msg.hdr.payloadLen = sizeof( FANS_DATA_T ); - - memcpy( payloadPtr, fansData, sizeof( FANS_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -793,8 +423,8 @@ result = TRUE; memcpy( &payload, message->payload, sizeof( TARGET_TEMPS_PAYLOAD_T ) ); - setPrimaryHeaterTargetTemperature( payload.targetPrimaryHeaterTemp ); - setTrimmerHeaterTargetTemperature( payload.targetTrimmerHeaterTemp ); + setHeaterTargetTemperature( DG_PRIMARY_HEATER, payload.targetPrimaryHeaterTemp ); + setHeaterTargetTemperature( DG_TRIMMER_HEATER, payload.targetTrimmerHeaterTemp ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } @@ -893,117 +523,6 @@ /*********************************************************************//** * @brief - * The broadcastConductivityData function sends out conductivity data. - * @details Inputs: none - * @details Outputs: conductivity data message constructed and queued - * @param conductivityDataPtr which is the data msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastConductivityData( void * conductivityDataPtr ) -{ - BOOL result; - MESSAGE_T msg; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CONDUCTIVITY_DATA; - msg.hdr.payloadLen = sizeof( CONDUCTIVITY_DATA_T ); - - memcpy( &msg.payload, conductivityDataPtr, sizeof( CONDUCTIVITY_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastUVReactorsData function sends out the UV reactors data. - * @details Inputs: none - * @details Outputs: UV reactors data msg constructed and queued - * @param uvReactorsData which is UV reactors msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_UV_REACTORS_DATA; - msg.hdr.payloadLen = sizeof( UV_REACTORS_DATA_T ); - - memcpy( payloadPtr, uvReactorsData, sizeof( UV_REACTORS_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastHeatDisinfectData function sends out the heat disinfect - * mode data. - * @details Inputs: none - * @details Outputs: heat disinfect data msg constructed and queued - * @param heatDisinfectData which is heat disinfect msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastHeatDisinfectData( MODE_HEAT_DISINFECT_DATA_T *heatDisinfectData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_HEAT_DISINFECT_DATA; - msg.hdr.payloadLen = sizeof( MODE_HEAT_DISINFECT_DATA_T ); - - memcpy( payloadPtr, heatDisinfectData, sizeof( MODE_HEAT_DISINFECT_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastFilterFlushData function sends out the filter flush progress data. - * @details Inputs: none - * @details Outputs: filter flush data msg constructed and queued - * @param timeout flush filter timeout (in sec) - * @param countdown flush filter timeout count down (in sec) - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_FILTER_FLUSH_PROGRESS; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - - memcpy( payloadPtr, &timeout, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &countdown, sizeof( U32 ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief * The sendDGCalibrationRecord function sends out the DG calibration * record. * @details Inputs: none @@ -1042,203 +561,9 @@ return result; } -/***********************************************************************//** - * @brief - * The broadcastFluidLeakState function constructs a DG fluid leak state msg to \n - * be broadcasted and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: fluid leak state msg constructed and queued - * @param state fluid leak state - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastFluidLeakState( FLUID_LEAK_STATES_T state ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - U32 leakState = (U32)state; - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_FLUID_LEAK_STATE; - msg.hdr.payloadLen = sizeof( U32 ); - - memcpy( payloadPtr, &leakState, sizeof( U32 ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - /*********************************************************************//** * @brief - * The broadcastVoltagesData function constructs a monitored voltages data msg to - * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: monitored voltages data msg constructed and queued. - * @param data Latest monitored voltage values. - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastVoltagesData( VOLTAGES_DATA_PAYLOAD_T data ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_VOLTAGES_DATA; - msg.hdr.payloadLen = sizeof( VOLTAGES_DATA_PAYLOAD_T ); - - memcpy( payloadPtr, &data, sizeof( VOLTAGES_DATA_PAYLOAD_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - - /*********************************************************************//** - * @brief - * The broadcastFlushData function sends out the flush mode data. - * @details Inputs: none - * @details Outputs: flush data msg constructed and queued - * @param flushData which is flush msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastFlushData( MODE_FLUSH_DATA_T *flushData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_FLUSH_DATA; - msg.hdr.payloadLen = sizeof( MODE_FLUSH_DATA_T ); - - memcpy( payloadPtr, flushData, sizeof( MODE_FLUSH_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastChemicalDisinfectData function sends out the chemical - * disinfect mode data. - * @details Inputs: none - * @details Outputs: chemical disinfect data msg constructed and queued - * @param chemDisinfectData which is flush msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastChemicalDisinfectData( MODE_CHEMICAL_DISINFECT_DATA_T *chemDisinfectData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CHEM_DISINFECT_DATA; - msg.hdr.payloadLen = sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ); - - memcpy( payloadPtr, chemDisinfectData, sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastChemicalDisinfectData2UI function sends out the chemical - * disinfect mode data to the UI. - * @details Inputs: none - * @details Outputs: chemical disinfect UI data msg constructed and queued - * @param chemDisinfectUIData which is flush msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastChemicalDisinfectData2UI( MODE_CHEMICAL_DISINFECT_UI_DATA_T *chemDisinfectUIData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CHEM_DISINFECT_TIME_DATA; - msg.hdr.payloadLen = sizeof( MODE_CHEMICAL_DISINFECT_UI_DATA_T ); - - memcpy( payloadPtr, chemDisinfectUIData, sizeof( MODE_CHEMICAL_DISINFECT_UI_DATA_T ) ); - - // 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_DG_2_UI, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastChemicalDisinfectData2UI function sends out the heat - * disinfect mode data to the UI. - * @details Inputs: none - * @details Outputs: heat disinfect UI data msg constructed and queued - * @param heatDisinfectUIData which is flush msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastHeatDisinfectData2UI( MODE_HEAT_DISINFECT_UI_DATA_T *heatDisinfectUIData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_HEAT_DISINFECT_TIME_DATA; - msg.hdr.payloadLen = sizeof( MODE_HEAT_DISINFECT_UI_DATA_T ); - - memcpy( payloadPtr, heatDisinfectUIData, sizeof( MODE_HEAT_DISINFECT_UI_DATA_T ) ); - - // 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_DG_2_UI, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The broadcastSwitchesData function sends out switches data. - * @details Inputs: none - * @details Outputs: switches data msg constructed and queued - * @param switchesData which is switches msg constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastSwitchesData( SWITCHES_DATA_T *switchesData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SWITCHES_DATA; - msg.hdr.payloadLen = sizeof( SWITCHES_DATA_T ); - - memcpy( payloadPtr, switchesData, sizeof( SWITCHES_DATA_T ) ); - - // 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_DG_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief * The sendDGSystemRecord function sends out the DG system record. * @details Inputs: none * @details Outputs: DG system record msg constructed and queued @@ -1470,7 +795,6 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - /*********************************************************************//** * @brief * The handleChangeValveSettingCmd function handles a switch reservoirs command @@ -1547,7 +871,14 @@ result = TRUE; memcpy( &drainCmd, message->payload, sizeof( DRAIN_CMD_T ) ); - startDrainCmd( drainCmd ); + if ( DG_CMD_START == drainCmd.cmd ) + { + startDrainCmd( drainCmd ); + } + else + { + stopDrainCmd(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); @@ -1566,17 +897,18 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( U32 ) ) + if ( message->hdr.payloadLen == sizeof( BOOL ) ) { BOOL startingTreatment; + DG_OP_MODE_T dgMode = getCurrentOperationMode(); - memcpy( &startingTreatment, message->payload, sizeof( U32 ) ); + memcpy( &startingTreatment, message->payload, sizeof( BOOL ) ); - if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( TRUE == startingTreatment ) ) + if ( ( DG_MODE_STAN == dgMode ) && ( TRUE == startingTreatment ) ) { result = requestDGStart(); } - else if ( ( DG_MODE_GENE == getCurrentOperationMode() ) && ( FALSE == startingTreatment ) ) + else if ( ( dgMode >= DG_MODE_GENE ) && ( dgMode <= DG_MODE_DRAI ) && ( FALSE == startingTreatment ) ) { result = requestDGStop(); } @@ -1681,11 +1013,11 @@ if ( TRUE == startingHeater ) { - result = startPrimaryHeater(); + result = startHeater( DG_PRIMARY_HEATER ); } else { - stopPrimaryHeater(); + stopHeater( DG_PRIMARY_HEATER ); result = TRUE; } } @@ -2104,15 +1436,15 @@ } -/*********************************************************************//** - * @brief - * The handleTestROMeasuredFlowOverrideRequest function handles a request to - * override the RO flow rate. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ +/*********************************************************************//** + * @brief + * The handleTestROMeasuredFlowOverrideRequest function handles a request to + * override the RO flow rate. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ void handleTestROMeasuredFlowOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; @@ -2138,6 +1470,38 @@ /*********************************************************************//** * @brief + * The handleTestDialysateMeasuredFlowOverrideRequest function handles a request to + * override the Dialysate flow rate. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDialysateMeasuredFlowOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetMeasuredDialysateFlowRateOverride( payload.state.f32 ); + } + else + { + result = testResetMeasuredDialysateFlowRateOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for RO pump data. * @details Inputs: none @@ -2170,18 +1534,50 @@ /*********************************************************************//** * @brief - * The handleTestDrainPumpRPMOverrideRequest function handles a request to - * override the drain pump speed set point (in RPM). + * The handleTestDialysateFlowDataBroadcastIntervalOverrideRequest function handles + * a request to override the broadcast interval for dialysate flow data. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleTestDrainPumpRPMOverrideRequest( MESSAGE_T *message ) +void handleTestDialysateFlowDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) { + TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetDialysateFlowDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetDialysateFlowDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSetDrainPumpRPM function handles a request to set the drain + * pump speed set point (in RPM). + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSetDrainPumpRPM( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 payLoad; @@ -2325,14 +1721,14 @@ /************************************************************************* * @brief - * The handleSetDrainPumpDeltaPressureOverrideRequest function handles a - * request to override the delta pressure for the drain pump. + * The handleSetDrainPumpTargetOutletPressure function handles a + * request to set the drain pump outlet pressure. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleSetDrainPumpDeltaPressureOverrideRequest( MESSAGE_T *message ) +void handleSetDrainPumpTargetOutletPressure( MESSAGE_T *message ) { BOOL result = 0; @@ -2405,7 +1801,7 @@ } else { - result = testResetSwitchesDataPublishIntervalOverrid(); + result = testResetSwitchesDataPublishIntervalOverride(); } } @@ -3014,38 +2410,6 @@ /*********************************************************************//** * @brief -* The handleTestROFlowRateOverride function handles a request to override -* the RO flow rate. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*******************************************************************/ -void handleTestMeasuredROFlowRateOverride( MESSAGE_T *message ) -{ - TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; - BOOL result = FALSE; - - // verify payload length - if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) - { - memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); - if ( FALSE == payload.reset ) - { - result = testSetMeasuredROFlowRateOverride( payload.state.f32 ); - } - else - { - result = testResetMeasuredROFlowRateOverride(); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** -* @brief * The handleTestThermistorsValueOverride function handles a request to * override a thermistor's value. * @details Inputs: none @@ -3076,7 +2440,15 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -//*******************************************************************/ +/*********************************************************************//** +* @brief +* The handleTestROPumpTargetFlowOverride function handles a request to +* set the RO pump target flow. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ void handleTestROPumpTargetFlowOverride( MESSAGE_T *message ) { BOOL result = FALSE; @@ -3278,7 +2650,6 @@ { BOOL status = FALSE; BOOL result = FALSE; - U08* payloadPtr = message->payload; if ( 0 == message->hdr.payloadLen ) { @@ -3603,7 +2974,91 @@ } /*********************************************************************//** + * @brief + * The handleFansRPMOverride function handles a request to override a fans RPM value. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleFansRPMOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetFanRPMOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetFanRPMOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief +* The handleStopDGRTCClock function handles a request to stop the RTC clock. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleStopDGRTCClock( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + testSetStopRTC(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDrainPumpMeasuredRPMOverrideRequest function handles a request +* to override the drain pump measured RPM. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDrainPumpMeasuredRPMOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetDrainPumpMeasuredRPMOverride( payload.state.u32 ); + } + else + { + result = testResetDrainPumpMeasuredRPMOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief * The handleStartStopDGChemicalDisinfect function handles a request to start * or stop DG chemical disinfect mode. * @details Inputs: none @@ -3637,4 +3092,88 @@ return result; } +/*********************************************************************//** + * @brief + * The handleTestBlockMessagesRequest function handles a request to + * block transmission of specific message(s). + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestBlockMessagesRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(BLOCKED_MSGS_DATA_T) == message->hdr.payloadLen ) + { + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + memcpy( &blockedMessagesForXmit.blockedMessages[0], message->payload, sizeof(BLOCKED_MSGS_DATA_T) ); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestAlarmInfoSendIntervalOverrideRequest function handles a + * request to override the HD alarm information broadcast interval. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestAlarmInfoSendIntervalOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetAlarmInfoPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetAlarmInfoPublishIntervalOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSuperClearAlarmsRequest function handles a request to clear + * all active alarms on DG. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSuperClearAlarmsRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 key; + + memcpy( &key, message->payload, sizeof(U32) ); + result = testClearAllAlarms( key ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/