Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -re8f30ca933a7c373c1a4a749ad84adb2f63b7722 -r16b178ff7528cb09c66413d19980a4eb0d13b48e --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision e8f30ca933a7c373c1a4a749ad84adb2f63b7722) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 16b178ff7528cb09c66413d19980a4eb0d13b48e) @@ -189,7 +189,17 @@ *************************************************************************/ void signalUserConfirmDisposableRemoval( void ) { - disposableRemovalConfirmed = TRUE; + BOOL accepted = FALSE; + REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_DRAIN_NOT_COMPLETE; + + if ( DRAIN_COMPLETE_STATE == currentDrainReservoirState ) + { + disposableRemovalConfirmed = TRUE; + accepted = TRUE; + rejReason = REQUEST_REJECT_REASON_NONE; + } + + sendDisposableRemovalConfirmResponse( accepted, rejReason ); } /*********************************************************************//** Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re8f30ca933a7c373c1a4a749ad84adb2f63b7722 -r16b178ff7528cb09c66413d19980a4eb0d13b48e --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e8f30ca933a7c373c1a4a749ad84adb2f63b7722) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 16b178ff7528cb09c66413d19980a4eb0d13b48e) @@ -64,7 +64,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 @@ -207,6 +208,38 @@ 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 ******************** @@ -552,6 +585,22 @@ /*********************************************************************//** * @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_UI_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE, accepted, reason ); +} + +/*********************************************************************//** + * @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 Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -re8f30ca933a7c373c1a4a749ad84adb2f63b7722 -r16b178ff7528cb09c66413d19980a4eb0d13b48e --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision e8f30ca933a7c373c1a4a749ad84adb2f63b7722) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 16b178ff7528cb09c66413d19980a4eb0d13b48e) @@ -191,9 +191,12 @@ // MSG_ID_UI_PATIENT_DISCONNECTION_CONFIRM void handlePatientDisconnectionConfirmCmd( MESSAGE_T *message ); -// MSG_ID_HD_DISPOSABLE_REMOVAL_CONFIRM +// MSG_ID_UI_DISPOSABLE_REMOVAL_CONFIRM void handleDisposableRemovalConfirmCmd( MESSAGE_T *message ); +// MSG_ID_UI_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE +BOOL sendDisposableRemovalConfirmResponse( BOOL accepted, U32 reason ); + // MSG_ID_HD_TREATMENT_LOG_DATA BOOL sendTreatmentLogData( TREATMENT_LOG_DATA_PAYLOAD_T *logDataPtr );