diff options
Diffstat (limited to 'src/components/application_manager')
-rw-r--r-- | src/components/application_manager/include/application_manager/app_service_manager.h | 7 | ||||
-rw-r--r-- | src/components/application_manager/src/app_service_manager.cc | 27 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h index a6cd0efcf8..736302dbc2 100644 --- a/src/components/application_manager/include/application_manager/app_service_manager.h +++ b/src/components/application_manager/include/application_manager/app_service_manager.h @@ -72,7 +72,7 @@ class AppServiceManager { /** * @brief TODO - * @param manifest + * @param service_id */ bool UnpublishAppService(const std::string service_id); @@ -82,6 +82,11 @@ class AppServiceManager { */ std::vector<smart_objects::SmartObject> GetAllServices(); + std::pair<std::string, AppService> ActiveServiceByType( + std::string service_type); + + std::pair<std::string, AppService> FindServiceByName(std::string name); + private: ApplicationManager& app_manager_; std::map<std::string, AppService> published_services_; diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index 7d91a3cbe5..c52e6a12f1 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -106,4 +106,31 @@ std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() { return services; } + +std::pair<std::string, AppService> AppServiceManager::ActiveServiceByType( + std::string service_type) { + for (auto it = published_services_.begin(); it != published_services_.end(); + ++it) { + if (it->second.record[strings::app_service_manifest][strings::service_type] + .asString() == service_type && + it->second.record[strings::service_active].asBool()) { + return *it; + } + } + AppService empty; + return std::make_pair(std::string(), empty); +} + +std::pair<std::string, AppService> AppServiceManager::FindServiceByName( + std::string name) { + for (auto it = published_services_.begin(); it != published_services_.end(); + ++it) { + if (it->second.record[strings::app_service_manifest][strings::service_name] + .asString() == name) { + return *it; + } + } + AppService empty; + return std::make_pair(std::string(), empty); +} } // namespace application_manager |