summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-03-01 16:19:45 -0500
committerGitHub <noreply@github.com>2019-03-01 16:19:45 -0500
commit9ef245688d5f4c16e44c1980483cf78506a227c9 (patch)
treedab1626e9ccfa4a97a5f835e1289cbe85f221c0d /src
parentfc9f7d13c0e03caee9e196a636815e791213ad66 (diff)
downloadsdl_core-9ef245688d5f4c16e44c1980483cf78506a227c9.tar.gz
GetCloudAppProperties (#2824)
* GetCloudAppProperties * Update setCloudAppProperties to use properties param * Address comments * Add set endpoint and app name * Remove setAppName * Address comment * Address Comments * Add return value to GetCloudAppParameters * Add return
Diffstat (limited to 'src')
-rw-r--r--src/appMain/sdl_preloaded_pt.json5
-rw-r--r--src/components/application_manager/include/application_manager/application.h4
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h2
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc110
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc8
-rw-r--r--src/components/application_manager/src/application_impl.cc4
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc4
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc53
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc3
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc5
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h4
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h2
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h9
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h9
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h2
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h5
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h3
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h5
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h5
-rw-r--r--src/components/interfaces/MOBILE_API.xml68
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h9
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h9
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h9
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h5
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc15
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc21
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc5
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h9
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h9
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h9
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h5
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc15
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc21
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc10
39 files changed, 480 insertions, 81 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 3c84fc96bd..a2fdb7740a 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -540,6 +540,11 @@
"FULL",
"LIMITED"]
},
+ "GetCloudAppProperties":{
+ "hmi_levels":["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
"GetVehicleData": {
"hmi_levels": ["BACKGROUND",
"FULL",
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 7a59263299..15a79388c1 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -957,7 +957,7 @@ class Application : public virtual InitialApplicationData,
* websocket open.
* @return cloud app auth token
*/
- virtual const std::string& cloud_app_auth_token() const = 0;
+ virtual const std::string& auth_token() const = 0;
/**
* @brief Get cloud app tranpsport type. Defines the type of websocket
@@ -994,7 +994,7 @@ class Application : public virtual InitialApplicationData,
/**
* @brief Set cloud app auth token
*/
- virtual void set_cloud_app_auth_token(const std::string& auth_token) = 0;
+ virtual void set_auth_token(const std::string& auth_token) = 0;
/**
* @brief Set cloud app transport type
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 6d627d0c67..aedb973b31 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -420,7 +420,7 @@ class ApplicationImpl : public virtual Application,
* websocket open.
* @return cloud app auth token
*/
- const std::string& cloud_app_auth_token() const OVERRIDE;
+ const std::string& auth_token() const OVERRIDE;
/**
* @brief Get cloud app tranpsport type. Defines the type of websocket
@@ -457,7 +457,7 @@ class ApplicationImpl : public virtual Application,
/**
* @brief Set cloud app auth token
*/
- void set_cloud_app_auth_token(const std::string& auth_token) OVERRIDE;
+ void set_auth_token(const std::string& auth_token) OVERRIDE;
/**
* @brief Set cloud app transport type
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index b912c489e4..2b6919eac0 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -433,7 +433,7 @@ class PolicyHandler : public PolicyHandlerInterface,
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- void GetCloudAppParameters(const std::string& policy_app_id,
+ bool GetCloudAppParameters(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 5e6a3bb377..aaca228eda 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -189,11 +189,12 @@ extern const char* blue;
extern const char* display_layout;
extern const char* icon_resumed;
extern const char* enabled;
-extern const char* cloud_app_auth_token;
+extern const char* auth_token;
extern const char* cloud_transport_type;
extern const char* hybrid_app_preference;
extern const char* is_cloud_application;
extern const char* cloud_connection_status;
+extern const char* endpoint;
// PutFile
extern const char* sync_file_name;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h
new file mode 100644
index 0000000000..3d74a80dc2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class GetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ GetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~GetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesRequest);
+}; // GetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h
new file mode 100644
index 0000000000..f716c7dcb5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class GetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ GetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~GetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesResponse);
+
+}; // GetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..62c91ff3d5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
@@ -0,0 +1,110 @@
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {}
+
+void GetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ std::string policy_app_id =
+ (*message_)[strings::msg_params][strings::app_id].asString();
+
+ bool enabled = true;
+ std::string endpoint;
+ std::string auth_token;
+ std::string certificate;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+
+ bool result = policy_handler_.GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+
+ if (!result) {
+ SendResponse(false,
+ mobile_apis::Result::DATA_NOT_AVAILABLE,
+ "Cloud app does not exist on module");
+ return;
+ }
+
+ ApplicationSharedPtr cloud_app =
+ application_manager_.application_by_policy_id(policy_app_id);
+ std::string cloud_name;
+ if (cloud_app) {
+ cloud_name = cloud_app->name().AsMBString();
+ } else {
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ policy_handler_.GetInitialAppData(
+ policy_app_id, &nicknames, &app_hmi_types);
+
+ if (!nicknames.size()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ SendResponse(false,
+ mobile_apis::Result::DATA_NOT_AVAILABLE,
+ "No available nick names for the requested app");
+ return;
+ }
+ cloud_name = nicknames[0];
+ }
+
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+
+ properties[strings::app_name] = cloud_name;
+ properties[strings::app_id] = policy_app_id;
+ properties[strings::enabled] = enabled;
+
+ if (!auth_token.empty()) {
+ properties[strings::auth_token] = auth_token;
+ }
+ if (!cloud_transport_type.empty()) {
+ properties[strings::cloud_transport_type] = cloud_transport_type;
+ }
+ if (!hybrid_app_preference.empty()) {
+ properties[strings::hybrid_app_preference] = hybrid_app_preference;
+ }
+ if (!endpoint.empty()) {
+ properties[strings::endpoint] = endpoint;
+ }
+
+ response_params[strings::properties] = properties;
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+}
+
+void GetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
new file mode 100644
index 0000000000..813a9e7006
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
@@ -0,0 +1,31 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {}
+
+void GetCloudAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugins
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 8eab054be3..5ef76b59ef 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -126,6 +126,8 @@
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h"
#include "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -345,6 +347,12 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
: factory
.GetCreator<commands::SetCloudAppPropertiesResponse>();
}
+ case mobile_apis::FunctionID::GetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::GetCloudAppPropertiesResponse>();
+ }
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 02bf5b49fe..63bc9be8c6 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -1167,7 +1167,7 @@ const std::string& ApplicationImpl::cloud_app_endpoint() const {
return endpoint_;
}
-const std::string& ApplicationImpl::cloud_app_auth_token() const {
+const std::string& ApplicationImpl::auth_token() const {
return auth_token_;
}
@@ -1193,7 +1193,7 @@ void ApplicationImpl::set_cloud_app_endpoint(const std::string& endpoint) {
endpoint_ = endpoint;
}
-void ApplicationImpl::set_cloud_app_auth_token(const std::string& auth_token) {
+void ApplicationImpl::set_auth_token(const std::string& auth_token) {
auth_token_ = auth_token;
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index a9ae2e5ca7..364887ad3f 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -632,7 +632,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
// Set cloud app parameters
application->set_cloud_app_endpoint((*it)->cloud_app_endpoint());
application->set_cloud_app_certificate((*it)->cloud_app_certificate());
- application->set_cloud_app_auth_token((*it)->cloud_app_auth_token());
+ application->set_auth_token((*it)->auth_token());
application->set_cloud_app_transport_type(
(*it)->cloud_app_transport_type());
application->set_hybrid_app_preference((*it)->hybrid_app_preference());
@@ -1105,7 +1105,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
application->set_hmi_application_id(GenerateNewHMIAppID());
application->set_cloud_app_endpoint(endpoint);
- application->set_cloud_app_auth_token(auth_token);
+ application->set_auth_token(auth_token);
application->set_cloud_app_transport_type(cloud_transport_type);
application->set_hybrid_app_preference(hybrid_app_preference_enum);
application->set_cloud_app_certificate(certificate);
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 05aa9154ea..7d94e19b12 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1869,7 +1869,7 @@ void PolicyHandler::GetEnabledCloudApps(
policy_manager_->GetEnabledCloudApps(enabled_apps);
}
-void PolicyHandler::GetCloudAppParameters(
+bool PolicyHandler::GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -1877,14 +1877,14 @@ void PolicyHandler::GetCloudAppParameters(
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
- POLICY_LIB_CHECK_VOID();
- policy_manager_->GetCloudAppParameters(policy_app_id,
- enabled,
- endpoint,
- certificate,
- auth_token,
- cloud_transport_type,
- hybrid_app_preference);
+ POLICY_LIB_CHECK(false);
+ return policy_manager_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
}
const bool PolicyHandler::CheckCloudAppEnabled(
@@ -1915,40 +1915,51 @@ void PolicyHandler::OnSetCloudAppProperties(
<< strings::msg_params);
return;
}
- const smart_objects::SmartObject& msg_params = message[strings::msg_params];
- if (!msg_params.keyExists(strings::app_id)) {
+ if (!message[strings::msg_params].keyExists(strings::properties)) {
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain app properties "
+ << strings::msg_params);
+ return;
+ }
+
+ const smart_objects::SmartObject& properties =
+ message[strings::msg_params][strings::properties];
+ if (!properties.keyExists(strings::app_id)) {
LOG4CXX_ERROR(logger_,
"Message does not contain mandatory parameter "
<< strings::app_id);
return;
}
- std::string policy_app_id(msg_params[strings::app_id].asString());
+ std::string policy_app_id(properties[strings::app_id].asString());
policy_manager_->InitCloudApp(policy_app_id);
bool auth_token_update = false;
- if (msg_params.keyExists(strings::enabled)) {
- bool enabled = msg_params[strings::enabled].asBool();
+ if (properties.keyExists(strings::enabled)) {
+ bool enabled = properties[strings::enabled].asBool();
policy_manager_->SetCloudAppEnabled(policy_app_id, enabled);
auth_token_update = enabled;
application_manager_.RefreshCloudAppInformation();
}
- if (msg_params.keyExists(strings::cloud_app_auth_token)) {
- std::string auth_token =
- msg_params[strings::cloud_app_auth_token].asString();
+ if (properties.keyExists(strings::auth_token)) {
+ std::string auth_token = properties[strings::auth_token].asString();
policy_manager_->SetAppAuthToken(policy_app_id, auth_token);
auth_token_update = true;
}
- if (msg_params.keyExists(strings::cloud_transport_type)) {
+ if (properties.keyExists(strings::cloud_transport_type)) {
policy_manager_->SetAppCloudTransportType(
- policy_app_id, msg_params[strings::cloud_transport_type].asString());
+ policy_app_id, properties[strings::cloud_transport_type].asString());
+ }
+ if (properties.keyExists(strings::endpoint)) {
+ policy_manager_->SetAppEndpoint(policy_app_id,
+ properties[strings::endpoint].asString());
}
- if (msg_params.keyExists(strings::hybrid_app_preference)) {
+ if (properties.keyExists(strings::hybrid_app_preference)) {
std::string hybrid_app_preference;
mobile_apis::HybridAppPreference::eType value =
static_cast<mobile_apis::HybridAppPreference::eType>(
- msg_params[strings::hybrid_app_preference].asUInt());
+ properties[strings::hybrid_app_preference].asUInt());
smart_objects::EnumConversionHelper<
mobile_apis::HybridAppPreference::eType>::
EnumToString(value, &hybrid_app_preference);
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 70581466eb..109739c359 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -156,11 +156,12 @@ const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
const char* enabled = "enabled";
-const char* cloud_app_auth_token = "cloudAppAuthToken";
+const char* auth_token = "authToken";
const char* cloud_transport_type = "cloudTransportType";
const char* hybrid_app_preference = "hybridAppPreference";
const char* is_cloud_application = "isCloudApplication";
const char* cloud_connection_status = "cloudConnectionStatus";
+const char* endpoint = "endpoint";
// PutFile
const char* sync_file_name = "syncFileName";
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index 4ea44e5aca..d4e73ef492 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -1428,8 +1428,7 @@ TEST_F(ApplicationManagerImplTest,
ON_CALL(*waiting_app, device()).WillByDefault(Return(kDeviceId));
EXPECT_CALL(*waiting_app, cloud_app_endpoint())
.WillOnce(ReturnRef(kEndpoint));
- EXPECT_CALL(*waiting_app, cloud_app_auth_token())
- .WillOnce(ReturnRef(kAuthToken));
+ EXPECT_CALL(*waiting_app, auth_token()).WillOnce(ReturnRef(kAuthToken));
EXPECT_CALL(*waiting_app, cloud_app_certificate())
.WillOnce(ReturnRef(kCertificate));
EXPECT_CALL(*waiting_app, cloud_app_transport_type())
@@ -1482,7 +1481,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_EQ(APIVersion::kAPIV3,
application->version().max_supported_api_version);
EXPECT_EQ(kEndpoint, application->cloud_app_endpoint());
- EXPECT_EQ(kAuthToken, application->cloud_app_auth_token());
+ EXPECT_EQ(kAuthToken, application->auth_token());
EXPECT_EQ(kCertificate, application->cloud_app_certificate());
EXPECT_EQ(kTransportType, application->cloud_app_transport_type());
EXPECT_EQ(kHybridAppPreference, application->hybrid_app_preference());
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index d5b3752936..36d20f227d 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -343,14 +343,14 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(is_remote_control_supported, bool());
MOCK_METHOD1(set_remote_control_supported, void(const bool allow));
MOCK_CONST_METHOD0(cloud_app_endpoint, const std::string&());
- MOCK_CONST_METHOD0(cloud_app_auth_token, const std::string&());
+ MOCK_CONST_METHOD0(auth_token, const std::string&());
MOCK_CONST_METHOD0(cloud_app_transport_type, const std::string&());
MOCK_CONST_METHOD0(hybrid_app_preference,
const mobile_apis::HybridAppPreference::eType&());
MOCK_CONST_METHOD0(cloud_app_certificate, const std::string&());
MOCK_CONST_METHOD0(is_cloud_app, bool());
MOCK_METHOD1(set_cloud_app_endpoint, void(const std::string& endpoint));
- MOCK_METHOD1(set_cloud_app_auth_token, void(const std::string& auth_token));
+ MOCK_METHOD1(set_auth_token, void(const std::string& auth_token));
MOCK_METHOD1(set_cloud_app_transport_type,
void(const std::string& transport_type));
MOCK_METHOD1(set_hybrid_app_preference,
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index c9feacabd4..8dfa1b133a 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -472,7 +472,7 @@ class PolicyHandlerInterface {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(
+ virtual bool GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index f342c2a07a..61ad6b9a91 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -555,7 +555,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(
+ virtual bool GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -593,6 +593,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& cloud_transport_type) = 0;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 6876611b3f..898c9ff2c6 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -535,7 +535,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(
+ virtual bool GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -574,6 +574,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& cloud_transport_type) = 0;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 3d3fb31af7..0983e8eedb 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -219,7 +219,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD1(CheckCloudAppEnabled,
const bool(const std::string& policy_app_id));
MOCK_CONST_METHOD7(GetCloudAppParameters,
- void(const std::string& policy_app_id,
+ bool(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index 82d4a866c4..d47a88fe54 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -79,7 +79,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_CONST_METHOD1(GetEnabledCloudApps,
void(std::vector<std::string>& enabled_apps));
MOCK_CONST_METHOD7(GetCloudAppParameters,
- void(const std::string& policy_app_id,
+ bool(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -95,6 +95,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(SetAppCloudTransportType,
void(const std::string& policy_app_id,
const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 9fe96e1544..9b21d95f1b 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -204,6 +204,9 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SetAppCloudTransportType,
void(const std::string& policy_app_id,
const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index e7c9502db9..83774ab7cd 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -66,7 +66,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_CONST_METHOD1(GetEnabledCloudApps,
void(std::vector<std::string>& enabled_apps));
MOCK_CONST_METHOD7(GetCloudAppParameters,
- void(const std::string& policy_app_id,
+ bool(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -82,6 +82,9 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD2(SetAppCloudTransportType,
void(const std::string& policy_app_id,
const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 7283397187..401db5586f 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -184,7 +184,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD1(GetEnabledCloudApps,
void(std::vector<std::string>& enabled_apps));
MOCK_CONST_METHOD7(GetCloudAppParameters,
- void(const std::string& policy_app_id,
+ bool(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -200,6 +200,9 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SetAppCloudTransportType,
void(const std::string& policy_app_id,
const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 66f5a19208..33613d2eca 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -552,6 +552,24 @@
<element name="BOTH" />
</enum>
+ <struct name="CloudAppProperties" since="5.1">
+ <param name="appName" type="String" maxlength="100" mandatory="true"></param>
+ <param name="appID" type="String" maxlength="100" mandatory="true"></param>
+ <param name="enabled" type="Boolean" mandatory="false">
+ <description>If true, cloud app will be included in HMI RPC UpdateAppList</description>
+ </param>
+ <param name="authToken" type="String" maxlength="65535" mandatory="false">
+ <description>Used to authenticate websocket connection on app activation</description>
+ </param>
+ <param name="cloudTransportType" type="String" maxlength="100" mandatory="false">
+ <description>Specifies the connection type Core should use</description>
+ </param>
+ <param name="hybridAppPreference" type="HybridAppPreference" mandatory="false">
+ <description>Specifies the user preference to use the cloud app version or mobile app version when both are available</description>
+ </param>
+ <param name="endpoint" type="String" maxlength="65535" mandatory="false"></param>
+ </struct>
+
<enum name="ButtonName" since="1.0">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
<element name="OK" />
@@ -2618,6 +2636,7 @@
<element name="GetSystemCapabilityID" value="48" hexvalue="30" since="4.5" />
<element name="SendHapticDataID" value="49" hexvalue="31" since="4.5" />
<element name="SetCloudAppPropertiesID" value="50" hexvalue="32" since="5.1" />
+ <element name="GetCloudAppPropertiesID" value="51" hexvalue="33" since="5.1" />
<!--
Base Notifications
@@ -6639,19 +6658,8 @@
<description>
RPC used to enable/disable a cloud application and set authentication data
</description>
- <param name="appName" type="String" maxlength="100" mandatory="true"></param>
- <param name="appID" type="String" maxlength="100" mandatory="true"></param>
- <param name="enabled" type="Boolean" mandatory="false">
- <description>If true, cloud app will be included in HMI RPC UpdateAppList</description>
- </param>
- <param name="cloudAppAuthToken" type="String" maxlength="100" mandatory="false">
- <description>Used to authenticate websocket connection on app activation</description>
- </param>
- <param name="cloudTransportType" type="String" maxlength="100" mandatory="false">
- <description>Specifies the connection type Core should use</description>
- </param>
- <param name="hybridAppPreference" type="HybridAppPreference" mandatory="false">
- <description>Specifies the user preference to use the cloud app version or mobile app version when both are available</description>
+ <param name="properties" type="CloudAppProperties" mandatory="true">
+ <description> The requested cloud application properties </description>
</param>
</function>
@@ -6679,6 +6687,40 @@
<element name="RESUME_FAILED" />
</param>
</function>
+
+ <function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="request" since="5.1">
+ <description>
+ RPC used to get the current properties of a cloud application
+ </description>
+ <param name="appID" type="String" maxlength="100" mandatory="true"></param>
+ </function>
+
+ <function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="response" since="5.1">
+ <description>The response to GetCloudAppProperties</description>
+ <param name="properties" type="CloudAppProperties" mandatory="false">
+ <description> The requested cloud application properties </description>
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="TOO_MANY_APPLICATIONS"/>
+ <element name="APPLICATION_REGISTERED_ALREADY"/>
+ <element name="UNSUPPORTED_VERSION"/>
+ <element name="WRONG_LANGUAGE"/>
+ <element name="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ <element name="RESUME_FAILED"/>
+ </param>
+ </function>
+
<!-- Notifications -->
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index 90783b7a46..25adbe19f7 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -182,7 +182,7 @@ class CacheManager : public CacheManagerInterface {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(const std::string& policy_app_id,
+ virtual bool GetCloudAppParameters(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -221,6 +221,13 @@ class CacheManager : public CacheManagerInterface {
const std::string& cloud_transport_type);
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index 58baf5ce99..86b4373650 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -189,7 +189,7 @@ class CacheManagerInterface {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(
+ virtual bool GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -229,6 +229,13 @@ class CacheManagerInterface {
const std::string& cloud_transport_type) = 0;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index caa1b0dc95..35fd3a1a7e 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -603,7 +603,7 @@ class PolicyManagerImpl : public PolicyManager {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- void GetCloudAppParameters(const std::string& policy_app_id,
+ bool GetCloudAppParameters(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -640,6 +640,13 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& cloud_transport_type) OVERRIDE;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h
index 2477d7eb04..a37a9d6b5e 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h
@@ -447,6 +447,11 @@ enum FunctionID {
SetCloudAppPropertiesID = 50,
/**
+ * @brief GetCloudAppPropertiesID.
+ */
+ GetCloudAppPropertiesID = 51,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 0220d38b07..b0ff7f12d2 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1403,7 +1403,7 @@ void CacheManager::GetEnabledCloudApps(
}
}
-void CacheManager::GetCloudAppParameters(
+bool CacheManager::GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -1432,7 +1432,9 @@ void CacheManager::GetCloudAppParameters(
? EnumToJsonString(*app_policy.hybrid_app_preference)
: std::string();
enabled = app_policy.enabled.is_initialized() && *app_policy.enabled;
+ return true;
}
+ return false;
}
void CacheManager::InitCloudApp(const std::string& policy_app_id) {
@@ -1487,6 +1489,17 @@ void CacheManager::SetAppCloudTransportType(
}
}
+void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.endpoint = endpoint;
+ }
+}
+
void CacheManager::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 23101438cb..37f5ab666f 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -741,7 +741,7 @@ void PolicyManagerImpl::GetEnabledCloudApps(
cache_->GetEnabledCloudApps(enabled_apps);
}
-void PolicyManagerImpl::GetCloudAppParameters(
+bool PolicyManagerImpl::GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -749,13 +749,13 @@ void PolicyManagerImpl::GetCloudAppParameters(
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
- cache_->GetCloudAppParameters(policy_app_id,
- enabled,
- endpoint,
- certificate,
- auth_token,
- cloud_transport_type,
- hybrid_app_preference);
+ return cache_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
}
void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
@@ -777,6 +777,11 @@ void PolicyManagerImpl::SetAppCloudTransportType(
cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
}
+void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
void PolicyManagerImpl::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index 9cc838bd82..aa4b8e55d1 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1134,6 +1134,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("GetCloudAppProperties" == literal) {
+ *result = GetCloudAppPropertiesID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index d23145994a..3b3c941b20 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -170,7 +170,7 @@ class CacheManager : public CacheManagerInterface {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(const std::string& policy_app_id,
+ virtual bool GetCloudAppParameters(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -209,6 +209,13 @@ class CacheManager : public CacheManagerInterface {
const std::string& cloud_transport_type);
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index ea59a4ef62..a50127d141 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -175,7 +175,7 @@ class CacheManagerInterface {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- virtual void GetCloudAppParameters(
+ virtual bool GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -215,6 +215,13 @@ class CacheManagerInterface {
const std::string& cloud_transport_type) = 0;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 779bea729d..357d3f1c87 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -597,7 +597,7 @@ class PolicyManagerImpl : public PolicyManager {
* @param hybrid_app_preference Filled with the hybrid app preference for the
* cloud application set by the user
*/
- void GetCloudAppParameters(const std::string& policy_app_id,
+ bool GetCloudAppParameters(const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
std::string& certificate,
@@ -635,6 +635,13 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& cloud_transport_type) OVERRIDE;
/**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index 563e822a36..a32060d9bc 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -432,6 +432,11 @@ enum FunctionID {
SetCloudAppPropertiesID = 50,
/**
+ * @brief GetCloudAppPropertiesID.
+ */
+ GetCloudAppPropertiesID = 51,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 677ea66454..1a0a908f5d 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -696,7 +696,7 @@ void CacheManager::GetEnabledCloudApps(
}
}
-void CacheManager::GetCloudAppParameters(
+bool CacheManager::GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -725,7 +725,9 @@ void CacheManager::GetCloudAppParameters(
? EnumToJsonString(*app_policy.hybrid_app_preference)
: std::string();
enabled = app_policy.enabled.is_initialized() && *app_policy.enabled;
+ return true;
}
+ return false;
}
void CacheManager::InitCloudApp(const std::string& policy_app_id) {
@@ -782,6 +784,17 @@ void CacheManager::SetAppCloudTransportType(
}
}
+void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.endpoint = endpoint;
+ }
+}
+
void CacheManager::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index b09478bba1..ae07b5529c 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -560,7 +560,7 @@ void PolicyManagerImpl::GetEnabledCloudApps(
cache_->GetEnabledCloudApps(enabled_apps);
}
-void PolicyManagerImpl::GetCloudAppParameters(
+bool PolicyManagerImpl::GetCloudAppParameters(
const std::string& policy_app_id,
bool& enabled,
std::string& endpoint,
@@ -568,13 +568,13 @@ void PolicyManagerImpl::GetCloudAppParameters(
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
- cache_->GetCloudAppParameters(policy_app_id,
- enabled,
- endpoint,
- certificate,
- auth_token,
- cloud_transport_type,
- hybrid_app_preference);
+ return cache_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
}
void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
@@ -596,6 +596,11 @@ void PolicyManagerImpl::SetAppCloudTransportType(
cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
}
+void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
void PolicyManagerImpl::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index 91d0a6990f..195213f844 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -849,6 +849,8 @@ bool IsValidEnum(FunctionID val) {
return true;
case SetCloudAppPropertiesID:
return true;
+ case GetCloudAppPropertiesID:
+ return true;
case OnHMIStatusID:
return true;
case OnAppInterfaceUnregisteredID:
@@ -998,6 +1000,8 @@ const char* EnumToJsonString(FunctionID val) {
return "SendHapticData";
case SetCloudAppPropertiesID:
return "SetCloudAppProperties";
+ case GetCloudAppPropertiesID:
+ return "GetCloudAppProperties";
case OnHMIStatusID:
return "OnHMIStatus";
case OnAppInterfaceUnregisteredID:
@@ -1287,11 +1291,17 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
*result = SendHapticDataID;
return true;
}
+
if ("SetCloudAppProperties" == literal) {
*result = SetCloudAppPropertiesID;
return true;
}
+ if ("GetCloudAppProperties" == literal) {
+ *result = GetCloudAppPropertiesID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;