Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r2c16de14d2acd2aa1e36943f95c3855da094dc97 -r8492830da5862d7eeaea89d30efb5ea5dcc22572 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 2c16de14d2acd2aa1e36943f95c3855da094dc97) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 8492830da5862d7eeaea89d30efb5ea5dcc22572) @@ -33,6 +33,7 @@ #include "LevelSensors.h" #include "Messaging.h" #include "ModeInitPOST.h" +#include "ModePostTreat.h" #include "ModePreTreat.h" #include "ModeStandby.h" #include "ModeTreatment.h" @@ -143,6 +144,10 @@ { MSG_ID_UI_BLOOD_PRESSURE_REQUEST, &bpModuleHandleVitalsRequest }, { MSG_ID_FFU_SIGNAL_TD_UPDATE_AVAILABLE, &handleUpdateAvailable }, { MSG_ID_UI_FLUID_BOLUS_REQUEST, &handleFluidBolusRequest }, + { MSG_ID_UI_DISINFECT_REQUEST, &handleUIDisinfectRequest }, + { MSG_ID_UI_PATIENT_DISCONNECT_CONFIRM_REQUEST, &handlePatientDisconnectionConfirmCmd }, + { MSG_ID_UI_POST_TREATMENT_DISPOSABLE_REMOVAL_CONFIRM_REQUEST, &handleDisposableRemovalConfirmCmd }, + { MSG_ID_TD_DISINFECT_RESPONSE, &handleDisinfectionConfirmCmd }, { MSG_ID_UI_RINSEBACK_CMD_REQUEST, &signalRinsebackUserAction }, { MSG_ID_UI_RECIRCULATE_REQUEST, &signalTreatmentRecircUserAction }, { MSG_ID_UI_GENERIC_CONFIRMATION_RESULT_RESPONSE, &handleUIConfirmation }, @@ -538,8 +543,8 @@ * @brief * The handleUIVersionResponse function handles a response to request for * UI version information. - * @details Inputs: none - * @details Outputs: none + * @details \b Inputs: none + * @details \b Outputs: none * @param message a pointer to the message to handle. * @return none *************************************************************************/ @@ -560,6 +565,51 @@ } /*********************************************************************//** + * @brief + * The handlePatientDisconnectionConfirmCmd function handles user + * confirmation of patient disconnection. + * @details \b Inputs: Patient disconnection confirmation message. + * @details \b Outputs: Acceptance response and patient disconnection signal. + * @param message Pointer to the message to handle. + * @return TRUE if the confirmation is accepted, FALSE otherwise. + *************************************************************************/ +BOOL handlePatientDisconnectionConfirmCmd( MESSAGE_T *message ) +{ + BOOL result = FALSE; + BOOL modeValid = FALSE; + TD_OP_MODE_T mode = getCurrentOperationMode(); + UI_RESPONSE_PAYLOAD_T response; + + response.rejectionReason = REQUEST_REJECT_REASON_NONE; + + if ( 0 == message->hdr.payloadLen ) + { + modeValid = ( MODE_POST == mode ) ? TRUE : FALSE; + + if ( ( TRUE != modeValid ) ) + { + response.rejectionReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; + } + else + { + signalUserConfirmPatientDisconnection(); + result = TRUE; + } + } + else + { + response.rejectionReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + response.accepted = result; + sendMessage( MSG_ID_TD_PATIENT_DISCONNECT_CONFIRM_RESPONSE, + COMM_BUFFER_OUT_CAN_TD_2_UI, (U08*)(&response), + sizeof( UI_RESPONSE_PAYLOAD_T ) ); + + return result; +} + +/*********************************************************************//** * The sendPOSTFinalResult function sends the overall TD POST result * and queues the message for transmit on the appropriate CAN channel. * @details \b Message \b Sent: MSG_ID_TD_POST_FINAL_TEST_RESULT @@ -576,6 +626,55 @@ /*********************************************************************//** * @brief + * The handleDisposableRemovalConfirmCmd function handles user confirmation + * of disposable removal. + * @details \b Inputs: Disposable removal confirmation message. + * @details \b Outputs: Acceptance response and disposable removal signal. + * @param message Pointer to the message to handle. + * @return TRUE if the confirmation is accepted, FALSE otherwise. + *************************************************************************/ +BOOL handleDisposableRemovalConfirmCmd( MESSAGE_T *message ) +{ + BOOL result = FALSE; + BOOL modeValid = FALSE; + TD_OP_MODE_T mode = getCurrentOperationMode(); + UI_RESPONSE_PAYLOAD_T response; + + response.rejectionReason = REQUEST_REJECT_REASON_NONE; + + if ( 0 == message->hdr.payloadLen ) + { + modeValid = ( MODE_POST == mode ) ? TRUE : FALSE; + + if ( FALSE == modeValid ) + { + response.rejectionReason = + REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; + } + else + { + signalUserConfirmDisposableRemoval(); + result = TRUE; + } + } + else + { + response.rejectionReason = + REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + response.accepted = result; + + sendMessage( MSG_ID_TD_POST_TREATMENT_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE, + COMM_BUFFER_OUT_CAN_TD_2_UI, + (U08 *)&response, + sizeof( UI_RESPONSE_PAYLOAD_T ) ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleUIConfirmationResponse function handles a UI response for a * confirmation request. * @details \b Inputs: none @@ -607,6 +706,7 @@ return result; } + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // ***********************************************************************