Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rb55b4aad2941b470c5652aad5538a1bbb28a76ed -r495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision b55b4aad2941b470c5652aad5538a1bbb28a76ed) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6) @@ -1205,7 +1205,7 @@ endTreatmentRequest = FALSE; rinsebackToRecircRequest = FALSE; bloodPrimeToDialysisRequest = FALSE; -// treatmentEndToRinsebackRequest = FALSE; +// treatmentEndToRinsebackRequest = FALSE; // TODO: Declare & uncomment when end treat is implemented. recirculateToBloodPrimeRequest = FALSE; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -rb55b4aad2941b470c5652aad5538a1bbb28a76ed -r495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision b55b4aad2941b470c5652aad5538a1bbb28a76ed) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6) @@ -491,11 +491,15 @@ // Send UI clear if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) { - sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); + sendConfirmationRequest( confirmRequests[ i ].requestID, + GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, + 0 ); } else { - sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, 0 ); + sendConfirmationRequest( confirmRequests[ i ].requestID, + GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, + 0 ); } // Clear the confirmation request, it is done and consumed @@ -526,7 +530,9 @@ if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) { // Last confirmation cleared, pending request must be resent to UI - sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, confirmRequests[ pendingIndex ].requestType, 0 ); + sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, + confirmRequests[ pendingIndex ].requestType, + 0 ); } return status; Index: firmware/App/Services/Messaging.c =================================================================== diff -u -ra218d123f6595a403ffe1de3ca50cfd0bf4fc893 -r495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision a218d123f6595a403ffe1de3ca50cfd0bf4fc893) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6) @@ -563,6 +563,54 @@ 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 + * @details \b Inputs: none + * @details \b Outputs: TD POST final result msg queued for CAN transmit. + * @param passed TRUE if all TD POST tests passed, FALSE otherwise. + * @return TRUE if message successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPOSTFinalResult( BOOL passed ) +{ + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_FINAL_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08 *)&passed, sizeof( BOOL ) ); +} + +/*********************************************************************//** + * @brief + * The handleUIConfirmationResponse function handles a UI response for a + * confirmation request. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message pointer to the received confirmation response message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleUIConfirmation( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( ( 2U * sizeof(U32) ) == message->hdr.payloadLen ) + { + U32 requestID; + U32 status; + + memcpy( &requestID, message->payload, sizeof(U32) ); + memcpy( &status, message->payload + sizeof(U32), sizeof(U32) ); + + if ( ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) || + ( CONFIRMATION_REQUEST_STATUS_REJECTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) ) + { + setConfirmationRequestStatus( ( GENERIC_CONFIRM_ID_T )requestID, + ( CONFIRMATION_REQUEST_STATUS_T)status ); + result = TRUE; + } + } + + return result; +} + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -654,7 +702,61 @@ return result; } +/*********************************************************************//** + * The sendPOSTTestResult function sends the result of a single TD POST + * test to the UI. + * @details \b Message \b Sent: MSG_ID_TD_POST_SINGLE_TEST_RESULT + * @details \b Inputs: none + * @details \b Outputs: TD POST test result msg queued for CAN transmit. + * @param test ID of the TD POST test. + * @param passed TRUE if POST test passed, FALSE if POST test failed. + * @return TRUE if message successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ) +{ + U08 payload[ sizeof( BOOL ) + sizeof( U32 ) ]; + U32 testID = (U32)test; + memcpy( payload, &passed, sizeof( BOOL ) ); + memcpy( &payload[ sizeof( BOOL ) ], &testID, sizeof( U32 ) ); + + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_SINGLE_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, payload, sizeof( payload ) ); +} + +/*********************************************************************//** + * @brief + * The sendConfirmationRequest function constructs and transmits a + * confirmation request message to the UI. + * @details \b Message \b Sent: MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST + * @details \b Inputs: none + * @details \b Outputs: none + * @param requestID ID of the confirmation being requested + * @param requestType Type of confirmation being requested + * @param rejectReason Reason for reject if type is reject, 0 otherwise + * @return none + *************************************************************************/ +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, + GENERIC_CONFIRM_COMMAND_T requestType, + U32 rejectReason ) +{ + GENERIC_CONFIRMATION_REQUEST_T payload; + + payload.requestID = (U32)requestID; + payload.requestType = (U32)requestType; + payload.rejectReason = rejectReason; + payload.genericPayload1 = 0.0F; + payload.genericPayload2 = 0.0F; + payload.genericPayload3 = 0.0F; + payload.genericPayload4 = 0.0F; + + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, + COMM_BUFFER_OUT_CAN_TD_2_UI, + (U08*)&payload, + sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -794,108 +896,6 @@ /*********************************************************************//** * @brief - * The sendConfirmationRequest function constructs and transmits a - * confirmation request message to the UI. - * @details \b Message \b Sent: MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST - * @details \b Inputs: none - * @details \b Outputs: none - * @param requestID ID of the confirmation being requested - * @param requestType Type of confirmation being requested - * @param rejectReason Reason for reject if type is reject, 0 otherwise - * @return none - *************************************************************************/ -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, - GENERIC_CONFIRM_COMMAND_T requestType, - U32 rejectReason ) -{ - GENERIC_CONFIRMATION_REQUEST_T payload; - - payload.requestID = (U32)requestID; - payload.requestType = (U32)requestType; - payload.rejectReason = rejectReason; - payload.genericPayload1 = 0.0F; - payload.genericPayload2 = 0.0F; - payload.genericPayload3 = 0.0F; - payload.genericPayload4 = 0.0F; - - sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, - COMM_BUFFER_OUT_CAN_TD_2_UI, - (U08*)&payload, - sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); -} - -/*********************************************************************//** - * The sendPOSTTestResult function sends the result of a single TD POST - * test to the UI. - * @details \b Message \b Sent: MSG_ID_TD_POST_SINGLE_TEST_RESULT - * @details \b Inputs: none - * @details \b Outputs: TD POST test result msg queued for CAN transmit. - * @param test ID of the TD POST test. - * @param passed TRUE if POST test passed, FALSE if POST test failed. - * @return TRUE if message successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ) -{ - U08 payload[ sizeof( BOOL ) + sizeof( U32 ) ]; - U32 testID = (U32)test; - - memcpy( payload, &passed, sizeof( BOOL ) ); - memcpy( &payload[ sizeof( BOOL ) ], &testID, sizeof( U32 ) ); - - // Use the generic send helper for transmission. - return sendMessage( MSG_ID_TD_POST_SINGLE_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, payload, sizeof( payload ) ); -} - -/*********************************************************************//** - * @brief - * The handleUIConfirmationResponse function handles a UI response for a - * confirmation request. - * @details \b Inputs: none - * @details \b Outputs: none - * @param message pointer to the received confirmation response message - * @return TRUE if message handled successfully, FALSE if not - *************************************************************************/ -BOOL handleUIConfirmation( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( ( 2U * sizeof(U32) ) == message->hdr.payloadLen ) - { - U32 requestID; - U32 status; - - memcpy( &requestID, message->payload, sizeof(U32) ); - memcpy( &status, message->payload + sizeof(U32), sizeof(U32) ); - - if ( ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) || - ( CONFIRMATION_REQUEST_STATUS_REJECTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) ) - { - setConfirmationRequestStatus( ( GENERIC_CONFIRM_ID_T )requestID, - ( CONFIRMATION_REQUEST_STATUS_T)status ); - result = TRUE; - } - } - - 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 - * @details \b Inputs: none - * @details \b Outputs: TD POST final result msg queued for CAN transmit. - * @param passed TRUE if all TD POST tests passed, FALSE otherwise. - * @return TRUE if message successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendPOSTFinalResult( BOOL passed ) -{ - // Use the generic send helper for transmission. - return sendMessage( MSG_ID_TD_POST_FINAL_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08 *)&passed, sizeof( BOOL ) ); -} - -/*********************************************************************//** - * @brief * The testTDSoftwareResetRequest function handles a request to reset the * TD firmware processor. * @note If reset is successful, this function will not return. Index: firmware/App/Services/Messaging.h =================================================================== diff -u -rb55b4aad2941b470c5652aad5538a1bbb28a76ed -r495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6 --- firmware/App/Services/Messaging.h (.../Messaging.h) (revision b55b4aad2941b470c5652aad5538a1bbb28a76ed) +++ firmware/App/Services/Messaging.h (.../Messaging.h) (revision 495aa17426d8fcef1e14d3cfee2e0cc2c751dcd6) @@ -144,24 +144,23 @@ BOOL handleTesterLogInRequest( MESSAGE_T *message ); BOOL handleUpdateAvailable( MESSAGE_T *message ); BOOL handleUIVersionResponse( MESSAGE_T *message ); +BOOL handleUIConfirmation( MESSAGE_T *message ); // Test send message helper functions BOOL sendEvent( TD_EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ); BOOL sendUIVersionRequest( void ); BOOL sendRequestForDDResendAlarms( void ); BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ); BOOL sendPOSTFinalResult( BOOL passed ); +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, + GENERIC_CONFIRM_COMMAND_T requestType, + U32 rejectReason ); BOOL testTDSoftwareResetRequest( MESSAGE_T *message ); BOOL testSetTestConfiguration( MESSAGE_T *message ); BOOL testGetTestConfiguration( MESSAGE_T *message ); BOOL testResetAllTestConfigurations( MESSAGE_T *message ); -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, - GENERIC_CONFIRM_COMMAND_T requestType, - U32 rejectReason ); -BOOL handleUIConfirmation( MESSAGE_T *message ); - /**@}*/ #endif