summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin
diff options
context:
space:
mode:
authorAshwin Karemore <akaremor@ford.com>2018-06-28 15:35:58 +0200
committerAKalinich-Luxoft <AKalinich@luxoft.com>2018-07-26 18:56:06 +0300
commit32c4573733a9660e05d94ed6c1a192beeda177c1 (patch)
tree99ed17f35c90c0f34d7c64a593af43e2876dde0c /src/components/application_manager/rpc_plugins/sdl_rpc_plugin
parent25e00ebf5cb3dfa127a1f56a6bdead72ed0a10a9 (diff)
downloadsdl_core-32c4573733a9660e05d94ed6c1a192beeda177c1.tar.gz
fix for invalid image rpc in create interaction choice set request
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc54
2 files changed, 45 insertions, 10 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 950c295072..12b075af7a 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
@@ -128,6 +128,7 @@ class CreateInteractionChoiceSetRequest
int32_t choice_set_id_;
size_t expected_chs_count_;
size_t received_chs_count_;
+ bool should_send_warnings;
/**
* @brief Flag for stop sending VR commands to HMI, in case one of responses
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 89ae0c1aac..767a4e2c27 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
@@ -42,6 +42,7 @@
#include "utils/gen_hash.h"
#include "utils/helpers.h"
+#define INVALID_IMG_WARNING_INFO "Requested image(s) not found."
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -95,6 +96,37 @@ void CreateInteractionChoiceSetRequest::Run() {
SendResponse(false, result);
return;
}
+
+
+ should_send_warnings = false;
+ for (uint32_t i = 0;
+ i < (*message_)[strings::msg_params][strings::choice_set].length();
+ ++i) {
+ Result::eType verification_result_image = Result::SUCCESS;
+ Result::eType verification_result_secondary_image = Result::SUCCESS;
+ if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists(
+ strings::image)) {
+ verification_result_image = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::choice_set][i]
+ [strings::image],
+ app,
+ application_manager_);
+ }
+ if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists(
+ strings::secondary_image)) {
+ verification_result_secondary_image = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::choice_set][i]
+ [strings::secondary_image],
+ app,
+ application_manager_);
+ }
+ if (verification_result_image == Result::INVALID_DATA ||
+ verification_result_secondary_image == Result::INVALID_DATA) {
+ should_send_warnings = true;
+ break;
+ }
+ }
+
uint32_t grammar_id = application_manager_.GenerateGrammarID();
(*message_)[strings::msg_params][strings::grammar_id] = grammar_id;
app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]);
@@ -405,16 +437,18 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
}
void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!error_from_hmi_) {
- SendResponse(true, mobile_apis::Result::SUCCESS);
- } else {
- DeleteChoices();
- }
-
- application_manager_.TerminateRequest(
- connection_key(), correlation_id(), function_id());
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!error_from_hmi_ && should_send_warnings) {
+ SendResponse(true, mobile_apis::Result::WARNINGS,INVALID_IMG_WARNING_INFO);
+ } else if (!error_from_hmi_) {
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ } else {
+ DeleteChoices();
+ }
+
+ application_manager_.TerminateRequest(
+ connection_key(), correlation_id(), function_id());
}
} // namespace commands