diff options
author | Alexander <akutsan@luxoft.com> | 2018-06-18 09:48:21 +0300 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:48 +0300 |
commit | c80699e649caa7743fc592945cdc596ee1784e17 (patch) | |
tree | 0ad686f634141ce8114d57c0f2691d993277f140 /src/components | |
parent | 4752f7b32a961d8dc60019d0256424a6b93bc598 (diff) | |
download | sdl_core-c80699e649caa7743fc592945cdc596ee1784e17.tar.gz |
Modify amount pf parameters for creating VI app extensions.
Add Extension creating and processing resumption
Diffstat (limited to 'src/components')
4 files changed, 20 insertions, 10 deletions
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h index 25aa75c459..693fcc4b07 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h @@ -39,6 +39,8 @@ #include <string> namespace vehicle_info_plugin { +class VehicleInfoPlugin; + namespace app_mngr = application_manager; typedef mobile_apis::VehicleDataType::eType VehicleDataType; @@ -49,7 +51,8 @@ typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions; class VehicleInfoAppExtension : public app_mngr::AppExtension { public: - explicit VehicleInfoAppExtension(); + explicit VehicleInfoAppExtension(VehicleInfoPlugin& plugin, + app_mngr::Application& app); virtual ~VehicleInfoAppExtension(); bool subscribeToVehicleInfo(const VehicleDataType vehicle_data); @@ -69,6 +72,8 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension { private: VehicleInfoSubscriptions subscribed_data_; + VehicleInfoPlugin& plugin_; + app_mngr::Application& app_; }; } 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 1cf7378594..97d06b85d5 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 @@ -62,7 +62,7 @@ class VehicleInfoPlugin : public plugins::RPCPlugin { void OnApplicationEvent(plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) OVERRIDE; - void ProcessResumptionSubscription(app_mngr::ApplicationSharedPtr app, + void ProcessResumptionSubscription(app_mngr::Application& app, VehicleInfoAppExtension& ext); static const VehicleData vehicle_data_; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc index 0b2e188fc2..d2f393db10 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc @@ -39,9 +39,12 @@ namespace vehicle_info_plugin { unsigned VehicleInfoAppExtension::VehicleInfoAppExtensionUID = 146; -VehicleInfoAppExtension::VehicleInfoAppExtension() +VehicleInfoAppExtension::VehicleInfoAppExtension( + VehicleInfoPlugin& plugin, application_manager::Application& app) : app_mngr::AppExtension( - VehicleInfoAppExtension::VehicleInfoAppExtensionUID) { + VehicleInfoAppExtension::VehicleInfoAppExtensionUID) + , plugin_(plugin) + , app_(app) { LOG4CXX_AUTO_TRACE(logger_); } @@ -104,8 +107,7 @@ void VehicleInfoAppExtension::PorcessResumption( (resumption_data[i]).asInt()); subscribeToVehicleInfo(ivi); } - // ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests( - // application, application_manager_)); + plugin_.ProcessResumptionSubscription(app_, *this); } } 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 7bf7896321..2a828cab0e 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 @@ -134,15 +134,18 @@ void VehicleInfoPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} void VehicleInfoPlugin::OnApplicationEvent( plugins::ApplicationEvent event, - app_mngr::ApplicationSharedPtr application) {} + app_mngr::ApplicationSharedPtr application) { + if (plugins::ApplicationEvent::kApplicationRegistered == event) { + application->AddExtension(new VehicleInfoAppExtension(*this, *application)); + } +} void VehicleInfoPlugin::ProcessResumptionSubscription( - application_manager::ApplicationSharedPtr app, - VehicleInfoAppExtension& ext) { + application_manager::Application& app, VehicleInfoAppExtension& ext) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); + msg_params[strings::app_id] = app.app_id(); const auto& subscriptions = ext.Subscriptions(); for (auto& ivi_data : vehicle_data_) { mobile_apis::VehicleDataType::eType type_id = ivi_data.second; |