summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-02-05 14:46:10 -0500
committerJackLivio <jack@livio.io>2019-02-05 14:46:10 -0500
commit000a8e84cbae684537b2edbd34716923e418d938 (patch)
tree180708d55fb35aad2efe24cc4f092fe2ac66ab69 /src/components/application_manager
parent19b7312d7bef764e8362640165dd4f1e0b5e5c58 (diff)
downloadsdl_core-000a8e84cbae684537b2edbd34716923e418d938.tar.gz
Update PublishAppService
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc3
-rw-r--r--src/components/application_manager/src/app_service_manager.cc18
4 files changed, 28 insertions, 8 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 a15921d9f7..a6cd0efcf8 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
@@ -37,6 +37,12 @@
namespace application_manager {
+struct AppService {
+ uint32_t connection_key;
+ bool mobile_service;
+ smart_objects::SmartObject record;
+};
+
class ApplicationManager;
/**
@@ -60,7 +66,9 @@ class AppServiceManager {
* @param manifest
*/
smart_objects::SmartObject PublishAppService(
- const smart_objects::SmartObject& manifest);
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key);
/**
* @brief TODO
@@ -76,7 +84,7 @@ class AppServiceManager {
private:
ApplicationManager& app_manager_;
- std::map<std::string, smart_objects::SmartObject> published_services_;
+ std::map<std::string, AppService> published_services_;
};
} // namespace application_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 1e235c1282..7a71bea57f 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
@@ -86,7 +86,8 @@ void ASPublishAppServiceRequest::Run() {
return;
}
smart_objects::SmartObject service_record =
- application_manager_.GetAppServiceManager().PublishAppService(manifest);
+ application_manager_.GetAppServiceManager().PublishAppService(
+ manifest, false, UINT32_MAX);
response_params[strings::app_service_record] = service_record;
// TODO: Add AppServiceRecord to response
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 bf1fbae4f5..78372661dc 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
@@ -90,7 +90,8 @@ void PublishAppServiceRequest::Run() {
return;
}
smart_objects::SmartObject service_record =
- application_manager_.GetAppServiceManager().PublishAppService(manifest);
+ application_manager_.GetAppServiceManager().PublishAppService(
+ manifest, true, connection_key());
response_params[strings::app_service_record] = service_record;
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index edfdfa26bc..7d91a3cbe5 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -60,7 +60,9 @@ AppServiceManager::~AppServiceManager() {
}
smart_objects::SmartObject AppServiceManager::PublishAppService(
- const smart_objects::SmartObject& manifest) {
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key) {
std::string str_to_hash = "";
std::string service_id = "";
@@ -70,13 +72,21 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
service_id = encryption::MakeHash(str_to_hash);
} while (published_services_.find(service_id) != published_services_.end());
+ AppService app_service;
+ app_service.connection_key = connection_key;
+ app_service.mobile_service = mobile_service;
+
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));
+
+ app_service.record = service_record;
+
+ published_services_.insert(
+ std::pair<std::string, AppService>(service_id, app_service));
+
return service_record;
}
@@ -91,7 +101,7 @@ std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() {
std::vector<smart_objects::SmartObject> services;
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
- services.push_back(it->second);
+ services.push_back(it->second.record);
}
return services;
}