Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r9fe5e1e935ff1eb15960de3349c74544f49dfcd2 -r6e23d627c3f5a1ef3f7cca5d4e48eb478b0eef4c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 9fe5e1e935ff1eb15960de3349c74544f49dfcd2) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6e23d627c3f5a1ef3f7cca5d4e48eb478b0eef4c) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Sean Nash -* @date (last) 08-Mar-2023 +* @date (last) 28-Mar-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -287,7 +287,7 @@ * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: Off button msg constructed and queued. - * @param cmd 0=prompt user to confirm, 1=cancel prompt, 2=reject user off request + * @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 ) @@ -303,7 +303,7 @@ 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 ) ); + 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 ); @@ -726,7 +726,7 @@ } else { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } @@ -747,7 +747,7 @@ } else { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } } @@ -839,18 +839,22 @@ memcpy( &cmd, message->payload, sizeof(U32) ); - if ( 0 == cmd ) // Command 0 = Flush + if ( DG_DISINFECT_FLUSH_STATE == cmd ) // Command 0 = Flush { result = signalUserInitiateFlushMode(); } - else if ( 1 == cmd ) // Command 1 = Heat disinfect + else if ( DG_DISINFECT_HEAT_STATE == cmd ) // Command 1 = Heat disinfect { result = signalUserInitiateHeatDisinfectMode(); } - else if ( 2 == cmd ) // Command 2 = chemical disinfect + 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 = signalUserInitiateChemcialDisinfectFlushMode(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); @@ -886,7 +890,7 @@ { U32 cmd; - if ( message->hdr.payloadLen == sizeof( U32 ) ) + if ( sizeof( U32 ) == message->hdr.payloadLen ) { memcpy( &cmd, &message->payload[0], sizeof( U32 ) ); signalInitiateStandbyDisinfectSubmode( cmd ); @@ -1214,7 +1218,7 @@ *************************************************************************/ void handleInstallationConfirm( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == 0) + if ( 0 == message->hdr.payloadLen) { signalUserConfirmInstallation(); } @@ -1793,6 +1797,35 @@ /*********************************************************************//** * @brief + * The sendDGStartChemicalDisinfectFlushModeCommand 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 sendDGStartChemicalDisinfectFlushModeCommand( 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 @@ -2031,7 +2064,7 @@ void handleUICheckIn( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == 0 ) + if ( message->hdr.payloadLen == sizeof( U32 ) ) { checkInFromUI(); } @@ -3158,7 +3191,7 @@ void handleUIVersionResponse( MESSAGE_T *message ) { // Get UI version data and have it recorded - if ( message->hdr.payloadLen == sizeof(UI_VERSIONS_T) ) + if ( sizeof(UI_VERSIONS_T) == message->hdr.payloadLen ) { UI_VERSIONS_T uiVersion; @@ -3317,7 +3350,7 @@ if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) { - setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T) request_id, (CONFIRMATION_REQUEST_STATUS_T) status ); + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); } } @@ -3329,10 +3362,10 @@ * The sendConfirmationRequest function sends a confirmation request to UI * @details Inputs: none * @details Outputs: none - * @param request ID - * @param request type - * @param reject reason - * @return request ID - will be non-zero if sent + * @param request_id ID of confirmation being requested + * @param request_type Type of confirmation being requested + * @param reject_reason Reason Reason for reject if type is reject + * @return none *************************************************************************/ void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) { @@ -3357,7 +3390,33 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_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; + // The payload length is U32 Request ID, U32 Type + 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 ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -7196,7 +7255,7 @@ DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; - if ( message->hdr.payloadLen == 0 ) + if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { @@ -7952,4 +8011,73 @@ 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() ) ) + { + 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() ) ) + { + 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() ) ) + { + signalBloodPumpHardStop(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/