summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc44
-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/src/commands/mobile/delete_interaction_choice_set_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc3
5 files changed, 54 insertions, 30 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index ddd2c9db35..eaad84dafd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -444,12 +444,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
result_code = ui_result_ == hmi_apis::Common_Result::REJECTED
? mobile_apis::Result::REJECTED
: mobile_apis::Result::GENERIC_ERROR;
-
- msg_params[strings::grammar_id] = application->get_grammar_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
-
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
- application->RemoveCommand(cmd_id);
result = false;
SDL_LOG_DEBUG("Result " << result);
}
@@ -461,10 +455,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
result_code = vr_result_ == hmi_apis::Common_Result::REJECTED
? mobile_apis::Result::REJECTED
: mobile_apis::Result::GENERIC_ERROR;
-
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
-
- application->RemoveCommand(cmd_id);
result = false;
SDL_LOG_DEBUG("Result " << result);
}
@@ -588,12 +578,28 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() {
void AddCommandRequest::RemoveCommand() {
SDL_LOG_AUTO_TRACE();
+ using namespace helpers;
+
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
SDL_LOG_ERROR("No application associated with session key");
return;
}
+ const bool is_ui_result_ok_or_missing =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_vr_result_ok_or_missing =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
const uint32_t cmd_id =
(*message_)[strings::msg_params][strings::cmd_id].asUInt();
smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
@@ -602,21 +608,15 @@ void AddCommandRequest::RemoveCommand() {
app->RemoveCommand(cmd_id);
- if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) &&
- IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) {
- // in case we have send bth UI and VR and no one respond
- // we have nothing to remove from HMI so no DeleteCommand expected
- return;
- }
-
- if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
+ if (ui_is_sent_ && is_ui_result_ok_or_missing) {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
}
- if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) {
- msg_params[strings::grammar_id] = app->get_grammar_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ if (vr_is_sent_ && is_vr_result_ok_or_missing) {
+ smart_objects::SmartObject vr_msg_params = msg_params;
+ vr_msg_params[strings::grammar_id] = app->get_grammar_id();
+ vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+ SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &vr_msg_params);
}
}
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/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/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index af0a5a6539..0537043cd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -225,8 +225,13 @@ size_t OnSystemRequestNotification::ParsePTString(
size_t result_length = length;
result.reserve(length * 2);
for (size_t i = 0; i < length; ++i) {
- if (pt_string[i] == '\"' || pt_string[i] == '\\') {
+ if (pt_string[i] == '\"') {
result += '\\';
+ } else if (pt_string[i] == '\\') {
+ result += '\\';
+ --result_length; // contentLength is adjusted for the additional escape
+ // character added before special characters (like the
+ // newline string)
} else if (pt_string[i] == '\n') {
--result_length; // contentLength is adjusted when this character is
// not copied to result.
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index 92c5d19a05..a9abb5dc6d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -123,6 +123,9 @@ void ResetGlobalPropertiesRequest::Run() {
SendHMIRequest(
hmi_apis::FunctionID::RC_SetGlobalProperties, msg_params.get(), true);
}
+ auto& help_prompt_manager = app->help_prompt_manager();
+ help_prompt_manager.OnResetGlobalPropertiesReceived(
+ (*message_)[strings::msg_params]);
}
void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {