summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src
diff options
context:
space:
mode:
authorBSolonenko <BSolonenko@luxoft.com>2018-03-03 19:06:29 +0200
committerIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-06-26 12:01:46 +0300
commit57aa1c99210a39546106d02a26be82eeb2a7800f (patch)
treeb0bc3878f2e75725548870e381300b47f2f0a96b /src/components/application_manager/rpc_plugins/rc_rpc_plugin/src
parentf3c20e49e05d65314760e04ed6656fe2d6bcd49c (diff)
downloadsdl_core-57aa1c99210a39546106d02a26be82eeb2a7800f.tar.gz
Fixed get RC Applications
- added is_rc_ field, getter and setter in ApplicationImpl; - fixed RegisterAppInterfaceRequest::Run(); - fixed RCRPCPlugin::GetRCApplications(). Fix UTs Added is_remote_control_supported and set_remote_control_supported methods in MockApplication Fixed on_interior_vehicle_data_notification_test and resource_allocation_manager_impl_test. Fixed sending of notifications. - Fixed RCRPCPlugin::OnPolicyEvent; - Fixed RCRPCPlugin::OnApplicationEvent; - Fixed OnExitApplicationNotification::Run; - Fixed ApplicationManagerImpl::UnregisterApplication; - Fixed ApplicationManagerImpl::OnPTUFinished; - Refactoring ApplicationImpl::RemoveExtension; - is_remote_control_supported_ added in initialization list. Fix UTs In application_manager_impl_test added seting RPCPluginManager Conflicts: src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc src/components/application_manager/src/application_manager_impl.cc
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/src')
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc36
1 files changed, 25 insertions, 11 deletions
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 4bf2abd607..9a3b55e278 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
@@ -39,16 +39,36 @@ application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() {
}
void RCRPCPlugin::OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent event) {}
+ application_manager::plugin_manager::PolicyEvent event) {
+ switch (event) {
+ case plugins::kApplicationPolicyUpdated: {
+ resource_allocation_manager_->OnPolicyEvent(event);
+ break;
+ }
+ default:
+ break;
+ }
+}
void RCRPCPlugin::OnApplicationEvent(
application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application) {
+ if (!application->is_remote_control_supported()) {
+ return;
+ }
switch (event) {
case plugins::kApplicationRegistered: {
application->AddExtension(new RCAppExtension(kRCPluginID));
break;
}
+ case plugins::kApplicationExit: {
+ resource_allocation_manager_->OnApplicationEvent(event, application);
+ break;
+ }
+ case plugins::kApplicationUnregistered: {
+ resource_allocation_manager_->OnApplicationEvent(event, application);
+ break;
+ }
default:
break;
}
@@ -59,17 +79,11 @@ RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(application_manager::Applicatio
using application_manager::ApplicationSet;
ApplicationSet accessor = app_mngr.applications().GetData();
- auto predicate = [](const ApplicationSharedPtr& app) {
- auto uid = RCRPCPlugin::kRCPluginID;
- return app ? app->QueryInterface(uid).valid() : false;
- };
-
- auto it = std::find_if(accessor.begin(), accessor.end(), predicate);
-
std::vector<ApplicationSharedPtr> result;
- while (it != accessor.end()) {
- result.push_back(*it);
- it = std::find_if(++it, accessor.end(), predicate);
+ for (const auto& it : accessor) {
+ if (it->is_remote_control_supported()) {
+ result.push_back(it);
+ }
}
return result;
}