Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes processing ABORTED code for VR in PerformInteraction #1562

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ class CommandRequestImpl : public CommandImpl,
* @return true if result code complies successful result code
* otherwise returns false
*/
bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const;
virtual bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const;

/**
* @brief If message from HMI contains returns this info
Expand All @@ -256,7 +256,7 @@ class CommandRequestImpl : public CommandImpl,
* interface that returns response.
* @return resulting code for sending to mobile application.
*/
mobile_apis::Result::eType PrepareResultCodeForResponse(
virtual mobile_apis::Result::eType PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second);

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,30 @@ class PerformInteractionRequest : public CommandRequestImpl {
virtual void onTimeOut();

private:
/**
* @brief Checks result code from HMI for splitted RPC
* and returns parameter for sending to mobile app.
* @param first contains result_code from HMI response and
* interface that returns response
* @param second contains result_code from HMI response and
* interface that returns response
* @return true if result code complies successful result code
* otherwise returns false
*/
bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const OVERRIDE;

/**
* @brief Prepare result code for sending to mobile application
* @param first contains result_code from HMI response and
* interface that returns response
* @param second contains result_code from HMI response and
* interface that returns response.
* @return resulting code for sending to mobile application.
*/
mobile_apis::Result::eType PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second) OVERRIDE;

/**
* @brief Function will be called when VR_OnCommand event
* comes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,46 @@ void PerformInteractionRequest::onTimeOut() {
};
}

bool PerformInteractionRequest::PrepareResultForMobileResponse(
ResponseInfo& out_first, ResponseInfo& out_second) const {
const bool is_ui_or_both_mode =
helpers::Compare<mobile_apis::InteractionMode::eType,
helpers::EQ,
helpers::ONE>(interaction_mode_,
mobile_apis::InteractionMode::BOTH,
mobile_apis::InteractionMode::MANUAL_ONLY);

if (is_ui_or_both_mode) {
if (vr_result_code_ == hmi_apis::Common_Result::ABORTED &&
ui_result_code_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) {
return true;
}
}

return CommandRequestImpl::PrepareResultForMobileResponse(out_first,
out_second);
}

mobile_apis::Result::eType
PerformInteractionRequest::PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second) {
const bool is_ui_or_both_mode =
helpers::Compare<mobile_apis::InteractionMode::eType,
helpers::EQ,
helpers::ONE>(interaction_mode_,
mobile_apis::InteractionMode::BOTH,
mobile_apis::InteractionMode::MANUAL_ONLY);

if (is_ui_or_both_mode) {
if (vr_result_code_ == hmi_apis::Common_Result::ABORTED &&
ui_result_code_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) {
return mobile_apis::Result::UNSUPPORTED_RESOURCE;
}
}

return CommandRequestImpl::PrepareResultCodeForResponse(first, second);
}

bool PerformInteractionRequest::ProcessVRResponse(
const smart_objects::SmartObject& message,
smart_objects::SmartObject& msg_params) {
Expand Down