diff options
author | Ira Lytvynenko <ILytvynenko@luxoft.com> | 2018-02-15 15:50:57 +0000 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:45 +0300 |
commit | 44bb162a73480bfc45f2675897baae456ffcd932 (patch) | |
tree | 219f07c6b9a83b969d09707186cc2ba317babf24 /src/components/application_manager/src/commands | |
parent | c8c46e8a07a7817db63b8cfed6c8834f43296715 (diff) | |
download | sdl_core-44bb162a73480bfc45f2675897baae456ffcd932.tar.gz |
OnRemoteControlSettings and OnInteriorVehicleData notifications impl
Diffstat (limited to 'src/components/application_manager/src/commands')
-rw-r--r-- | src/components/application_manager/src/commands/command_impl.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 22f6a822ff..593b8ee398 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -35,6 +35,16 @@ #include "application_manager/application_manager.h" namespace application_manager { + +namespace { +struct AppExtensionPredicate { + AppExtensionUID uid; + bool operator()(const ApplicationSharedPtr app) { + return app ? app->QueryInterface(uid).valid() : false; + } +}; +} + namespace commands { CREATE_LOGGERPTR_LOCAL(CommandImpl::logger_, "Commands") @@ -204,5 +214,21 @@ DEPRECATED void CommandImpl::ReplaceHMIByMobileAppId( } } +std::vector<ApplicationSharedPtr> CommandImpl::GetApplications( + AppExtensionUID uid) { + ApplicationSet accessor = application_manager_.applications().GetData(); + AppExtensionPredicate predicate; + predicate.uid = uid; + + std::vector<ApplicationSharedPtr> result; + ApplicationSetConstIt it = + std::find_if(accessor.begin(), accessor.end(), predicate); + while (it != accessor.end()) { + result.push_back(*it); + it = std::find_if(++it, accessor.end(), predicate); + } + return result; +} + } // namespace commands } // namespace application_manager |