summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerii Malkov (GitHub) <vmalkov@luxoft.com>2019-10-16 19:12:51 +0300
committerJackLivio <jack@livio.io>2019-10-16 12:12:51 -0400
commitb756603bbc7d63f268873f878d8e98082ab71ec7 (patch)
tree9d2e777b3d0029ea0e4fa2448678444b60f2f121
parent7fb3ad3803fb1c1d3d5fc79c66c8ba2a55bee823 (diff)
downloadsdl_core-b756603bbc7d63f268873f878d8e98082ab71ec7.tar.gz
Fix/sdl must send generic error hmi doesnt respond during timeout (#2495)
* Fix SDL timeout logic for RPCs with own timer SDL must send GENERIC_ERROR to app in case HMI does NOT respond during <DefaultTimeout>+<RPCs_internal_timeout> for all RPCs with own timer * Fix default timeout for HMI requests For RPS with own timers SDL should apply default+internal timeout for mobile and HMI requests
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc4
9 files changed, 61 insertions, 49 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
index bf449db808..793e70d9e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
@@ -47,7 +47,11 @@ UIAlertRequest::UIAlertRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::duration].asUInt();
+ default_timeout_ += request_timeout;
+}
UIAlertRequest::~UIAlertRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
index aa5878590b..a07c72cbf4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
@@ -47,7 +47,11 @@ UIPerformInteractionRequest::UIPerformInteractionRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UIPerformInteractionRequest::~UIPerformInteractionRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
index de639420fb..cad68e23aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
@@ -47,7 +47,11 @@ UIScrollableMessageRequest::UIScrollableMessageRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UIScrollableMessageRequest::~UIScrollableMessageRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
index 56fca3d062..eae8cc523c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
@@ -47,7 +47,11 @@ UISliderRequest::UISliderRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UISliderRequest::~UISliderRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
index ae94019b25..4257158f6a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
@@ -47,7 +47,11 @@ VRPerformInteractionRequest::VRPerformInteractionRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
VRPerformInteractionRequest::~VRPerformInteractionRequest() {}
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 7a0fd79b08..8e90de8b51 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
@@ -73,18 +73,15 @@ AlertRequest::~AlertRequest() {}
bool AlertRequest::Init() {
/* Timeout in milliseconds.
- If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::duration)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::duration].asUInt();
- } else {
- const int32_t def_value = 5000;
- default_timeout_ = def_value;
- }
+ If omitted a standard value of 10000 milliseconds is used.*/
+ auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t duration_timeout = msg_params[strings::duration].asUInt();
+
+ default_timeout_ += duration_timeout;
// If soft buttons are present, SDL will not use initiate timeout tracking for
// response.
- if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ if (msg_params.keyExists(strings::soft_buttons)) {
LOG4CXX_INFO(logger_,
"Request contains soft buttons - request timeout "
"will be set to 0.");
@@ -375,7 +372,8 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
// app_id
msg_params[strings::app_id] = app_id;
- msg_params[strings::duration] = default_timeout_;
+ msg_params[strings::duration] =
+ (*message_)[strings::msg_params][strings::duration].asUInt();
// NAVI platform progressIndicator
if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) {
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 cc109afcf0..622f64f792 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
@@ -82,17 +82,18 @@ PerformInteractionRequest::~PerformInteractionRequest() {}
bool PerformInteractionRequest::Init() {
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::timeout].asUInt();
- }
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
+ msg_params[strings::interaction_mode].asInt());
if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- default_timeout_ *= 2;
+ const uint32_t increase_value = 2;
+ default_timeout_ += request_timeout * increase_value;
+ } else {
+ default_timeout_ += request_timeout;
}
return true;
}
@@ -284,7 +285,7 @@ void PerformInteractionRequest::onTimeOut() {
CommandRequestImpl::onTimeOut();
} else {
application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
+ connection_key(), correlation_id(), default_timeout_);
}
break;
}
@@ -341,7 +342,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
}
LOG4CXX_DEBUG(logger_, "Update timeout for UI");
application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
+ connection_key(), correlation_id(), default_timeout_);
return false;
}
@@ -358,6 +359,13 @@ bool PerformInteractionRequest::ProcessVRResponse(
msg_params[strings::choice_id] = choice_id;
}
+ if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
+ mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ LOG4CXX_DEBUG(logger_, "Update timeout for UI");
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout_);
+ }
+
const bool is_vr_result_success = Compare<Common_Result::eType, EQ, ONE>(
vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS);
@@ -476,12 +484,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
}
}
- if (mobile_apis::InteractionMode::BOTH == mode ||
- mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_ / 2;
- } else {
- msg_params[strings::timeout] = default_timeout_;
- }
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
msg_params[strings::app_id] = app->app_id();
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
msg_params[strings::choice_set] =
@@ -662,16 +666,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
return;
}
- mobile_apis::InteractionMode::eType mode =
- static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
-
- if (mobile_apis::InteractionMode::BOTH == mode ||
- mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_ / 2;
- } else {
- msg_params[strings::timeout] = default_timeout_;
- }
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
+ ;
msg_params[strings::app_id] = app->app_id();
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
SendHMIRequest(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
index 5bef1d56fc..90dbb91b5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
@@ -65,13 +65,9 @@ ScrollableMessageRequest::~ScrollableMessageRequest() {}
bool ScrollableMessageRequest::Init() {
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::timeout].asUInt();
- } else {
- const int32_t def_value = 30000;
- default_timeout_ = def_value;
- }
+ uint32_t request_timeout =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
return true;
}
@@ -110,7 +106,8 @@ void ScrollableMessageRequest::Run() {
msg_params[hmi_request::message_text][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::scroll_message_body];
msg_params[strings::app_id] = app->app_id();
- msg_params[strings::timeout] = default_timeout_;
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
msg_params[strings::cancel_id] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
index 3820112ea5..6b17aa238d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
@@ -175,7 +175,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kTimeOut + kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
@@ -183,7 +183,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {