summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc4
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc13
3 files changed, 19 insertions, 6 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
index dccf2e9fdd..9caf7e4c7a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -89,7 +89,13 @@ void DeleteInteractionChoiceSetRequest::Run() {
SendResponse(false, mobile_apis::Result::IN_USE);
return;
}
- SendVrDeleteCommand(app);
+ if (choice_set.keyExists(strings::grammar_id) &&
+ choice_set[strings::grammar_id].asInt() != -1) {
+ SendVrDeleteCommand(app);
+ } else {
+ response_result_codes_.push_back(hmi_apis::Common_Result::SUCCESS);
+ SendDeleteInteractionChoiceSetResponse();
+ }
}
bool DeleteInteractionChoiceSetRequest::Init() {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index bd4c5c1ec6..aded581faf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -205,10 +205,6 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
.WillOnce(Return(choice_set_id));
EXPECT_CALL(*app_, is_perform_interaction_active()).WillOnce(Return(false));
EXPECT_CALL(*app_, performinteraction_choice_set_map()).Times(0);
-
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
- .WillOnce(Return(invalid_choice_set_id));
-
EXPECT_CALL(*app_, app_id()).Times(0);
}
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 8588d02319..d5d87a6a2f 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -737,11 +737,16 @@ void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd,
DCHECK_OR_RETURN_VOID(cmd);
using namespace smart_objects;
- SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
+ if (!cmd->keyExists(strings::grammar_id) ||
+ (*cmd)[strings::grammar_id].asInt() == -1) {
+ return;
+ }
+ SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = application->app_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
msg_params[strings::grammar_id] = (*cmd)[strings::grammar_id];
+
cmd = &((*cmd)[strings::choice_set]);
for (uint32_t i = 0; i < (*cmd).length(); ++i) {
msg_params[strings::cmd_id] = (*cmd)[i][strings::choice_id];
@@ -1527,6 +1532,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
smart_objects::SmartObjectList
MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectList requests;
if (!app) {
SDL_LOG_ERROR("Invalid application");
@@ -1541,6 +1547,11 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
(*(it->second))[strings::grammar_id].asUInt();
const size_t size = (*(it->second))[strings::choice_set].length();
for (size_t j = 0; j < size; ++j) {
+ if (!(*(it->second))[strings::choice_set][j].keyExists(
+ strings::vr_commands)) {
+ continue;
+ }
+
smart_objects::SmartObjectSPtr vr_command = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!vr_command) {