Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r9b64066d98f80589129c28618d07cf2c3645d1c9 -r457fc704dc96f6da4e14263d576bc3ba479e36a8 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 9b64066d98f80589129c28618d07cf2c3645d1c9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 457fc704dc96f6da4e14263d576bc3ba479e36a8) @@ -3258,7 +3258,73 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } +/*********************************************************************//** + * @brief + * The handleUIConfirmationResponse function handles a UI response for + * confirmation request. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUIConfirmationResponse( MESSAGE_T *message ) +{ + BOOL result = FALSE; + U08* payloadPtr = message->payload; + if ( message->hdr.payloadLen == 2 * sizeof(U32) ) + { + U32 request_id; + U32 status; + + memcpy( &request_id, payloadPtr, sizeof(U32) ); + payloadPtr += sizeof(U32); + memcpy( &status, payloadPtr, sizeof(U32) ); + + if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || + ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) + { + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T) request_id, (CONFIRMATION_REQUEST_STATUS_T) status ); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); +} + +/*********************************************************************//** + * @brief + * 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 + *************************************************************************/ +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 temp_request = request_id; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_CONFIRMATION; + // The payload length is U32 Request ID, U32 Type, U32 Reject Reason + msg.hdr.payloadLen = 3 * sizeof( U32 ); + + memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + temp_request = request_type; + memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reject_reason, 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_NOT_REQUIRED ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -7515,77 +7581,4 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } - -/*********************************************************************//** - * @brief - * The handleUIConfirmationResponse function handles a UI response for - * confirmation request. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUIConfirmationResponse( MESSAGE_T *message ) -{ - BOOL result = FALSE; - U08* payloadPtr = message->payload; - - if ( message->hdr.payloadLen == 2 * sizeof(U32) ) - { - U32 request_id; - U32 status; - - memcpy( &request_id, payloadPtr, sizeof(U32) ); - payloadPtr += sizeof(U32); - memcpy( &status, payloadPtr, sizeof(U32) ); - - if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || - ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) - { - setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T) request_id, (CONFIRMATION_REQUEST_STATUS_T) status ); - } - else - { - // illegal response param - // TODO set alarm? No Ack? - } - } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); -} - -/*********************************************************************//** - * @brief - * 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 - *************************************************************************/ -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) -{ - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - U32 temp_request; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_CONFIRMATION; - // The payload length is U32 Request ID, U32 Type, U32 Reject Reason - msg.hdr.payloadLen = 3 * sizeof( U32 ); - - temp_request = request_id; - memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - temp_request = request_type; - memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &reject_reason, 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_NOT_REQUIRED ); -} - /**@}*/