diff options
author | JackLivio <jack@livio.io> | 2019-01-30 14:11:12 -0500 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-01-30 14:11:12 -0500 |
commit | 59e638c2ae6722b07e70423eff9d3eb44c9581bb (patch) | |
tree | b83d53c524baf51b94c49c15800f840a29e13cc1 /src/components/application_manager | |
parent | 2f5fe1b89dc6d15fb9bb2e42083db23edf3de276 (diff) | |
parent | c0bc15dbfcf78eaa3bcecb34b28fe98a5c9a1757 (diff) | |
download | sdl_core-59e638c2ae6722b07e70423eff9d3eb44c9581bb.tar.gz |
Merge remote-tracking branch 'origin/feature/base_app_services_implementation' into feature/app_service_policies
Diffstat (limited to 'src/components/application_manager')
5 files changed, 17 insertions, 19 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 afbf9b8dcd..a15921d9f7 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 @@ -59,7 +59,8 @@ class AppServiceManager { * @brief TODO * @param manifest */ - bool PublishAppService(const smart_objects::SmartObject& manifest); + smart_objects::SmartObject PublishAppService( + const smart_objects::SmartObject& manifest); /** * @brief TODO diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 418161b0ff..f72b02e320 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -213,8 +213,7 @@ class ApplicationManagerImpl return *plugin_manager_; } - virtual application_manager::AppServiceManager& GetAppServiceManager() - OVERRIDE { + virtual AppServiceManager& GetAppServiceManager() OVERRIDE { DCHECK(app_service_manager_); return *app_service_manager_; } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 835762f78a..1e235c1282 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -80,17 +80,14 @@ void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject service_record = - smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; if (!ValidateManifest(manifest)) { return; } - service_record[strings::service_manifest] = manifest; - service_record[strings::service_id] = "This is a service ID"; - service_record[strings::service_published] = true; - service_record[strings::service_active] = true; + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService(manifest); + response_params[strings::app_service_record] = service_record; // TODO: Add AppServiceRecord to response SendResponse(true, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index c19cd22859..f975cb0543 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -84,17 +84,13 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject service_record = - smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; if (!ValidateManifest(manifest)) { return; } - service_record[strings::service_manifest] = manifest; - service_record[strings::service_id] = "This is a service ID"; - service_record[strings::service_published] = true; - service_record[strings::service_active] = true; + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService(manifest); std::string requested_service_name = (*message_)[strings::msg_params][strings::app_service_manifest] diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index 2c5a31e86e..d11203feec 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -58,12 +58,17 @@ AppServiceManager::~AppServiceManager() { LOG4CXX_AUTO_TRACE(logger_); } -bool AppServiceManager::PublishAppService( +smart_objects::SmartObject AppServiceManager::PublishAppService( const smart_objects::SmartObject& manifest) { std::string service_id = "SERVICE_UUID"; // TODO: Generate UUID - published_services_.insert( - std::pair<std::string, smart_objects::SmartObject>(service_id, manifest)); - return true; + smart_objects::SmartObject service_record; + service_record[strings::service_manifest] = manifest; + service_record[strings::service_id] = service_id; + service_record[strings::service_published] = true; + service_record[strings::service_active] = true; + published_services_.insert(std::pair<std::string, smart_objects::SmartObject>( + service_id, service_record)); + return service_record; } bool AppServiceManager::UnpublishAppService(const std::string service_id) { |