summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlha Vorobiova (GitHub) <86727408+OlhaVorobiova@users.noreply.github.com>2022-06-15 15:19:39 +0200
committerGitHub <noreply@github.com>2022-06-15 09:19:39 -0400
commitba3e91d409312da7ebe8c352fcfba12b120927dc (patch)
tree4c79db76e9dbac875b6c03ffc9931516228e8cdf
parentff52b89f23f2d91e67a0936168f278810263dc4d (diff)
downloadsdl_core-ba3e91d409312da7ebe8c352fcfba12b120927dc.tar.gz
Fix result codes of CreateInteractionChoiceSet response (#3907)
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc2
3 files changed, 22 insertions, 9 deletions
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 82967b717b..edbeaf1b9e 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 70f462c05d..f221742523 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<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
const bool is_no_error = Compare<Common_Result::eType, EQ, ONE>(
- 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<uint32_t>(
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 951a206dff..8939ff9633 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<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));