summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleh Herasym (GitHub) <oolleehh@gmail.com>2016-10-12 21:34:18 +0300
committerAnton Hrytsevich (GitHub) <AGritsevich@users.noreply.github.com>2016-10-12 21:34:18 +0300
commit7767e65c2009c0c5e9bdd219d1d936a0cfd2e4ef (patch)
treecaa0106fa30aa93559d0d45f543d40e5c33ae576
parent88a1d59e32547307edf35a0ec439a9ce4386cddc (diff)
downloadsdl_core-7767e65c2009c0c5e9bdd219d1d936a0cfd2e4ef.tar.gz
Fix TTS IsReady false issues (#892)
* Fix TTS IsReady false issues Related: APPLINK-28576, 28577, 28662
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h4
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc76
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc31
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc16
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc5
-rw-r--r--src/components/application_manager/test/commands/mobile/change_registration_test.cc8
33 files changed, 132 insertions, 144 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index 47ec32cc74..5b86bfa851 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -250,9 +250,7 @@ class CommandRequestImpl : public CommandImpl,
* @param response_from_hmi contains response from HMI
* @param out_info contain info for sending to application
*/
- void GetInfo(HmiInterfaces::InterfaceID interface,
- hmi_apis::Common_Result::eType result_code,
- const smart_objects::SmartObject& response_from_hmi,
+ void GetInfo(const smart_objects::SmartObject& response_from_hmi,
std::string& out_info);
/**
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index d1f223bc8b..d8f14fa844 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -737,18 +737,12 @@ bool CommandRequestImpl::PrepareResultForMobileResponse(
}
void CommandRequestImpl::GetInfo(
- HmiInterfaces::InterfaceID interface,
- hmi_apis::Common_Result::eType result_code,
const smart_objects::SmartObject& response_from_hmi,
std::string& out_info) {
if (response_from_hmi[strings::msg_params].keyExists(strings::info)) {
- out_info = response_from_hmi[strings::msg_params][strings::info].asString();
- } else {
- HmiInterfaces::InterfaceState interface_state =
- application_manager_.hmi_interfaces().GetInterfaceState(interface);
- if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code &&
- HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == interface_state) {
- out_info = CreateInfoForUnsupportedResult(interface);
+ if (!response_from_hmi[strings::msg_params][strings::info].empty()) {
+ out_info =
+ response_from_hmi[strings::msg_params][strings::info].asString();
}
}
}
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 267a9c3149..6c361c2ff4 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,7 +315,7 @@ 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());
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, message, ui_info_);
+ GetInfo(message, ui_info_);
if (hmi_apis::Common_Result::SUCCESS != ui_result_) {
(*message_)[strings::msg_params].erase(strings::menu_params);
}
@@ -326,7 +326,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_, message, vr_info_);
+ GetInfo(message, vr_info_);
if (hmi_apis::Common_Result::SUCCESS != vr_result_) {
(*message_)[strings::msg_params].erase(strings::vr_commands);
}
diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
index 3d91dbecfc..6838d1af7d 100644
--- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
@@ -107,8 +107,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
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 2b55f76115..b151990289 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,10 +138,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
navi_alert_maneuver_result_code_ =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- navi_alert_maneuver_result_code_,
- message,
- info_navi_);
+ GetInfo(message, info_navi_);
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
@@ -149,10 +146,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
pending_requests_.Remove(event_id);
tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_TTS,
- tts_speak_result_code_,
- message,
- info_tts_);
+ GetInfo(message, info_tts_);
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc
index 069b21cb66..60113508f5 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -165,10 +165,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
// Mobile Alert request is successful when UI_Alert is successful
alert_response_params_ = message[strings::msg_params];
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI,
- alert_result_,
- message,
- ui_response_info_);
+ GetInfo(message, ui_response_info_);
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
@@ -178,10 +175,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
awaiting_tts_speak_response_ = false;
tts_speak_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_TTS,
- tts_speak_result_,
- message,
- tts_response_info_);
+ GetInfo(message, tts_response_info_);
break;
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc
index 9477c3beae..c14fce13ae 100644
--- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc
@@ -172,10 +172,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
pending_requests_.Remove(event_id);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI,
- ui_result_,
- message,
- ui_response_info_);
+ GetInfo(message, ui_response_info_);
break;
}
case hmi_apis::FunctionID::VR_ChangeRegistration: {
@@ -183,10 +180,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
pending_requests_.Remove(event_id);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_VR,
- vr_result_,
- message,
- vr_response_info_);
+ GetInfo(message, vr_response_info_);
break;
}
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
@@ -194,10 +188,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
pending_requests_.Remove(event_id);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_TTS,
- tts_result_,
- message,
- tts_response_info_);
+ GetInfo(message, tts_response_info_);
break;
}
default: {
@@ -244,6 +235,23 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
}
}
+namespace {
+void CheckInfo(std::string& str) {
+ if (std::string::npos != str.find("is not supported by system")) {
+ str.clear();
+ }
+}
+
+bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) {
+ if (first.is_ok && second.is_unsupported_resource &&
+ second.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) {
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
bool ChangeRegistrationRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& response_info) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -285,6 +293,24 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
ui_result_,
vr_result_);
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ const HmiInterfaces::InterfaceState tts_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS);
+ const HmiInterfaces::InterfaceState vr_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_VR);
+ const HmiInterfaces::InterfaceState ui_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_UI);
+
+ ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI);
+
+ ResponseInfo tts_properties_info(tts_result_,
+ HmiInterfaces::HMI_INTERFACE_TTS);
+
+ ResponseInfo vr_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_VR);
+
bool result = ((!is_tts_ui_vr_unsupported) && is_tts_succeeded_unsupported &&
is_ui_succeeded_unsupported && is_vr_succeeded_unsupported);
@@ -295,8 +321,10 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
ui_result_,
vr_result_);
- if ((result && is_tts_or_ui_or_vr_unsupported) || is_tts_ui_vr_unsupported) {
+ if ((result && is_tts_or_ui_or_vr_unsupported)) {
result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ result = CheckResultCode(ui_properties_info, tts_properties_info) ||
+ CheckResultCode(tts_properties_info, vr_properties_info);
} else {
// If response contains erroneous result code SDL need return erroneus
// result code.
@@ -318,6 +346,28 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
result_code = MessageHelper::HMIToMobileResult(
std::max(std::max(ui_result, vr_result), tts_result));
}
+
+ const bool is_tts_state_available =
+ tts_state == HmiInterfaces::STATE_AVAILABLE;
+ const bool is_vr_state_available = vr_state == HmiInterfaces::STATE_AVAILABLE;
+ const bool is_ui_state_available = ui_state == HmiInterfaces::STATE_AVAILABLE;
+
+ const bool is_tts_hmi_info =
+ is_tts_state_available && !tts_response_info_.empty();
+ const bool is_vr_hmi_info =
+ is_vr_state_available && !vr_response_info_.empty();
+ const bool is_ui_hmi_info =
+ is_ui_state_available && !ui_response_info_.empty();
+
+ if (is_tts_hmi_info || is_vr_hmi_info || is_ui_hmi_info) {
+ if (!is_tts_hmi_info)
+ CheckInfo(tts_response_info_);
+ if (!is_vr_hmi_info)
+ CheckInfo(ui_response_info_);
+ if (!is_ui_hmi_info)
+ CheckInfo(vr_response_info_);
+ }
+
response_info =
MergeInfos(ui_response_info_, vr_response_info_, tts_response_info_);
return result;
diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
index cfcd4b743e..4878ae1fe1 100644
--- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
@@ -149,7 +149,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_,
"Received UI_DeleteCommand event with result "
<< MessageHelper::HMIResultToString(ui_result_));
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, message, ui_info_);
+ GetInfo(message, ui_info_);
break;
}
case hmi_apis::FunctionID::VR_DeleteCommand: {
@@ -159,7 +159,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_,
"Received VR_DeleteCommand event with result "
<< MessageHelper::HMIResultToString(vr_result_));
- GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_, message, vr_info_);
+ GetInfo(message, vr_info_);
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
index eec7960df8..57748e6feb 100644
--- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
@@ -147,8 +147,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
index 072a4aaf47..5c5d250026 100644
--- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
@@ -100,10 +100,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
response_info.empty() ? NULL : response_info.c_str(),
diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
index 25a83e5aef..f67d1f2434 100644
--- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -60,8 +60,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
if (result) {
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
index 90d9b20285..d98207c772 100644
--- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
@@ -88,10 +88,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) {
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
index a572a2cf8f..25e2da3eb6 100644
--- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
@@ -272,10 +272,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
result = result ||
((hmi_apis::Common_Result::DATA_NOT_AVAILABLE == result_code) &&
(message[strings::msg_params].length() > 1));
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
index 3a253d1d7f..198964a333 100644
--- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
@@ -44,10 +44,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
SendResponse(result,
diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
index b44d2144ee..28c7918f22 100644
--- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -123,7 +123,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
result_ui_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_ui_, message, ui_info_);
+ GetInfo(message, ui_info_);
// in case perform audio is started by other request skip stopping
if (hmi_apis::Common_Result::REJECTED == result_ui_) {
@@ -141,10 +141,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_TTS,
- result_tts_speak_,
- message,
- tts_info_);
+ GetInfo(message, tts_info_);
awaiting_tts_speak_response_ = false;
const bool is_tts_speak_success_unsuported =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
index af94e877a8..34ec2b4fe2 100644
--- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
@@ -230,8 +230,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, ui_result_code_, message, ui_info_);
+ GetInfo(message, ui_info_);
ProcessUIResponse(event.smart_object(), msg_param);
break;
}
@@ -241,8 +240,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction);
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_VR, vr_result_code_, message, vr_info_);
+ GetInfo(message, vr_info_);
if (ProcessVRResponse(event.smart_object(), msg_param)) {
return;
}
diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc
index 3b53bc427e..0bf747bde3 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc
@@ -103,10 +103,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index 9843c30a3e..f13dc02f48 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -312,11 +312,6 @@ void RegisterAppInterfaceRequest::Run() {
SendRegisterAppInterfaceResponseToMobile();
}
-void FillTTSRelatedFields(smart_objects::SmartObject& response_params,
- const HMICapabilities& hmi_capabilities) {
- response_params[strings::language] = hmi_capabilities.active_tts_language();
-}
-
void FillVRRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
response_params[strings::language] = hmi_capabilities.active_vr_language();
@@ -334,6 +329,19 @@ void FillVIRelatedFields(smart_objects::SmartObject& response_params,
}
}
+void FillTTSRelatedFields(smart_objects::SmartObject& response_params,
+ const HMICapabilities& hmi_capabilities) {
+ response_params[strings::language] = hmi_capabilities.active_tts_language();
+ if (hmi_capabilities.speech_capabilities()) {
+ response_params[strings::speech_capabilities] =
+ *hmi_capabilities.speech_capabilities();
+ }
+ if (hmi_capabilities.prerecorded_speech()) {
+ response_params[strings::prerecorded_speech] =
+ *(hmi_capabilities.prerecorded_speech());
+ }
+}
+
void FillUIRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
response_params[strings::hmi_display_language] =
@@ -502,9 +510,11 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
*hmi_capabilities.hmi_zone_capabilities();
}
}
- if (hmi_capabilities.speech_capabilities()) {
- response_params[strings::speech_capabilities] =
- *hmi_capabilities.speech_capabilities();
+
+ if (HmiInterfaces::STATE_NOT_AVAILABLE !=
+ application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_TTS)) {
+ FillTTSRelatedFields(response_params, hmi_capabilities);
}
if (hmi_capabilities.pcm_stream_capabilities()) {
@@ -518,11 +528,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
FillVIRelatedFields(response_params, hmi_capabilities);
}
- if (hmi_capabilities.prerecorded_speech()) {
- response_params[strings::prerecorded_speech] =
- *(hmi_capabilities.prerecorded_speech());
- }
-
const std::vector<uint32_t>& diag_modes =
application_manager_.get_settings().supported_diag_modes();
if (!diag_modes.empty()) {
diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
index a897aba811..0c770953fe 100644
--- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
@@ -131,8 +131,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc
index 4f1f1c9783..7b9ec53c3a 100644
--- a/src/components/application_manager/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc
@@ -140,10 +140,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) {
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
SendResponse(result,
diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
index e7130d8e17..5d70a2fb5b 100644
--- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
@@ -240,8 +240,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
if (result) {
ApplicationSharedPtr app =
application_manager_.application(connection_key());
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
index b4122b9210..984690384a 100644
--- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
@@ -76,7 +76,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
const bool response_success = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
std::string info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, message, info);
+ GetInfo(message, info);
smart_objects::SmartObject msg_params = message[strings::msg_params];
if (response_success) {
HMICapabilities& hmi_capabilities =
diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
index 1dd56faea5..d198c115d5 100644
--- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
@@ -232,10 +232,7 @@ void SetGlobalPropertiesRequest::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());
- GetInfo(HmiInterfaces::HMI_INTERFACE_UI,
- ui_result_,
- message,
- ui_response_info_);
+ GetInfo(message, ui_response_info_);
break;
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
@@ -243,10 +240,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
is_tts_received_ = true;
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- GetInfo(HmiInterfaces::HMI_INTERFACE_TTS,
- tts_result_,
- message,
- tts_response_info_);
+ GetInfo(message, tts_response_info_);
break;
}
default: {
@@ -303,7 +297,11 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters(
}
result_code =
PrepareResultCodeForResponse(ui_properties_info, tts_properties_info);
- info = MergeInfos(tts_response_info_, ui_response_info_);
+
+ info = MergeInfos(tts_properties_info,
+ tts_response_info_,
+ ui_properties_info,
+ ui_response_info_);
return result;
}
diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
index 1ec6a26ae5..1e0a00318d 100644
--- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
@@ -91,8 +91,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) {
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, result_code, message, response_info);
+ GetInfo(message, response_info);
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
index 7c2bd7722b..b1cc40009d 100644
--- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
@@ -188,10 +188,7 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
SendResponse(result,
diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc
index d518c8fdc3..cf2509cdb9 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -233,10 +233,7 @@ void ShowRequest::on_event(const event_engine::Event& event) {
message[strings::params][hmi_response::code].asInt());
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_UI);
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_UI,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
if (hmi_apis::Common_Result::WARNINGS == result_code &&
message[strings::params].keyExists(hmi_response::message)) {
response_info =
diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc
index 8170c3ce52..054d0ec16d 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -155,8 +155,7 @@ void SliderRequest::on_event(const event_engine::Event& event) {
}
}
std::string response_info;
- GetInfo(
- HmiInterfaces::HMI_INTERFACE_UI, response_code, message, response_info);
+ GetInfo(message, response_info);
const bool is_response_success = PrepareResultForMobileResponse(
response_code, HmiInterfaces::HMI_INTERFACE_UI);
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
index 933d23ec1f..56027bacaf 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -236,10 +236,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- hmi_result,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
index 26e89b44bf..29cc8e6541 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
@@ -52,10 +52,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index 2b289b6fff..6902a9d659 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -316,10 +316,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo,
- hmi_result,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
index d5c98e1a36..728209fcf2 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -45,10 +45,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
index a17f1acd55..becab175e9 100644
--- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
@@ -159,10 +159,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
- GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
- result_code,
- message,
- response_info);
+ GetInfo(message, response_info);
const bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
SendResponse(result,
diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
index e5cdaa0f1c..2a159af868 100644
--- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
@@ -195,6 +195,12 @@ TEST_F(ChangeRegistrationRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
hmi_apis::FunctionID::TTS_ChangeRegistration);
event_tts.set_smart_object(*tts_response);
+ MockHmiInterfaces hmi_interfaces;
+ EXPECT_CALL(app_mngr_, hmi_interfaces())
+ .WillRepeatedly(ReturnRef(hmi_interfaces));
+ EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
MessageSharedPtr response_to_mobile;
EXPECT_CALL(
@@ -208,7 +214,7 @@ TEST_F(ChangeRegistrationRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
EXPECT_EQ(
(*response_to_mobile)[strings::msg_params][strings::success].asBool(),
- true);
+ false);
EXPECT_EQ(
(*response_to_mobile)[strings::msg_params][strings::result_code].asInt(),
static_cast<int32_t>(mobile_apis::Result::UNSUPPORTED_RESOURCE));