/************************************************************************** * * Copyright (c) 2019-2025 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 * * @author (last) Dara Navaei * @date (last) 16-Jun-2025 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #include // For memcpy() #include "reg_system.h" // Used to access system register to reset processor on request #include "Accel.h" #include "AlarmLamp.h" #include "Battery.h" #include "Buttons.h" #include "Compatible.h" #include "ConsumableSelfTest.h" #include "Fans.h" #include "FPGA.h" #include "Integrity.h" #include "ModeStandby.h" #include "ModeInitPOST.h" #include "OperationModes.h" #include "Reservoirs.h" #include "RTC.h" #include "SafetyShutdown.h" #include "SalineBolus.h" #include "SampleWater.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "Temperatures.h" #include "Timers.h" #include "TreatmentEnd.h" #include "TreatmentRecirc.h" #include "TreatmentStop.h" #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" #include "HDDefs.h" #include "TaskPriority.h" /** * @addtogroup SystemCommMessages * @{ */ // ********** private definitions ********** #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 messages. } BLOCKED_MSGS_DATA_T; #pragma pack(pop) typedef struct { U32 minBloodFlowMLPM; ///< Min blood flow in mL/min. U32 maxBloodFlowMLPM; ///< Max blood flow in mL/min. U32 minDialysateFlowMLPM; ///< Min dialysate flow in mL/min. U32 maxDialysateFlowMLPM; ///< Max dialysate flow in mL/min. U32 minTxDurationMIN; ///< Min treatment duration in minutes. U32 maxTxDurationMIN; ///< Max treatment duration in minutes. U32 minStopHeparinDispBeforeTxEndMIN; ///< Min stop heparin dispense before treatment end in minutes. U32 maxStopHeparinDispBeforeTxEndMIN; ///< Max stop heparin dispense before treatment end in minutes. U32 minSalineBolusVolumeML; ///< Min saline bolus volume in milliliters. U32 maxSalineBolusVolumeML; ///< Max saline bolus volume in milliliters. F32 minDialysateTempC; ///< Min dialysate temperature in C. F32 maxDialysateTempC; ///< Max dialysate temperature in C. S32 minArtPressLimitWindowMMHG; ///< Min arterial pressure limit window in mmHg. S32 maxArtPressLimitWindowMMHG; ///< Max arterial pressure limit window in mmHg. S32 minVenPressLimitWindowMMHG; ///< Min venous pressure limit window in mmHg. S32 maxVenPressLimitWindowMMHG; ///< Max venous pressure limit window in mmHg. S32 minVenAsymPressLimitMMHG; ///< Min venous asymmetric pressure limit in mmHg. S32 maxVenAsymPressLimitMMHG; ///< Max venous asymmetric pressure limit in mmHg. F32 minUFVolumeL; ///< Min ultrafiltration volume in mL. F32 maxUFVolumeL; ///< Max ultrafiltration volume in mL. F32 minHeparinDispRateMLPHR; ///< Min heparin dispense rate in mL/hr. F32 maxHeparinDispRateMLPHR; ///< Max heparin dispense rate in mL/hr. F32 minHeparinBolusVolumeML; ///< Min heparin bolus volume in mL. F32 maxHeparinBolusVolumeML; ///< Max heparin bolus volume in mL. U32 enableChemicalDisinfect; ///< Enable/disable chemical disinfect. U32 minRORejectionRatioPCT; ///< Min RO rejection ratio in percent. F32 minInletWaterCondAlarmLimitUSPCM; ///< Min inlet water conductivity alarm limit in uS/cm. } HD_INSTITUTIONAL_LOCAL_RECORD_T; typedef struct { U08 topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; } LOCAL_TOP_SN_T; // ********** private data ********** #ifndef CARTRIDGE_TEST_BUILD static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether an external tester (connected PC) has sent a valid login message. #else static BOOL testerLoggedIn = TRUE; ///< Flag indicates whether an external tester (connected PC) has sent a valid login message. #endif static volatile U16 nextSeqNo = 1; ///< Value of sequence number to use for next transmitted message. /// 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 BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ); static void sendInstitutionalRecordToUI( HD_INSTITUTIONAL_LOCAL_RECORD_T* instit ); /*********************************************************************//** * @brief * The serializeMessage function serializes a given message into a given * array of bytes. A sequence # is added to the message here and the ACK * 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: blockedMessagesForXmit * @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? * @return size (in bytes) of serialized message populated in given data array. *************************************************************************/ U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) { BOOL result = 0; BOOL blocked = FALSE; U32 msgSize = 0; U32 sizeMod, sizePad; U32 i; U08 crc; U08 data[ MAX_ACK_MSG_SIZE ]; // Byte array to populate with message data // Check to see if tester has requested this message not be transmited if ( TRUE == isTestingActivated() ) { U32 i; for ( i = 0; i < MAX_MSGS_BLOCKED_FOR_XMIT; i++ ) { if ( msg.hdr.msgID == blockedMessagesForXmit.blockedMessages[ i ] ) { blocked = TRUE; break; } } } // Serialize and queue message for transmission unless this message is blocked if ( blocked != TRUE ) { // Prefix data with message sync byte data[ msgSize++ ] = MESSAGE_SYNC_BYTE; // Set sequence # and ACK bit (unless this is an ACK to a received message) if ( msg.hdr.msgID != MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK ) { // Thread protect next sequence # access & increment _disable_IRQ(); msg.hdr.seqNo = nextSeqNo; nextSeqNo = INC_WRAP( nextSeqNo, MIN_MSG_SEQ_NO, MAX_MSG_SEQ_NO ); _enable_IRQ(); if ( TRUE == ackReq ) { msg.hdr.seqNo *= -1; } } // Calculate message CRC crc = crc8( (U08*)(&msg), sizeof( MESSAGE_HEADER_T ) + msg.hdr.payloadLen ); // Serialize message header data memcpy( &data[ msgSize ], &( msg.hdr ), sizeof( MESSAGE_HEADER_T ) ); msgSize += sizeof( MESSAGE_HEADER_T ); // Serialize message payload (only used bytes per payloadLen field) memcpy( &data[ msgSize ], &( msg.payload ), msg.hdr.payloadLen ); msgSize += msg.hdr.payloadLen; // Add 8-bit CRC data[ msgSize++ ] = crc; // Pad with zero bytes to get length a multiple of CAN_MESSAGE_PAYLOAD_SIZE (8) sizeMod = msgSize % CAN_MESSAGE_PAYLOAD_SIZE; sizePad = ( sizeMod == 0 ? 0 : CAN_MESSAGE_PAYLOAD_SIZE - sizeMod ); for ( i = 0; i < sizePad; i++ ) { data[ msgSize++ ] = 0; } #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACK_ERRORS ) != SW_CONFIG_ENABLE_VALUE ) #endif { // If ACK required, add to pending ACK list if ( TRUE == ackReq ) { if ( FALSE == addMsgToPendingACKList( &msg, buffer, data, msgSize ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MSG_PENDING_ACK_LIST_FULL, (U32)(msg.hdr.msgID) ) } } } // Add serialized message data to appropriate out-going comm buffer result = addToCommBuffer( buffer, data, msgSize ); } else { result = TRUE; // If message blocked, return successful transmission } return result; } /*********************************************************************//** * @brief * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. * @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 *************************************************************************/ BOOL sendACKMsg( MESSAGE_T *message ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); // Send ACK back with same seq. #, but w/o ACK bit msg.hdr.seqNo = message->hdr.seqNo * -1; // ACK messages always have this ID msg.hdr.msgID = MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK; // ACK messages always have no payload msg.hdr.payloadLen = 0; // Serialize and queue the message for transmit on broadcast channel result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendAckResponseMsg function constructs a simple response * message for a handled message and queues it for transmit on the * appropriate CAN channel. * @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 * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ) { BOOL result; MESSAGE_T msg; ACK_RESPONSE_PAYLOAD_T cmd; cmd.acknowledgement = ack; // Create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = sizeof( ACK_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &cmd, sizeof( ACK_RESPONSE_PAYLOAD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, buffer, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendUIResponseMsg function constructs an UI response message for a * handled UI message and queues it for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to * @param accepted T/F - request accepted? * @param reason reason code if rejected * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ) { BOOL result; MESSAGE_T msg; UI_RESPONSE_PAYLOAD_T cmd; cmd.accepted = accepted; cmd.rejectionReason = reason; // Create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = sizeof( UI_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &cmd, sizeof( UI_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** /*********************************************************************//** * @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 * @details Outputs: Off button msg constructed and queued. * @param prompt 0=prompt user to confirm, 1=cancel prompt, 2=reject user off request * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendOffButtonMsgToUI( U08 prompt ) { BOOL result; MESSAGE_T msg; UI_OFF_BUTTON_RESPONSE_PAYLOAD_T cmd; cmd.userRequest = prompt; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_OFF_BUTTON_PRESS_REQUEST; msg.hdr.payloadLen = sizeof( UI_OFF_BUTTON_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &cmd, sizeof( UI_OFF_BUTTON_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendUIVersionRequest function constructs a UI version request msg * to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: UI version request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendUIVersionRequest( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_UI_VERSION_INFO_REQUEST; msg.hdr.payloadLen = 0; // 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGPOSTResultRequest function constructs a POST result request msg * to the DG and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG POST result request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGPOSTResultRequest( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DG_POST_RESULT_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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( HD_EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ) { BOOL result; MESSAGE_T msg; EVENT_PAYLOAD_T eventStruct; eventStruct.event = (U32)event; eventStruct.dataType1 = (U32)dat1.dataType; eventStruct.data1 = dat1.data; eventStruct.dataType2 = (U32)dat2.dataType; eventStruct.data2 = dat2.data; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_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( EVENT_PAYLOAD_T ); memcpy( &msg.payload, &eventStruct, sizeof( EVENT_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_HD_2_UI, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * 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 * @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) * @param time_min treatment duration (in minutes) * @param ufRate_mL_min UF rate (in mL/min) * @param timeDiff change in treatment duration (in minutes) * @param rateDiff change in UF rate (in mL/min) * @param oldUFRate_mL_min the UF rate prior to this change (in mL/min) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendChangeUFSettingsResponse( BOOL accepted, U32 reason, F32 volume_mL, U32 time_min, F32 ufRate_mL_min, S32 timeDiff, F32 rateDiff, F32 oldUFRate_mL_min ) { BOOL result; MESSAGE_T msg; UF_SETTINGS_CHANGE_RESPONSE_PAYLOAD_T ufResponse; ufResponse.accepted = accepted; ufResponse.rejectionReason = reason; ufResponse.ufVolume = volume_mL; ufResponse.durationInMinutes = time_min; ufResponse.timeDiff = timeDiff; ufResponse.ufRate = ufRate_mL_min; ufResponse.rateDiff = rateDiff; ufResponse.oldUFRate = oldUFRate_mL_min; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_SETTINGS_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( UF_SETTINGS_CHANGE_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &ufResponse, sizeof( UF_SETTINGS_CHANGE_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * 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 * @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) * @param time_min treatment duration (in minutes) * @param ufRate_mL_min UF rate (in mL/min) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendChangeUFSettingsOptionResponse( BOOL accepted, U32 reason, F32 volume_mL, U32 time_min, F32 ufRate_mL_min ) { BOOL result; MESSAGE_T msg; UF_SETTINGS_CONFIRMATION_RESPONSE_PAYLOAD_T ufConfirm; // Populate Messsage ufConfirm.accepted = accepted; ufConfirm.rejectionReason = reason; ufConfirm.volume = volume_mL; ufConfirm.duration = time_min; ufConfirm.ufRate = ufRate_mL_min; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_SETTINGS_CHANGE_CONFIRMATION_RESPONSE; msg.hdr.payloadLen = sizeof( UF_SETTINGS_CONFIRMATION_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &ufConfirm, sizeof( UF_SETTINGS_CONFIRMATION_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * 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 * @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) * @param volume_mL UF volume (in mL) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendChangeTreatmentDurationResponse( BOOL accepted, U32 reason, U32 time_min, F32 volume_mL ) { BOOL result; MESSAGE_T msg; TREATMENT_TIME_CHANGE_RESPONSE_PAYLOAD_T treatmentResponse; treatmentResponse.accepted = accepted; treatmentResponse.rejectionReason = reason; treatmentResponse.duration = time_min; treatmentResponse.volume = volume_mL; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_TREATMENT_TIME_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( TREATMENT_TIME_CHANGE_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &treatmentResponse, sizeof( TREATMENT_TIME_CHANGE_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * 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 * @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 * @param dialRate new dialysate flow rate * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendChangeBloodDialysateRateChangeResponse( BOOL accepted, U32 reason, U32 bloodRate, U32 dialRate ) { BOOL result; MESSAGE_T msg; BLOOD_DIAL_RATE_CHANGE_RESPONSE_PAYLOAD_T rateResponse; rateResponse.accepted = accepted; rateResponse.rejectionReason = reason; rateResponse.bloodRate = bloodRate; rateResponse.dialRate = dialRate; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_BLOOD_DIAL_RATE_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( BLOOD_DIAL_RATE_CHANGE_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &rateResponse, sizeof( BLOOD_DIAL_RATE_CHANGE_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendPressureLimitsChangeResponse function constructs a change * pressure limits response to the UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Pressure limits change response msg constructed and queued. * @param data response data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendPressureLimitsChangeResponse( PRESSURE_LIMIT_CHANGE_RESPONSE_T *data ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_PRESSURE_LIMITS_CHANGE_RESPONSE; msg.hdr.payloadLen = sizeof( PRESSURE_LIMIT_CHANGE_RESPONSE_T ); memcpy( payloadPtr, (U08*)data, sizeof( PRESSURE_LIMIT_CHANGE_RESPONSE_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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendHeparinCommandResponse function constructs a Heparin command response * to the UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Heparin command response msg constructed and queued. * @param accepted flag indicating whether request was accepted * @param rejReason rejection reason code * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHeparinCommandResponse( U32 accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; UI_RESPONSE_PAYLOAD_T heparinResponse; heparinResponse.accepted = accepted; heparinResponse.rejectionReason = rejReason; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_HEPARIN_PAUSE_RESUME_RESPONSE; msg.hdr.payloadLen = sizeof( UI_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &heparinResponse, sizeof( UI_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendAlarmAudioVolumeSetResponse function constructs an alarm audio * volume set request response to the UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Alarm audio volume set. * @param accepted flag indicating whether request was accepted * @param rejReason rejection reason code * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendAlarmAudioVolumeSetResponse( U32 accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; UI_RESPONSE_PAYLOAD_T audioVolumeResponse; audioVolumeResponse.accepted = accepted; audioVolumeResponse.rejectionReason = rejReason; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE; msg.hdr.payloadLen = sizeof( UI_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &audioVolumeResponse, sizeof( UI_RESPONSE_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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 * @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) * @param maxUFVol Maximum ultrafiltration volume (in mL) * @param minDialRate Minimum dialysate flow rate (in mL/min) * @param maxDialRate Maximum dialysate flow rate (in mL/min) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentParamsRangesToUI( U32 minTime, U32 maxTime, F32 minUFVol, F32 maxUFVol, U32 minDialRate, U32 maxDialRate ) { BOOL result; MESSAGE_T msg; TREATMENT_PARAM_BROADCAST_PAYLOAD_T paramRanges; paramRanges.minTreatmentTime = minTime; paramRanges.maxTreatmentTime = maxTime; paramRanges.minUFVolume = minUFVol; paramRanges.maxUFVolume = maxUFVol; paramRanges.minDialRate = minDialRate; paramRanges.maxDialRate = maxDialRate; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_TREATMENT_PARAM_CHANGE_RANGES_DATA; msg.hdr.payloadLen = sizeof( TREATMENT_PARAM_BROADCAST_PAYLOAD_T ); memcpy( &msg.payload, ¶mRanges, sizeof( TREATMENT_PARAM_BROADCAST_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_HD_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendTreatmentPeriodicDataToUI function constructs a treatment periodic * data message to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment parameter ranges msg constructed and queued. * @param periodDataPtr treatment log period data record pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentPeriodicDataToUI( TREATMENT_LOG_DATA_PERIODIC_T * periodDataPtr ) { MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_PERIODIC_DATA; msg.hdr.payloadLen = sizeof( TREATMENT_LOG_DATA_PERIODIC_T ); memcpy( &msg.payload, periodDataPtr, sizeof( TREATMENT_LOG_DATA_PERIODIC_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//**  * @brief  * The handlePatientDisconnectionConfirmCmd function handles user confirms  * patient disconnection.  * @details Inputs: none  * @details Outputs: message handled  * @param message a pointer to the message to handle  * @return none. *************************************************************************/ void handlePatientDisconnectionConfirmCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserConfirmPatientDisconnection(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//**  * @brief  * The handleDisposableRemovalConfirmCmd function handles user confirms  * disposable removal.  * @details Inputs: none  * @details Outputs: message handled  * @param message a pointer to the message to handle  * @return none. *************************************************************************/ void handleDisposableRemovalConfirmCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserConfirmDisposableRemoval(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendDisposableRemovalConfirmResponse function constructs a disposable * removal confirm user action response to the UI and queues the msg for * transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Disposable removal confirm response msg constructed and queued. * @param accepted T/F - was disposable removal confirm request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDisposableRemovalConfirmResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE, accepted, reason ); } /*********************************************************************//**  * @brief  * The handleUITreatmentLogDataRequest function handles UI treatment log data request.  * @details Inputs: none  * @details Outputs: message handled  * @param message a pointer to the message to handle  * @return none. *************************************************************************/ void handleUITreatmentLogDataRequest( MESSAGE_T *message ) { BOOL ack = FALSE; if ( 0 == message->hdr.payloadLen ) { ack = TRUE; sendTreatmentLogDataToUI(); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ack ); } /*********************************************************************//** * @brief * The sendTreatmentLogData function constructs a treatment log data message * for UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment log data msg constructed and queued. * @param accepted T/F - was treatment log request accepted? * @param reason reason why request was rejected (or zero if accepted) * @param logDataPtr treatment log data record pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentLogData( BOOL accepted, U32 reason, TREATMENT_LOG_DATA_PAYLOAD_T *logDataPtr ) { MESSAGE_T msg; UI_RESPONSE_PAYLOAD_T UIReponse; U08 *payloadPtr = msg.payload; UIReponse.accepted = accepted; UIReponse.rejectionReason = reason; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE; msg.hdr.payloadLen = sizeof( UI_RESPONSE_PAYLOAD_T ) + sizeof( TREATMENT_LOG_DATA_PAYLOAD_T ); memcpy( payloadPtr, &UIReponse, sizeof( UI_RESPONSE_PAYLOAD_T ) ); payloadPtr += sizeof( UI_RESPONSE_PAYLOAD_T ); memcpy( payloadPtr, logDataPtr, sizeof( TREATMENT_LOG_DATA_PAYLOAD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleUIDisinfectRequest function handles a disinfect/flush user * action command message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIDisinfectRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(U32) ) { U32 cmd; memcpy( &cmd, message->payload, sizeof(U32) ); if ( DG_DISINFECT_FLUSH_STATE == cmd ) // Command 0 = Flush { result = signalUserInitiateFlushMode(); } else if ( DG_DISINFECT_HEAT_STATE_ACTIVE_COOL == cmd ) // Command 1 = Heat disinfect active cool { result = signalUserInitiateHeatDisinfectActiveCoolMode(); } else if ( DG_DISINFECT_CHEM_STATE == cmd ) // Command 2 = chemical disinfect { result = signalUserInitiateChemicalDisinfectMode(); } else if ( DG_DISINFECT_CHEM_FLUSH_STATE == cmd ) // Command 3 = chemical disinfect flush { result = signalUserInitiateChemicalDisinfectFlushMode(); } else if ( DG_DISINFECT_RO_PERMEATE_SAMPLE_STATE == cmd ) // Command 4 = RO permeate sample { result = signalUserInitiateROPermeateSampleMode(); } else if ( DG_DISINFECT_HEAT_STATE_PASSIVE_COOL == cmd ) // Command 5 = Heat disinfect passive coode { result = signalUserInitiateHeatDisinfectPassiveCoolMode(); } else if ( DG_DISINFECT_ACTIVE_COOL == cmd ) // Command 6 = Active cool { result = signalUserInitiateActiveCoolMode(); } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The sendDisinfectConfirmResponse function constructs a disinfect or flush * confirm user action response to the UI and queues the msg for * transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Disposable removal confirm response msg constructed * and queued. * @param accepted T/F - was disinfect or flush confirm request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDisinfectConfirmResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_DISINFECT_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleSetHDStandbyDisinfectSubmodeRequest function handles setting the * standby submode to wait for disisnfect state. * @details Inputs: 1=initiate, 0=cancel * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDStandbyDisinfectSubmodeRequest( MESSAGE_T *message ) { U32 cmd; if ( sizeof( U32 ) == message->hdr.payloadLen ) { memcpy( &cmd, &message->payload[0], sizeof( U32 ) ); signalInitiateStandbyDisinfectSubmode( cmd ); } else { handleSetHDStandbyDisinfectSubmodeResponse( FALSE, REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT ); } } /*********************************************************************//** * @brief * The handleSetHDStandbyDisinfectSubmodeResponse function constructs a * standby submode change to wait for disinfect confirm user action response * to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Disposable removal confirm response msg constructed * and queued. * @param accepted T/F - was set standby submode confirm request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL handleSetHDStandbyDisinfectSubmodeResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleFlushUIStateReadingFromDG function handles the readings of DG * flush mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleFlushUIStateReadingFromDG( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof(MODE_FLUSH_DATA_T) ) { MODE_FLUSH_DATA_T payload; DG_DISINFECT_UI_STATES_T uiStates; memcpy( &payload, message->payload, sizeof(MODE_FLUSH_DATA_T) ); uiStates.heatDisinfectUIState = 0; uiStates.chemDisinfectUIState = 0; uiStates.flushUIState = payload.flushUIState; setDGDisinfectsStates( uiStates ); } } /*********************************************************************//** * @brief * The handleHeatDisinfectUIStateReadingFromDG function handles the readings * of DG heat disinfect mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleHeatDisinfectUIStateReadingFromDG( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof(MODE_HEAT_DISINFECT_DATA_T) ) { MODE_HEAT_DISINFECT_DATA_T payload; DG_DISINFECT_UI_STATES_T uiStates; memcpy( &payload, message->payload, sizeof(MODE_HEAT_DISINFECT_DATA_T) ); uiStates.heatDisinfectUIState = payload.heatDisinfectUIState; uiStates.chemDisinfectUIState = 0; uiStates.flushUIState = 0; setDGDisinfectsStates( uiStates ); } } /*********************************************************************//**  * @brief  * The handleUIActiveAlarmsListRequest function handles UI active alarms list request.  * @details Inputs: none  * @details Outputs: message handled  * @param message a pointer to the message to handle  * @return none. *************************************************************************/ void handleUIActiveAlarmsListRequest( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { handleActiveAlarmListRequest(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleChemDisinfectUIStateReadingFromDG function handles the readings * of DG chemical disinfect mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChemDisinfectUIStateReadingFromDG( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ) ) { MODE_CHEMICAL_DISINFECT_DATA_T payload; DG_DISINFECT_UI_STATES_T uiStates; memcpy( &payload, message->payload, sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ) ); uiStates.heatDisinfectUIState = 0; uiStates.flushUIState = 0; setDGDisinfectsStates( uiStates ); } } /*********************************************************************//** * @brief * The sendActiveAlarmsList function constructs a treatment log data message * for UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment log data msg constructed and queued. * @details Outputs: Treatment log data msg constructed and queued. * @param accepted T/F - was treatment log request accepted? * @param alarmList pointer to active alarms list record * @param size the size of active alarms list * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendActiveAlarmsList( ACTIVE_ALARM_LIST_RESPONSE_PAYLOAD_T alarmListPayload ) { MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_ACTIVE_ALARMS_LIST_REQUEST_RESPONSE; msg.hdr.payloadLen = sizeof( ACTIVE_ALARM_LIST_RESPONSE_PAYLOAD_T ); memcpy( &msg.payload, &alarmListPayload, sizeof( ACTIVE_ALARM_LIST_RESPONSE_PAYLOAD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The sendTreatmentLogAlarmEventData function constructs a treatment log * alarm event data message for UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment log alarm event data msg constructed and queued. * @param alarmID ID of the occurred alarm * @param almData1 data associates with the alarm * @param almData1 data associates with the alarm * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentLogAlarmEventData( ALARM_ID_T alarmID, F32 alarmData1, F32 alarmData2 ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; U32 id = (U32)alarmID; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_ALARM_EVENT; msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( F32 ); memcpy( payloadPtr, &id, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &alarmData1, sizeof( F32 ) ); payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &alarmData2, sizeof( F32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The sendTreatmentLogEventData function constructs a treatment log parameter * change event data message for UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment log event data msg constructed and queued. * @param event ID of parameter change event * @param oldValue parameter change event old data value * @param newValue parameter change event new data value * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentLogEventData( TX_EVENT_ID_T event, F32 oldValue, F32 newValue ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; U32 eventID = (U32)event; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_EVENT; msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( F32 ); memcpy( payloadPtr, &eventID, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &oldValue, sizeof( F32 ) ); payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &newValue, sizeof( F32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleSampleWaterCmd function handles a sample water user action command * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleSampleWaterCmd( MESSAGE_T *message ) { if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 cmd; memcpy( &cmd, &message->payload[0], sizeof( U32 ) ); signalSampleWaterUserAction( (REQUESTED_SAMPLE_WATER_USER_ACTIONS_T)cmd ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendSampleWaterCmdResponse function constructs a sample water user action * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Sample water command response msg constructed and queued. * @param accepted T/F - was sample water request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendSampleWaterCmdResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_SAMPLE_WATER_CMD_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleSampleWaterCmd function handles a sample water result msg from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleSampleWaterResult( MESSAGE_T *message ) { if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 result; memcpy( &result, &message->payload[0], sizeof( U32 ) ); setSampleWaterResult( (BOOL) result ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleConsumableInstallConfirm function handles a consumable install * confirm msg from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleConsumableInstallConfirm( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserConfirmConsumableInstall(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendConsumableInstallCmdResponse function constructs a Consumable Install Confirm user action * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Consumable Install Confirm command response msg constructed and queued. * @param accepted T/F - was Consumable Install Confirm request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendConsumableInstallCmdResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_UI_INSTALLATION_CONFIRM_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleInstallationConfirm function handles user confirms disposable * installation msg from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleInstallationConfirm( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen) { signalUserConfirmInstallation(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handlePrimingStartCmd function handles user confirms disposable * installation msg from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleStartPrimeCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalStartPrime(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendStartPrimeCmdResponse function constructs a start prime user action * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Start prime command response msg constructed and queued. * @param accepted T/F - was start prime request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendStartPrimeCmdResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_START_PRIME_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleContinueToTreatmentCmd function handles user request to continue * to treatment. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleContinueToTreatmentCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserContinueToTreatment(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendContinueToTreatmentCmdResponse function constructs a continue to treatment * user action response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Continue to treatment request response msg constructed and queued. * @param accepted T/F - was continue to treatment request accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendContinueToTreatmentCmdResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_PATIENT_CONNECTION_BEGIN_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handlePatientConnectionConfirmCmd function handles user confirms * patient connection. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handlePatientConnectionConfirmCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserConfirmPatientConnection(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendPatientConnectionConfirmCmdResponse function constructs a patient connection confirm * user action response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Patient connection confirm response msg constructed and queued. * @param accepted T/F - was patient connection confirm accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendPatientConnectionConfirmCmdResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_PATIENT_CONNECTION_CONFIRM_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleStartTreatmentRequest function handles user requests to start treatment. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none. *************************************************************************/ void handleStartTreatmentRequest( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { signalUserStartTreatment(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendStartTreatmentResponse function constructs a start treatment user action * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Patient connection confirm response msg constructed and queued. * @param accepted T/F - was patient connection confirm accepted? * @param reason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendStartTreatmentResponse( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_START_TREATMENT_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The sendDialysateTempTargetsAndReservoirCycleTimeToDG function constructs a * dialysate temperature set points message and the active reservoir cycle time * for DG and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Dialysate temperature set points msg constructed and queued. * @param trimmer temperature set point for trimmer heater * @param rsrvrCycleTime active reservoir cycle time in milliseconds * @param rsrvrWait2Switch time to switch the inactive and active reservoirs in milliseconds * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDialysateHeatingParamsToDG( DG_CMD_DIALYSATE_HEATING_PARAMS_T *params ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS; msg.hdr.payloadLen = sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_T ); memcpy( payloadPtr, params, sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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 * @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 *************************************************************************/ BOOL sendDGSwitchReservoirCommand( DG_SWITCH_RSRVRS_CMD_T *cmd ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_SWITCH_RESERVOIR_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_SWITCH_RSRVRS_CMD_T ); memcpy( payloadPtr, cmd, sizeof( DG_SWITCH_RSRVRS_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGChangeValveSettingCommand function constructs a DG change valve * setting message for DG and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG change valve setting msg constructed and queued. * @param valveSettingCmd valve setting ID to change to * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGChangeValveSettingCommand( U32 valveSettingCmd ) { BOOL result; MESSAGE_T msg; DG_VALVE_SETTING_CMD_REQUEST_T valveCmd; valveCmd.valveSettingCmd = valveSettingCmd; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_CHANGE_VALVE_SETTING_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_VALVE_SETTING_CMD_REQUEST_T ); memcpy( &msg.payload, &valveCmd, sizeof( DG_VALVE_SETTING_CMD_REQUEST_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGFillCommand function constructs a DG fill command message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG fill command msg constructed and queued. * @param cmd start or stop fill command * @param fillToVolumeMl volume (in mL) to fill inactive reservoir to * @param targetFlowLRatePM target fill flow rate in L/min * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGFillCommand( U32 cmd, U32 fillToVolumeMl, F32 targetFlowRateLPM ) { BOOL result; MESSAGE_T msg; DG_FILL_CMD_T fillPayload; fillPayload.fillToVolMl = fillToVolumeMl; fillPayload.cmd = cmd; fillPayload.targetFlowRateLPM = targetFlowRateLPM; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_FILL_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_FILL_CMD_T ); memcpy( &msg.payload, &fillPayload, sizeof( DG_FILL_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGDrainCommand function constructs a DG drain command message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG drain command msg constructed and queued. * @param drainCmdPtr drain command data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGDrainCommand( DRAIN_RESERVOIR_CMD_PAYLOAD_T *drainCmdPtr ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_DRAIN_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DRAIN_RESERVOIR_CMD_PAYLOAD_T ); memcpy( payloadPtr, drainCmdPtr, sizeof( DRAIN_RESERVOIR_CMD_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_HD_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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 * @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 *************************************************************************/ BOOL sendDGStartStopCommand( BOOL start ) { BOOL result; MESSAGE_T msg; DG_START_STOP_TX_CMD_REQUEST_T cmd; cmd.acidType = 0; cmd.bicarbType = 0; cmd.start = start; if ( TRUE == start ) { cmd.acidType = getTreatmentParameterU32( TREATMENT_PARAM_ACID_CONCENTRATE ); cmd.bicarbType = getTreatmentParameterU32( TREATMENT_PARAM_BICARB_CONCENTRATE ); } // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_STARTING_STOPPING_TREATMENT_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_START_STOP_TX_CMD_REQUEST_T ); memcpy( &msg.payload, &cmd, sizeof( DG_START_STOP_TX_CMD_REQUEST_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * 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 * @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 *************************************************************************/ BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start ) { BOOL result; MESSAGE_T msg; DG_START_STOP_TRIMMER_HEATER_CMD_T cmd; cmd.start = start; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_START_STOP_TRIMMER_HEATER_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_START_STOP_TRIMMER_HEATER_CMD_T ); memcpy( &msg.payload, &cmd, sizeof( DG_START_STOP_TRIMMER_HEATER_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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 * @details Outputs: DG sample water command msg constructed and queued. * @param cmd sample water sub-command * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGSampleWaterCommand( SAMPLE_WATER_CMD_T cmd ) { BOOL result; MESSAGE_T msg; DG_SAMPLE_WATER_CMD_REQUEST_T sampleCmd; sampleCmd.cmd = (U32)cmd; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_SAMPLE_WATER_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_SAMPLE_WATER_CMD_REQUEST_T ); memcpy( &msg.payload, &sampleCmd, sizeof( DG_SAMPLE_WATER_CMD_REQUEST_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleDGCmdResp function handles a DG command response message. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. * @param message pointer to the message to handle. * @return none *************************************************************************/ void handleDGCmdResp( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof( DG_CMD_RESPONSE_T ) ) { DG_CMD_RESPONSE_T dgCmdResponse; result = TRUE; memcpy( &dgCmdResponse, message->payload, sizeof( DG_CMD_RESPONSE_T ) ); handleDGCommandResponse( &dgCmdResponse ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, result ); } /*********************************************************************//** * @brief * The handleUIClockSyncRequest function handles a UI clock sync message. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. * @param messagePtr pointer to the message to handle. * @return none *************************************************************************/ void handleUIClockSyncRequest( MESSAGE_T *message ) { MESSAGE_T msg; BOOL result = FALSE; U32 rejReason = REQUEST_REJECT_REASON_NONE; U08 *payloadPtr = msg.payload; U32 *messagePayload = (U32*)message->payload; if ( message->hdr.payloadLen == sizeof( U32 ) ) { U32 epoch; memcpy( &epoch, messagePayload, sizeof( U32 ) ); result = setRTCEpoch( epoch ); if ( FALSE == result ) { rejReason = REQUEST_REJECT_REASON_INVALID_DATE_OR_TIME; } } else { rejReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; } // Create a response message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_UI_SET_RTC_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &result, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, 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_2_UI, ACK_REQUIRED ); sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The handleDGOpMode function handles a DG broadcast of its current mode. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. * @param message pointer to the message to handle. * @return none *************************************************************************/ void handleDGOpMode( MESSAGE_T *message ) { U32 payloadSize = sizeof(U32) + sizeof(U32); if ( message->hdr.payloadLen == payloadSize ) { U32 mode, subMode; memcpy( &mode, message->payload, sizeof(U32) ); memcpy( &subMode, &message->payload[sizeof(U32)], sizeof(U32) ); setDGOpMode( mode, subMode ); checkInFromDG(); // TODO - here until we implement DG check-in w/ HD broadcast } } /*********************************************************************//** * @brief * The sendDGParkConcentratePumpsCommand function constructs a DG concetentrate * pumps park request msg to the DG and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG park concentrate pumps command msg constructed and queued.. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGParkConcentratePumpsCommand( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_PARK_CONCENTRATE_PUMPS_CMD_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGStartFlushModeCommand function constructs a DG start/stop * flush mode command message and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: DG start flush mode command msg constructed and queued. * @param start TRUE indicates start flush mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGStartFlushModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; DG_FLUSH_MODE_CMD_T cmd; cmd.start = start; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_FLUSH_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_FLUSH_MODE_CMD_T ); memcpy( &msg.payload, &cmd, sizeof( DG_FLUSH_MODE_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGStartHeatDisinfectActiveCoolModeCommand function constructs a * DG start/stop heat disinfect with active coolmode command message and * queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG start heat disinfect mode command msg constructed * and queued. * @param start TRUE indicates start heat disinfect mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGStartHeatDisinfectActiveCoolModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; DG_HEAT_DISINFECTION_MODE_CMD_T cmd; // Start command cmd.start = start; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_CMD_REQUEST; msg.hdr.payloadLen = sizeof( DG_HEAT_DISINFECTION_MODE_CMD_T ); memcpy( &msg.payload, &cmd, sizeof( DG_HEAT_DISINFECTION_MODE_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGStartChemicalDisinfectModeCommand function constructs a DG * start/stop chemical disinfect mode command message and queues the msg * for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG start chemical disinfect mode command msg * constructed and queued. * @param start TRUE indicates start chemical disinfect mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_CHEM_DISINFECT; msg.hdr.payloadLen = sizeof( DG_CHEM_DISINFECTION_MODE_CMD_T ); memcpy( &msg.payload, &start, sizeof( DG_CHEM_DISINFECTION_MODE_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGStartStopChemicalDisinfectFlushModeCommand function constructs a DG * start/stop chemical disinfect flush mode command message and queues the msg * for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG start chemical disinfect flush mode command msg * constructed and queued. * @param start TRUE indicates start chemical disinfect flush mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGStartStopChemicalDisinfectFlushModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_CHEM_DISINFECT_FLUSH; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( msg.payload, &start, sizeof( BOOL ) ); // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @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 * @details Outputs: alarm status msg constructed and queued. * @param almStatus alarm status record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastAlarmStatus( COMP_ALARM_STATUS_T almStatus ) { BOOL result; ALARM_COMP_STATUS_PAYLOAD_T payload; payload.alarmState = (U32)almStatus.alarmsState; payload.alarmTop = (U32)almStatus.alarmTop; payload.silenceExpiresIn = almStatus.alarmsSilenceExpiresIn; payload.escalatesIn = almStatus.alarmsEscalatesIn; payload.alarmsFlags = ( almStatus.systemFault ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_SYSTEM_FAULT) : 0 ); payload.alarmsFlags |= ( almStatus.stop ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_STOP) : 0 ); payload.alarmsFlags |= ( almStatus.noClear ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_CLEAR) : 0 ); payload.alarmsFlags |= ( almStatus.noResume ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RESUME) : 0 ); payload.alarmsFlags |= ( almStatus.noRinseback ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RINSEBACK) : 0 ); payload.alarmsFlags |= ( almStatus.noEndTreatment ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_END_TREATMENT) : 0 ); payload.alarmsFlags |= ( almStatus.ok ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_OK_BUTTON_ONLY) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_TO_ESCALATE) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_SILENCED) : 0 ); payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_LAMP_ON) : 0 ); payload.alarmsFlags |= ( almStatus.noReTrigger ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RETRIGGER) : 0 ); payload.alarmsFlags |= ( almStatus.noBloodRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_BLOOD_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noDialRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_DIALYSATE_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noMinimize ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_MINIMIZE) : 0 ); payload.alarmsFlags |= ( almStatus.topAlarmConditionDetected ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_TOP_CONDITION) : 0 ); result = broadcastData( MSG_ID_ALARM_STATUS_DATA, COMM_BUFFER_OUT_CAN_HD_ALARM, (U08*)&payload, sizeof( ALARM_COMP_STATUS_PAYLOAD_T ) ); return result; } /*********************************************************************//** * @brief * The sendHDCalibrationRecord function sends out the HD calibration * record. * @details Inputs: none * @details Outputs: HD calibration record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param calRcrdAddress: start address of the calibration record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_CALIBRATION_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, calRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendHDSystemRecord function sends out the HD system record. * @details Inputs: none * @details Outputs: HD system record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param sysRcrdAddress: start address of the system record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_SYSTEM_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, sysRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendHDServiceRecord function sends out the HD service record. * @details Inputs: none * @details Outputs: HD service record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param srvcRcrdAddress: start address of the service record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_SERVICE_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, srvcRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGConcentrateMixingRatiosRequest function constructs a request msg * to the DG to request the concentrate ratios and queues the msg for transmit * on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG POST result request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGConcentrateMixingRatiosRequest( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DG_CONCENTRATE_MIXING_RATIOS_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleDGMixingRatios function handles a concentrate mixing ratios and * prepare fill time broadcast from DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGMixingRatios( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( DG_MIXING_RATIOS_T ) ) { DG_MIXING_RATIOS_T payload; memcpy( &payload, message->payload, sizeof( DG_MIXING_RATIOS_T ) ); setDGMixingRatios( payload ); } } // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** /*********************************************************************//** * @brief * The handleDGCheckIn function handles a check-in from the DG. * @details Inputs: none * @details Outputs: check in the DG with the SystemComm module. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGCheckIn( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( U32 ) ) { checkInFromDG(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, FALSE ); } } /*********************************************************************//** * @brief * The handleUICheckIn function handles a check-in from the UI. * @details Inputs: none * @details Outputs: check in the UI with the SystemComm module. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUICheckIn( MESSAGE_T *message ) { checkInFromUI(); } /*********************************************************************//** * @brief * The handleAlarmTriggered function handles a triggered alarm event message. * @details Inputs: none * @details Outputs: alarm triggered. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAlarmTriggered( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ) { ALARM_TRIGGERED_PAYLOAD_T payload; U08 *payloadPtr = message->payload; memcpy( &payload, payloadPtr, sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ); if ( (ALARM_ID_T)(payload.alarm) < NUM_OF_ALARM_IDS ) { ALARM_DATA_T alm1, alm2; alm1.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType1); alm1.data.uInt.data = payload.almData1; alm2.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType2); alm2.data.uInt.data = payload.almData2; activateAlarm2Data( (ALARM_ID_T)(payload.alarm), alm1, alm2, TRUE ); } } } /*********************************************************************//** * @brief * The handleAlarmCleared function handles a cleared alarm condition event message. * @details Inputs: none * @details Outputs: alarm condition is cleared. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAlarmCleared( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( U32 ) ) { U08 *payloadPtr = message->payload; U32 alarmID; memcpy( &alarmID, payloadPtr, sizeof( U32 ) ); if ( (ALARM_ID_T)alarmID < NUM_OF_ALARM_IDS ) { clearAlarmCondition( (ALARM_ID_T)alarmID ); } } } /*********************************************************************//** * @brief * The handleUIAlarmSilenceRequest function handles an alarm silence request * message. * @details Inputs: none * @details Outputs: alarm silence command is handled. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIAlarmSilenceRequest( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( U32 ) ) { U08 *payloadPtr = message->payload; U32 cmd; memcpy( &cmd, payloadPtr, sizeof( U32 ) ); signalAlarmSilence( (ALARM_SILENCE_CMD_T)cmd ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); } } /*********************************************************************//** * @brief * The handleAlarmUserAction function handles a user alarm action event message. * @details Inputs: none * @details Outputs: selected action initiated. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAlarmUserAction( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( U32 ) ) { U08 *payloadPtr = message->payload; U32 action; memcpy( &action, payloadPtr, sizeof( U32 ) ); if ( (ALARM_USER_ACTION_T)action < NUMBER_OF_ALARM_USER_ACTIONS ) { signalAlarmUserActionInitiated( (ALARM_USER_ACTION_T)action ); } } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); } } /*********************************************************************//** * @brief * The sendPOSTTestResult function constructs an HD POST test result message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: HD POST test result msg constructed and queued. * @param test ID of HD POST test * @param passed TRUE if POST test passed, FALSE if not * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendPOSTTestResult( HD_POST_STATE_T test, BOOL passed ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; U32 testID = (U32)test; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_POST_SINGLE_TEST_RESULT; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &passed, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &testID, 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_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendPOSTFinalResult function constructs an HD POST final result message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: HD POST final result msg constructed and queued. * @param passed TRUE if HD POST passed, FALSE if not * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendPOSTFinalResult( BOOL passed ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_POST_FINAL_TEST_RESULT; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &passed, sizeof( BOOL ) ); // 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_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleDGPOSTFinalResult function handles a DG POST final result message. * @details Inputs: none * @details Outputs: DG POST final result delivered to InitPOST mode. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGPOSTFinalResult( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( BOOL ) ) { U08 *payloadPtr = message->payload; BOOL passed; memcpy( &passed, payloadPtr, sizeof( BOOL ) ); signalDGPOSTFinalResult( passed ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); } } /*********************************************************************//** * @brief * The sendUIRequestPOSTFinalResult function constructs a reqeust for UI POST * final result message and queues the msg for transmit on the appropriate * CAN channel. * @details Inputs: none * @details Outputs: request for UI POST final result msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendUIRequestPOSTFinalResult( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_FINAL_POST_RESULT; msg.hdr.payloadLen = 0; // 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleUIPOSTFinalResult function handles a UI POST final result message. * @details Inputs: none * @details Outputs: UI POST final result delivered to InitPOST mode. * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIPOSTFinalResult( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( BOOL ) ) { U08 *payloadPtr = message->payload; BOOL passed; memcpy( &passed, payloadPtr, sizeof( BOOL ) ); signalUIPOSTFinalResult( passed ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); } } /*********************************************************************//** * @brief * The handleOffButtonConfirmMsgFromUI function handles a response to an * off button message to the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) { OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; if ( message->hdr.payloadLen == sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ) { memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); userConfirmOffButton( payload.confirmed ); } } /*********************************************************************//** * @brief * The handleLoadCellReadingsFromDG function handles a load cell readings * broadcast message from the DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleLoadCellReadingsFromDG( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( LOAD_CELL_DATA_T ) ) { LOAD_CELL_DATA_T payload; memcpy( &payload, message->payload, sizeof( LOAD_CELL_DATA_T ) ); setNewLoadCellReadings( payload.loadCellA1inGram, payload.loadCellA2inGram, payload.loadCellB1inGram, payload.loadCellB2inGram ); } } /*********************************************************************//** * @brief * The handleDGHeatersData function handles the heaters data reading from DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGHeatersData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( HEATERS_DATA_T ) ) { HEATERS_DATA_T payload; memcpy( &payload, message->payload, sizeof( HEATERS_DATA_T ) ); setDGHeatersData( &payload ); } } /*********************************************************************//** * @brief * The handleDGTemperatureData function handles a temperature readings * broadcast message from the DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGTemperatureData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( TEMPERATURE_SENSORS_DATA_T ) ) { TEMPERATURE_SENSORS_DATA_T payload; memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant, payload.heatDisinfect ); } } /*********************************************************************//** * @brief * The handleDialysateFlowData function handles dialysate flow data broadcast * message from the DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDialysateFlowData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( FLOW_SENSORS_DATA_T ) ) { FLOW_SENSORS_DATA_T payload; memcpy( &payload, message->payload, sizeof( FLOW_SENSORS_DATA_T ) ); setDialysateFlowData( payload ); } } /*********************************************************************//** * @brief * The handleDGReservoirData function handles a reservoir data broadcast * message from the DG. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGReservoirData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( DG_RESERVOIRS_DATA_PAYLOAD_T ) ) { DG_RESERVOIRS_DATA_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof( DG_RESERVOIRS_DATA_PAYLOAD_T ) ); setDGReservoirsData( (DG_RESERVOIR_ID_T)payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); } } /*********************************************************************//** * @brief * The handleUFPauseResumeRequest function handles a ultrafiltration pause * or resume request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUFPauseResumeRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(U32) ) { U32 cmd; memcpy( &cmd, message->payload, sizeof(U32) ); if ( UF_CMD_PAUSE == cmd ) { result = pauseUF(); } else if ( UF_CMD_RESUME == cmd ) { result = resumeUF(); } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The sendUFPauseResumeResponse function constructs a UF pause/resume * response to the UI and queues the msg for transmit on the appropriate CAN * channel. * @details Inputs: none * @details Outputs: UF pause/resume response msg constructed and queued. * @param accepted was pause/resume request accepted * @param reason reason rejected (if not accepted) * @param ufState new UF state * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendUFPauseResumeResponse( BOOL accepted, U32 reason, U32 ufState ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &reason, sizeof( U32) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &ufState, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleInitiateTreatmentRequest function handles a treatment initiate/cancel * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleInitiateTreatmentRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(U32) ) { U32 cmd; memcpy( &cmd, message->payload, sizeof(U32) ); if ( 0 == cmd ) // Cancel treatment (return from aborted treatment params mode) { result = signalUserCancelTreatment(); } else if ( 1 == cmd ) // Initiate treatment (go to treatment params mode) { result = signalUserInitiateTreatment(); } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * 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 * @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 *************************************************************************/ BOOL sendInitiateTreatmentResponseMsg( BOOL accepted, U32 reason ) { return sendUIResponseMsg( MSG_ID_HD_INITIATE_TREATMENT_RESPONSE, accepted, reason ); } /*********************************************************************//** * @brief * The handleTreatmentParametersFromUI function handles a treatment parameters * set and validate request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTreatmentParametersFromUI( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(TREATMENT_PARAMS_DATA_PAYLOAD_T) ) { TREATMENT_PARAMS_DATA_PAYLOAD_T treatmentParams; memcpy( &treatmentParams, message->payload, sizeof(TREATMENT_PARAMS_DATA_PAYLOAD_T) ); result = validateAndSetTreatmentParameters( treatmentParams ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The handleUIUserConfirmTreatmentParameters function handles a user confirmation * of treatment parameters message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIUserConfirmTreatmentParameters( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof( BOOL ) ) { BOOL confirmed; memcpy( &confirmed, message->payload, sizeof( BOOL ) ); if ( TRUE == confirmed ) { result = signalUserConfirmationOfTreatmentParameters(); } else { result = signalUserRejectionOfTreatmentParameters(); } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @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 * @details Outputs: Treatment parameters response msg constructed and queued. * @param accepted T/F - are settings accepted? * @param rejectReasons reasons each parameter was rejected (if not accepted) * @param byteLength number of bytes that array of reject reasons takes * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentParametersResponseMsg( BOOL accepted, U08 *rejectReasons, U32 byteLength ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_NEW_TREATMENT_PARAMS_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + ( sizeof( U32 ) * byteLength ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, rejectReasons, sizeof( U32 ) * byteLength ); // 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleUFVolumeSetRequest function handles a UF volume treatment parameter * set and validate request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUFVolumeSetRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(F32) ) { F32 uFVolumeMl; memcpy( &uFVolumeMl, message->payload, sizeof(F32) ); result = validateAndSetUFVolume( uFVolumeMl ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The sendUFVolumeSetResponseMsg function constructs a UF volume treatment parameter * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: UF volume treatment parameter response msg constructed and queued. * @param accepted T/F - is UF volume setting accepted? * @param rejectReasons reason UF volume setting was rejected (if not accepted) * @param uFVolumeMl UF volume (in mL) value that is now in place * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendUFVolumeSetResponseMsg( BOOL accepted, U32 reason, F32 uFVolumeMl ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( F32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &reason, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &uFVolumeMl, sizeof( F32 ) ); // 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration * change settings request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChangeUFSettingsRequest( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof(F32) ) { F32 uFVolume; memcpy( &uFVolume, message->payload, sizeof(F32) ); verifyUFSettingsChange( uFVolume ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleChangeUFSettingsConfirmation function handles a ultrafiltration * change setting confirmation message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) { UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleChangeTreatmentDurationRequest function handles a treatment * duration setting change message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof(U32) ) { U32 timeInMin; memcpy( &timeInMin, message->payload, sizeof(U32) ); verifyTreatmentDurationSettingChange( timeInMin ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleChangeBloodDialysateRateChangeRequest function handles a blood * and dialysate rate settings change message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) { U32 expPayloadSize = sizeof(U32) + sizeof(U32); if ( expPayloadSize == message->hdr.payloadLen ) { U32 bloodRate; U32 dialRate; memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleChangePressureLimitsRequest function handles a pressure limits * change message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleChangePressureLimitsRequest( MESSAGE_T *message ) { if ( sizeof( PRESSURE_LIMIT_CHANGE_REQUEST_T ) == message->hdr.payloadLen ) { PRESSURE_LIMIT_CHANGE_REQUEST_T data; memcpy( &data, &message->payload[0], sizeof(PRESSURE_LIMIT_CHANGE_REQUEST_T) ); verifyPressureLimitsChange( &data ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleHeparinCommandRequest function handles a Heparin command * request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleHeparinCommandRequest( MESSAGE_T *message ) { if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 payload; memcpy( &payload, &message->payload[0], sizeof( U32 ) ); userHeparinRequest( (HEPARIN_CMD_T)payload ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleAlarmAudioVolumeSetCmd function handles a alarm audio volume * set request message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAlarmAudioVolumeSetCmd( MESSAGE_T *message ) { if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 payload; memcpy( &payload, &message->payload[0], sizeof( U32 ) ); setAlarmAudioVolume( payload ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handleSalineBolusRequest function handles a saline bolus request * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSalineBolusRequest( MESSAGE_T *message ) { if ( sizeof(BOOL) == message->hdr.payloadLen ) { SALINE_CMD_T cmd; memcpy( &cmd, &message->payload[0], sizeof(BOOL) ); if ( SALINE_CMD_START == cmd ) { signalStartSalineBolus(); } else { signalAbortSalineBolus(); } } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendSalineBolusResponse function constructs a saline bolus start/abort * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment parameters response msg constructed and queued. * @param accepted T/F - was saline bolus request accepted? * @param rejReason reason why request was rejected (or zero if accepted) * @param bolusVol volume (in mL) currently set for saline bolus * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendSalineBolusResponse( BOOL accepted, U32 rejReason, U32 bolusVol ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_USER_SALINE_BOLUS_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &bolusVol, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handlRinsebackCmd function handles a rinseback user action command * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handlRinsebackCmd( MESSAGE_T *message ) { if ( sizeof(U32) == message->hdr.payloadLen ) { U32 cmd; memcpy( &cmd, &message->payload[0], sizeof(U32) ); signalRinsebackUserAction( (REQUESTED_RINSEBACK_USER_ACTIONS_T)cmd ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendRinsebackCmdResponse function constructs a rinseback user action * response to the UI and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Rinseback command response msg constructed and queued. * @param accepted T/F - was rinseback user action accepted? * @param rejReason reason why action was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendRinsebackCmdResponse( BOOL accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_RINSEBACK_CMD_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleTreatmentRecircCmd function handles a treatment re-circ user action command * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTreatmentRecircCmd( MESSAGE_T *message ) { if ( sizeof(U32) == message->hdr.payloadLen ) { U32 cmd; memcpy( &cmd, &message->payload[0], sizeof(U32) ); signalTreatmentRecircUserAction( (REQUESTED_TREATMENT_RECIRC_USER_ACTIONS_T)cmd ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The handlePostTxNextCmd function handles a post-treatment next request * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handlePostTxNextCmd( MESSAGE_T *message ) { if ( 0 == message->hdr.payloadLen ) { requestPostTxNext(); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendTreatmentRecircCmdResponse function constructs a treatment re-circulation * user action response to the UI and queues the msg for transmit on the appropriate * CAN channel. * @details Inputs: none * @details Outputs: Treatment re-circ command response msg constructed and queued. * @param accepted T/F - was re-circ user action accepted? * @param rejReason reason why action was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentRecircCmdResponse( BOOL accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_RECIRC_CMD_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendPostTxNextCmdResponse function constructs a post-treatment next * command response to the UI and queues the msg for transmit on the appropriate * CAN channel. * @details Inputs: none * @details Outputs: Post-treatment next command response msg constructed and queued. * @param accepted T/F - was request accepted? * @param rejReason reason why request was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendPostTxNextCmdResponse( BOOL accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_POST_TX_NEXT_CMD_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleTreatmentEndCmd function handles a treatment end user action command * message from the UI. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTreatmentEndCmd( MESSAGE_T *message ) { if ( sizeof(U32) == message->hdr.payloadLen ) { U32 cmd; memcpy( &cmd, &message->payload[0], sizeof(U32) ); signalTreatmentEndUserAction( (REQUESTED_TREATMENT_END_USER_ACTIONS_T)cmd ); } else { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } /*********************************************************************//** * @brief * The sendTreatmentEndCmdResponse function constructs a treatment end * user action response to the UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none * @details Outputs: Treatment end command response msg constructed and queued. * @param accepted T/F - was user action accepted? * @param rejReason reason why action was rejected (or zero if accepted) * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTreatmentEndCmdResponse( BOOL accepted, U32 rejReason ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_TX_END_CMD_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejReason, 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_2_UI, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleFWVersionRequest function handles a request for HD f/w version. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ void handleFWVersionRequest( MESSAGE_T *message ) { MESSAGE_T msg; HD_VERSIONS_T payload; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_VERSION_REPONSE; msg.hdr.payloadLen = sizeof( HD_VERSIONS_T ); if ( message->hdr.payloadLen == sizeof( UI_VERSIONS_T ) ) { // Get UI version data from this request msg and have it recorded handleUIVersionResponse( message ); // Populate payload for response payload.major = (U08)HD_VERSION_MAJOR; payload.minor = (U08)HD_VERSION_MINOR; payload.micro = (U08)HD_VERSION_MICRO; payload.build = (U16)HD_VERSION_BUILD; payload.compatibilityRev = (U32)SW_COMPATIBILITY_REV; getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); // Fill message payload memcpy( payloadPtr, &payload, sizeof( HD_VERSIONS_T ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The sendFWVersionRequest function constructs a firmware version request * message and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Firmware version request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendFWVersionRequest( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_FW_VERSIONS_REQUEST; msg.hdr.payloadLen = sizeof( UI_VERSIONS_T ); // usually UI sends this request w/ UI version info - we will leave that blank // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleUIVersionResponse function handles a response to request for * UI version information. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle. * @return none *************************************************************************/ void handleUIVersionResponse( MESSAGE_T *message ) { // Get UI version data and have it recorded if ( sizeof(UI_VERSIONS_T) == message->hdr.payloadLen ) { UI_VERSIONS_T uiVersion; memcpy( &uiVersion, &message->payload[0], sizeof(UI_VERSIONS_T) ); signalUIVersion( uiVersion ); } } /*********************************************************************//** * @brief * The handleHDSerialNumberRequest function handles a request for HD serial * number request. * @details Inputs: none * @details Outputs: message handled, response constructed and queued * for transmit. * @return none *************************************************************************/ void handleHDSerialNumberRequest( void ) { MESSAGE_T msg; HD_SYSTEM_RECORD_T system; U08 i; LOCAL_TOP_SN_T localTopLevelSN; // Get the system's record. There are no arrays of system to check and also, raise no alarm since the system record // has been already checked in POST getNVRecord2Driver( GET_SYS_RECORD, (U08*)&system, sizeof( HD_SYSTEM_RECORD_T ), 0, ALARM_ID_NO_ALARM ); U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SERIAL_NUMBER_RESPONSE; // Add 1 byte for null terminator msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; for ( i = 0; i < MAX_TOP_LEVEL_SN_CHARS; i++ ) { // NOTE: A local variable was created to avoid system.topLevelSN in the messages list // NOTE: For loop was used instead of memory copy to ensure it is not parsed in the messages list script localTopLevelSN.topLevelSN[ i ] = system.topLevelSN[ i ]; } // Fill message payload memcpy( payloadPtr, &localTopLevelSN, sizeof( LOCAL_TOP_SN_T ) ); payloadPtr += MAX_TOP_LEVEL_SN_CHARS; *payloadPtr = 0; // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleDGVersionResponse function handles a response for DG f/w version. * @details Inputs: none * @details Outputs: message handled, DG version info recorded. * @param message a pointer to the message to handle. * @return none *************************************************************************/ void handleDGVersionResponse( MESSAGE_T *message ) { // Get DG version data from this response msg and have it recorded if ( sizeof(DG_VERSIONS_T) == message->hdr.payloadLen ) { DG_VERSIONS_T dgVersion; memcpy( &dgVersion, &message->payload[0], sizeof(DG_VERSIONS_T) ); signalDGVersion( dgVersion ); } } /*********************************************************************//** * @brief * The handleHDServiceScheduleRequest function handles a request for HD * service information. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for * transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ void handleHDServiceScheduleRequest( MESSAGE_T *message ) { MESSAGE_T msg; HD_SERVICE_RECORD_T service; U08 *payloadPtr = msg.payload; getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( HD_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SERVICE_SCHEDULE_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); if ( 0 == message->hdr.payloadLen ) { U32 lastServiceEpochDate = service.lastServiceEpochDate; U32 serviceIntervalSeconds = ( 0 == service.lastServiceEpochDate ? 0 : service.serviceIntervalSeconds ); // Fill message payload memcpy( payloadPtr, &lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &serviceIntervalSeconds, sizeof( U32 ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleHDUsageInfoRequest function handles a request for HD * usage information. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for * transmit. * @param message a pointer to the message to handle. * @return none *************************************************************************/ void handleHDUsageInfoRequest( MESSAGE_T *message ) { MESSAGE_T msg; HD_USAGE_INFO_RECORD_T usageRecord; U08 *payloadPtr = msg.payload; getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageRecord, sizeof( HD_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_USAGE_DATA; msg.hdr.payloadLen = sizeof( F32 ) + sizeof( F32 ) + sizeof( U32 ); // Fill message payload memcpy( payloadPtr, &usageRecord.txTimeTotalHrs, sizeof( F32 ) ); payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &usageRecord.txTimeSinceLastSrvcHrs, sizeof( F32 ) ); payloadPtr += sizeof( F32 ); memcpy( payloadPtr, &usageRecord.txLastStartTimeEpoch, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleUIConfirmationResponse function handles a UI response for * confirmation request. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIConfirmationResponse( MESSAGE_T *message ) { U08* payloadPtr = message->payload; if ( message->hdr.payloadLen == 2 * sizeof(U32) ) { U32 request_id; U32 status; memcpy( &request_id, payloadPtr, sizeof(U32) ); payloadPtr += sizeof(U32); memcpy( &status, payloadPtr, sizeof(U32) ); if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) { setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } /*********************************************************************//** * @brief * The sendConfirmationRequest function sends a confirmation request to UI * @details Inputs: none * @details Outputs: none * @param request ID pointer to generic message request structure * @return none *************************************************************************/ void sendConfirmationRequest( GENERIC_CONFIRMATION_REQUEST_T *request ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_UI_CONFIRMATION_REQUEST; // The payload length is U32 Request ID, U32 Type, U32 Reject Reason msg.hdr.payloadLen = sizeof( GENERIC_CONFIRMATION_REQUEST_T ); memcpy( payloadPtr, request, sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleSendChemFlushPassFailToDG function sends the result of the * chemical disinfect flush sample pass/fail to DG * @details Inputs: none * @details Outputs: none * @param status which is the status of the result * @return none *************************************************************************/ void handleSendChemFlushPassFailToDG( U32 status ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &status, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_NOT_REQUIRED ); } /*********************************************************************//** * @brief * The sendDGStopActiveCoolModeCommand function sends a request to stop * active cool mode command * @details Inputs: none * @details Outputs: none * @param start the boolean flag to indicate whether to start or stop the * active cool * @return TRUE if the command was serialized successfully *************************************************************************/ BOOL sendDGStopActiveCoolModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( msg.payload, &start, sizeof( BOOL ) ); // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGStartStopDGROPermeateSampleModeCommand function sends a request * to start or stop RO permeate sample mode command * @details Inputs: none * @details Outputs: none * @param start TRUE to star the RO permeate sample mode and FALSE to stop * the RO permeate sample mode * @return TRUE if the command was serialized successfully *************************************************************************/ BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( msg.payload, &start, sizeof( BOOL ) ); // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendRequestROPermeateSampleCollectionToDG function sends a request * to collect RO permeate sample to DG * @details Inputs: none * @details Outputs: none * @param status which could be dispense or cancel * @return TRUE if the command was serialized successfully *************************************************************************/ BOOL sendRequestROPermeateSampleCollectionToDG( U32 status ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_RO_PERMEATE_SAMPLE_DISPENSE_REQUEST_TO_DG; msg.hdr.payloadLen = sizeof( U32 ); memcpy( msg.payload, &status, 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleReceiveROPermeateSampleReadyToDispenseFromDG function receives * the signal from DG that it is ready to dispnese more in RO permeate sample * mode * @details Inputs: none * @details Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleReceiveROPermeateSampleReadyToDispenseFromDG( MESSAGE_T* message ) { if ( 0 == message->hdr.payloadLen ) { signalROPermeateSampleDGReadyToDispense(); } } /*********************************************************************//** * @brief * The handleSendInstitutionalRecordToUI function sends the institutional record to UI * @details Inputs: none * @details Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSendInstitutionalRecordToUI( MESSAGE_T* message ) { if ( 0 == message->hdr.payloadLen ) { HD_INSTITUTIONAL_RECORD_T hdInstitutionalRecord; HD_INSTITUTIONAL_LOCAL_RECORD_T hdInstitutionalLocalRecord; getNVRecord2Driver( GET_INSTITUTIONAL_RECORD, (U08*)&hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ), 0, ALARM_ID_NO_ALARM ); memcpy( &hdInstitutionalLocalRecord, &hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); sendInstitutionalRecordToUI( &hdInstitutionalLocalRecord ); } } /*********************************************************************//** * @brief * The sendInstitutionalRecordToUI function sends the institutional record to UI * @details Inputs: none * @details Outputs: none * @param instit a pointer to the local institutional recored in the system * messages that is without calibration time and crc * @return none *************************************************************************/ static void sendInstitutionalRecordToUI( HD_INSTITUTIONAL_LOCAL_RECORD_T* instit ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; U32 accept = 1; U32 reason = 0; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_INSTITUTIONAL_RECORD_RESPONSE; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ); memcpy( payloadPtr, &accept, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &reason, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, instit, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The handleUIHDResetInServiceModeRequest function handles the UI request * to reset HD in service mode * @details Inputs: none * @details Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIHDResetInServiceModeRequest( MESSAGE_T* message ) { // Verify payload length if ( ( 0 == message->hdr.payloadLen ) && ( MODE_SERV == getCurrentOperationMode() ) ) { #ifndef _VECTORCAST_ systemREG1->SYSECR = (0x2) << 14; // Reset processor #endif } // Respond to request sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } /*********************************************************************//** * @brief * The sendDGStartHeatDisinfectPassiveCoolModeCommand function handles the send * request to start or stop nocturnal heat disinfect. * @details Inputs: none * @details Outputs: none * @param start TRUE indicates start heat disinfect mode * @return none *************************************************************************/ BOOL sendDGStartHeatDisinfectPassiveCoolModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; DG_HEAT_DISINFECTION_MODE_CMD_T cmd; // Start command cmd.start = start; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_PASSIVE_COOL_HEAT_DISINFECT; msg.hdr.payloadLen = sizeof( DG_HEAT_DISINFECTION_MODE_CMD_T ); memcpy( &msg.payload, &cmd, sizeof( DG_HEAT_DISINFECTION_MODE_CMD_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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleDGRequestInstitutionalValues function handles the DG request * to receive the DG institutional values from HD institutional record. * @details Inputs: none * @details Outputs: none * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGRequestInstitutionalValues( MESSAGE_T* message ) { if ( 0 == message->hdr.payloadLen ) { MESSAGE_T msg; DG_INSTITUTIONAL_VALUES_T dgInstitValues; dgInstitValues.minRORejectionRatioPCT = getMinRORejectionRatioInInstitRecordPCT(); dgInstitValues.minInletWaterCondAlarmLimitUSPCM = getMinInletWaterConductivityLimitInstitRecordUSPCM(); // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_INSTIT_VALUES_FROM_HD_INSTIT_RECORD_RESPONSE; msg.hdr.payloadLen = sizeof( DG_INSTITUTIONAL_VALUES_T ); memcpy( msg.payload, &dgInstitValues, sizeof( DG_INSTITUTIONAL_VALUES_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); } } /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ /*********************************************************************//** * @brief * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. * @details Inputs: testerLoggedIn * @details Outputs: none * @return TRUE if a tester has logged in to activate testing, FALSE if not *************************************************************************/ BOOL isTestingActivated( void ) { return testerLoggedIn; } /*********************************************************************//** * @brief * The setTesterStatusToLoggedOut function sets the status of the tester to * logged out. * @details Inputs: none * @details Outputs: testerLoggedIn * @return none *************************************************************************/ void setTesterStatusToLoggedOut( void ) { testerLoggedIn = FALSE; } /*********************************************************************//** * @brief * 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 * @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 *************************************************************************/ static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = msgID; msg.hdr.payloadLen = sizeof( U08 ); msg.payload[ 0 ] = (U08)ack; // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleTesterLogInRequest function handles a request to login as a * tester. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTesterLogInRequest( MESSAGE_T *message ) { // Verify pass code // TODO - placeholder - how do we want to authenticate tester? if ( ( 3 == message->hdr.payloadLen ) && ( 0x31 == message->payload[ 0 ] ) && ( 0x32 == message->payload[ 1 ] ) && ( 0x33 == message->payload[ 2 ] ) ) { testerLoggedIn = TRUE; checkInFromUI(); // Allow tasks to begin normal processing when tester has logged in // Set the dialin checkin time stamp until the first checkin message is received from dailin setDialinCheckInTimeStamp(); } else { testerLoggedIn = FALSE; } // Respond to would be tester sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } /*********************************************************************//** * @brief * The handleTestOffButtonStateOverrideRequest function handles a request to * override the state of the off button. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestOffButtonStateOverrideRequest( 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 = testSetOffButtonStateOverride( payload.state.u32 ); } else { result = testResetOffButtonStateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestStopButtonStateOverrideRequest function handles a request to * override the stop button state. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestStopButtonStateOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = 0; // 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 = testSetStopButtonStateOverride( payload.state.u32 ); } else { result = testResetStopButtonStateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmLampPatternOverrideRequest function handles a request to * override the alarm lamp pattern. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmLampPatternOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = 0; // 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 = testSetCurrentLampPatternOverride( payload.state.u32 ); } else { result = testResetCurrentLampPatternOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestWatchdogCheckInStateOverrideRequest function handles a * request to override the check-in status of a given task. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestWatchdogCheckInStateOverrideRequest( 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 = testSetWatchdogTaskCheckInOverride( payload.index, payload.state.u32 ); } else { result = testResetWatchdogTaskCheckInOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmStateOverrideRequest function handles a request to * override the active status of a given alarm. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmStateOverrideRequest( 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 = testSetAlarmStateOverride( payload.index, payload.state.u32 ); } else { result = testResetAlarmStateOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmTimeOverrideRequest function handles a request to * override the time since activation of a given alarm. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmTimeOverrideRequest( 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 = testSetAlarmStartOverride( payload.index, payload.state.u32 ); } else { result = testResetAlarmStartOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodFlowSetPointOverrideRequest function handles a request to * override the set point for the blood flow rate (mL/min). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodFlowSetPointOverrideRequest( MESSAGE_T *message ) { OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetBloodFlowRateOverride( payload.setPt, payload.ctrlMode ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodFlowMeasuredOverrideRequest function handles a request to * override the measured blood flow rate (mL/min). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodFlowMeasuredOverrideRequest( 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 = testSetMeasuredBloodFlowRateOverride( payload.state.f32 ); } else { result = testResetMeasuredBloodFlowRateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleHDBloodPumpRotorCountOverrideRequest function handles a request to * override the blood pump rotor count. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleHDBloodPumpRotorCountOverrideRequest( 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 = testSetBloodPumpRotorCountOverride( payload.state.u32 ); } else { result = testResetBloodPumpRotorCountOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleHDDialInPumpRotorCountOverrideRequest function handles a request to * override the dialysate inlet pump rotor count. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleHDDialInPumpRotorCountOverrideRequest( 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 = testSetDialysateInPumpRotorCountOverride( payload.state.u32 ); } else { result = testResetDialysateInPumpRotorCountOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump rotor speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpRotorMeasuredSpeedOverrideRequest( 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 = testSetMeasuredBloodPumpRotorSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredBloodPumpRotorSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpMeasuredSpeedOverrideRequest( 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 = testSetMeasuredBloodPumpSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredBloodPumpSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump motor controller speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpMCMeasuredSpeedOverrideRequest( 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 = testSetMeasuredBloodPumpMCSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredBloodPumpMCSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured blood pump motor controller current (mA). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpMCMeasuredCurrentOverrideRequest( 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 = testSetMeasuredBloodPumpMCCurrentOverride( payload.state.f32 ); } else { result = testResetMeasuredBloodPumpMCCurrentOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for blood flow data. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodFlowBroadcastIntervalOverrideRequest( 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 = testSetBloodFlowDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetBloodFlowDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate inlet flow rate (mL/min). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInFlowSetPointOverrideRequest( MESSAGE_T *message ) { OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetDialInFlowRateOverride( payload.setPt, payload.ctrlMode ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate outlet flow rate (mL/min). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutFlowSetPointOverrideRequest( MESSAGE_T *message ) { OVERRIDE_PUMP_SET_PT_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length if ( sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(OVERRIDE_PUMP_SET_PT_PAYLOAD_T) ); result = testSetTargetDialOutFlowRateOverride( payload.setPt, payload.ctrlMode ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInFlowMeasuredOverrideRequest function handles a request to * override the measured dialysate inlet flow rate (mL/min). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInFlowMeasuredOverrideRequest( 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 = testSetMeasuredDialInFlowRateOverride( payload.state.f32 ); } else { result = testResetMeasuredDialInFlowRateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump rotor speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInPumpRotorMeasuredSpeedOverrideRequest( 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 = testSetMeasuredDialInPumpRotorSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialInPumpRotorSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInPumpMeasuredSpeedOverrideRequest( 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 = testSetMeasuredDialInPumpSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialInPumpSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller speed (RPM). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInPumpMCMeasuredSpeedOverrideRequest( 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 = testSetMeasuredDialInPumpMCSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialInPumpMCSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller current (mA). * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInPumpMCMeasuredCurrentOverrideRequest( 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 = testSetMeasuredDialInPumpMCCurrentOverride( payload.state.f32 ); } else { result = testResetMeasuredDialInPumpMCCurrentOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for dialysate inlet flow data. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInFlowBroadcastIntervalOverrideRequest( 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 = testSetDialInFlowDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetDialInFlowDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestArterialPressureOverrideRequest function handles a request to * override the arterial pressure. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestArterialPressureOverrideRequest( 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 = testSetArterialPressureOverride( payload.state.f32, payload.index ); } else { result = testResetArterialPressureOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestVenousPressureOverrideRequest function handles a request to * override the venous pressure. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestVenousPressureOverrideRequest( 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 = testSetVenousPressureOverride( payload.state.f32, payload.index ); } else { result = testResetVenousPressureOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpOcclusionOverrideRequest function handles a request to * override the blood pump occlusion sensor. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpOcclusionOverrideRequest( 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 = testSetBloodPumpOcclusionOverride( payload.state.u32 ); } else { result = testResetBloodPumpOcclusionOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestFilteredBloodPumpOcclusionOverrideRequest function handles a request to * override the filtered blood pump occlusion sensor readings. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestFilteredBloodPumpOcclusionOverrideRequest( 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 = testSetFilteredBloodPumpOcclusionOverride( payload.state.f32 ); } else { result = testResetFilteredBloodPumpOcclusionOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPumpOcclusionBaselineOverrideRequest function handles a request to * override the blood pump occlusion baseline value. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpOcclusionBaselineOverrideRequest( 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 = testSetBloodPumpPartialOcclusionBaselineOverride( payload.state.f32 ); } else { result = testResetBloodPumpPartialOcclusionBaselineOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestPresOcclBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for pressure/occlusion data. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestPresOcclBroadcastIntervalOverrideRequest( 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 = testSetPresOcclDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetPresOcclDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetRTCTimestamp function handles a request to write time and * date to RTC * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetRTCTimestamp( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == 9 ) // TODO - add payload structure to RTC.h and use a structure to import payload. { U08 seconds = message->payload[0]; U08 minutes = message->payload[1]; U08 hours = message->payload[2]; U08 days = message->payload[3]; U08 months = message->payload[4]; U32 years; memcpy(&years, &message->payload[5], sizeof(U32)); result = setRTCTimestamp( seconds, minutes, hours, days, months, years ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutFlowBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for dialysate outlet pump data. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutFlowBroadcastIntervalOverrideRequest( 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 = testSetDialOutPumpAndLoadCellDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetDialOutPumpAndLoadCellDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutUFReferenceVolumeOverrideRequest function handles a * request to override the ultrafiltration reference volume for the dialysate * outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutUFReferenceVolumeOverrideRequest( 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 = testSetDialOutUFRefVolumeOverride( payload.state.f32 ); } else { result = testResetDialOutUFRefVolumeOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutUFMeasuredVolumeOverrideRequest function handles a * request to override the ultrafiltration measured volume for the dialysate * outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutUFMeasuredVolumeOverrideRequest( 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 = testSetDialOutUFTotVolumeOverride( payload.state.f32 ); } else { result = testResetDialOutUFTotVolumeOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutPumpMCMeasuredSpeedOverrideRequest function handles a * request to override the measured motor controller speed for the dialysate * outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutPumpMCMeasuredSpeedOverrideRequest( 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 = testSetMeasuredDialOutPumpMCSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialOutPumpMCSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutPumpMCMeasuredCurrentOverrideRequest function handles a * request to override the measured motor controller current for the dialysate * outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutPumpMCMeasuredCurrentOverrideRequest( 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 = testSetMeasuredDialOutPumpMCCurrentOverride( payload.state.f32 ); } else { result = testResetMeasuredDialOutPumpMCCurrentOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutPumpMeasuredSpeedOverrideRequest function handles a * request to override the measured speed for the dialysate outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutPumpMeasuredSpeedOverrideRequest( 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 = testSetMeasuredDialOutPumpSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialOutPumpSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutPumpMeasuredRotorSpeedOverrideRequest function handles a * request to override the measured rotor speed for the dialysate outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutPumpMeasuredRotorSpeedOverrideRequest( 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 = testSetMeasuredDialOutPumpRotorSpeedOverride( payload.state.f32 ); } else { result = testResetMeasuredDialOutPumpRotorSpeedOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutLoadCellWeightOverrideRequest function handles a * request to override the measured load cell weight for the dialysate outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutLoadCellWeightOverrideRequest( 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 = testSetDialOutLoadCellWeightOverride( payload.index, payload.state.f32 ); } else { result = testResetDialOutLoadCellWeightOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTreatmentTimeRemainingOverrideRequest function handles a treatment * time remaining override request message. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestTreatmentTimeRemainingOverrideRequest( MESSAGE_T *message ) { U32 payload; BOOL result = FALSE; // Verify payload length if ( sizeof(U32) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(U32) ); result = testSetTreatmentTimeRemainingOverride( payload ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDSafetyShutdownOverrideRequest function handles a * request to override the safety shutdown signal. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDSafetyShutdownOverrideRequest( 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 = testSetSafetyShutdownOverride( payload.state.u32 ); } else { result = testResetSafetyShutdownOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDAccelOverrideRequest function handles a request to * override the measured accelerometer sensor readings. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDAccelOverrideRequest( 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 = testSetAccelAxisOverride( payload.index, payload.state.f32 ); } else { result = testResetAccelAxisOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDAccelMaxOverrideRequest function handles a request to * override the measured accelerometer sensor maximum readings. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDAccelMaxOverrideRequest( 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 = testSetAccelMaxOverride( payload.index, payload.state.f32 ); } else { result = testResetAccelMaxOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDAccelBroadcastIntervalOverrideRequest function handles a * request to override the broadcast interval for accelerometer data messages. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDAccelBroadcastIntervalOverrideRequest( 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 = testSetAccelDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetAccelDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSetTreatmentParameter function handles a request to set * a specific treatment parameter value. * @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]; memcpy( &payload[0], message->payload, sizeof(CRITICAL_DATAS_T) * 2 ); result = testSetTreatmentParameter( (TREATMENT_PARAM_T)payload[0].uInt, payload[1] ); } // Respond to request 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, VALVE_FORCE_HOME, VALVE_NO_CARTRIDGE_PRESENT ); 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 ); } /*********************************************************************//** * @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 ); } /*********************************************************************//** * @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 handleSetRawAirTrapLevelSensorOverrideRequest function handles a request to * override an air trap level sensor raw value. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetRawAirTrapLevelSensorOverrideRequest( 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 = testSetRawAirTrapLevelOverride( (AIR_TRAP_LEVEL_SENSORS_T)payload.index, (AIR_TRAP_LEVELS_T)( payload.state.u32 ) ); } else { result = testResetRawAirTrapLevelOverride( (AIR_TRAP_LEVEL_SENSORS_T)payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetFluidLeakBroadcastIntervalOverrideRequest function handles a * request to override the fluid leak state broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetFluidLeakBroadcastIntervalOverrideRequest( 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 = testSetFluidLeakStatePublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetFluidLeakStatePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetFluidLeakStateOverrideRequest function handles a request to * override the fluid leak detector state. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetFluidLeakStateOverrideRequest( 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 = testSetFluidLeakStateOverride( ( FLUID_LEAK_STATES_T)( payload.state.u32 ) ); } else { result = testResetFluidLeakStateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetBloodLeakDataBroadcastIntervalOverrideRequest function handles a * request to override the blood leak data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetBloodLeakDataBroadcastIntervalOverrideRequest( 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 = testSetBloodLeakDataPublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetBloodLeakDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetBloodLeakStatusOverrideRequest function handles a request to * override the blood leak detector status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetBloodLeakStatusOverrideRequest( 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 = testSetBloodLeakStatusOverride( (BLOOD_LEAK_STATUS_T)( payload.state.u32 ) ); } else { result = testResetBloodLeakStatusOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBloodLeakZeroRequest function handles a request to * zero the blood leak detector. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBloodLeakZeroRequest( MESSAGE_T *message ) { BOOL result = FALSE; // Verify payload length if ( 0 == message->hdr.payloadLen ) { result = TRUE; zeroBloodLeak(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetBubblesDataBroadcastIntervalOverrideRequest function handles a * request to override the air bubble detectors data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetBubblesDataBroadcastIntervalOverrideRequest( 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 = testSetBubblesDataPublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetBubblesDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetBubbleStatusOverrideRequest function handles a request to * override a given air bubble detector status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleSetBubbleStatusOverrideRequest( 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 = testSetBubbleStatusOverride( (BUBBLE_STATUS_T)payload.state.u32, (BUBBLES_T)payload.index ); } else { result = testResetBubbleStatusOverride( (BUBBLES_T)payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBubbleSelfTestRequest function handles a request to * self-test a given air bubble detector. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBubbleSelfTestRequest( MESSAGE_T *message ) { U32 payload; BOOL result = FALSE; // Verify payload length if ( sizeof( U32 ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( U32 ) ); result = TRUE; selfTestBubble( (BUBBLES_T)payload ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetSwitchesStatusOverrideRequest function handles a * request to override the status of a switch in HD. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetSwitchesStatusOverrideRequest( 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 = testSetSwitchesStatusOverride( payload.index, payload.state.u32 ); } else { result = testResetSwitchesStatusOverride( payload.index ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSwitchesPublishIntervalOverrideRequest function handles a * request to override the the switches data publish interval. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestSwitchesPublishIntervalOverrideRequest( 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 = testSetSwitchesDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetSwitchesDataPublishIntervalOverrid(); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBatteryRemainingPercentOverrideRequest function handles a * request to override battery remaining percent. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBatteryRemainingPercentOverrideRequest( 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 = testSetBatteryRemainingCapacityOverride( payload.state.f32 ); } else { result = testResetBatteryRemainingCapacityOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBloodPrimeVolumeOverrideRequest function handles a request to * override the calculated blood prime volume (in mL). * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBloodPrimeVolumeOverrideRequest( 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 = testSetBloodPrimeVolumeOverride( payload.state.f32 ); } else { result = testResetBloodPrimeVolumeOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleRinsebackVolumeOverrideRequest function handles a request to * override the calculated rinseback volume (in mL). * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleRinsebackVolumeOverrideRequest( 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 = testSetRinsebackVolumeOverride( payload.state.f32 ); } else { result = testResetRinsebackVolumeOverride(); } } // 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 ); } /*********************************************************************//** * @brief * The handleTestBloodPumpHomeRequest function handles a request to home * the blood pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpHomeRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( 0 == message->hdr.payloadLen ) { result = homeBloodPump(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInPumpHomeRequest function handles a request to home * the dialysate inlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInPumpHomeRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( 0 == message->hdr.payloadLen ) { result = homeDialInPump(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutPumpHomeRequest function handles a request to home * the dialysate outlet pump. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutPumpHomeRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( 0 == message->hdr.payloadLen ) { result = homeDialOutPump(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSuperClearAlarmsRequest function handles a request to clear * all active alarms. * @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 ); } /*********************************************************************//** * @brief * The handleTestSetOpModeRequest function handles a request to set the * HD operation mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestSetOpModeRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(U32) ) { U32 mode; memcpy( &mode, message->payload, sizeof(U32) ); result = testSetOperationMode( (HD_OP_MODE_T)mode ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetHDCalibrationRecord function handles a request to set the HD * calibration data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDCalibrationRecord( MESSAGE_T *message ) { BOOL status = FALSE; U08* payloadPtr = message->payload; U32 currentMessage; U32 totalMessages; U32 payloadLength; if ( ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) && ( MODE_SERV == getCurrentOperationMode() ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleGetHDCalibrationRecord function handles a request to get the HD * calibration data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDCalibrationRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_CALIBRATION_RECORD ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpDataBroadcastIntervalOverrideRequest function handles a * request to override the syringe pump data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpDataBroadcastIntervalOverrideRequest( 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 = testSetSyringePumpDataPublishIntervalOverride( (U32)(payload.state.u32) ); } else { result = testResetSyringePumpDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpOperationRequest function handles a * request to initiate a syringe pump operation. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpOperationRequest( MESSAGE_T *message ) { BOOL result = FALSE; if ( message->hdr.payloadLen == sizeof(SYRINGE_PUMP_OP_PAYLOAD_T) ) { SYRINGE_PUMP_OP_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof(SYRINGE_PUMP_OP_PAYLOAD_T) ); result = testSyringePumpOperationRequest( payload ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredRateOverrideRequest function handles a * request to override the syringe pump measured rate. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredRateOverrideRequest( 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 = testSetSyringePumpMeasuredRateOverride( payload.state.f32 ); } else { result = testResetSyringePumpMeasuredRateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpHeprinBolusTargetRateOverrideRequest function handles a * request to override the syringe pump heprin bolus target rate. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpHeprinBolusTargetRateOverrideRequest( 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 = testSetHeprinBolusTargetRateOverride( payload.state.f32 ); } else { result = testResetHeprinBolusTargetRateOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetHDSystemRecord function handles a request to set the HD * system data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDSystemRecord( MESSAGE_T *message ) { BOOL status = FALSE; U08* payloadPtr = message->payload; U32 currentMessage; U32 totalMessages; U32 payloadLength; if ( ( message->hdr.payloadLen >= sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) && ( MODE_SERV == getCurrentOperationMode() ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleGetHDSystemRecord function handles a request to get the HD * system data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDSystemRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_SYSTEM_RECORD ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredForceOverrideRequest function handles a * request to override the syringe pump measured force analog signal. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredForceOverrideRequest( 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 = testSetSyringePumpMeasuredForceOverride( payload.state.f32 ); } else { result = testResetSyringePumpMeasuredForceOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredSyringeDetectOverrideRequest function handles a * request to override the syringe pump syringe detected analog signal. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredSyringeDetectOverrideRequest( 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 = testSetSyringePumpMeasuredSyringeDetectOverride( payload.state.f32 ); } else { result = testResetSyringePumpMeasuredSyringeDetectOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleGetHDServiceRecord function handles a request to get the HD * service data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDServiceRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_SERVICE_RECORD ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredHomeOverrideRequest function handles a * request to override the syringe pump measured home analog signal. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredHomeOverrideRequest( 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 = testSetSyringePumpMeasuredHomeOverride( payload.state.f32 ); } else { result = testResetSyringePumpMeasuredHomeOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetHDServiceRecord function handles a request to set the HD * service data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDServiceRecord( MESSAGE_T *message ) { BOOL status = FALSE; U08* payloadPtr = message->payload; U32 currentMessage; U32 totalMessages; U32 payloadLength; if ( ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) && ( MODE_SERV == getCurrentOperationMode() ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredPositionOverrideRequest function handles a * request to override the syringe pump measured position. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredPositionOverrideRequest( 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 = testSetSyringePumpMeasuredPositionOverride( (S32)(payload.state.u32) ); } else { result = testResetSyringePumpMeasuredPositionOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpMeasuredVolumeOverrideRequest function handles a * request to override the syringe pump measured volume delivered. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpMeasuredVolumeOverrideRequest( 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 = testSetSyringePumpMeasuredVolumeOverride( payload.state.f32 ); } else { result = testResetSyringePumpMeasuredVolumeOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestValvesCurrentOverrideRequest function handles a * request to override HD valves' current. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestValvesCurrentOverrideRequest( 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 = testSetValvesCurrentOverride( payload.index, payload.state.f32 ); } else { result = testResetValvesCurrentOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestMonitoredVoltagesSendIntervalOverrideRequest function * handles a request to override the monitored HD voltages data * publication interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestMonitoredVoltagesSendIntervalOverrideRequest( 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 = testSetVoltagesDataPublishIntervalOverride( payload.state.u32 ); } else { result = testResetVoltagesDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestValvesPositionCountOverrideRequest function handles a * request to override HD valves' position in counts. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestValvesPositionCountOverrideRequest( 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 = testSetValvesPositionCountOverride( payload.index, payload.state.u32 ); } else { result = testResetValvesPositionCountOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestMonitoredVoltageOverrideRequest function handles a * request to override the monitored HD voltage override. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestMonitoredVoltageOverrideRequest( 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 = testSetLineLevelOverride( payload.index, payload.state.f32 ); } else { result = testResetLineLevelOverride( payload.index ); } } // 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 handleTestAlarmStatusSendIntervalOverrideRequest function handles a * request to override the HD alarm status broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmStatusSendIntervalOverrideRequest( 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 = testSetAlarmStatusPublishIntervalOverride( payload.state.u32 ); } else { result = testResetAlarmStatusPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTreatmentTimeDataSendIntervalOverrideRequest function handles a * request to override the HD treatment time data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTreatmentTimeDataSendIntervalOverrideRequest( 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 = testSetTreatmentTimePublishIntervalOverride( payload.state.u32 ); } else { result = testResetTreatmentTimePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTreatmentRangesSendIntervalOverrideRequest function handles a * request to override the HD treatment param ranges broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTreatmentRangesSendIntervalOverrideRequest( 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 = testSetTreatmentParamRangesPublishIntervalOverride( payload.state.u32 ); } else { result = testResetTreatmentParamRangesPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTreatmentStopDataSendIntervalOverrideRequest function handles a * request to override the HD treatment stop sub-mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTreatmentStopDataSendIntervalOverrideRequest( 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 = testSetTreatmentStopPublishIntervalOverride( payload.state.u32 ); } else { result = testResetTreatmentStopPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestBloodPrimeDataSendIntervalOverrideRequest function handles a * request to override the HD blood prime sub-mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPrimeDataSendIntervalOverrideRequest( 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 = testSetBloodPrimePublishIntervalOverride( payload.state.u32 ); } else { result = testResetBloodPrimePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestRinsebackDataSendIntervalOverrideRequest function handles a * request to override the HD rinseback sub-mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestRinsebackDataSendIntervalOverrideRequest( 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 = testSetRinsebackPublishIntervalOverride( payload.state.u32 ); } else { result = testResetRinsebackPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestStandbyModeDataSendIntervalOverrideRequest function handles a * request to override the HD standby mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestStandbyModeDataSendIntervalOverrideRequest( 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 = testSetStandbyModePublishIntervalOverride( payload.state.u32 ); } else { result = testResetStandbyModePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestOpModeDataSendIntervalOverrideRequest function handles a * request to override the HD operation mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestOpModeDataSendIntervalOverrideRequest( 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 = testSetOpModePublishIntervalOverride( payload.state.u32 ); } else { result = testResetOpModePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestPreTreatmentModeDataSendIntervalOverrideRequest function handles a * request to override the HD pre-treatment mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestPreTreatmentModeDataSendIntervalOverrideRequest( 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 = testSetPreTreatmentModePublishIntervalOverride( payload.state.u32 ); } else { result = testResetPreTreatmentModePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTreatmentModeSendIntervalOverrideRequest function handles a * request to override the HD treatment mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTreatmentModeSendIntervalOverrideRequest( 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 = testSetTreatmentStatePublishIntervalOverride( payload.state.u32 ); } else { result = testResetTreatmentStatePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestPostTreatmentModeSendIntervalOverrideRequest function handles a * request to override the HD post-treatment mode data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestPostTreatmentModeSendIntervalOverrideRequest( 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 = testSetPostTreatmentModePublishIntervalOverride( payload.state.u32 ); } else { result = testResetPostTreatmentModePublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, 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 handleTestSyringePumpForceSensorCalibrateRequest function handles a * request message to set the syringe pump DAC reference voltage. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpForceSensorCalibrateRequest( MESSAGE_T *message ) { BOOL result = FALSE; // Verify payload length if ( 0 == message->hdr.payloadLen ) { if ( TRUE == isTestingActivated() ) { result = setSyringePumpDACVref(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmAudioVolumeOverrideRequest function handles a * request to override the alarm audio volume level. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmAudioVolumeOverrideRequest( 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 = testSetAlarmAudioVolumeLevelOverride( payload.state.u32 ); } else { result = testResetAlarmAudioVolumeLevelOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmAudioCurrentHgOverrideRequest function handles a * request to override the alarm audio (high gain) current. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmAudioCurrentHgOverrideRequest( 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 = testSetPrimaryAlarmAudioCurrentHGOverride( payload.state.f32 ); } else { result = testResetPrimaryAlarmAudioCurrentHGOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmAudioCurrentLgOverrideRequest function handles a * request to override the alarm audio (low gain) current. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmAudioCurrentLgOverrideRequest( 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 = testSetPrimaryAlarmAudioCurrentLGOverride( payload.state.f32 ); } else { result = testResetPrimaryAlarmAudioCurrentLGOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestAlarmBackupAudioCurrentOverrideRequest function handles a * request to override the backup alarm audio current. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestAlarmBackupAudioCurrentOverrideRequest( 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 = testSetBackupAlarmAudioCurrentOverride( payload.state.f32 ); } else { result = testResetBackupAlarmAudioCurrentOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpStatusOverrideRequest function handles a * request to override the syringe pump status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpStatusOverrideRequest( 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 = testSetSyringePumpStatus( payload.state.u32 ); } else { result = testResetSyringePumpStatus(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpEncoderStatusOverrideRequest function handles a * request to override the syringe pump encoder status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpEncoderStatusOverrideRequest( 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 = testSetSyringePumpEncoderStatus( payload.state.u32 ); } else { result = testResetSyringePumpEncoderStatus(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpADCandDACStatusOverrideRequest function handles a * request to override the syringe pump ADC & DAC status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpADCandDACStatusOverrideRequest( 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 = testSetSyringePumpADCandDACStatus( payload.state.u32 ); } else { result = testResetSyringePumpADCandDACStatus(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestSyringePumpADCReadCtrOverrideRequest function handles a * request to override the syringe pump ADC read counter. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestSyringePumpADCReadCtrOverrideRequest( 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 = testSetSyringePumpADCReadCounter( payload.state.u32 ); } else { result = testResetSyringePumpADCReadCounter(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTemperaturesValueOverrideRequest function handles a * request to override a temperatures sensor's value. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTemperaturesValueOverrideRequest( 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 = testSetMeasuredTemperatureOverride( payload.index, payload.state.f32 ); } else { result = testResetMeasuredTemperatureOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTemperaturesBroadcastIntervalOverrideRequest function handles a * request to override the temperatures data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestTemperaturesBroadcastIntervalOverrideRequest( 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 = testSetTemperaturesPublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetTemperaturesPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestTemperaturesBroadcastIntervalOverrideRequest function handles a * request to override the temperatures data broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestFansBroadcastIntervalOverrideRequest( 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 = testSetFanPublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetFanPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @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 handleStopHDRTCClock 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 handleStopHDRTCClock( MESSAGE_T *message ) { BOOL result = FALSE; if ( 0 == message->hdr.payloadLen ) { result = testSetStopRTC(); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetFansDutyCycleOverrideRequest function handles a * request to override the fans duty cycle. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetFansDutyCycleOverrideRequest( 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 = testSetFansDutyCycleOverride( payload.state.f32 ); } else { result = testResetFansDutyCycleOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestCurrentTreamtmentParametersRequest function handles a * request to retrieve the current treatment parameters. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestCurrentTreamtmentParametersRequest( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { result = TRUE; // ACK request result = testSendCurrentTreatmentParameters(); } sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The sendTestCurrentTreatmentParametersResponse function constructs a current * treatment parameter response message to the appropriate CAN channel. * @details Inputs: none * @details Outputs: current treatment prameters response msg constructed and queued. * @param data response data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendTestCurrentTreatmentParametersResponse(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T current_params) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_RES_CURRENT_TREATMENT_PARAMETERS; msg.hdr.payloadLen = sizeof(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T); memcpy(payloadPtr, ¤t_params, sizeof(CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T)); return serializeMessage(msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); } /*********************************************************************//** * @brief * The handleTestFansRPMAlarmStartTimeOffsetRequest function handles a * request to set the fans RPM alarm start time offset. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestFansRPMAlarmStartTimeOffsetRequest( MESSAGE_T *message ) { U32 rpmTimeOffset; BOOL result = FALSE; // Verify payload length if ( sizeof(U32) == message->hdr.payloadLen ) { memcpy( &rpmTimeOffset, message->payload, sizeof(U32) ); result = testSetFanRPMAlarmStartTimeOffset( rpmTimeOffset ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The sendHDSWConfigRecord function sends out the HD software configuration record. * @details Inputs: none * @details Outputs: HD software configuration record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param swRcrdAddress: start address of the software configuration record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDSWConfigRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* swRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_SW_CONFIG_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, swRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } #ifndef _RELEASE_ /*********************************************************************//** * @brief * The handleGetHDSoftwareConfigRecord function handles a request to get the HD * software configuration record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDSoftwareConfigRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_SW_CONFIG_RECORD ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetHDSoftwareConfigRecord function handles a request to set the HD * software configuration record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ) { U32 currentMessage; U32 totalMessages; U32 payloadLength; BOOL status = FALSE; U08* payloadPtr = message->payload; if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_SW_CONFIG_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } #endif /*********************************************************************//** * @brief * The sendHDUsageRecord function sends out the HD service record. * @details Inputs: none * @details Outputs: HD system record msg constructed and queued * @param payloadCurrNum: current payload number * @param payloadTotalNum: total number of payloads * @param length: buffer length to be written * @param srvcRcrdAddress: start address of the usage record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDUsageRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_USAGE_INFO_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, sysRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleUIServiceModeRequest function handles a request to enter service * mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleUIServiceModeRequest( MESSAGE_T *message ) { BOOL status = FALSE; HD_OP_MODE_T currentMode = getCurrentOperationMode(); DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { requestNewOperationMode( MODE_SERV ); if ( ( DG_MODE_STAN == currentDGMode ) || ( DG_MODE_FAUL == currentDGMode ) ) { status = TRUE; cmdSetDGToServiceMode(); reject = REQUEST_REJECT_REASON_NONE; } else { reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; } } else { reject = REQUEST_REJECT_REASON_TREATMENT_IN_PROGRESS; } } else { reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); sendUIServiceModeResponse( status, (U32)reject ); } /*********************************************************************//** * @brief * The sendUIServiceModeResponse function sends out the HD response to a * UI request to go to service mode. * @details Inputs: none * @details Outputs: Service mode request response msg constructed and queued * @param accepted TRUE if request was accepted, FALSE if not * @param rejCode Reject reason code explaining why request was rejected * @return none *************************************************************************/ void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST; msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** * @brief * The sendRequestForDGResendAlarms function sends out the HD request for * DG re-send all active alarms. * @details Inputs: none * @details Outputs: DG alarms re-send request msg constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendRequestForDGResendAlarms( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DG_ALARMS_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGUsageInfoRequestToDG function constructs a request msg * to the DG to request the DG usage info and queues the msg for transmit * on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG usage info result request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGUsageInfoRequestToDG( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DG_USAGE_INFO_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The sendDGServiceRequestToDG function constructs a request msg * to the DG to request the DG service record and queues the msg for transmit * on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG usage info result request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGServiceRequestToDG( void ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_REQUEST_SERVICE_RECORD_FROM_HD; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleDGServiceScheduleData function receives the HD version of the * DG service record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGServiceScheduleData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( DG_SERVICE_RECORD_T ) ) { DG_SERVICE_RECORD_T payload; memcpy( &payload, message->payload, sizeof( DG_SERVICE_RECORD_T ) ); setHDVersionDGServiceRecord( &payload ); } } /*********************************************************************//** * @brief * The handleDGUsageInfoData function receives the HD version of the * DG usage info. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleDGUsageInfoData( MESSAGE_T *message ) { if ( message->hdr.payloadLen == sizeof( DG_USAGE_INFO_RECORD_T ) ) { DG_USAGE_INFO_RECORD_T payload; memcpy( &payload, message->payload, sizeof( DG_USAGE_INFO_RECORD_T ) ); setHDVersionDGUsageInfo( &payload ); } } /*********************************************************************//** * @brief * The handleSetHDServiceTime function sets the HD service time once the * command is received from UI * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDServiceTime( MESSAGE_T *message ) { BOOL result = FALSE; if ( 0 == message->hdr.payloadLen ) { result = setServiceTime(); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } /*********************************************************************//** * @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDUsageInfoRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_USAGE_INFO_RECORD ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetHDUsageInfoRecord function handles a request to set the HD * information record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDUsageInfoRecord( MESSAGE_T *message ) { U32 currentMessage; U32 totalMessages; U32 payloadLength; BOOL status = FALSE; U08* payloadPtr = message->payload; if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_USAGE_INFO_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The sendDGUsageInfoRecord function sends out the DG usage information record. * @details Inputs: none * @details Outputs: DG usage information record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param usageInfoAddress: start address of the susage information record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL handleSendHDUsageInfoRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* usageInfoAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_USAGE_INFO_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, usageInfoAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleSetBloodLeak2EmbeddedMode function handles a request to set the HD * blood leak to embedded mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetBloodLeak2EmbeddedMode( MESSAGE_T* message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { result = testSetBloodLeak2EmbeddedMode(); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleSetBloodLeakEmbeddedModeCommand function handles a request to set * the HD blood leak to embedded mode command. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetBloodLeakEmbeddedModeCommand( MESSAGE_T* message ) { U08 command; U16 commandPayload; BOOL result = FALSE; U08* payloadPtr = message->payload; // verify payload length if ( sizeof( U08 ) + sizeof( U16 ) == message->hdr.payloadLen ) { memcpy( &command, payloadPtr, sizeof( U08 ) ); payloadPtr += sizeof( U08 ); memcpy( &commandPayload, payloadPtr, sizeof( U16 ) ); result = testSetBloodLeakEmbeddedModeCommand( command, commandPayload ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The sendBloodLeakEmbeddedModeCommandResponse function sends out * the blood leak embedded mode command response. * @details Inputs: none * @details Outputs: blood leak embedded mode command response msg constructed and queued * @param cmd: the command its response is being sent * @param responseLen: the length of the buffer * @param response: pointer to the response buffer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendBloodLeakEmbeddedModeCommandResponse( U08 cmd, U32 responseLen, U08* response ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE; msg.hdr.payloadLen = sizeof( U08 ) + sizeof( U32 ) + responseLen; memcpy( payloadPtr, &cmd, sizeof( U08 ) ); payloadPtr += sizeof( U08 ); memcpy( payloadPtr, &responseLen, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, response, responseLen ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleResendAllAlarmsCommand function handles a request to re-send * all active HD alarms. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleResendAllAlarmsCommand( MESSAGE_T* message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { handleResendActiveAlarmsRequest(); result = TRUE; } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The sendDGServiceModeRequest function constructs a service mode request msg * to the DG and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: DG Service mode request msg constructed and queued. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendDGServiceModeRequest() { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_DG_SERVICE_MODE_REQUEST; msg.hdr.payloadLen = 0; // 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_2_DG, ACK_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleTestBloodPumpSetPWM function handles a request to override * the Blood pumps duty cycle. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestBloodPumpSetPWM( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( sizeof( F32 ) == message->hdr.payloadLen ) { F32 payLoad; memcpy( &payLoad, message->payload, sizeof( F32 ) ); result = testSetBloodPumpTargetDutyCycle( payLoad ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialInSetPWM function handles a request to override * the Dialysate Inlet pumps duty cycle. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialInSetPWM( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( sizeof( F32 ) == message->hdr.payloadLen ) { F32 payLoad; memcpy( &payLoad, message->payload, sizeof( F32 ) ); result = testSetDialInPumpTargetDutyCycle( payLoad ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestDialOutSetPWM function handles a request to override * the Dialysate Outlet pumps duty cycle. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestDialOutSetPWM( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( sizeof( F32 ) == message->hdr.payloadLen ) { F32 payLoad; memcpy( &payLoad, message->payload, sizeof( F32 ) ); result = testSetDialOutPumpTargetDutyCycle( payLoad ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDNVRecordCRCOverride function handles a request to override * the selected NV record's CRC. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDNVRecordCRCOverride( 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 ) ); result = testSetNVRecordCRCOverride( payload.index, (U16)payload.state.u32 ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleAirPumpIntervalOverrideRequest function handles a request to override * the air pump's broadcast interval. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAirPumpIntervalOverrideRequest( 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 = testSetAirPumpDataPublishIntervalOverride( (U32)( payload.state.u32 ) ); } else { result = testResetAirPumpDataPublishIntervalOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleAirPumpSetState function handles a request to set the * air pump state. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleAirPumpSetState( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( sizeof( U32 ) == message->hdr.payloadLen ) { U32 payLoad; memcpy( &payLoad, message->payload, sizeof( U32 ) ); result = testSetAirPump( payLoad ); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleHDRTCControlReg1StatusOverrideRequest function handles a * request to override RTC control register 1. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleHDRTCControlReg1StatusOverrideRequest( 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 = testSetRTCCtlReg1Status( payload.state.u32 ); } else { result = testResetRTCCtlReg1Status(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleHDRTCControlReg3StatusOverrideRequest function handles a * request to override RTC control register 3. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleHDRTCControlReg3StatusOverrideRequest( 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 = testSetRTCCtlReg3Status( payload.state.u32 ); } else { result = testResetRTCCtlReg3Status(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBatteryStatusOverrideRequest function handles a * request to override battery status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBatteryStatusOverrideRequest( 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 = testSetBatteryStatusOverride( payload.state.u32 ); } else { result = testResetBatteryStatusOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBatteryChargerStatusOverrideRequest function handles a * request to override battery charger status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBatteryChargerStatusOverrideRequest( 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 = testSetBatteryChargerStatusOverride( payload.state.u32 ); } else { result = testResetBatteryChargerStatusOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBatteryStatusOverrideRequest function handles a * request to override battery status. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBatteryI2CStatusOverrideRequest( 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 = testSetBatteryI2CStatusOverride( payload.state.u32 ); } else { result = testResetBatteryI2CStatusOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleDialInPumpHardStopRequest function handles a * request to stop the dial in pump. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleDialInPumpHardStopRequest( MESSAGE_T * message ) { BOOL result = FALSE; // Verify payload length if ( ( 0 == message->hdr.payloadLen ) && ( TRUE == isTestingActivated() ) ) { result = TRUE; signalDialInPumpHardStop(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleDialOutPumpHardStopRequest function handles a * request to stop the dial out pump. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleDialOutPumpHardStopRequest( MESSAGE_T *message ) { BOOL result = FALSE; // Verify payload length if ( ( 0 == message->hdr.payloadLen ) && ( TRUE == isTestingActivated() ) ) { result = TRUE; signalDialOutPumpHardStop(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBloodPumpHardStopRequest function handles a * request to stop the blood pump. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBloodPumpHardStopRequest( MESSAGE_T *message ) { BOOL result = FALSE; // Verify payload length if ( ( 0 == message->hdr.payloadLen ) && ( TRUE == isTestingActivated() ) ) { result = TRUE; signalBloodPumpHardStop(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleEnableVenousBubbleAlarmDetectionRequest function handles a * request to enable/disable venous bubble alarm detection. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleEnableVenousBubbleAlarmDetectionRequest( MESSAGE_T *message ) { BOOL result = FALSE; // Verify payload length if ( sizeof( BOOL ) == message->hdr.payloadLen ) { BOOL enabled; memcpy( &enabled, message->payload, sizeof( BOOL ) ); result = TRUE; setVenousBubbleDetectionEnabled( enabled ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDGetTestConfig function handles a request to get the * test configuration per request. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDGetTestConfig( MESSAGE_T* message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { result = sendTestConfigStatusToDialin(); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDResetAllTestConfigs function handles a request to reset * all of the test configurations. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDResetAllTestConfigs( MESSAGE_T* message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { result = resetAllTestConfigs(); } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDDialinCheckIn function handles check in from Dialin. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDDialinCheckIn( MESSAGE_T* message ) { if ( 0 == message->hdr.payloadLen ) { setDialinCheckInTimeStamp(); } } /*********************************************************************//** * @brief * The handleTestHDSetTestConfig function handles a request to set the * test configuration. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDSetTestConfig( MESSAGE_T *message ) { BOOL status = FALSE; if ( message->hdr.payloadLen == sizeof( TEST_CONFIG_PAYLOAD_T ) ) { TEST_CONFIG_PAYLOAD_T payload; memcpy( &payload, message->payload, sizeof( TEST_CONFIG_PAYLOAD_T ) ); if ( TRUE == payload.reset ) { status = resetTestConfig( (TEST_CONFIG_T)payload.config ); } else { status = setTestConfig( (TEST_CONFIG_T)payload.config ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleTestHDSetRecoverFromFaultModeSignal function handles a request to * set the signal to recover from the fault mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDSetRecoverFromFaultModeSignal( MESSAGE_T* message ) { BOOL status = FALSE; if ( 0 == message->hdr.payloadLen ) { status = TRUE; setRecoverFromFaultModeSignal(); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleTestHDRAMStatusOverrideRequest function handles a request to * override the RAM status register. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDRAMStatusOverrideRequest( 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 = testSetRAMStatusOverride( payload.index, payload.state.u32 ); } else { result = testResetRAMStatusOverride( payload.index ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDPendingACKOverrideRequest function handles a * request to override pending ACKs. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDPendingACKOverrideRequest( 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 = testSetPendingACKOverride( payload.state.u32 ); } else { result = testResetPendingACKOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleTestHDRecirulationPctOverrideRequest function handles a * request to override recirulation percentage. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDRecirulationPctOverrideRequest( 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 = testSetRecirculationLevelPctOverride( payload.state.f32 ); } else { result = testResetRecirculationLevelPctOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleGetHDInstitutionalRecord function handles a request to get the HD * institutional record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleGetHDInstitutionalRecord( MESSAGE_T *message ) { BOOL result = FALSE; // verify payload length if ( 0 == message->hdr.payloadLen ) { // Tester must be logged in if ( TRUE == isTestingActivated() ) { result = sendRecordToDialin( NVDATAMGMT_INTITUTIONAL_RECORD ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The sendHDInstitutionalRecord function sends out the HD institutional record. * @details Inputs: none * @details Outputs: HD institutional record msg constructed and queued * @param msgCurrNum: current payload number * @param msgTotalNum: total number of payloads * @param length: buffer length to be written * @param srvcRcrdAddress: start address of the institutional record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL sendHDInstitutionalRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SEND_INSTITUTIONAL_RECORD; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &length, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, srvcRcrdAddress, length ); // 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_PC, ACK_NOT_REQUIRED ); return result; } /*********************************************************************//** * @brief * The handleSetHDInstitutionalRecord function handles a request to set the HD * institutional data record. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDInstitutionalRecord( MESSAGE_T *message ) { BOOL status = FALSE; U08* payloadPtr = message->payload; U32 currentMessage; U32 totalMessages; U32 payloadLength; if ( ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) && ( MODE_SERV == getCurrentOperationMode() ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&totalMessages, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); memcpy(&payloadLength, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); status = receiveRecordFromDialin( NVDATAMGMT_INTITUTIONAL_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /*********************************************************************//** * @brief * The handleBloodLeakEmbModeInfoValuesOverride function handles the blood * leak embedded mode info commands override. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleBloodLeakEmbModeInfoValuesOverride( 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 = testSetBloodLeakEmbeddedModeInfoOverride( payload.index, payload.state.u32 ); } else { result = testResetBloodLeakEmbeddedModeInfoOverride( payload.index ); } } // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBloodLeakIntensityMovingAverageOverride function handles a * request to override the blood leak intensity moving average. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBloodLeakIntensityMovingAverageOverride( 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 = testSetBloodLeakIntensityMovingAverageOverride( payload.state.f32 ); } else { result = testResetBloodLeakIntensityMovingAverageOverride(); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** * @brief * The handleBloodLeakZeroingIntervalInMinutesOverride function handles a * request to override the blood leak zeroing interval in minutes. * @details Inputs: none * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ void handleBloodLeakZeroingIntervalInMinutesOverride( 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 = testSetBloodLeakZeroingIntervalInMinsOverride( payload.index, payload.state.u32 ); } else { result = testResetBloodLeakZeroingIntervalInMinsOverride( payload.index ); } } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /**@}*/