Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r8b939adf8c4cf4b0dad998b89572e4a2e2fc5389 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8b939adf8c4cf4b0dad998b89572e4a2e2fc5389) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Sean Nash -* @date (last) 04-Sep-2020 +* @author (last) Dara Navaei +* @date (last) 05-Oct-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -17,7 +17,9 @@ #include // for memcpy() -#include "Accel.h" +#include "reg_system.h" + +#include "Accel.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" @@ -26,14 +28,16 @@ #include "Dialysis.h" #include "FPGA.h" #include "MessagePayloads.h" +#include "ModePreTreat.h" #include "ModeStandby.h" #include "ModeTreatment.h" #include "ModeTreatmentParams.h" #include "PresOccl.h" #include "SafetyShutdown.h" #include "SystemComm.h" #include "SystemCommMessages.h" -#include "Utilities.h" +#include "Utilities.h" +#include "Valves.h" #include "WatchdogMgmt.h" #include "RTC.h" @@ -69,9 +73,8 @@ * bit of the sequence # is set if ACK is required per parameter. A sync byte * is inserted at the beginning of the message and an 8-bit CRC is appended to * the end of the message. The message is queued for transmission in the given buffer. - * @details - * Inputs : none - * Outputs : given data array populated with serialized message data and queued for transmit. + * @details Inputs: none + * @details Outputs: given data array populated with serialized message data and queued for transmit. * @param msg message to serialize * @param buffer outgoing buffer that message should be queued in * @param ackReq is an acknowledgement from receiver required? @@ -151,9 +154,8 @@ * @brief * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. - * @details - * Inputs : none - * Outputs : ACK message queued for transmit on broadcast CAN channel. + * @details Inputs: none + * @details Outputs: ACK message queued for transmit on broadcast CAN channel. * @param message message to send an ACK for * @return TRUE if ACK message queued successfully, FALSE if not *************************************************************************/ @@ -182,9 +184,8 @@ * The sendTestAckResponseMsg function constructs a simple response * message for a handled test message and queues it for transmit on the * appropriate UART channel. - * @details - * Inputs : none - * Outputs : response message constructed and queued for transmit. + * @details Inputs: none + * @details Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to * @param buffer outgoing buffer that message should be queued in * @param ack TRUE if test message was handled successfully, FALSE if not @@ -215,9 +216,8 @@ * @brief * The sendOffButtonMsgToUI function constructs an off button msg to the UI * and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Off button msg constructed and queued. + * @details Inputs: none + * @details Outputs: Off button msg constructed and queued. * @param cmd 0=prompt user to confirm, 1=cancel prompt, 2=reject user off request * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -243,9 +243,8 @@ * The sendChangeUFSettingsResponse function constructs a UF change settings * response to the UI and queues the msg for transmit on the appropriate CAN * channel. - * @details - * Inputs : none - * Outputs : UF change settings response msg constructed and queued. + * @details Inputs: none + * @details Outputs: UF change settings response msg constructed and queued. * @param accepted T/F - are settings ok? * @param reason reason rejected (if not accepted) * @param volume_mL UF volume (in mL) @@ -294,9 +293,8 @@ * The sendChangeUFSettingsResponse function constructs a UF change settings * option response to the UI and queues the msg for transmit on the appropriate CAN * channel. - * @details - * Inputs : none - * Outputs : UF change settings option response msg constructed and queued. + * @details Inputs: none + * @details Outputs: UF change settings option response msg constructed and queued. * @param accepted T/F - are settings ok? * @param reason reason rejected (if not accepted) * @param volume_mL UF volume (in mL) @@ -336,9 +334,8 @@ * The sendChangeTreatmentDurationResponse function constructs a treatment * duration change response to the UI and queues the msg for transmit on the * appropriate CAN channel. - * @details - * Inputs : none - * Outputs : treatment duration change settings response msg constructed and queued. + * @details Inputs: none + * @details Outputs: treatment duration change settings response msg constructed and queued. * @param accepted T/F - are settings ok? * @param reason reason rejected (if not accepted) * @param time_min treatment duration (in minutes) @@ -375,9 +372,8 @@ * The sendChangeBloodDialysateRateChangeResponse function constructs a change * blood and dialysate rate settings response to the UI and queues the msg for * transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Blood & dialysate rate change response msg constructed and queued. + * @details Inputs: none + * @details Outputs: Blood & dialysate rate change response msg constructed and queued. * @param accepted T/F - are settings ok? * @param reason reason code for rejection or unused if accepted * @param bloodRate new blood flow rate @@ -413,9 +409,8 @@ * @brief * The sendTreatmentParamsRangesToUI function constructs a treatment parameter * ranges message to the UI and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Treatment parameter ranges msg constructed and queued. + * @details Inputs: none + * @details Outputs: Treatment parameter ranges msg constructed and queued. * @param minTime Minimum treatment duration (in minutes) * @param maxTime Maximum treatment duration (in minutes) * @param minUFVol Minimum ultrafiltration volume (in mL) @@ -457,9 +452,8 @@ * @brief * The sendDialysateTempTargetsToDG function constructs a dialysate temperature * set points message for DG and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Dialysate temperature set points msg constructed and queued. + * @details Inputs: none + * @details Outputs: Dialysate temperature set points msg constructed and queued. * @param primary temperature set point for primary heater * @param trimmer temperature set point for trimmer heater * @return TRUE if msg successfully queued for transmit, FALSE if not @@ -489,9 +483,8 @@ * @brief * The sendDGSwitchReservoirCommand function constructs a DG set active * reservoir message for DG and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG set active reservoir msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG set active reservoir msg constructed and queued. * @param activeReservoir reservoir ID to set as active * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -518,9 +511,8 @@ * @brief * The sendDGFillCommand function constructs a DG fill command message * and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG fill command msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG fill command msg constructed and queued. * @param fillToVolumeMl volume (in mL) to fill inactive reservoir to * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -547,9 +539,8 @@ * @brief * The sendDGDrainCommand function constructs a DG drain command message * and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG drain command msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG drain command msg constructed and queued. * @param drainToVolumeMl volume (in mL) to drain the inactive reservoir to * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -576,9 +567,8 @@ * @brief * The sendDGStartStopCommand function constructs a DG start/stop command * message and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG start/stop command msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG start/stop command msg constructed and queued. * @param start TRUE indicates start DG, FALSE indicates stop DG * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -606,9 +596,8 @@ * The sendDGStartStopTrimmerHeaterCommand function constructs a DG start/stop * trimmer heater command message and queues the msg for transmit on the * appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG start/stop trimmer heater command msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG start/stop trimmer heater command msg constructed and queued. * @param start TRUE indicates start heater, FALSE indicates stop heater * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -635,9 +624,8 @@ * @brief * The sendDGSampleWaterCommand function constructs a DG sample water command * message and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : DG sample water command msg constructed and queued. + * @details Inputs: none + * @details Outputs: DG sample water command msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGSampleWaterCommand( void ) @@ -660,9 +648,8 @@ * @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 - * Outputs : accelerometer data broadcast msg constructed and queued. + * @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) @@ -707,9 +694,8 @@ * @brief * The broadcastAlarmStatus function constructs an alarm status msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : alarm status msg constructed and queued. + * @details Inputs: none + * @details Outputs: alarm status msg constructed and queued. * @param almStatus alarm status record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -737,7 +723,8 @@ payload.alarmsFlags |= ( almStatus.noNewTreatment ? BIT_BY_POS(6) : 0 ); payload.alarmsFlags |= ( almStatus.bypassDialyzer ? BIT_BY_POS(7) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(8) : 0 ); - payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(9) : 0 ); + payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(9) : 0 ); + payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(10) : 0 ); memcpy( payloadPtr, &payload, sizeof( ALARM_COMP_STATUS_PAYLOAD_T ) ); @@ -751,9 +738,8 @@ * @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 - * Outputs : alarm triggered msg constructed and queued. + * @details Inputs: none + * @details Outputs: alarm triggered msg constructed and queued. * @param alarm ID of alarm triggered * @param almData1 1st data associated with alarm * @param almData2 2nd data associated with alarm @@ -790,9 +776,8 @@ * @brief * The broadcastAlarmCleared function constructs an alarm cleared msg to be * broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : alarm cleared msg constructed and queued. + * @details Inputs: none + * @details Outputs: alarm cleared msg constructed and queued. * @param alarm ID of alarm cleared * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -819,9 +804,8 @@ * @brief * The broadcastBloodFlowData function constructs a blood flow data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : blood flow data msg constructed and queued. + * @details Inputs: none + * @details Outputs: blood flow data msg constructed and queued. * @param flowStPt Current set point for blood flow * @param measFlow Latest measured blood flow * @param measRotorSpd Latest measured blood pump rotoro speed @@ -863,9 +847,8 @@ * @brief * The broadcastDialInFlowData function constructs a dialysate flow data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : dialysate flow data msg constructed and queued. + * @details Inputs: none + * @details Outputs: dialysate flow data msg constructed and queued. * @param flowStPt Current set point for dialysate flow * @param measFlow Latest measured dialysate flow * @param measRotorSpd Latest measured dialysate pump rotor speed @@ -907,9 +890,8 @@ * @brief * The broadcastDialInFlowData function constructs a dialysate outlet flow data * msg to be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : dialysate out flow data msg constructed and queued. + * @details Inputs: none + * @details Outputs: dialysate out flow data msg constructed and queued. * @param dialOutFlowData Pointer to the dialysate out flow data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -936,9 +918,8 @@ * @brief * The broadcastPresOcclData function constructs a pres/occl data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : pressure/occlusion data msg constructed and queued. + * @details Inputs: none + * @details Outputs: pressure/occlusion data msg constructed and queued. * @param artPres Latest measured arterial pressure * @param venPres Latest measured venous pressure * @param bpOccl Latest measured blood pump occlusion pressure @@ -976,9 +957,8 @@ * @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 - * Outputs : RTC time and date in epoch + * @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 *************************************************************************/ @@ -1005,9 +985,8 @@ * @brief * The broadcastTreatmentTime function constructs a treatment time msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : treatment time data msg constructed and queued + * @details Inputs: none + * @details Outputs: treatment time data msg constructed and queued * @param secsTotTreatment Total treatment time prescribed (in seconds) * @param secsElapsed Treatment time elapsed (in seconds) * @param secsRemaining Treatment time remaining (in seconds) @@ -1041,9 +1020,8 @@ * @brief * The broadcastTreatmentState function constructs a treatment state msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : treatment state msg constructed and queued + * @details Inputs: none + * @details Outputs: treatment state msg constructed and queued * @param subMode Current state (sub-mode) of treatment * @param uFState Current state of ultrafiltration * @param salineBolusState 1=saline bolus in progress, 0=not, 2=max bolus volume reached @@ -1077,9 +1055,8 @@ * @brief * The broadcastPowerOffWarning function constructs a power off warning msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : power off warning msg constructed and queued + * @details Inputs: none + * @details Outputs: power off warning msg constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastPowerOffWarning( void ) @@ -1102,9 +1079,8 @@ * @brief * The broadcastHDOperationMode function constructs an HD operation mode * broadcast message and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : HD operation mode msg constructed and queued + * @details Inputs: none + * @details Outputs: HD operation mode msg constructed and queued * @param mode current HD operation mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -1127,8 +1103,66 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; -} - +} + +/***********************************************************************//** + * @brief + * The broadcastHDValves function constructs an HD valves msg to \n + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: HD valves msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastHDValves( HD_VALVE_DATA_T *valveData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_VALVES_DATA; + msg.hdr.payloadLen = sizeof( HD_VALVE_DATA_T ); + + memcpy( payloadPtr, valveData, sizeof( HD_VALVE_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_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/***********************************************************************//** + * @brief + * The broadcastAirTrapData function constructs an HD air trap data msg to \n + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: air trap data msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastAirTrapData( AIR_TRAP_LEVELS_T lowerLevel, AIR_TRAP_LEVELS_T upperLevel ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 lower = (U32)lowerLevel; + U32 upper = (U32)upperLevel; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_AIR_TRAP_DATA; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &lower, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &upper, 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_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + #ifdef EMC_TEST_BUILD BOOL broadcastCANErrorCount( U32 count ) { @@ -1157,9 +1191,8 @@ /*********************************************************************//** * @brief * The handleDGCheckIn function handles a check-in from the DG. - * @details - * Inputs : none - * Outputs : check in the DG with the SystemComm module. + * @details Inputs: none + * @details Outputs: check in the DG with the SystemComm module. * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1171,9 +1204,8 @@ /*********************************************************************//** * @brief * The handleUICheckIn function handles a check-in from the UI. - * @details - * Inputs : none - * Outputs : check in the UI with the SystemComm module. + * @details Inputs: none + * @details Outputs: check in the UI with the SystemComm module. * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1185,9 +1217,8 @@ /*********************************************************************//** * @brief * The handleAlarmTriggered function handles a triggered alarm event message. - * @details - * Inputs : none - * Outputs : alarm triggered. + * @details Inputs: none + * @details Outputs: alarm triggered. * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1219,9 +1250,8 @@ /*********************************************************************//** * @brief * The handleAlarmCleared function handles a cleared alarm event message. - * @details - * Inputs : none - * Outputs : alarm cleared. + * @details Inputs: none + * @details Outputs: alarm cleared. * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1245,9 +1275,8 @@ * @brief * The handleOffButtonConfirmMsgFromUI function handles a response to an * off button message to the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1266,9 +1295,8 @@ * @brief * The handleLoadCellReadingsFromDG function handles a load cell readings * broadcast message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1291,9 +1319,8 @@ * @brief * The handleDGTemperatureData function handles a temperature readings * broadcast message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1314,9 +1341,8 @@ * @brief * The handleROPumpData function handles an RO pump data broadcast * message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1336,9 +1362,8 @@ * @brief * The handleDrainPumpData function handles a drain pump broadcast * message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1358,9 +1383,8 @@ * @brief * The handleDGPressuresData function handles a DG pressure sensor readings * broadcast message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1380,9 +1404,8 @@ * @brief * The handleDGReservoirData function handles a reservoir data broadcast * message from the DG. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1402,9 +1425,8 @@ * @brief * The handleUFPauseResumeRequest function handles a ultrafiltration pause * or resume request message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1434,9 +1456,8 @@ * @brief * The handleUIStartTreatmentMsg function handles a treatment start/cancel * message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1460,7 +1481,7 @@ } else if ( 2 == cmd ) // start treatment { - // TODO - handle when pre-treatment mode is ready for this + result = signalUserBeginningTreatment(); } } @@ -1472,9 +1493,8 @@ * The sendTreatmentStartResponseMsg function constructs a treatment start * request response message to the UI and queues the msg for transmit on * the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Treatment start response msg constructed and queued. + * @details Inputs: none + * @details Outputs: Treatment start response msg constructed and queued. * @param accepted T/F - request accepted? * @param reason reason code if rejected * @return TRUE if msg successfully queued for transmit, FALSE if not @@ -1504,9 +1524,8 @@ * @brief * The handleUIUserEndTreatmentRequest function handles a treatment end * request message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1527,9 +1546,8 @@ * The sendTreatmentEndResponseMsg function constructs a treatment end * request response message to the UI and queues the msg for transmit on * the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Treatment end response msg constructed and queued. + * @details Inputs: none + * @details Outputs: Treatment end response msg constructed and queued. * @param accepted T/F - request accepted? * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -1556,9 +1574,8 @@ * @brief * The handleTreatmentParametersFromUI function handles a treatment parameters * set and validate request message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1582,9 +1599,8 @@ * @brief * The handleUIUserConfirmTreatmentParameters function handles a user confirmation * of treatment parameters message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1604,9 +1620,8 @@ * @brief * The sendTreatmentParametersResponseMsg function constructs a treatment parameters * response to the UI and queues the msg for transmit on the appropriate CAN channel. - * @details - * Inputs : none - * Outputs : Treatment parameters response msg constructed and queued. + * @details Inputs: none + * @details Outputs: Treatment parameters response msg constructed and queued. * @param accepted T/F - are settings ok? * @param rejectReasons reasons each parameter was rejected (if not accepted) * @param byteLength number of bytes that array of reject reasons takes @@ -1637,9 +1652,8 @@ * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration * change settings request message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1663,9 +1677,8 @@ * @brief * The handleChangeUFSettingsConfirmation function handles a ultrafiltration * change setting confirmation message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1689,9 +1702,8 @@ * @brief * The handleChangeTreatmentDurationRequest function handles a treatment * duration setting change message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1715,9 +1727,8 @@ * @brief * The handleChangeBloodDialysateRateChangeRequest function handles a blood * and dialysate rate settings change message from the UI. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1744,9 +1755,8 @@ /*********************************************************************//** * @brief * The handleDGOpMode function handles a DG broadcast of it's current mode. - * @details - * Inputs : none - * Outputs : message handled, response constructed and queued for transmit. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ @@ -1773,9 +1783,8 @@ /*********************************************************************//** * @brief * The handleFWVersionRequest function handles a request for HD f/w version. - * @details - * Inputs : none - * Outputs : message handled, response constructed and queued for transmit. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ @@ -1815,8 +1824,8 @@ * @brief * The sendDebugData function sends debug data out to the PC port. * @details - * Inputs : none - * Outputs : PC serial port + * @details Inputs: none + * @details Outputs: PC serial port * @param dbgData Pointer to debug data * @param len number of bytes of debug data * @return TRUE if debug data was successfully queued for transmit, FALSE if not @@ -1835,8 +1844,8 @@ * @brief * The sendDebugDataToUI function sends debug string to the UI for logging. * @details - * Inputs : none - * Outputs : Message constructed and queued for transmit + * @details Inputs: none + * @details Outputs: Message constructed and queued for transmit * @param str Pointer to debug string * @return none *************************************************************************/ @@ -1864,9 +1873,8 @@ * @brief * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. - * @details - * Inputs : testerLoggedIn - * Outputs : none + * @details Inputs: testerLoggedIn + * @details Outputs: none * @return TRUE if a tester has logged in to activate testing, FALSE if not *************************************************************************/ BOOL isTestingActivated( void ) @@ -1879,9 +1887,8 @@ * The sendTestAckResponseMsg function constructs a simple response * message for a handled test message and queues it for transmit on the * appropriate UART channel. - * @details - * Inputs : none - * Outputs : response message constructed and queued for transmit. + * @details Inputs: none + * @details Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to * @param ack TRUE if test message was handled successfully, FALSE if not * @return TRUE if response message successfully queued for transmit, FALSE if not @@ -1907,9 +1914,8 @@ * @brief * The handleTesterLogInRequest function handles a request to login as a * tester. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1934,9 +1940,8 @@ * @brief * The handleTestOffButtonStateOverrideRequest function handles a request to * override the state of the off button. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1968,9 +1973,8 @@ * @brief * The handleTestStopButtonStateOverrideRequest function handles a request to * override the stop button state. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2001,9 +2005,8 @@ * @brief * The handleTestAlarmLampPatternOverrideRequest function handles a request to * override the alarm lamp pattern. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2034,9 +2037,8 @@ * @brief * The handleTestWatchdogCheckInStateOverrideRequest function handles a * request to override the check-in status of a given task. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2067,9 +2069,8 @@ * @brief * The handleTestAlarmStateOverrideRequest function handles a request to * override the active status of a given alarm. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2100,9 +2101,8 @@ * @brief * The handleTestAlarmTimeOverrideRequest function handles a request to * override the time since activation of a given alarm. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2133,9 +2133,8 @@ * @brief * The handleTestAlarmStatusBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for alarm status. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2166,9 +2165,8 @@ * @brief * The handleTestBloodFlowSetPointOverrideRequest function handles a request to * override the set point for the blood flow rate (mL/min). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2199,9 +2197,8 @@ * @brief * The handleTestBloodFlowMeasuredOverrideRequest function handles a request to * override the measured blood flow rate (mL/min). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2232,9 +2229,8 @@ * @brief * The handleTestBloodPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump rotor speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2265,9 +2261,8 @@ * @brief * The handleTestBloodPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2298,9 +2293,8 @@ * @brief * The handleTestBloodPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump motor controller speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2331,9 +2325,8 @@ * @brief * The handleTestBloodPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured blood pump motor controller current (mA). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2364,9 +2357,8 @@ * @brief * The handleTestBloodFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for blood flow data. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2397,9 +2389,8 @@ * @brief * The handleTestDialInFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate inlet flow rate (mL/min). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2430,9 +2421,8 @@ * @brief * The handleTestDialOutFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate outlet flow rate (mL/min). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2463,9 +2453,8 @@ * @brief * The handleTestDialInFlowMeasuredOverrideRequest function handles a request to * override the measured dialysate inlet flow rate (mL/min). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2496,9 +2485,8 @@ * @brief * The handleTestDialInPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump rotor speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2529,9 +2517,8 @@ * @brief * The handleTestDialInPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2562,9 +2549,8 @@ * @brief * The handleTestDialInPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller speed (RPM). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2595,9 +2581,8 @@ * @brief * The handleTestDialInPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller current (mA). - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2628,9 +2613,8 @@ * @brief * The handleTestDialInFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for dialysate inlet flow data. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2661,9 +2645,8 @@ * @brief * The handleTestArterialPressureOverrideRequest function handles a request to * override the arterial pressure. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2694,9 +2677,8 @@ * @brief * The handleTestVenousPressureOverrideRequest function handles a request to * override the venous pressure. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2727,9 +2709,8 @@ * @brief * The handleTestBloodPumpOcclusionOverrideRequest function handles a request to * override the blood pump occlusion sensor. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2760,9 +2741,8 @@ * @brief * The handleTestDialysateInletPumpOcclusionOverrideRequest function handles a request to * override the dialysate inlet pump occlusion sensor. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2793,9 +2773,8 @@ * @brief * The handleTestDialysateOutletPumpOcclusionOverrideRequest function handles a request to * override the dialysate outlet pump occlusion sensor. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2826,9 +2805,8 @@ * @brief * The handleTestPresOcclBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for pressure/occlusion data. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2859,9 +2837,8 @@ * @brief * The handleSetRTCTimestamp function handles a request to write time and * date to RTC - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2890,9 +2867,8 @@ * @brief * The handleTestDialOutFlowBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for dialysate outlet pump data. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2924,9 +2900,8 @@ * The handleTestDialOutUFReferenceVolumeOverrideRequest function handles a * request to override the ultrafiltration reference volume for the dialysate * outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2958,9 +2933,8 @@ * The handleTestDialOutUFMeasuredVolumeOverrideRequest function handles a * request to override the ultrafiltration measured volume for the dialysate * outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -2992,9 +2966,8 @@ * The handleTestDialOutPumpMCMeasuredSpeedOverrideRequest function handles a * request to override the measured motor controller speed for the dialysate * outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3026,9 +2999,8 @@ * The handleTestDialOutPumpMCMeasuredCurrentOverrideRequest function handles a * request to override the measured motor controller current for the dialysate * outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3059,9 +3031,8 @@ * @brief * The handleTestDialOutPumpMeasuredSpeedOverrideRequest function handles a * request to override the measured speed for the dialysate outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3092,9 +3063,8 @@ * @brief * The handleTestDialOutPumpMeasuredRotorSpeedOverrideRequest function handles a * request to override the measured rotor speed for the dialysate outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3125,9 +3095,8 @@ * @brief * The handleTestDialOutLoadCellWeightOverrideRequest function handles a * request to override the measured load cell weight for the dialysate outlet pump. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3158,9 +3127,8 @@ * @brief * The handleTestHDSafetyShutdownOverrideRequest function handles a * request to override the safety shutdown signal. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3191,9 +3159,8 @@ * @brief * The handleTestHDAccelOverrideRequest function handles a request to * override the measured accelerometer sensor readings. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3224,9 +3191,8 @@ * @brief * The handleTestHDAccelMaxOverrideRequest function handles a request to * override the measured accelerometer sensor maximum readings. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3257,9 +3223,8 @@ * @brief * The handleTestHDAccelBroadcastIntervalOverrideRequest function handles a * request to override the broadcast interval for accelerometer data messages. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -3290,16 +3255,16 @@ * @brief * The handleSetAccelCalibration function handles a request to set * accelerometer calibration factors. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetAccelCalibration( MESSAGE_T *message ) { BOOL result = FALSE; + // verify payload length if ( message->hdr.payloadLen == sizeof(ACCEL_CAL_PAYLOAD_T) ) { ACCEL_CAL_PAYLOAD_T payload; @@ -3316,16 +3281,16 @@ * @brief * The handleSetBloodFlowCalibration function handles a request to set * blood flow calibration factors. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetBloodFlowCalibration( MESSAGE_T *message ) { BOOL result = FALSE; + // verify payload length if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) { LINEAR_F32_CAL_PAYLOAD_T payload; @@ -3342,16 +3307,16 @@ * @brief * The handleSetDialysateFlowCalibration function handles a request to set * dialysate flow calibration factors. - * @details - * Inputs : none - * Outputs : message handled + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetDialysateFlowCalibration( MESSAGE_T *message ) { BOOL result = FALSE; + // verify payload length if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) { LINEAR_F32_CAL_PAYLOAD_T payload; @@ -3366,18 +3331,18 @@ /*********************************************************************//** * @brief - * The handleSetDialysateFlowCalibration function handles a request to set - * dialysate flow calibration factors. - * @details - * Inputs : none - * Outputs : message handled + * The handleTestSetTreatmentParameter function handles a request to set + * a treatment parameter. + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestSetTreatmentParameter( MESSAGE_T *message ) { BOOL result = FALSE; + // verify payload length if ( message->hdr.payloadLen == sizeof(CRITICAL_DATAS_T) + sizeof(CRITICAL_DATAS_T) ) { CRITICAL_DATAS_T payload[2]; @@ -3390,4 +3355,248 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleHomeHDValve function handles a request to home an HD valve + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleHomeHDValve( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 valve; + + memcpy( &valve, message->payload, sizeof(U32) ); + homeValve( (VALVE_T)valve ); + + result = TRUE; + } + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDValvesBroadcastIntervalOverrideRequest function handles + * a request to override the broadcast interval for HD valves data. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDValvesBroadcastIntervalOverrideRequest( 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 = testSetValvesDataPublishInterval( (U32)(payload.state.u32) ); + } + else + { + result = testResetValvesDataPublishInterval(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleSetAirTrapValve function handles a request to set the HD air + * (blood) trap valve to open or close + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetAirTrapValve( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 valveState; + + memcpy( &valveState, message->payload, sizeof(U32) ); + setValveAirTrap( (OPN_CLS_STATE_T)valveState ); + + result = TRUE; + } + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleSetHDValvePositionOverrideRequest function handles a request to + * override the position of a valve + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetHDValvePositionOverrideRequest( 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 = testSetValvesPositionOverride( payload.index, (BOOL)(payload.state.u32) ); + } + else + { + result = testResetValvesPositionOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +#ifdef DEBUG_ENABLED +/*********************************************************************//** + * @brief + * The handleSetHDValvePWMOverrideRequest function handles a request to + * override the PWM of a valve + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetHDValvePWMOverrideRequest( MESSAGE_T *message ) +{ + OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetValvePWMOverride( payload.valve, payload.pwm, payload.direction ); + } + else + { + result = testResetValvePWMOverride( payload.valve ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} +#endif + +/*********************************************************************//** + * @brief + * The handleSetAirTrapBroadcastIntervalOverrideRequest function handles a + * request to override the air trap data broadcast interval. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetAirTrapBroadcastIntervalOverrideRequest( 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 = testSetAirTrapDataPublishIntervalOverride( (U32)(payload.state.u32) ); + } + else + { + result = testResetAirTrapDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleSetAirTrapLevelSensorOverrideRequest function handles a request to + * override an air trap level sensor. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetAirTrapLevelSensorOverrideRequest( 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 = testSetAirTrapLevelOverride( (AIR_TRAP_LEVEL_SENSORS_T)payload.index, (AIR_TRAP_LEVELS_T)(payload.state.u32) ); + } + else + { + result = testResetAirTrapLevelOverride( (AIR_TRAP_LEVEL_SENSORS_T)payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleHDSoftwareResetRequest function handles a request to reset + * the HD firmware processor. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleHDSoftwareResetRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // tester must be logged in + if ( TRUE == isTestingActivated() ) + { // s/w reset of processor + result = TRUE; // reset will prevent this from getting transmitted though +#ifndef _VECTORCAST_ + systemREG1->SYSECR = (0x2) << 14; // reset processor +#endif + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/