summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerasym Oleh <oolleehh@gmail.com>2016-05-18 08:39:52 +0300
committerHerasym Oleh <oolleehh@gmail.com>2016-05-18 09:11:44 +0300
commit5107c24099a587ee2bb6e2d473c02dbb2511d8e0 (patch)
tree64b766cdc2924755d5cdf2f460dabd02404d7a92
parent52834f9d230db84e9d059ab681591a65238f972d (diff)
downloadsdl_core-5107c24099a587ee2bb6e2d473c02dbb2511d8e0.tar.gz
Fix send info in AlertManever
Related: APPLINK-23121 Conflicts: src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h2
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc71
2 files changed, 50 insertions, 23 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
index 03c0db83c4..472ff45551 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
@@ -84,6 +84,8 @@ class AlertManeuverRequest : public CommandRequestImpl {
mobile_apis::Result::eType tts_speak_result_code_;
mobile_apis::Result::eType navi_alert_maneuver_result_code_;
+ std::string info_navi_;
+ std::string info_tts_;
Pending pending_requests_;
DISALLOW_COPY_AND_ASSIGN(AlertManeuverRequest);
diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
index d771553962..ea00bc8d70 100644
--- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
@@ -138,7 +138,10 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
-
+ bool is_tts_ok;
+ bool is_no_navi_error;
+ hmi_apis::Common_Result::eType tts_result;
+ hmi_apis::Common_Result::eType navi_result;
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
@@ -149,7 +152,22 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
navi_alert_maneuver_result_code_ =
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
+ navi_result =
+ MessageHelper::MobileToHMIResult(navi_alert_maneuver_result_code_);
+ is_no_navi_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ navi_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+ const bool is_navi_success =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ navi_result, hmi_apis::Common_Result::SUCCESS);
+ if (is_navi_success) {
+ info_navi_ =
+ message[strings::msg_params][hmi_response::message].asString();
+ } else {
+ info_navi_ = message[strings::msg_params][strings::info].asString();
+ }
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
@@ -160,6 +178,24 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
tts_speak_result_code_ = static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
+ tts_result = MessageHelper::MobileToHMIResult(tts_speak_result_code_);
+
+ is_tts_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ tts_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_tts_success =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ tts_result, hmi_apis::Common_Result::SUCCESS);
+ if (is_tts_success) {
+ info_tts_ =
+ message[strings::msg_params][hmi_response::message].asString();
+ } else {
+ info_tts_ = message[strings::msg_params][strings::info].asString();
+ }
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
@@ -184,25 +220,6 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
return;
}
- hmi_apis::Common_Result::eType tts_result =
- MessageHelper::MobileToHMIResult(tts_speak_result_code_);
-
- hmi_apis::Common_Result::eType navi_result =
- MessageHelper::MobileToHMIResult(navi_alert_maneuver_result_code_);
-
- const bool is_tts_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- tts_result,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::INVALID_ENUM);
-
- const bool is_no_navi_error =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- navi_result,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS);
-
const bool result =
(is_tts_ok && is_no_navi_error) ||
(hmi_apis::Common_Result::SUCCESS == tts_result &&
@@ -212,8 +229,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
static_cast<mobile_apis::Result::eType>(
std::max(tts_speak_result_code_, navi_alert_maneuver_result_code_));
- std::string return_info =
- message[strings::msg_params][hmi_response::message].asString();
+ std::string return_info;
const bool is_tts_or_navi_warning =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
@@ -225,9 +241,18 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
return_info = std::string("Unsupported phoneme type sent in a prompt");
}
+ if (!info_tts_.empty() && !info_navi_.empty()) {
+ info_tts_ += ". ";
+ }
+ return_info = info_tts_ + info_navi_;
+ bool must_be_empty_info = false;
+ if (return_info.find("\n") != std::string::npos ||
+ return_info.find("\t") != std::string::npos) {
+ must_be_empty_info = true;
+ }
SendResponse(result,
result_code,
- return_info.c_str(),
+ (must_be_empty_info) ? NULL : return_info.c_str(),
&(message[strings::msg_params]));
}