Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -r3d5a2ff09f3f4983699bfc61c7b63df1732970e0 -r8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72 --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 3d5a2ff09f3f4983699bfc61c7b63df1732970e0) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72) @@ -22,6 +22,7 @@ #include "DialOutFlow.h" #include "ModeTreatment.h" #include "OperationModes.h" +#include "SystemCommMessages.h" #include "TaskGeneral.h" #include "TreatmentStop.h" #include "Valves.h" @@ -321,7 +322,7 @@ * @param action User action requested * @return none *************************************************************************/ -void signalTreatmentEndUserAction( REQUESTED_TREATMENT_RECIRC_USER_ACTIONS_T action ) +void signalTreatmentEndUserAction( REQUESTED_TREATMENT_END_USER_ACTIONS_T action ) { BOOL accepted = FALSE; REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; @@ -346,7 +347,7 @@ } // Respond to user action request - sendRinsebackCmdResponse( accepted, (U32)rejReason ); + sendTreatmentEndCmdResponse( accepted, (U32)rejReason ); } /*********************************************************************//** Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r49dba1e95bb3763b4c150e7a80b84a65264a7ca8 -r8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 49dba1e95bb3763b4c150e7a80b84a65264a7ca8) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72) @@ -1203,6 +1203,10 @@ handleTreatmentRecircCmd( message ); break; + case MSG_ID_UI_TX_END_CMD: + handleTreatmentEndCmd( message ); + break; + case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1b27784f400d03678a1441cd70ab1c4111bbfa04 -r8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1b27784f400d03678a1441cd70ab1c4111bbfa04) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72) @@ -33,6 +33,7 @@ #include "SafetyShutdown.h" #include "SystemComm.h" #include "SystemCommMessages.h" +#include "TreatmentEnd.h" #include "TreatmentRecirc.h" #include "Utilities.h" #include "Valves.h" @@ -2142,6 +2143,63 @@ 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_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 Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1b27784f400d03678a1441cd70ab1c4111bbfa04 -r8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1b27784f400d03678a1441cd70ab1c4111bbfa04) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 8000e5d68a7a0ed6d1b43d8e6778a246ff0d8e72) @@ -169,6 +169,12 @@ // MSG_ID_HD_RECIRC_CMD_RESPONSE BOOL sendTreatmentRecircCmdResponse( BOOL accepted, U32 rejReason ); +// MSG_ID_UI_TX_END_CMD: +void handleTreatmentEndCmd( MESSAGE_T *message ); + +// MSG_ID_HD_RECIRC_CMD_RESPONSE +BOOL sendTreatmentEndCmdResponse( BOOL accepted, U32 rejReason ); + // MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS BOOL sendDialysateTempTargetsToDG( F32 primary, F32 trimmer );