diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h index 82967b717bc..edbeaf1b9ed 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h @@ -97,8 +97,10 @@ class CreateInteractionChoiceSetRequest * @brief Calls after all responses from HMI were received. * Terminates request and sends successful response to mobile * if all responses were SUCCESS or calls DeleteChoices in other case. + * @param vr_result the result code from hmi. */ - void OnAllHMIResponsesReceived(); + void OnAllHMIResponsesReceived( + const hmi_apis::Common_Result::eType vr_result); /** * @brief The VRCommand struct @@ -201,8 +203,9 @@ class CreateInteractionChoiceSetRequest * @brief CountReceivedVRResponses counts received HMI responses. Updated * request timeout if not all responses received * Send response to mobile if all responses received. + * @param vr_result the result code from hmi. */ - void CountReceivedVRResponses(); + void CountReceivedVRResponses(const hmi_apis::Common_Result::eType vr_result); DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 70f462c05d9..f221742523c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -368,7 +368,8 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( return true; } -void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { +void CreateInteractionChoiceSetRequest::CountReceivedVRResponses( + const hmi_apis::Common_Result::eType vr_result) { ++received_chs_count_; SDL_LOG_DEBUG("Got VR.AddCommand response, there are " << expected_chs_count_ - received_chs_count_ @@ -378,7 +379,7 @@ void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { connection_key(), correlation_id(), default_timeout()); SDL_LOG_DEBUG("Timeout for request was updated"); } else { - OnAllHMIResponsesReceived(); + OnAllHMIResponsesReceived(vr_result); } } @@ -392,7 +393,15 @@ void CreateInteractionChoiceSetRequest::on_event( const Common_Result::eType result = static_cast( message[strings::params][hmi_response::code].asInt()); const bool is_no_error = Compare( - result, Common_Result::SUCCESS, Common_Result::WARNINGS); + result, + Common_Result::SUCCESS, + Common_Result::WARNINGS, + Common_Result::WRONG_LANGUAGE, + Common_Result::RETRY, + Common_Result::SAVED, + Common_Result::TRUNCATED_DATA, + Common_Result::UNSUPPORTED_RESOURCE); + uint32_t corr_id = static_cast( message[strings::params][strings::correlation_id].asUInt()); if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { @@ -407,7 +416,7 @@ void CreateInteractionChoiceSetRequest::on_event( ProcessHmiError(result); } } - CountReceivedVRResponses(); + CountReceivedVRResponses(result); } } @@ -464,7 +473,8 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { sent_commands_map_.clear(); } -void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { +void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived( + const hmi_apis::Common_Result::eType vr_result) { SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = @@ -478,7 +488,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { if (!error_from_hmi_ && should_send_warnings_) { SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo); } else if (!error_from_hmi_) { - SendResponse(true, mobile_apis::Result::SUCCESS); + SendResponse(true, MessageHelper::HMIToMobileResult(vr_result)); } else { DeleteChoices(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index 951a206dff1..8939ff96334 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -252,7 +252,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::success].asBool(), - false); + true); EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::result_code].asInt(), static_cast(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));