summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2020-12-21 13:35:16 -0500
committerGitHub <noreply@github.com>2020-12-21 13:35:16 -0500
commit8a4bf49140b02b7150e12f6f92e02720efeebfee (patch)
tree6bde864ab38402ff81ca4734e62dd84dd17c6c2b
parent49bf5dfc019b2c28db5bc1b0b5d0af582642fa23 (diff)
downloadsdl_core-8a4bf49140b02b7150e12f6f92e02720efeebfee.tar.gz
Fix success=false after UNSUPPORTED_RESOURCE response for multiple RPCs (#3587)
* Fix success=false after UNSUPPORTED_RESOURCE response for multiple RPCs Fixes issue for PerformInteraction, Alert, SubtleAlert, AlertManeuver, and PerformAudioPassThru
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc16
6 files changed, 63 insertions, 63 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 52a0ad4dc1..9d14b248b6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -128,15 +128,13 @@ class PerformInteractionRequest
* @return true if send response to mobile application otherwise
* return false.
*/
- bool ProcessVRResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ bool ProcessVRResponse(const smart_objects::SmartObject& message);
/**
* @brief Sends PerformInteraction response to mobile side
* @param message which should send to mobile side
*/
- void ProcessUIResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ void ProcessUIResponse(const smart_objects::SmartObject& message);
/*
* @brief Sends UI PerformInteraction request to HMI
@@ -279,6 +277,7 @@ class PerformInteractionRequest
mobile_apis::InteractionMode::eType interaction_mode_;
std::int32_t ui_choice_id_received_;
std::int32_t vr_choice_id_received_;
+ std::string ui_text_entry_received_;
bool ui_response_received_;
bool vr_response_received_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
index 47b3a87d52..c2172d5180 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
@@ -236,7 +236,8 @@ bool AlertManeuverRequest::PrepareResponseParameters(
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_TTS)))) {
result_code = mobile_apis::Result::WARNINGS;
- return_info = std::string("Unsupported phoneme type sent in a prompt");
+ return_info = app_mngr::commands::MergeInfos(
+ navigation_alert_info, info_navi_, tts_alert_info, info_tts_);
return result;
}
result_code =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index cfd3106f4d..9f04541b46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -213,19 +213,10 @@ bool AlertRequest::PrepareResponseParameters(
bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive responce for
- * TTS.IsReady.
- */
- if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
return result;
@@ -234,7 +225,10 @@ bool AlertRequest::PrepareResponseParameters(
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
// Mobile Alert request is successful when UI_Alert is successful
- if (is_ui_alert_sent_ && !ui_alert_info.is_ok) {
+ bool has_unsupported_data =
+ ui_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE != ui_alert_info.interface_state;
+ if (is_ui_alert_sent_ && !ui_alert_info.is_ok && !has_unsupported_data) {
return false;
}
return result;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 5918c05f2d..0accdd1e76 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -224,20 +224,17 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
HmiInterfaces::HMI_INTERFACE_TTS,
application_manager_);
- // Note(dtrunov): According to requirment "WARNINGS, success:true on getting
- // UNSUPPORTED_RESOURCE for "ttsChunks"
+ response_params_.success =
+ PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) {
response_params_.result_code = mobile_apis::Result::WARNINGS;
- tts_info_ = "Unsupported phoneme type sent in a prompt";
response_params_.info = app_mngr::commands::MergeInfos(
ui_perform_info, ui_info_, tts_perform_info, tts_info_);
response_params_.success = true;
return response_params_;
}
- response_params_.success =
- PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) {
response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index a3269847a1..5d3b203afe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -253,7 +253,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, ui_info_);
- ProcessUIResponse(event.smart_object(), response_msg_params);
+ ProcessUIResponse(event.smart_object());
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
@@ -265,7 +265,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, vr_info_);
- if (ProcessVRResponse(event.smart_object(), response_msg_params)) {
+ if (ProcessVRResponse(event.smart_object())) {
return;
}
break;
@@ -328,8 +328,7 @@ void PerformInteractionRequest::onTimeOut() {
}
bool PerformInteractionRequest::ProcessVRResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace mobile_apis;
@@ -343,9 +342,6 @@ bool PerformInteractionRequest::ProcessVRResponse(
return false;
}
- msg_params[strings::trigger_source] =
- static_cast<int32_t>(TriggerSource::TS_VR);
-
const bool is_vr_aborted_timeout = Compare<Common_Result::eType, EQ, ONE>(
vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT);
@@ -403,8 +399,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
}
void PerformInteractionRequest::ProcessUIResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace helpers;
using namespace smart_objects;
@@ -436,38 +431,30 @@ void PerformInteractionRequest::ProcessUIResponse(
ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
if (result) {
+ const smart_objects::SmartObject& hmi_msg_params =
+ message[strings::msg_params];
if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
ui_info_ = message[strings::msg_params][strings::info].asString();
- } else {
- if (message.keyExists(strings::msg_params)) {
- msg_params = message[strings::msg_params];
- }
- if (is_pi_warning) {
- ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = message[strings::msg_params][strings::info].asString();
- }
+ } else if (is_pi_warning) {
+ ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
+ ui_info_ = message[strings::msg_params][strings::info].asString();
}
// result code must be GENERIC_ERROR in case wrong choice_id
- if (msg_params.keyExists(strings::choice_id)) {
+ if (hmi_msg_params.keyExists(strings::choice_id)) {
const std::int32_t ui_choice_id =
- static_cast<std::int32_t>(msg_params[strings::choice_id].asInt());
+ static_cast<std::int32_t>(hmi_msg_params[strings::choice_id].asInt());
if (!CheckChoiceIDFromResponse(app, ui_choice_id)) {
ui_result_code_ = hmi_apis::Common_Result::GENERIC_ERROR;
ui_info_ = "Wrong choiceID was received from HMI";
} else {
ui_choice_id_received_ = ui_choice_id;
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_MENU;
- }
- } else if (msg_params.keyExists(strings::manual_text_entry)) {
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_KEYBOARD;
- if (msg_params[strings::manual_text_entry].empty()) {
- msg_params.erase(strings::manual_text_entry);
}
+ } else if (hmi_msg_params.keyExists(strings::manual_text_entry)) {
+ ui_text_entry_received_ =
+ hmi_msg_params[strings::manual_text_entry].asString();
}
}
}
@@ -1124,7 +1111,8 @@ PerformInteractionRequest::PrepareResultCodeForResponse(
if (INVALID_CHOICE_ID != vr_choice_id_received_) {
return mobile_vr_result_code;
}
- if (INVALID_CHOICE_ID != ui_choice_id_received_) {
+ if (INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty()) {
return mobile_ui_result_code;
}
@@ -1135,14 +1123,29 @@ PerformInteractionRequest::PrepareResultCodeForResponse(
bool PerformInteractionRequest::PrepareResultForMobileResponse(
app_mngr::commands::ResponseInfo& ui_response,
app_mngr::commands::ResponseInfo& vr_response) const {
+ bool vr_choice_received = INVALID_CHOICE_ID != vr_choice_id_received_;
+ bool ui_choice_received = INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty();
+
+ bool vr_response_success =
+ vr_response.is_ok ||
+ (vr_response.is_unsupported_resource &&
+ vr_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ vr_choice_received);
+ bool ui_response_success =
+ ui_response.is_ok ||
+ (ui_response.is_unsupported_resource &&
+ ui_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ ui_choice_received);
+
if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
- return vr_response.is_ok;
+ return vr_response_success;
}
if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- return ui_response.is_ok;
+ return ui_response_success;
}
- return (vr_response.is_ok || ui_response.is_ok);
+ return (vr_response_success || ui_response_success);
}
bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
@@ -1151,25 +1154,37 @@ bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_;
const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_;
-
if (ui_choice_id_valid && vr_choice_id_valid &&
ui_choice_id_received_ != vr_choice_id_received_) {
return false;
}
+ if (!ui_text_entry_received_.empty()) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_KEYBOARD;
+ msg_param[strings::manual_text_entry] = ui_text_entry_received_;
+ return true;
+ }
+
switch (interaction_mode_) {
case mobile_apis::InteractionMode::eType::MANUAL_ONLY:
if (ui_choice_id_valid) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_MENU;
msg_param[strings::choice_id] = ui_choice_id_received_;
}
case mobile_apis::InteractionMode::eType::VR_ONLY:
if (vr_choice_id_valid) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_VR;
msg_param[strings::choice_id] = vr_choice_id_received_;
}
default:
if (ui_choice_id_valid) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_MENU;
msg_param[strings::choice_id] = ui_choice_id_received_;
} else if (vr_choice_id_valid) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_VR;
msg_param[strings::choice_id] = vr_choice_id_received_;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
index 327315b372..1a54f7f106 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
@@ -206,20 +206,10 @@ bool SubtleAlertRequest::PrepareResponseParameters(
bool result =
PrepareResultForMobileResponse(ui_subtle_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive response for
- * TTS.IsReady.
- */
- if (result && ui_subtle_alert_info.is_ok &&
- tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_subtle_alert_info.is_ok || ui_subtle_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(ui_subtle_alert_info,
ui_response_info_,
tts_alert_info,
@@ -244,7 +234,11 @@ bool SubtleAlertRequest::PrepareResponseParameters(
tts_alert_info,
tts_response_info_);
// Mobile Alert request is successful when UI_SubtleAlert is successful
- if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok) {
+ bool has_unsupported_data = ui_subtle_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE !=
+ ui_subtle_alert_info.interface_state;
+ if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok &&
+ !has_unsupported_data) {
return false;
}
return result;