Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rbd8d1a18ca5d9dd52c1082f74c19b90ca925af92 -r5ea32b3039d77bda54cecc0740ccc489812b943d --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bd8d1a18ca5d9dd52c1082f74c19b90ca925af92) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5ea32b3039d77bda54cecc0740ccc489812b943d) @@ -20,8 +20,9 @@ #include "reg_system.h" #include "Accel.h" -#include "AlarmLamp.h" -#include "Buttons.h" +#include "AlarmLamp.h" +#include "Buttons.h" +#include "ConsumableSelfTest.h" #include "DGInterface.h" #include "FPGA.h" #include "ModePreTreat.h" @@ -31,6 +32,7 @@ #include "OperationModes.h" #include "PresOccl.h" #include "RTC.h" +#include "SampleWater.h" #include "SafetyShutdown.h" #include "SystemComm.h" #include "SystemCommMessages.h" @@ -63,7 +65,8 @@ static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); -static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); +static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); +static BOOL sendUIResponseMsg( MSG_ID_T msgID, BOOL accepted, U32 reason ); /*********************************************************************//** * @brief @@ -180,9 +183,9 @@ /*********************************************************************//** * @brief - * The sendTestAckResponseMsg function constructs a simple response - * message for a handled test message and queues it for transmit on the - * appropriate UART channel. + * 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 @@ -206,10 +209,44 @@ 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; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = msgID; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &reason, 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; +} + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** + /*********************************************************************//** * @brief @@ -506,8 +543,239 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; -} +} +/*********************************************************************//** + * @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 ); + } + + 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 ); + } + + 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(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); +} + +/*********************************************************************//** + * @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(); + } + + 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(); + } + + 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(); + } + + 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(); + } + + 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(); + } + + 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 sendDialysateTempTargetsToDG function constructs a dialysate temperature @@ -600,11 +868,12 @@ * 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. + * @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 * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGFillCommand( U32 fillToVolumeMl ) +BOOL sendDGFillCommand( U32 cmd, U32 fillToVolumeMl ) { BOOL result; MESSAGE_T msg; @@ -613,10 +882,12 @@ // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_FILL_CMD; - msg.hdr.payloadLen = sizeof( U32 ); + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &fillToVolumeMl, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &cmd, sizeof( U32 ) ); - memcpy( payloadPtr, &fillToVolumeMl, 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 ); @@ -716,18 +987,21 @@ * 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. + * @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( void ) +BOOL sendDGSampleWaterCommand( SAMPLE_WATER_CMD_T cmd ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_SAMPLE_WATER_CMD; - msg.hdr.payloadLen = 0; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( msg.payload, &cmd, 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 ); @@ -1109,7 +1383,7 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); return result; -} +} /*********************************************************************//** * @brief @@ -1228,6 +1502,34 @@ return result; } + +/*********************************************************************//** + * @brief + * The broadcastPreTreatmentState function constructs a pre-treatment state msg to + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: pre-treatment state msg constructed and queued + * @param preTreatmentDataPtr pointer to pre-treatment data record to broadcast + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastPreTreatmentState( PRE_TREATMENT_STATE_DATA_T *preTreatmentDataPtr ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_PRE_TREATMENT_STATE; + msg.hdr.payloadLen = sizeof( PRE_TREATMENT_STATE_DATA_T ); + + memcpy( payloadPtr, preTreatmentDataPtr, sizeof( PRE_TREATMENT_STATE_DATA_T ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} /*********************************************************************//** * @brief @@ -1491,12 +1793,73 @@ return result; } +/*********************************************************************//** + * @brief + * The broadcastNoCartSelfTestTime function sends out the no cartridge self-test + * progress data. + * @details Inputs: none + * @details Outputs: no cartridge self-test time data msg constructed and queued + * @param timeout no cartridge self-test timeout (in sec) + * @param countdown no cartridge self-test timeout count down (in sec) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastNoCartSelfTestTime( U32 timeout, U32 countdown ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_NO_CART_SELF_TEST_PROGRESS; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &timeout, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &countdown, sizeof( U32 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The broadcastDrySelfTestTime function sends out the dry self-test progress data. + * @details Inputs: none + * @details Outputs: dry self-test time data msg constructed and queued + * @param timeout dry self-test timeout (in sec) + * @param countdown dry self-test timeout count down (in sec) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastDrySelfTestTime( U32 timeout, U32 countdown ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_DRY_SELF_TEST_PROGRESS; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &timeout, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &countdown, sizeof( U32 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + /***********************************************************************//** * @brief - * The broadcastAirTrapData function constructs an HD air trap data msg to \n + * The broadcastPrimeData function constructs a priming status data msg to \n * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none - * @details Outputs: air trap data msg constructed and queued + * @details Outputs: priming data msg constructed and queued * @param primeDataPtr prime data record pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -1897,14 +2260,14 @@ /*********************************************************************//** * @brief - * The handleUIStartTreatmentMsg function handles a treatment start/cancel + * 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 handleUIStartTreatmentMsg( MESSAGE_T *message ) +void handleInitiateTreatmentRequest( MESSAGE_T *message ) { BOOL result = FALSE; @@ -1914,17 +2277,13 @@ memcpy( &cmd, message->payload, sizeof(U32) ); - if ( 0 == cmd ) // Initiate treatment (go to treatment params mode) + if ( 0 == cmd ) // Cancel treatment (return from aborted treatment params mode) { - result = signalUserStartingTreatment(); - } - else if ( 1 == cmd ) // Cancel treatment (return from aborted treatment params mode) - { result = signalUserCancelTreatment(); } - else if ( 2 == cmd ) // Start treatment + else if ( 1 == cmd ) // Initiate treatment (go to treatment params mode) { - result = signalUserBeginningTreatment(); + result = signalUserInitiateTreatment(); } } @@ -1933,34 +2292,18 @@ /*********************************************************************//** * @brief - * The sendTreatmentStartResponseMsg function constructs a treatment start - * request response message to the UI and queues the msg for transmit on + * The sendInitiateTreatmentResponseMsg function constructs a initiate treatment + * 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 sendTreatmentStartResponseMsg( BOOL accepted, U32 reason ) +BOOL sendInitiateTreatmentResponseMsg( BOOL accepted, U32 reason ) { - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_START_TREATMENT_RESPONSE; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); - - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &reason, 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; + return sendUIResponseMsg( MSG_ID_HD_INITIATE_TREATMENT_RESPONSE, accepted, reason ); } /*********************************************************************//** @@ -2071,6 +2414,7 @@ memcpy( &uFVolumeMl, message->payload, sizeof(F32) ); result = validateAndSetUFVolume( uFVolumeMl ); + setUserSetUFVolumeStatus( result ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rbd8d1a18ca5d9dd52c1082f74c19b90ca925af92 -r5ea32b3039d77bda54cecc0740ccc489812b943d --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision bd8d1a18ca5d9dd52c1082f74c19b90ca925af92) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5ea32b3039d77bda54cecc0740ccc489812b943d) @@ -26,7 +26,8 @@ #include "DialInFlow.h" #include "DialOutFlow.h" #include "Dialysis.h" -#include "Prime.h" +#include "Prime.h" +#include "ModePreTreat.h" #include "ModeTreatment.h" #include "MsgQueues.h" #include "NVDataMgmt.h" @@ -94,11 +95,11 @@ // MSG_ID_DG_RESERVOIR_DATA: void handleDGReservoirData( MESSAGE_T *message ); -// MSG_ID_UI_START_TREATMENT -void handleUIStartTreatmentMsg( MESSAGE_T *message ); +// MSG_ID_UI_INITIATE_TREATMENT_REQUEST +void handleInitiateTreatmentRequest( MESSAGE_T *message ); -// MSG_ID_HD_START_TREATMENT_RESPONSE -BOOL sendTreatmentStartResponseMsg( BOOL accepted, U32 reason ); +// MSG_ID_UI_INITIATE_TREATMENT_RESPONSE +BOOL sendInitiateTreatmentResponseMsg( BOOL accepted, U32 reason ); // MSG_ID_UI_NEW_TREATMENT_PARAMS void handleTreatmentParametersFromUI( MESSAGE_T *message ); @@ -187,6 +188,47 @@ // MSG_ID_HD_RECIRC_CMD_RESPONSE BOOL sendTreatmentEndCmdResponse( BOOL accepted, U32 rejReason ); +// MSG_ID_UI_SAMPLE_WATER_CMD +void handleSampleWaterCmd( MESSAGE_T *message ); + +// MSG_ID_HD_SAMPLE_WATER_CMD_RESPONSE +BOOL sendSampleWaterCmdResponse( BOOL accepted, U32 reason ); + +// MSG_ID_UI_SAMPLE_WATER_RESULT +void handleSampleWaterResult( MESSAGE_T *message ); + +// MSG_ID_UI_CONSUMABLE_INSTALL_CONFIRM +void handleConsumableInstallConfirm( MESSAGE_T *message ); + +// MSG_ID_UI_INSTALLATION_CONFIRM +void handleInstallationConfirm( MESSAGE_T *message ); + +// MSG_ID_UI_START_PRIME_REQUEST +void handleStartPrimeCmd( MESSAGE_T *message ); + +// MSG_ID_HD_START_PRIME_RESPONSE +BOOL sendStartPrimeCmdResponse( BOOL accepted, U32 reason ); + +// MSG_ID_UI_CONTINUE_TO_TREATMENT_REQUEST +void handleContinueToTreatmentCmd( MESSAGE_T *message ); + +// MSG_ID_HD_CONTINUE_TO_TREATMENT_RESPONSE +BOOL sendContinueToTreatmentCmdResponse( BOOL accepted, U32 reason ); + +// MSG_ID_UI_PATIENT_CONNECTION_CONFIRM +void handlePatientConnectionConfirmCmd( MESSAGE_T *message ); + +// MSG_ID_HD_PATIENT_CONNECTION_CONFIRM_RESPONSE +BOOL sendPatientConnectionConfirmCmdResponse( BOOL accepted, U32 reason ); + +// MSG_ID_UI_START_TREATMENT_REQUEST +void handleStartTreatmentRequest( MESSAGE_T *message ); + +// MSG_ID_HD_START_TREATMENT_RESPONSE +BOOL sendStartTreatmentResponse( BOOL accepted, U32 reason ); + +// *********** public DG command functions ********** + // MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS BOOL sendDialysateTempTargetsToDG( F32 primary, F32 trimmer ); @@ -197,7 +239,7 @@ BOOL sendDGChangeValveSettingCommand( U32 valveSettingCmd ); // MSG_ID_DG_FILL_CMD -BOOL sendDGFillCommand( U32 fillToVolumeMl ); +BOOL sendDGFillCommand( U32 cmd, U32 fillToVolumeMl ); // MSG_ID_DG_DRAIN_CMD BOOL sendDGDrainCommand( DRAIN_RESERVOIR_CMD_PAYLOAD_T *drainCmdPtr ); @@ -209,14 +251,16 @@ BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start, F32 trimmerHtrTemp ); // MSG_ID_DG_SAMPLE_WATER_CMD -BOOL sendDGSampleWaterCommand( void ); +BOOL sendDGSampleWaterCommand( SAMPLE_WATER_CMD_T cmd ); // MSG_ID_DG_COMMAND_RESPONSE void handleDGCmdResp( MESSAGE_T *messagePtr ); // MSG_ID_DG_OP_MODE void handleDGOpMode( MESSAGE_T *message ); +// *********** public data broad cast functions ********** + // MSG_ID_HD_ACCELEROMETER_DATA BOOL broadcastAccelData( F32 x, F32 y, F32 z, F32 xm, F32 ym, F32 zm, F32 xt, F32 yt, F32 zt ); @@ -242,7 +286,7 @@ BOOL broadcastDialInFlowData( DIALIN_PUMP_STATUS_PAYLOAD_T *dialInData ); // MSG_ID_DIALYSATE_OUT_FLOW_DATA -BOOL broadcastDialOutFlowData( DIAL_OUT_FLOW_DATA_T *dialOutFlowData ); +BOOL broadcastDialOutFlowData( DIAL_OUT_FLOW_DATA_T *dialOutFlowData ); // MSG_ID_HD_SYRINGE_PUMP_DATA BOOL broadcastSyringePumpData( SYRINGE_PUMP_DATA_PAYLOAD_T data ); @@ -261,6 +305,9 @@ // MSG_ID_TREATMENT_STATE BOOL broadcastTreatmentState( TREATMENT_STATE_DATA_T payload ); + +// MSG_ID_PRE_TREATMENT_STATE +BOOL broadcastPreTreatmentState( PRE_TREATMENT_STATE_DATA_T *preTreatmentDataPtr ); // MSG_ID_POWER_OFF_WARNING BOOL broadcastPowerOffWarning( void ); @@ -289,6 +336,12 @@ // MSG_ID_HD_AIR_TRAP_DATA BOOL broadcastAirTrapData( AIR_TRAP_LEVELS_T lowerLevel, AIR_TRAP_LEVELS_T upperLevel ); +// MSG_ID_HD_NO_CART_SELF_TEST_PROGRESS +BOOL broadcastNoCartSelfTestTime( U32 timeout, U32 countdown ); + +// MSG_ID_HD_DRY_SELF_TEST_PROGRESS +BOOL broadcastDrySelfTestTime( U32 timeout, U32 countdown ); + // MSG_ID_HD_PRIMING_STATUS_DATA BOOL broadcastPrimeData( PRIMING_DATA_PAYLOAD_T *primeDataPtr );