summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins')
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h10
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h31
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h11
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc33
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h50
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc153
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc496
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h7
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc7
28 files changed, 867 insertions, 158 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
index 1765c1e7fa..5d85237899 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
@@ -36,7 +36,6 @@
#include "application_manager/command_factory.h"
namespace app_service_rpc_plugin {
-// class AppServiceAppExtension;
namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
@@ -48,7 +47,14 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin {
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) OVERRIDE;
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state);
bool IsAbleToProcess(
const int32_t function_id,
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
index 0e739522d9..1c3a9c77c5 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -50,7 +50,19 @@ bool AppServiceRpcPlugin::Init(
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
+ resumption::LastStateWrapperPtr last_state) {
+ UNUSED(last_state);
+ application_manager_ = &app_manager;
+ command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
+bool AppServiceRpcPlugin::Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
UNUSED(last_state);
application_manager_ = &app_manager;
command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory(
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
index 3e88d4eaf3..6949a3aff0 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
@@ -41,6 +41,7 @@
#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
namespace am = application_manager;
using am::ApplicationSet;
@@ -80,7 +81,9 @@ class OnAppServiceDataNotificationTest
app_service_plugin_, *mock_app_))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_)
- , last_state_("app_storage_folder", "app_info_storage")
+ , last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage")))
, app_service_manager_(app_mngr_, last_state_) {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(*mock_app_, is_remote_control_supported())
@@ -109,7 +112,7 @@ class OnAppServiceDataNotificationTest
application_manager::ApplicationSet apps_;
const std::shared_ptr<sync_primitives::Lock> apps_lock_;
DataAccessor<application_manager::ApplicationSet> apps_da_;
- resumption::LastStateImpl last_state_;
+ resumption::LastStateWrapperPtr last_state_;
MockAppServiceManager app_service_manager_;
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h
index cde7928a14..c8b99cc724 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h
@@ -70,7 +70,7 @@ class RCConsentManager {
virtual rc_rpc_plugin::rc_rpc_types::ModuleConsent GetModuleConsent(
const std::string& app_id,
const std::string& mac_address,
- const rc_rpc_types::ModuleUid& module_id) const = 0;
+ const rc_rpc_types::ModuleUid& module_id) = 0;
/**
* @brief Remove modules consents from LastState if they exist
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
index b3c6a0b129..5cbc4b977e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_IMPL_H
#include "rc_consent_manager.h"
-#include "resumption/last_state.h"
+#include "resumption/last_state_wrapper.h"
#include "utils/lock.h"
namespace Json {
@@ -46,6 +46,12 @@ namespace rc_rpc_plugin {
class RCConsentManagerImpl : public RCConsentManager {
public:
RCConsentManagerImpl(
+ resumption::LastStateWrapperPtr last_state,
+ application_manager::ApplicationManager& application_manager,
+ const uint32_t period_of_consent_expired);
+
+ DEPRECATED
+ RCConsentManagerImpl(
resumption::LastState& last_state,
application_manager::ApplicationManager& application_manager,
const uint32_t period_of_consent_expired);
@@ -58,7 +64,7 @@ class RCConsentManagerImpl : public RCConsentManager {
rc_rpc_types::ModuleConsent GetModuleConsent(
const std::string& app_id,
const std::string& mac_address,
- const rc_rpc_types::ModuleUid& module_id) const OVERRIDE;
+ const rc_rpc_types::ModuleUid& module_id) OVERRIDE;
void RemoveExpiredConsents() OVERRIDE;
@@ -111,7 +117,7 @@ class RCConsentManagerImpl : public RCConsentManager {
* In case the section is absent, will be appended a new empty section.
* @return Remote Control section of LastState in Json
*/
- Json::Value& GetRemoteControlDataOrAppend() const;
+ Json::Value& GetRemoteControlDataOrAppend(Json::Value& last_state_data);
/**
* @brief Gets Device applications section for specified device mac adress
@@ -119,8 +125,8 @@ class RCConsentManagerImpl : public RCConsentManager {
* @param mac_aress Device MAC adress
* @return Device applications section of LastState in Json
*/
- Json::Value& GetDeviceApplicationsOrAppend(
- const std::string& mac_address) const;
+ Json::Value& GetDeviceApplicationsOrAppend(const std::string& mac_address,
+ Json::Value& last_state_data);
/**
* @brief Get AppConsentsList section of LastState for specified application.
@@ -130,7 +136,8 @@ class RCConsentManagerImpl : public RCConsentManager {
* @return AppConsentsList of LastState in Json
*/
Json::Value& GetAppConsentsListOrAppend(const std::string& policy_app_id,
- const std::string& mac_address) const;
+ const std::string& mac_address,
+ Json::Value& last_state_data);
/**
* @brief Get Application consents section of Remote Control section of
@@ -138,7 +145,7 @@ class RCConsentManagerImpl : public RCConsentManager {
* is absent, will be created a new empty section
* @return AppConsents section of RemoteControl section of LastState in Jason
*/
- Json::Value& GetAppsConsentsOrAppend() const;
+ Json::Value& GetAppsConsentsOrAppend(Json::Value& last_state_data);
/**
* @brief Get all module resource consents for specified application and
@@ -149,14 +156,14 @@ class RCConsentManagerImpl : public RCConsentManager {
* acquiring resource
* @param module_type Module type with consents
*/
- Json::Value& GetModuleTypeConsentsOrAppend(
- const std::string& policy_app_id,
- const std::string& mac_address,
- const std::string& module_type) const;
+ Json::Value& GetModuleTypeConsentsOrAppend(const std::string& policy_app_id,
+ const std::string& mac_address,
+ const std::string& module_type,
+ Json::Value& last_state_data);
private:
application_manager::ApplicationManager& app_manager_;
- resumption::LastState& last_state_;
+ resumption::LastStateWrapperPtr last_state_;
const uint32_t period_of_consent_expired_;
mutable sync_primitives::Lock dictionary_control_lock_;
mutable sync_primitives::Lock remote_control_lock_;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
index 1225feb67f..e12bd88e58 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
@@ -43,10 +43,6 @@
#include "rc_rpc_plugin/rc_consent_manager.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
-namespace resumption {
-class LastState;
-}
-
namespace rc_rpc_plugin {
namespace plugins = application_manager::plugin_manager;
namespace app_mngr = application_manager;
@@ -65,6 +61,13 @@ class RCRPCPlugin : public plugins::RPCPlugin {
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
resumption::LastState& last_state) OVERRIDE;
/**
* @param int32_t command id
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
index acaa6ce86c..1d7db181eb 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
@@ -48,7 +48,7 @@ namespace app_mngr = application_manager;
CREATE_LOGGERPTR_GLOBAL(logger_, "RCConsentManager")
RCConsentManagerImpl::RCConsentManagerImpl(
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state,
application_manager::ApplicationManager& application_manager,
const uint32_t period_of_consent_expired)
: app_manager_(application_manager)
@@ -64,20 +64,31 @@ void RCConsentManagerImpl::SaveModuleConsents(
for (const auto& consent : module_consents) {
std::string module_type = consent.module_id.first;
- auto& app_module_consents =
- GetModuleTypeConsentsOrAppend(policy_app_id, mac_address, module_type);
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& app_module_consents = GetModuleTypeConsentsOrAppend(
+ policy_app_id, mac_address, module_type, last_state_dictionary);
SaveAppModuleConsent(app_module_consents, consent);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
}
}
rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
const std::string& app_id,
const std::string& mac_address,
- const rc_rpc_types::ModuleUid& module_id) const {
+ const rc_rpc_types::ModuleUid& module_id) {
sync_primitives::AutoLock autolock(module_consents_lock_);
- auto& module_consents =
- GetModuleTypeConsentsOrAppend(app_id, mac_address, module_id.first);
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& module_consents = GetModuleTypeConsentsOrAppend(
+ app_id, mac_address, module_id.first, last_state_dictionary);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+
if (module_consents.empty()) {
LOG4CXX_DEBUG(
logger_,
@@ -102,23 +113,35 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
void RCConsentManagerImpl::RemoveExpiredConsents() {
LOG4CXX_AUTO_TRACE(logger_);
- auto& remote_control = GetRemoteControlDataOrAppend();
+
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& remote_control = GetRemoteControlDataOrAppend(last_state_dictionary);
if (remote_control.empty()) {
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
return;
}
- auto& devices = GetAppsConsentsOrAppend();
+ auto& devices = GetAppsConsentsOrAppend(last_state_dictionary);
sync_primitives::AutoLock autolock(device_applications_lock_);
for (auto& device_item : devices) {
RemoveDeviceExpiredConsents(device_item);
}
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
}
void RCConsentManagerImpl::RemoveAllConsents() {
- auto& remote_control = GetRemoteControlDataOrAppend();
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& remote_control = GetRemoteControlDataOrAppend(last_state_dictionary);
remote_control.removeMember(message_params::kAppConsents);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
}
rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState(
@@ -203,17 +226,17 @@ void RCConsentManagerImpl::RemoveModuleExpiredConsents(
}
}
-Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend() const {
- Json::Value& dictionary = last_state_.get_dictionary();
-
+Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend(
+ Json::Value& last_state_data) {
sync_primitives::AutoLock autolock(dictionary_control_lock_);
- if (!dictionary.isMember(app_mngr::strings::remote_control)) {
- dictionary[app_mngr::strings::remote_control] =
+ if (!last_state_data.isMember(app_mngr::strings::remote_control)) {
+ last_state_data[app_mngr::strings::remote_control] =
Json::Value(Json::objectValue);
LOG4CXX_DEBUG(logger_, "remote_control section is missed");
}
- Json::Value& remote_control = dictionary[app_mngr::strings::remote_control];
+ Json::Value& remote_control =
+ last_state_data[app_mngr::strings::remote_control];
if (!remote_control.isObject()) {
LOG4CXX_ERROR(logger_, "remote_control type INVALID rewrite");
@@ -223,10 +246,10 @@ Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend() const {
}
Json::Value& RCConsentManagerImpl::GetDeviceApplicationsOrAppend(
- const std::string& mac_address) const {
+ const std::string& mac_address, Json::Value& last_state_data) {
sync_primitives::AutoLock autolock(device_applications_lock_);
- auto& apps_consents = GetAppsConsentsOrAppend();
+ auto& apps_consents = GetAppsConsentsOrAppend(last_state_data);
if (!apps_consents.isArray()) {
LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
@@ -257,8 +280,11 @@ Json::Value& RCConsentManagerImpl::GetDeviceApplicationsOrAppend(
}
Json::Value& RCConsentManagerImpl::GetAppConsentsListOrAppend(
- const std::string& policy_app_id, const std::string& mac_address) const {
- auto& device_applications = GetDeviceApplicationsOrAppend(mac_address);
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ Json::Value& last_state_data) {
+ auto& device_applications =
+ GetDeviceApplicationsOrAppend(mac_address, last_state_data);
sync_primitives::AutoLock autolock(applications_lock_);
if (!device_applications.isArray()) {
@@ -291,8 +317,9 @@ Json::Value& RCConsentManagerImpl::GetAppConsentsListOrAppend(
[message_params::kAppConsentList];
}
-Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend() const {
- Json::Value& remote_control = GetRemoteControlDataOrAppend();
+Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend(
+ Json::Value& last_state_data) {
+ Json::Value& remote_control = GetRemoteControlDataOrAppend(last_state_data);
sync_primitives::AutoLock autolock(remote_control_lock_);
if (!remote_control.isMember(message_params::kAppConsents)) {
@@ -312,12 +339,13 @@ Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend() const {
Json::Value& RCConsentManagerImpl::GetModuleTypeConsentsOrAppend(
const std::string& policy_app_id,
const std::string& mac_address,
- const std::string& module_type) const {
- auto& app_consnets_list =
- GetAppConsentsListOrAppend(policy_app_id, mac_address);
+ const std::string& module_type,
+ Json::Value& last_state_data) {
+ auto& app_consents_list =
+ GetAppConsentsListOrAppend(policy_app_id, mac_address, last_state_data);
sync_primitives::AutoLock autolock(app_consents_lock_);
- for (auto& module_consents : app_consnets_list) {
+ for (auto& module_consents : app_consents_list) {
const bool module_exists =
module_consents.isMember(message_params::kModuleType);
@@ -338,10 +366,10 @@ Json::Value& RCConsentManagerImpl::GetModuleTypeConsentsOrAppend(
consent_item[message_params::kModuleType] = module_type;
consent_item[message_params::kModuleConsents] = Json::Value(Json::arrayValue);
- app_consnets_list.append(consent_item);
+ app_consents_list.append(consent_item);
// Returns last (appended) object
- return app_consnets_list[app_consnets_list.size() - 1]
+ return app_consents_list[app_consents_list.size() - 1]
[message_params::kModuleConsents];
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
index 4e43cff58d..c2aa639fda 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
@@ -52,7 +52,7 @@ bool RCRPCPlugin::Init(
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
+ resumption::LastStateWrapperPtr last_state) {
rc_consent_manager_.reset(new rc_rpc_plugin::RCConsentManagerImpl(
last_state,
app_manager,
@@ -83,6 +83,14 @@ bool RCRPCPlugin::Init(
return true;
}
+bool RCRPCPlugin::Init(application_manager::ApplicationManager&,
+ application_manager::rpc_service::RPCService&,
+ application_manager::HMICapabilities&,
+ policy::PolicyHandlerInterface&,
+ resumption::LastState&) {
+ return false;
+}
+
bool RCRPCPlugin::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h
index 147da9ed55..a89202b5f5 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h
@@ -46,11 +46,11 @@ class MockRCConsentManager : public rc_rpc_plugin::RCConsentManager {
void(const std::string&,
const std::string&,
const rc_rpc_plugin::rc_rpc_types::ModuleIdConsentVector&));
- MOCK_CONST_METHOD3(GetModuleConsent,
- rc_rpc_plugin::rc_rpc_types::ModuleConsent(
- const std::string&,
- const std::string&,
- const rc_rpc_plugin::rc_rpc_types::ModuleUid&));
+ MOCK_METHOD3(GetModuleConsent,
+ rc_rpc_plugin::rc_rpc_types::ModuleConsent(
+ const std::string&,
+ const std::string&,
+ const rc_rpc_plugin::rc_rpc_types::ModuleUid&));
MOCK_METHOD0(RemoveExpiredConsents, void());
MOCK_METHOD0(RemoveAllConsents, void());
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc
index b4d826719a..a2e9f6d83b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc
@@ -40,8 +40,8 @@
#include "application_manager/mock_application_manager_settings.h"
#include "rc_rpc_plugin/rc_consent_manager_impl.h"
-#include "resumption/last_state.h"
#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "utils/date_time.h"
#include "utils/file_system.h"
@@ -76,10 +76,11 @@ class RCConsentManagerImplTest : public ::testing::Test {
public:
RCConsentManagerImplTest()
: current_date_(0u)
- , last_state_(new resumption::LastStateImpl(kAppTestStorageFolder,
- kAppTestInfoStorage))
+ , last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppTestStorageFolder,
+ kAppTestInfoStorage)))
, rc_consent_manager_(new rc_rpc_plugin::RCConsentManagerImpl(
- *last_state_, mock_app_mngr_, kPeriodOfConsentExpired)) {}
+ last_state_, mock_app_mngr_, kPeriodOfConsentExpired)) {}
void SetUp() OVERRIDE {
current_date_ = std::time(0);
@@ -102,14 +103,20 @@ class RCConsentManagerImplTest : public ::testing::Test {
file_system::RemoveDirectory(kAppTestStorageFolder);
}
- last_state_->get_dictionary().clear();
+ auto last_state_accessor = last_state_->get_accessor();
+ last_state_accessor.GetMutableData().set_dictionary(Json::Value());
+ }
+
+ void SaveStateToFileSystem() {
+ auto last_state_accessor = last_state_->get_accessor();
+ last_state_accessor.GetMutableData().SaveToFileSystem();
}
protected:
time_t current_date_;
NiceMock<MockApplicationManagerSettings> mock_app_mnrg_settings_;
NiceMock<MockApplicationManager> mock_app_mngr_;
- std::unique_ptr<resumption::LastState> last_state_;
+ resumption::LastStateWrapperPtr last_state_;
std::unique_ptr<rc_rpc_plugin::RCConsentManagerImpl> rc_consent_manager_;
};
@@ -129,7 +136,7 @@ TEST_F(RCConsentManagerImplTest, SaveAndGetModuleConsents_SUCCESS) {
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress1, module_consents);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
auto radio_consent = rc_consent_manager_->GetModuleConsent(
kPolicyApp1Id, kMacAddress1, {kRadioModule, radio_moduleId});
@@ -160,7 +167,7 @@ TEST_F(RCConsentManagerImplTest, ModuleId_NOT_EXISTS) {
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress1, module_consents);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
ModuleConsent consent = rc_consent_manager_->GetModuleConsent(
kPolicyApp1Id, kMacAddress1, unknown_module);
@@ -197,7 +204,7 @@ TEST_F(RCConsentManagerImplTest, ConsentIsExpired) {
module_consent_not_expired};
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress1, module_consents);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
// All consents, which consent has been saved more than 30 days, will be
// removed.
@@ -238,7 +245,7 @@ TEST_F(RCConsentManagerImplTest,
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress2, module_consents_app2);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
// Module consents for same app ids and different device_id (mac_adress) will
// haven't been replaced each other
@@ -280,12 +287,12 @@ TEST_F(RCConsentManagerImplTest,
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress1, module_consents_app1);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress1, module_consents_app2);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
// Module consents for same app ids and same device_id (mac_adress) will
// have been replaced each other
@@ -318,7 +325,7 @@ TEST_F(RCConsentManagerImplTest, RemoveAllModuleConsents_SUCCESS) {
rc_consent_manager_->SaveModuleConsents(
kPolicyApp1Id, kMacAddress2, module_consents_app2);
- last_state_->SaveStateToFileSystem();
+ SaveStateToFileSystem();
rc_consent_manager_->RemoveAllConsents();
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 0572679c85..52a0ad4dc1 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
@@ -93,6 +93,33 @@ class PerformInteractionRequest
*/
virtual void onTimeOut();
+ protected:
+ /**
+ * @brief Prepare result code for sending to mobile application
+ * @param ui_response contains result_code from HMI response and
+ * interface that returns response
+ * @param vr_response contains result_code from HMI response and
+ * interface that returns response.
+ * @return resulting code for sending to mobile application.
+ */
+ mobile_apis::Result::eType PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& ui_response,
+ const app_mngr::commands::ResponseInfo& vr_response);
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app.
+ * @param ui_response contains result_code from HMI response and
+ * interface that returns response
+ * @param vr_response contains result_code from HMI response and
+ * interface that returns response
+ * @return true if result code complies successful result code
+ * otherwise returns false
+ */
+ bool PrepareResultForMobileResponse(
+ app_mngr::commands::ResponseInfo& out_first,
+ app_mngr::commands::ResponseInfo& out_second) const;
+
private:
/**
* @brief Function will be called when VR_OnCommand event
@@ -194,7 +221,7 @@ class PerformInteractionRequest
* otherwise returns FALSE.
*/
bool CheckChoiceIDFromResponse(app_mngr::ApplicationSharedPtr app,
- int32_t choice_id);
+ const int32_t choice_id);
/**
* @brief Checks for a match of choice ID, in
@@ -232,7 +259,27 @@ class PerformInteractionRequest
*/
void SendBothModeResponse(const smart_objects::SmartObject& msg_param);
+ /**
+ * @brief Sends UiClosePopUp request to HMI
+ */
+ void SendClosePopupRequestToHMI();
+
+ /**
+ * @brief Sets the choice according to the current interaction mode and first
+ * received choice id (UI or VR).
+ *
+ * @param msg_param Message parameters which will be included in the response
+ * to mobile device.
+ * @return Returns false, if choice_id received from UI and VR are valid and
+ * not equal. Otherwise returns true.
+ */
+ bool SetChoiceIdToResponseMsgParams(
+ smart_objects::SmartObject& msg_param) const;
+
mobile_apis::InteractionMode::eType interaction_mode_;
+ std::int32_t ui_choice_id_received_;
+ std::int32_t vr_choice_id_received_;
+
bool ui_response_received_;
bool vr_response_received_;
bool app_pi_was_active_before_;
@@ -241,6 +288,7 @@ class PerformInteractionRequest
hmi_apis::Common_Result::eType ui_result_code_;
std::string ui_info_;
std::string vr_info_;
+ smart_objects::SmartObject response_msg_params;
DISALLOW_COPY_AND_ASSIGN(PerformInteractionRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
index 91298f4883..9c770279ab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
@@ -48,6 +48,13 @@ class SDLRPCPlugin : public plugins::RPCPlugin {
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
resumption::LastState& last_state) OVERRIDE;
bool IsAbleToProcess(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
index 371f47a759..060a2bda34 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -113,7 +113,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == code) {
LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
- if (application_manager_.HMILevelAllowsStreaming(app->app_id(),
+ if (application_manager_.HMIStateAllowsStreaming(app->app_id(),
ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
index 90f7c2d0f1..4228eb8859 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
@@ -115,7 +115,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == code) {
LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS");
- if (application_manager_.HMILevelAllowsStreaming(
+ if (application_manager_.HMIStateAllowsStreaming(
app->app_id(), ServiceType::kMobileNav)) {
app->set_video_streaming_approved(true);
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
index 6d95febe71..e11eda165c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
@@ -121,16 +121,15 @@ void OnSystemRequestNotification::Run() {
params[strings::connection_key] = app->app_id();
-#ifdef EXTERNAL_PROPRIETARY_MODE
using namespace rpc::policy_table_interface_base;
const auto request_type =
static_cast<rpc::policy_table_interface_base::RequestType>(
(*message_)[strings::msg_params][strings::request_type].asUInt());
- if (RequestType::RT_PROPRIETARY == request_type) {
- policy_handler_.ptu_retry_handler().OnSystemRequestReceived();
+ if (helpers::Compare<RequestType, helpers::EQ, helpers::ONE>(
+ request_type, RequestType::RT_PROPRIETARY, RequestType::RT_HTTP)) {
+ policy_handler_.OnSystemRequestReceived();
}
-#endif
SendNotificationToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
index 13690809bb..0a6632fca8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
@@ -154,10 +154,6 @@ void SDLActivateAppRequest::Run() {
application_manager_.application(application_id);
if (!app_to_activate) {
- LOG4CXX_WARN(
- logger_,
- "Can't find application within regular apps: " << application_id);
-
// Here is the hack - in fact SDL gets hmi_app_id in appID field and
// replaces it with connection_key only for normally registered apps, but
// for apps_to_be_registered (waiting) it keeps original value (hmi_app_id)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
index 2607754228..52b7f83e9b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
@@ -131,10 +131,11 @@ smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam(
auto put_element_in_value_array = [&value](const Json::Value& element,
const int32_t index) {
- Json::FastWriter writer;
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder["indentation"] = "";
std::string str;
if (element.type() == Json::objectValue) {
- str = writer.write(element);
+ str = Json::writeString(writer_builder, element);
clear_new_line_symbol(str);
} else {
str = element.asString();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
index 12cdfb4ad9..bfbf73270e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -52,7 +53,20 @@ SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {}
void SDLPolicyUpdateResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- // TODO(PV): add some logic here
+ const hmi_apis::Common_Result::eType code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
+
+ if (helpers::Compare<hmi_apis::Common_Result::eType,
+ helpers::NEQ,
+ helpers::ALL>(code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS)) {
+ LOG4CXX_ERROR(logger_, "Error is returned. PTU won't be started.");
+ return;
+ }
+
+ application_manager_.GetPolicyHandler().OnUpdateRequestSentToMobile();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index a57d222765..1dbfc97458 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -160,7 +160,9 @@ void AddCommandRequest::Run() {
return;
}
- app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(),
+ const uint32_t internal_consecutive_number = application_manager::commands::
+ CommandImpl::CalcCommandInternalConsecutiveNumber(app);
+ app->AddCommand(internal_consecutive_number,
(*message_)[strings::msg_params]);
smart_objects::SmartObject ui_msg_params =
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 622f64f792..881c838c1a 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
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h"
+
#include <string.h>
#include <numeric>
#include <string>
@@ -46,6 +47,10 @@
#include "utils/gen_hash.h"
#include "utils/helpers.h"
+namespace {
+const std::int32_t INVALID_CHOICE_ID = -1;
+}
+
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -67,11 +72,15 @@ PerformInteractionRequest::PerformInteractionRequest(
hmi_capabilities,
policy_handler)
, interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM)
+ , ui_choice_id_received_(INVALID_CHOICE_ID)
+ , vr_choice_id_received_(INVALID_CHOICE_ID)
, ui_response_received_(false)
, vr_response_received_(false)
, app_pi_was_active_before_(false)
, vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM)
, ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {
+ response_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand);
subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress);
@@ -227,8 +236,6 @@ void PerformInteractionRequest::Run() {
void PerformInteractionRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
- smart_objects::SmartObject msg_param =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
@@ -241,22 +248,24 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_response_received_ = true;
+
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(message, ui_info_);
- ProcessUIResponse(event.smart_object(), msg_param);
+ ProcessUIResponse(event.smart_object(), response_msg_params);
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
vr_response_received_ = true;
+
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(message, vr_info_);
- if (ProcessVRResponse(event.smart_object(), msg_param)) {
+ if (ProcessVRResponse(event.smart_object(), response_msg_params)) {
return;
}
break;
@@ -268,8 +277,17 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
if (!HasHMIResponsesToWait()) {
- LOG4CXX_DEBUG(logger_, "Send response in BOTH iteraction mode");
- SendBothModeResponse(msg_param);
+ LOG4CXX_DEBUG(logger_,
+ "Send response in interaction mode "
+ << static_cast<int32_t>(interaction_mode_));
+ if (SetChoiceIdToResponseMsgParams(response_msg_params)) {
+ SendBothModeResponse(response_msg_params);
+ } else {
+ DisablePerformInteraction();
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Received two different choice IDs");
+ }
}
}
@@ -346,6 +364,11 @@ bool PerformInteractionRequest::ProcessVRResponse(
return false;
}
+ if (!ui_response_received_ &&
+ InteractionMode::MANUAL_ONLY != interaction_mode_) {
+ SendClosePopupRequestToHMI();
+ }
+
const SmartObject& hmi_msg_params = message[strings::msg_params];
if (hmi_msg_params.keyExists(strings::choice_id)) {
const int choice_id = hmi_msg_params[strings::choice_id].asInt();
@@ -356,7 +379,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI");
return true;
}
- msg_params[strings::choice_id] = choice_id;
+ vr_choice_id_received_ = choice_id;
}
if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
@@ -397,8 +420,8 @@ void PerformInteractionRequest::ProcessUIResponse(
HmiInterfaces::InterfaceState ui_interface_state =
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_UI);
- bool result = false;
- result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+
+ bool result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
ui_result_code_,
hmi_apis::Common_Result::SUCCESS,
hmi_apis::Common_Result::WARNINGS);
@@ -430,11 +453,14 @@ void PerformInteractionRequest::ProcessUIResponse(
// result code must be GENERIC_ERROR in case wrong choice_id
if (msg_params.keyExists(strings::choice_id)) {
- if (!CheckChoiceIDFromResponse(app,
- msg_params[strings::choice_id].asInt())) {
+ const std::int32_t ui_choice_id =
+ static_cast<std::int32_t>(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;
}
@@ -931,15 +957,19 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
void PerformInteractionRequest::TerminatePerformInteraction() {
LOG4CXX_AUTO_TRACE(logger_);
+ SendClosePopupRequestToHMI();
+ DisablePerformInteraction();
+}
+
+void PerformInteractionRequest::SendClosePopupRequestToHMI() {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[hmi_request::method_name] = "UI.PerformInteraction";
SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params);
- DisablePerformInteraction();
}
bool PerformInteractionRequest::CheckChoiceIDFromResponse(
- ApplicationSharedPtr app, int32_t choice_id) {
+ ApplicationSharedPtr app, const int32_t choice_id) {
LOG4CXX_AUTO_TRACE(logger_);
const DataAccessor<PerformChoiceSetMap> accessor =
app->performinteraction_choice_set_map();
@@ -951,12 +981,14 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
const PerformChoice& choice = choice_set_map_it->second;
PerformChoice::const_iterator it = choice.begin();
for (; choice.end() != it; ++it) {
- const smart_objects::SmartObject& choice_set =
- (*it->second).getElement(strings::choice_set);
- for (size_t j = 0; j < choice_set.length(); ++j) {
- if (choice_id ==
- choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
- return true;
+ if ((*it->second).keyExists(strings::choice_set)) {
+ const smart_objects::SmartObject& choice_set =
+ (*it->second).getElement(strings::choice_set);
+ for (size_t j = 0; j < choice_set.length(); ++j) {
+ if (choice_id ==
+ choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
+ return true;
+ }
}
}
}
@@ -1063,13 +1095,94 @@ void PerformInteractionRequest::SendBothModeResponse(
msg_param.empty() ? NULL : &msg_param;
std::string info = app_mngr::commands::MergeInfos(
ui_perform_info, ui_info_, vr_perform_info, vr_info_);
+
DisablePerformInteraction();
+
SendResponse(result,
perform_interaction_result_code,
info.empty() ? NULL : info.c_str(),
response_params);
}
-} // namespace commands
+mobile_apis::Result::eType
+PerformInteractionRequest::PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& ui_response,
+ const app_mngr::commands::ResponseInfo& vr_response) {
+ LOG4CXX_DEBUG(
+ logger_, "InteractionMode = " << static_cast<int32_t>(interaction_mode_));
+
+ auto mobile_vr_result_code =
+ MessageHelper::HMIToMobileResult(vr_result_code_);
+ auto mobile_ui_result_code =
+ MessageHelper::HMIToMobileResult(ui_result_code_);
+
+ if (mobile_apis::Result::eType::WARNINGS == mobile_vr_result_code) {
+ if (mobile_apis::Result::eType::SUCCESS == mobile_ui_result_code) {
+ return mobile_apis::Result::eType::WARNINGS;
+ }
+ } else if (mobile_apis::Result::eType::WARNINGS == mobile_ui_result_code) {
+ if (mobile_apis::Result::eType::SUCCESS == mobile_vr_result_code) {
+ return mobile_apis::Result::eType::WARNINGS;
+ }
+ }
+ if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
+ return mobile_vr_result_code;
+ }
+ if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ return mobile_ui_result_code;
+ }
+
+ if (INVALID_CHOICE_ID != vr_choice_id_received_) {
+ return mobile_vr_result_code;
+ }
+ if (INVALID_CHOICE_ID != ui_choice_id_received_) {
+ return mobile_ui_result_code;
+ }
+
+ return CommandRequestImpl::PrepareResultCodeForResponse(ui_response,
+ vr_response);
+}
+
+bool PerformInteractionRequest::PrepareResultForMobileResponse(
+ app_mngr::commands::ResponseInfo& ui_response,
+ app_mngr::commands::ResponseInfo& vr_response) const {
+ if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
+ return vr_response.is_ok;
+ }
+ if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ return ui_response.is_ok;
+ }
+
+ return (vr_response.is_ok || ui_response.is_ok);
+}
+
+bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_param) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ 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 (mobile_apis::InteractionMode::eType::MANUAL_ONLY == interaction_mode_) {
+ msg_param[strings::choice_id] = ui_choice_id_received_;
+ return true;
+ }
+
+ if (mobile_apis::InteractionMode::eType::VR_ONLY == interaction_mode_) {
+ msg_param[strings::choice_id] = vr_choice_id_received_;
+ return true;
+ }
+
+ msg_param[strings::choice_id] =
+ ui_choice_id_valid ? ui_choice_id_received_ : vr_choice_id_received_;
+ return true;
+}
+
+} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index 030db82881..033e70a29c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -46,6 +46,7 @@ Copyright (c) 2018, Ford Motor Company
#include "utils/custom_string.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -613,15 +614,18 @@ void SystemRequest::Run() {
} else if (mobile_apis::RequestType::QUERY_APPS == request_type) {
using namespace ns_smart_device_link::ns_json_handler::formatters;
application_manager_.OnQueryAppsRequest(application->device());
- smart_objects::SmartObject sm_object;
- Json::Reader reader;
+
+ utils::JsonReader reader;
std::string json(binary_data.begin(), binary_data.end());
Json::Value root;
- if (!reader.parse(json.c_str(), root)) {
- LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file.");
+
+ if (!reader.parse(json, &root)) {
+ LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file. ");
return;
}
+ smart_objects::SmartObject sm_object;
+
CFormatterJsonBase::jsonValueToObj(root, sm_object);
if (!ValidateQueryAppData(sm_object)) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
index 35d3fbe2f6..2a1261f643 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
@@ -45,7 +45,19 @@ bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
+ resumption::LastStateWrapperPtr last_state) {
+ UNUSED(last_state);
+ command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
+bool SDLRPCPlugin::Init(
+ application_manager::ApplicationManager& app_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
UNUSED(last_state);
command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
app_manager, rpc_service, hmi_capabilities, policy_handler));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
index 8e802bbd7d..b5263ece7d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
@@ -67,7 +67,6 @@ MATCHER_P(GetPolicyConfigurationDataFirstElementMatches,
return false;
}
- Json::Reader reader;
Json::Value msg_json_value(Json::ValueType::arrayValue);
auto msg_value_first = message[strings::msg_params][strings::value][0];
@@ -135,8 +134,9 @@ TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Success) {
.WillByDefault(Return(pt.ToJsonValue()));
auto json_val = module_config_with_endpoints.endpoints.ToJsonValue();
- Json::FastWriter writer;
- std::string expected_string = writer.write(json_val);
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder.settings_["indentation"] = "";
+ std::string expected_string = Json::writeString(writer_builder, json_val);
clear_new_line_symbol(expected_string);
EXPECT_CALL(mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
index f1f7c4c907..193229eeb0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
@@ -70,35 +70,107 @@ namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
namespace {
+const int32_t kCorrelationId = 1u;
const int32_t kCommandId = 1;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
+const int32_t kUiChoiceID = 1u;
+const int32_t kVrChoiceID = 2u;
+const int32_t kInvalidChoiceId = -1;
} // namespace
class PerformInteractionRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {}
+ PerformInteractionRequestTest()
+ : mock_app_(CreateMockApp())
+ , performinteraction_choice_set_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>()) {}
void SetUp() OVERRIDE {
+ smart_objects::SmartObject choice_set1(
+ smart_objects::SmartType::SmartType_Map);
+ smart_objects::SmartObject choice_set2(
+ smart_objects::SmartType::SmartType_Map);
+
+ choice_set1[strings::choice_set] =
+ smart_objects::SmartType::SmartType_Array;
+ choice_set2[strings::choice_set] =
+ smart_objects::SmartType::SmartType_Array;
+
+ choice_set1[strings::choice_set][0][strings::choice_id] = kUiChoiceID;
+ choice_set2[strings::choice_set][0][strings::choice_id] = kVrChoiceID;
+
+ choice_set_map_[kCorrelationId].insert(std::make_pair(
+ kUiChoiceID, new smart_objects::SmartObject(choice_set1)));
+ choice_set_map_[kCorrelationId].insert(std::make_pair(
+ kVrChoiceID, new smart_objects::SmartObject(choice_set2)));
+
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, performinteraction_choice_set_map())
+ .WillByDefault(Return(DataAccessor<app_mngr::PerformChoiceSetMap>(
+ choice_set_map_, performinteraction_choice_set_lock_ptr_)));
}
void ResultCommandExpectations(MessageSharedPtr msg,
+ bool success,
+ hmi_apis::Common_Result::eType result_code,
const std::string& info) {
- EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
- true);
+ EXPECT_EQ((*msg)[strings::msg_params][strings::success].asBool(), success);
+ EXPECT_EQ((*msg)[strings::msg_params][strings::result_code].asInt(),
+ static_cast<int32_t>(result_code));
+ EXPECT_EQ((*msg)[strings::msg_params][strings::info].asString(), info);
+ }
+
+ void HMIRequestExpectations(MessageSharedPtr msg,
+ hmi_apis::FunctionID::eType function_id,
+ const std::string& method_name) {
+ EXPECT_EQ((*msg)[strings::params][strings::function_id].asInt(),
+ static_cast<int32_t>(function_id));
EXPECT_EQ(
- (*msg)[am::strings::msg_params][am::strings::result_code].asInt(),
- static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
- EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::info].asString(),
- info);
+ (*msg)[strings::msg_params][am::hmi_request::method_name].asString(),
+ method_name);
+ }
+
+ MessageSharedPtr CreateRequestMessage(
+ const mobile_apis::InteractionMode::eType& interaction_mode) {
+ MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*request_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*request_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*request_msg)[strings::msg_params][strings::interaction_mode] =
+ interaction_mode;
+ return request_msg;
+ }
+
+ MessageSharedPtr CreateHMIResponseMessage(
+ const hmi_apis::Common_Result::eType& response_code,
+ const std::string& message_info,
+ const int32_t command_id = kCommandId) {
+ MessageSharedPtr response_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*response_msg)[strings::params][hmi_response::code] = response_code;
+ (*response_msg)[strings::msg_params][strings::cmd_id] = command_id;
+ (*response_msg)[strings::msg_params][strings::info] = message_info;
+ return response_msg;
+ }
+
+ MessageSharedPtr CreateHMIResponseMessageWithChoiceID(
+ const hmi_apis::Common_Result::eType& response_code,
+ const std::string& message_info,
+ const int32_t choice_id,
+ const int32_t command_id = kCommandId) {
+ MessageSharedPtr response_msg =
+ CreateHMIResponseMessage(response_code, message_info, kCommandId);
+ (*response_msg)[strings::msg_params][strings::choice_id] = choice_id;
+ return response_msg;
}
sync_primitives::Lock lock_;
MockAppPtr mock_app_;
+ app_mngr::PerformChoiceSetMap choice_set_map_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ performinteraction_choice_set_lock_ptr_;
};
TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
@@ -147,35 +219,101 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
}
TEST_F(PerformInteractionRequestTest,
+ OnEvent_BOTHMode_UIChoiceIdReceivedFirst) {
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::SUCCESS, "", kInvalidChoiceId);
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kUiChoiceID);
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_ui);
+ command->on_event(event_vr);
+
+ EXPECT_EQ(
+ kUiChoiceID,
+ (*response_to_mobile)[strings::msg_params][strings::choice_id].asInt());
+}
+
+TEST_F(PerformInteractionRequestTest,
+ OnEvent_BOTHMode_VRChoiceIdReceivedFirst) {
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID);
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kInvalidChoiceId);
+
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ EXPECT_EQ(hmi_apis::FunctionID::UI_ClosePopUp,
+ (*request_to_hmi)[strings::params][strings::function_id].asInt());
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ command->on_event(event_ui);
+
+ EXPECT_EQ(
+ kVrChoiceID,
+ (*response_to_mobile)[strings::msg_params][strings::choice_id].asInt());
+}
+
+TEST_F(PerformInteractionRequestTest,
OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
- CreateMessage(smart_objects::SmartType_Map);
- (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] =
- mobile_apis::InteractionMode::VR_ONLY;
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
std::shared_ptr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- command->Init();
+
+ ASSERT_TRUE(command->Init());
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
MessageSharedPtr response_msg_vr =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_vr)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*response_msg_vr)[strings::msg_params][strings::cmd_id] = kCommandId;
- (*response_msg_vr)[am::strings::msg_params][am::strings::info] =
- "VR is not supported by system";
-
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
event_vr.set_smart_object(*response_msg_vr);
MessageSharedPtr response_msg_ui =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_ui)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::SUCCESS;
-
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
event_ui.set_smart_object(*response_msg_ui);
@@ -197,61 +335,331 @@ TEST_F(PerformInteractionRequestTest,
command->on_event(event_ui);
ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
"VR is not supported by system");
}
TEST_F(PerformInteractionRequestTest,
OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
- CreateMessage(smart_objects::SmartType_Map);
- (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] =
- mobile_apis::InteractionMode::VR_ONLY;
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
std::shared_ptr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ ASSERT_TRUE(command->Init());
+
+ MockAppPtr mock_app;
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "UI is not supported by system");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::SUCCESS,
+ "UI is not supported by system");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_GetVRResultCodeOnly_InVR_OnlyMode_SUCCESS) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
+
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MockAppPtr mock_app;
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_GetVR_ErrorInfoAndCode_InBOTH_Mode_With_UI_success_result_code) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
MessageSharedPtr response_msg_vr =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_vr)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::SUCCESS;
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
event_vr.set_smart_object(*response_msg_vr);
MessageSharedPtr response_msg_ui =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_ui)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*response_msg_ui)[strings::msg_params][strings::cmd_id] = kCommandId;
- (*response_msg_ui)[am::strings::msg_params][am::strings::info] =
- "UI is not supported by system";
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+}
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_Send_GENERIC_ERROR_To_Mobile_When_different_valid_choice_ids_received_in_BOTH_mode_SUCCESS) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID);
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kUiChoiceID);
+
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
event_ui.set_smart_object(*response_msg_ui);
MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "Received two different choice IDs");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_WARNINGS_UI_response_SUCCESS_MobileResponseContains_true_WARNINGS_warnings_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::WARNINGS,
+ "WARNING MESSAGE");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_SUCCESS_UI_response_WARNINGS_MobileResponseContains_true_WARNINGS_warnings_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::WARNINGS,
+ "WARNING MESSAGE");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_UNSUPPORTED_RESOURCE_UI_response_WARNINGS_MobileResponseContains_false_UNSUPPORTED_RESOURSE_error_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
- EXPECT_CALL(*mock_app_, is_perform_interaction_active())
- .WillOnce(Return(false));
- EXPECT_CALL(*mock_app_, DeletePerformInteractionChoiceSet(_));
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR error message");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "UI warning message");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
command->on_event(event_ui);
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
ResultCommandExpectations(response_to_mobile,
- "UI is not supported by system");
+ true,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "UI warning message, VR error message");
}
} // namespace perform_interaction_request
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index f0f68af298..80336b6967 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -49,6 +49,13 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
resumption::LastState& last_state) OVERRIDE;
bool IsAbleToProcess(
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index 3017b6712f..3e8ef6b29d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -53,7 +53,7 @@ bool VehicleInfoPlugin::Init(
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
+ resumption::LastStateWrapperPtr last_state) {
UNUSED(last_state);
application_manager_ = &app_manager;
custom_vehicle_data_manager_.reset(
@@ -67,6 +67,25 @@ bool VehicleInfoPlugin::Init(
return true;
}
+bool VehicleInfoPlugin::Init(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
+ UNUSED(last_state);
+ application_manager_ = &application_manager;
+ custom_vehicle_data_manager_.reset(
+ new CustomVehicleDataManagerImpl(policy_handler, rpc_service));
+ command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory(
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ *(custom_vehicle_data_manager_.get())));
+ return true;
+}
+
bool VehicleInfoPlugin::IsAbleToProcess(
const int32_t function_id, const commands::Command::CommandSource source) {
return command_factory_->IsAbleToProcess(function_id, source);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
index 95d49f9a20..a8193c17f0 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
@@ -37,6 +37,7 @@ include_directories(
${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands
${COMPONENTS_DIR}/application_manager/test/include/
${COMPONENTS_DIR}/include/test/application_manager/
+ ${COMPONENTS_DIR}/resumption/include/resumption/
)
set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
@@ -53,6 +54,7 @@ file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vehicle_data_item_schema_test.cc
${COMPONENTS_DIR}/application_manager/src/message.cc
${COMPONENTS_DIR}/application_manager/src/event_engine/*
+ ${COMPONENTS_DIR}/resumption/src/last_state_wrapper_impl.cc
)
set(LIBRARIES
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 3a200ff282..450bb5ac26 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -39,6 +39,7 @@
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
#include "mobile/unsubscribe_vehicle_data_request.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "resumption/mock_last_state.h"
#include "vehicle_info_plugin/commands/vi_command_request_test.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
@@ -78,7 +79,9 @@ class UnsubscribeVehicleRequestTest
, vi_app_extension_ptr_(
std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
vi_plugin_, *mock_app_))
- , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , mock_last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption_test::MockLastState>())) {}
protected:
void UnsubscribeSuccessfully();
@@ -107,7 +110,7 @@ class UnsubscribeVehicleRequestTest
std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_;
vehicle_info_plugin::VehicleInfoPlugin vi_plugin_;
application_manager_test::MockRPCHandler mock_rpc_handler_;
- resumption_test::MockLastState mock_last_state_;
+ resumption::LastStateWrapperPtr mock_last_state_;
};
TEST_F(UnsubscribeVehicleRequestTest, Run_AppNotRegistered_UNSUCCESS) {