diff options
author | Alexander <akutsan@luxoft.com> | 2018-07-20 13:35:02 +0300 |
---|---|---|
committer | Alexander <akutsan@luxoft.com> | 2018-08-20 11:19:39 +0300 |
commit | 861cbf1da2fc9e480ea9e9197d858930a6bb7f5b (patch) | |
tree | 962eb06ca63adbd26a13a4102838925388ec48f0 /src | |
parent | 36ccbe8e8386a5e6229cf6ac9a55dc2162b6ced0 (diff) | |
download | sdl_core-861cbf1da2fc9e480ea9e9197d858930a6bb7f5b.tar.gz |
Add data to cache on interior data update
Add data to cache in case if there are applications subscribed to certain interior vehicle data
Diffstat (limited to 'src')
2 files changed, 16 insertions, 3 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h index f018e2daf4..931e79366c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h @@ -59,6 +59,7 @@ class OnInteriorVehicleDataNotification private: InteriorDataCache& interior_data_cache_; + void AddDataToCache(const std::string& module_type); }; } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index 261cdd49b1..c8d1329c02 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -54,11 +54,24 @@ OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification( OnInteriorVehicleDataNotification::~OnInteriorVehicleDataNotification() {} +void OnInteriorVehicleDataNotification::AddDataToCache( + const std::string& module_type) { + const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); + const auto module_data = + (*message_)[app_mngr::strings::msg_params][message_params::kModuleData] + [data_mapping(module_type)]; + interior_data_cache_.Add(module_type, module_data); +} + void OnInteriorVehicleDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); const std::string module_type = ModuleType(); - + auto apps_subscribed = + RCHelpers::AppsSubscribedToModuleType(application_manager_, module_type); + if (!apps_subscribed.empty()) { + AddDataToCache(module_type); + } typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs; AppPtrs apps = RCRPCPlugin::GetRCApplications(application_manager_); @@ -66,8 +79,7 @@ void OnInteriorVehicleDataNotification::Run() { DCHECK(*it); application_manager::Application& app = **it; - RCAppExtensionPtr extension = std::static_pointer_cast<RCAppExtension>( - app.QueryInterface(RCRPCPlugin::kRCPluginID)); + const auto extension = RCHelpers::GetRCExtension(app); DCHECK(extension); LOG4CXX_TRACE(logger_, "Check subscription for " |