summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/mobile/add_command_request.cc
diff options
context:
space:
mode:
authorAlexander Kutsan <AKutsan@luxoft.com>2016-08-31 15:40:17 +0300
committerAlexander Kutsan <AKutsan@luxoft.com>2016-08-31 15:43:36 +0300
commitb19c3e7da35b5a078dc8b7987107996ed0060fdf (patch)
treecb6b1914b3b7eeea5e25f7dd086d7f1adf14f898 /src/components/application_manager/src/commands/mobile/add_command_request.cc
parent0a967c1b2f6396b06f8ef124bdde0bcc09e85981 (diff)
downloadsdl_core-b19c3e7da35b5a078dc8b7987107996ed0060fdf.tar.gz
Add ordering of UI and VR infos
In case if only one interface is available UI SDL should respond to HMI info by pattern : info = "VR is not supported by system, " + error message from other interface Related issue : [APPLINK-26900](https://adc.luxoft.com/jira/browse/APPLINK-26900)
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/add_command_request.cc')
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc
index 77a4fe5a76..e89be2c288 100644
--- a/src/components/application_manager/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc
@@ -315,13 +315,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
+ ui_info_ = message[strings::msg_params][strings::info].asString();
if (hmi_apis::Common_Result::SUCCESS != ui_result_) {
(*message_)[strings::msg_params].erase(strings::menu_params);
}
- if (message[strings::msg_params].keyExists(strings::info)) {
- info_ += message[strings::msg_params][strings::info].asString();
- }
break;
}
case hmi_apis::FunctionID::VR_AddCommand: {
@@ -330,13 +327,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
MessageHelper::PrintSmartObject(message);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
+ vr_info_ = message[strings::msg_params][strings::info].asString();
if (hmi_apis::Common_Result::SUCCESS != vr_result_) {
(*message_)[strings::msg_params].erase(strings::vr_commands);
}
- if (message[strings::msg_params].keyExists(strings::info)) {
- info_ += message[strings::msg_params][strings::info].asString();
- }
break;
}
default: {
@@ -478,9 +472,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
RemoveCommand();
}
+ const std::string info = GenerateMobileResponseInfo();
SendResponse(result,
result_code,
- info_.empty() ? NULL : info_.c_str(),
+ info.empty() ? NULL : info.c_str(),
&(message[strings::msg_params]));
if (result) {
@@ -531,7 +526,31 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
}
bool AddCommandRequest::BothSend() const {
- return send_vr_ && send_ui_;
+ return send_vr_ && send_ui_;
+}
+
+std::string MergeInfos(const std::string& first, const std::string& second) {
+ if (!first.empty() && second.empty()) {
+ return first;
+ }
+ if (first.empty() && !second.empty()) {
+ return second;
+ }
+ if (!first.empty() && !second.empty()) {
+ return first + ", " + second;
+ }
+ return std::string();
+}
+
+const std::__cxx11::string AddCommandRequest::GenerateMobileResponseInfo() {
+ if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_) {
+ return MergeInfos(vr_info_, ui_info_);
+ }
+
+ if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_) {
+ return MergeInfos(ui_info_, vr_info_);
+ }
+ return MergeInfos(ui_info_, vr_info_);
}
void AddCommandRequest::RemoveCommand() {