Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r607854ec35335ec37a9e83976a4fb6655cc0fe90 -r863a9c650d97fbf75d56c60b907b9117d033ca94 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 607854ec35335ec37a9e83976a4fb6655cc0fe90) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 863a9c650d97fbf75d56c60b907b9117d033ca94) @@ -6995,7 +6995,6 @@ U32 currentMessage; U32 totalMessages; U32 payloadLength; - BOOL status = FALSE; U08* payloadPtr = message->payload; @@ -7019,6 +7018,72 @@ /*********************************************************************//** * @brief +* The handleUIServiceModeRequest function handles a request to enter service +* mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleUIServiceModeRequest( MESSAGE_T *message ) +{ + BOOL status = FALSE; + HD_OP_MODE_T currentMode = getCurrentOperationMode(); + REQUEST_REJECT_REASON_CODE_T reject; + + if ( 0 == message->hdr.payloadLen ) + { + if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) + { + status = TRUE; + requestNewOperationMode( MODE_SERV ); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_TREATMENT_IN_PROGRESS; + } + } + else + { + reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); + sendUIServiceModeResponse( status, (U32)reject ); +} + +/*********************************************************************//** + * @brief + * The sendUIServiceModeResponse function sends out the HD response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ +void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejCode, 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_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** +* @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. * @details Inputs: none @@ -7119,4 +7184,54 @@ return result; } +/*********************************************************************//** +* @brief +* The handleSetBloodLeak2EmbeddedMode function handles a request to set the HD +* blood leak to embedded mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetBloodLeak2EmbeddedMode( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = testSetBloodLeak2EmbeddedMode(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetBloodEmbeddedModeCommand function handles a request to set the HD +* blood leak to embedded mode command. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetBloodEmbeddedModeCommand( MESSAGE_T* message ) +{ + U08 command; + + BOOL result = FALSE; + + // verify payload length + if ( sizeof(U08) == message->hdr.payloadLen ) + { + memcpy(&command, message->payload, sizeof(U08)); + + result = testSetBloodLeakEmbeddedModeCommand( command ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/