summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-03-07 10:07:23 -0500
committerGitHub <noreply@github.com>2019-03-07 10:07:23 -0500
commitbaf0605cc0b8aa134baff557e53ad3a0be6ae0d7 (patch)
treee7f5dd4a75596583a9d7702695ef9a61366313bc
parent222ec0566594288744d73ef30174e714bd6f29ce (diff)
parent969c77262efd0db36a51eaaa665e091a076efebf (diff)
downloadsdl_core-baf0605cc0b8aa134baff557e53ad3a0be6ae0d7.tar.gz
Merge pull request #2817 from smartdevicelink/feature/forwarded_request_timeout
Increasing Timeout for forwarded AppService requests
-rw-r--r--src/appMain/smartDeviceLink.ini5
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h9
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc2
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc11
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc4
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc7
-rw-r--r--src/components/config_profile/include/config_profile/profile.h2
-rw-r--r--src/components/config_profile/src/profile.cc18
-rw-r--r--src/components/include/application_manager/application_manager.h3
-rw-r--r--src/components/include/application_manager/application_manager_settings.h1
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h2
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h1
13 files changed, 65 insertions, 2 deletions
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index 90c2d94bf3..54c2395c47 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -375,4 +375,7 @@ EnableAppLaunchIOS = true
HMIOriginID = "HMI_ID"
; Services that exist on the module. Values are of AppServiceType in RPC Spec. These services will be used as default and app services will only become primary service publisher with direct user interaction. These services will also be a fallback if no app service publisher is registered with the system of that type.
-EmbeddedServices = MEDIA, WEATHER, NAVIGATION, VOICE_ASSISTANT
+EmbeddedServices = MEDIA, WEATHER, NAVIGATION
+
+; Additional time added to RPC timeout when passing through to App service
+RpcPassThroughTimeout = 10000 \ No newline at end of file
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 07f11eddaa..6161d6bbbf 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -709,6 +709,15 @@ class ApplicationManagerImpl
uint32_t new_timeout_value) OVERRIDE;
/**
+ * @brief TODO
+ *
+ * @param connection_key Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ */
+ void IncreaseForwardedRequestTimeout(uint32_t connection_key,
+ uint32_t mobile_correlation_id) OVERRIDE;
+
+ /**
* @brief AddPolicyObserver allows to subscribe needed component to events
* from policy.
*
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
index 952d1834fb..9e262f0ca3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -93,6 +93,8 @@ void PerformAppServiceInteractionRequest::Run() {
// service
smart_objects::SmartObject request_params;
request_params[strings::service_id] = service_id;
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent,
&request_params,
true);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
index c0fbcee146..2b3611fece 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
@@ -151,6 +151,8 @@ void GetFileRequest::Run() {
if (GetFilePath(file_path, forward_to_hmi)) {
if (forward_to_hmi) {
LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath,
&(*message_)[strings::msg_params],
true);
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 7fd2bd1995..2c8f5e06b2 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -2397,6 +2397,17 @@ void ApplicationManagerImpl::updateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
+void ApplicationManagerImpl::IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Increasing Request Timeout by "
+ << get_settings().rpc_pass_through_timeout());
+ uint32_t new_timeout_value = get_settings().default_timeout() +
+ get_settings().rpc_pass_through_timeout();
+ request_ctrl_.updateRequestTimeout(
+ connection_key, mobile_correlation_id, new_timeout_value);
+}
+
uint32_t ApplicationManagerImpl::application_id(const int32_t correlation_id) {
// ykazakov: there is no erase for const iterator for QNX
std::map<const int32_t, const uint32_t>::iterator it =
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 970f8802c0..344831f882 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -444,6 +444,8 @@ void CommandRequestImpl::SendProviderRequest(
if (hmi_destination) {
LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
return;
}
@@ -471,6 +473,8 @@ void CommandRequestImpl::SendProviderRequest(
request[strings::msg_params] = (*msg)[strings::msg_params];
request[strings::params][strings::connection_key] = app->app_id();
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
SendMobileRequest(mobile_function_id, new_msg, use_events);
}
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index 3c8e75141a..0adb389e76 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -32,6 +32,7 @@
#include "application_manager/commands/request_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/request_info.h"
#include "application_manager/rpc_service.h"
#include "utils/helpers.h"
@@ -183,6 +184,9 @@ void RequestFromHMI::SendProviderRequest(
if (hmi_destination) {
LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectoinKey,
+ correlation_id());
SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
return;
}
@@ -193,6 +197,9 @@ void RequestFromHMI::SendProviderRequest(
}
LOG4CXX_DEBUG(logger_, "Sending Request to Mobile Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectoinKey,
+ correlation_id());
SendMobileRequest(
mobile_function_id, app, &(*msg)[strings::msg_params], use_events);
}
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 02fff3764b..ba43ec9695 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -526,6 +526,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::vector<std::string>& audio_service_transports() const OVERRIDE;
const std::vector<std::string>& video_service_transports() const OVERRIDE;
+ uint32_t rpc_pass_through_timeout() const OVERRIDE;
const std::vector<std::string>& embedded_services() const OVERRIDE;
const std::string hmi_origin_id() const OVERRIDE;
/**
@@ -1065,6 +1066,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
int low_voltage_signal_offset_;
int wake_up_signal_offset_;
int ignition_off_signal_offset_;
+ uint32_t rpc_pass_through_timeout_;
std::vector<std::string> embedded_services_;
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 5a6d3b3808..e5a32f4560 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -239,6 +239,7 @@ const char* kSecondaryTransportForUSBKey = "SecondaryTransportForUSB";
const char* kSecondaryTransportForWiFiKey = "SecondaryTransportForWiFi";
const char* kAudioServiceTransportsKey = "AudioServiceTransports";
const char* kVideoServiceTransportsKey = "VideoServiceTransports";
+const char* kRpcPassThroughTimeoutKey = "RpcPassThroughTimeout";
const char* kDefaultTransportRequiredForResumptionKey =
"DefaultTransportRequiredForResumption";
@@ -394,6 +395,7 @@ const std::string kAllowedSymbols =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-";
const bool kDefaultMultipleTransportsEnabled = false;
const char* kDefaultLowBandwidthResumptionLevel = "NONE";
+const uint32_t kDefaultRpcPassThroughTimeout = 10000;
const char* kDefaultHMIOriginId = "HMI_ID";
} // namespace
@@ -510,7 +512,8 @@ Profile::Profile()
, error_description_()
, low_voltage_signal_offset_(kDefaultLowVoltageSignalOffset)
, wake_up_signal_offset_(kDefaultWakeUpSignalOffset)
- , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset) {
+ , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset)
+ , rpc_pass_through_timeout_(kDefaultRpcPassThroughTimeout) {
// SDL version
ReadStringValue(
&sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
@@ -1082,6 +1085,10 @@ const bool Profile::multiple_transports_enabled() const {
return multiple_transports_enabled_;
}
+uint32_t Profile::rpc_pass_through_timeout() const {
+ return rpc_pass_through_timeout_;
+}
+
const std::vector<std::string>& Profile::secondary_transports_for_bluetooth()
const {
return secondary_transports_for_bluetooth_;
@@ -2247,6 +2254,15 @@ void Profile::UpdateValues() {
kMultipleTransportsEnabledKey,
kMultipleTransportsSection);
+ ReadUIntValue(&rpc_pass_through_timeout_,
+ kDefaultRpcPassThroughTimeout,
+ kAppServicesSection,
+ kRpcPassThroughTimeoutKey);
+
+ LOG_UPDATED_VALUE(rpc_pass_through_timeout_,
+ kRpcPassThroughTimeoutKey,
+ kAppServicesSection);
+
{ // Secondary Transports and ServicesMap
struct KeyPair {
std::vector<std::string>* ini_vector;
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index f1b17a8225..863ec093f0 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -560,6 +560,9 @@ class ApplicationManager {
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) = 0;
+ virtual void IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) = 0;
+
virtual StateController& state_controller() = 0;
virtual void SetUnregisterAllApplicationsReason(
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index a48d0ecc63..b206e56125 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -85,6 +85,7 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& audio_stream_file() const = 0;
virtual bool use_full_app_id() const = 0;
+ virtual uint32_t rpc_pass_through_timeout() const = 0;
virtual uint32_t cloud_app_retry_timeout() const = 0;
virtual uint16_t cloud_app_max_retry_attempts() const = 0;
virtual bool use_db_for_resumption() const = 0;
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index 46b2118249..1b9fe5ed1c 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -218,6 +218,8 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value));
+ MOCK_METHOD2(IncreaseForwardedRequestTimeout,
+ void(uint32_t connection_key, uint32_t mobile_correlation_id));
MOCK_METHOD0(state_controller, application_manager::StateController&());
MOCK_METHOD1(SetUnregisterAllApplicationsReason,
void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h
index b95a219111..a4ec7c0317 100644
--- a/src/components/include/test/application_manager/mock_application_manager_settings.h
+++ b/src/components/include/test/application_manager/mock_application_manager_settings.h
@@ -127,6 +127,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_time_scale, const uint32_t&());
MOCK_CONST_METHOD0(app_time_scale_max_requests, const uint32_t&());
MOCK_CONST_METHOD0(pending_requests_amount, const uint32_t&());
+ MOCK_CONST_METHOD0(rpc_pass_through_timeout, uint32_t());
// app_launch::AppLaunchSettings
MOCK_CONST_METHOD0(app_launch_wait_time, const uint16_t());