summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-11-05 17:56:55 -0500
committerjacobkeeler <jacob.keeler@livioradio.com>2018-11-09 09:22:26 -0500
commit9174e46f6ba6cde75eab481f85aab7d89f12e570 (patch)
tree1624097f455e264604cc4e8d785f27ba55f00980
parente2c2bf8f584aeaed25c4f9b56237537a00b3575b (diff)
downloadsdl_core-9174e46f6ba6cde75eab481f85aab7d89f12e570.tar.gz
Fix style, add certificate, and add GetEnabledCloudApps
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h45
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc36
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h15
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h13
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h16
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h5
-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.h5
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h15
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h5
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h11
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h11
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h15
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h6
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc18
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc7
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc3
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc5
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h11
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h16
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h13
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc18
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc17
23 files changed, 259 insertions, 52 deletions
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 3af03bf28b..a612c263ca 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
@@ -399,6 +399,14 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& policy_app_id) OVERRIDE;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
* @brief Checks if a given application is an enabled cloud application
* @param policy_app_id Unique application id
* @return true, if the application is an enabled cloud application,
@@ -407,17 +415,36 @@ class PolicyHandler : public PolicyHandlerInterface,
const bool CheckCloudAppEnabled(
const std::string& policy_app_id) const OVERRIDE;
- /**plzfix
- * @brief Checks if certain request type is allowed for application
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
* @param policy_app_id Unique application id
- * @return true, if allowed, otherwise - false
- */
- const bool GetCloudAppParameters(const std::string& policy_app_id,
- std::string& endpoint,
- std::string& auth_token,
- std::string& cloud_transport_type,
- std::string& hybrid_app_preference) const OVERRIDE;
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure
+ * connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param cloud_transport_type Filled with the hybrid app preference for the
+ * cloud application set by the user
+ * @return true if the cloud app is enabled, false otherwise
+ */
+ const bool GetCloudAppParameters(
+ const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received from a
+ * mobile app
+ * @param message The SetCloudAppProperties message
+ */
void OnSetCloudAppProperties(
const smart_objects::SmartObject& message) OVERRIDE;
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index c73e35768e..cc62d9f6f8 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1845,28 +1845,39 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
+void PolicyHandler::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetEnabledCloudApps(enabled_apps);
+}
+
const bool PolicyHandler::GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
POLICY_LIB_CHECK(false);
return policy_manager_->GetCloudAppParameters(policy_app_id,
endpoint,
+ certificate,
auth_token,
cloud_transport_type,
hybrid_app_preference);
}
-const bool PolicyHandler::CheckCloudAppEnabled(const std::string& policy_app_id) const {
+const bool PolicyHandler::CheckCloudAppEnabled(
+ const std::string& policy_app_id) const {
POLICY_LIB_CHECK(false);
std::string endpoint;
std::string auth_token;
+ std::string certificate;
std::string cloud_transport_type;
std::string hybrid_app_preference;
return policy_manager_->GetCloudAppParameters(policy_app_id,
endpoint,
+ certificate,
auth_token,
cloud_transport_type,
hybrid_app_preference);
@@ -1876,34 +1887,35 @@ void PolicyHandler::OnSetCloudAppProperties(
const smart_objects::SmartObject& message) {
POLICY_LIB_CHECK_VOID();
if (!message.keyExists(strings::msg_params)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contain mandatory section " << strings::msg_params);
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain mandatory section "
+ << strings::msg_params);
return;
}
const smart_objects::SmartObject& msg_params = message[strings::msg_params];
if (!msg_params.keyExists(strings::app_id)) {
- LOG4CXX_ERROR(
- logger_,
- "Message does not contain mandatory parameter " << 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());
if (msg_params.keyExists(strings::enabled)) {
policy_manager_->SetCloudAppEnabled(policy_app_id,
- msg_params[strings::enabled].asBool());
+ msg_params[strings::enabled].asBool());
}
if (msg_params.keyExists(strings::cloud_app_auth_token)) {
- policy_manager_->SetAppAuthToken(policy_app_id,
- msg_params[strings::cloud_app_auth_token].asString());
+ policy_manager_->SetAppAuthToken(
+ policy_app_id, msg_params[strings::cloud_app_auth_token].asString());
}
if (msg_params.keyExists(strings::cloud_transport_type)) {
policy_manager_->SetAppCloudTransportType(
policy_app_id, msg_params[strings::cloud_transport_type].asString());
}
if (msg_params.keyExists(strings::hybrid_app_preference)) {
- //const std::string hybrid_app_preference = EnumConversionHelper<HybridAppPreference>::EnumToString(msg_params[strings::hybrid_app_preference]);
- //policy_manager_->SetHybridAppPreference(
+ // const std::string hybrid_app_preference =
+ // EnumConversionHelper<HybridAppPreference>::EnumToString(msg_params[strings::hybrid_app_preference]);
+ // policy_manager_->SetHybridAppPreference(
// policy_app_id, 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 69433e6118..ddeb1da8f7 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -437,7 +437,15 @@ class PolicyHandlerInterface {
* @return Structure with vehicle information
*/
virtual const VehicleInfo GetVehicleInfo() const = 0;
-
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
/**
* @brief Checks if a given application is an enabled cloud application
* @param policy_app_id Unique application id
@@ -453,6 +461,8 @@ class PolicyHandlerInterface {
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -464,6 +474,7 @@ class PolicyHandlerInterface {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const = 0;
@@ -475,7 +486,7 @@ class PolicyHandlerInterface {
*/
virtual void OnSetCloudAppProperties(
const smart_objects::SmartObject& message) = 0;
-
+
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
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 2ea8ef08f1..b0fac8eae9 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -521,13 +521,23 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @return vehicle information
*/
virtual const VehicleInfo GetVehicleInfo() const = 0;
-
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
/**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -539,6 +549,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const = 0;
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 9c67e239b7..1f0f520077 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -503,11 +503,21 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -519,6 +529,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const = 0;
@@ -550,8 +561,9 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* should be used
* @param hybrid_app_preference Hybrid app user preference
*/
- virtual void SetHybridAppPreference(const std::string& policy_app_id,
- const std::string& hybrid_app_preference) = 0;
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
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 bd56d78128..cea36082c8 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
@@ -213,11 +213,14 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
GetAppRequestTypes,
const std::vector<std::string>(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
MOCK_CONST_METHOD1(CheckCloudAppEnabled,
const bool(const std::string& policy_app_id));
- MOCK_CONST_METHOD5(GetCloudAppParameters,
+ MOCK_CONST_METHOD6(GetCloudAppParameters,
const bool(const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference));
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 ecbd8c6cd6..03e0882129 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
@@ -76,9 +76,12 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD1(IsDeviceConsentCached, bool(const std::string& device_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
- MOCK_CONST_METHOD5(GetCloudAppParameters,
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD6(GetCloudAppParameters,
const bool(const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
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 f58ed10934..70dab8e99a 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
@@ -184,9 +184,12 @@ class MockPolicyManager : public PolicyManager {
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
- MOCK_CONST_METHOD5(GetCloudAppParameters,
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD6(GetCloudAppParameters,
const bool(const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
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 745bcd2db5..7ac94d278d 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
@@ -63,12 +63,15 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD0(TimeoutResponse, int());
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
- MOCK_CONST_METHOD5(GetCloudAppParameters,
- const bool(const std::string& policy_app_id,
- std::string& endpoint,
- std::string& auth_token,
- std::string& cloud_transport_type,
- std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD6(GetCloudAppParameters,
+ const bool(const std::string& policy_app_id,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
MOCK_METHOD2(SetCloudAppEnabled,
void(const std::string& policy_app_id, const bool enabled));
MOCK_METHOD2(SetAppAuthToken,
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 8867c3de80..7441701a34 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
@@ -181,9 +181,12 @@ class MockPolicyManager : public PolicyManager {
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
- MOCK_CONST_METHOD5(GetCloudAppParameters,
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD6(GetCloudAppParameters,
const bool(const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference));
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 d6eeb0457b..7660eb2df9 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -159,11 +159,21 @@ class CacheManager : public CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -175,6 +185,7 @@ class CacheManager : public CacheManagerInterface {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const;
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 0c094d2edb..79d6f4e731 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
@@ -166,11 +166,21 @@ class CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -182,6 +192,7 @@ class CacheManagerInterface {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const = 0;
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 f9648f803c..778892df13 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
@@ -569,13 +569,23 @@ class PolicyManagerImpl : public PolicyManager {
* @return vehicle information
*/
const VehicleInfo GetVehicleInfo() const OVERRIDE;
-
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
/**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -587,6 +597,7 @@ class PolicyManagerImpl : public PolicyManager {
const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const OVERRIDE;
@@ -597,7 +608,7 @@ class PolicyManagerImpl : public PolicyManager {
*/
void SetCloudAppEnabled(const std::string& policy_app_id,
const bool enabled) OVERRIDE;
-
+
/**
* @brief Set an app's auth token
* @param auth_token Cloud app authentication token
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 b13e6b6f26..dc2fdab2fa 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
@@ -182,11 +182,7 @@ bool IsValidEnum(ModuleType val);
const char* EnumToJsonString(ModuleType val);
bool EnumFromJsonString(const std::string& literal, ModuleType* result);
-enum HybridAppPreference {
- HAP_MOBILE,
- HAP_CLOUD,
- HAP_BOTH
-};
+enum HybridAppPreference { HAP_MOBILE, HAP_CLOUD, HAP_BOTH };
bool IsValidEnum(HybridAppPreference val);
const char* EnumToJsonString(HybridAppPreference val);
bool EnumFromJsonString(const std::string& literal,
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index d6d5f6daa5..116b315755 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1389,9 +1389,24 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
return vehicle_info;
}
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+}
+
const bool CacheManager::GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
@@ -1403,6 +1418,9 @@ const bool CacheManager::GetCloudAppParameters(
auto app_policy = (*policy_iter).second;
endpoint = app_policy.endpoint.is_initialized() ? *app_policy.endpoint
: std::string();
+ certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
auth_token = app_policy.auth_token.is_initialized() ? *app_policy.auth_token
: std::string();
cloud_transport_type = app_policy.cloud_transport_type.is_initialized()
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 e7538fa1b0..31cc212254 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -725,14 +725,21 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
const bool PolicyManagerImpl::GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
return cache_->GetCloudAppParameters(policy_app_id,
endpoint,
+ certificate,
auth_token,
cloud_transport_type,
hybrid_app_preference);
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index 4867eef281..977448dacd 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -247,7 +247,8 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, endpoint(impl::ValueMember(value__, "endpoint"))
, enabled(impl::ValueMember(value__, "enabled"))
, auth_token(impl::ValueMember(value__, "auth_token"))
- , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {}
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index 6a40e6d135..43961815d6 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -760,8 +760,9 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
std::string(policy_table::EnumToJsonString(
*app.second.hybrid_app_preference)))
: app_query.Bind(9);
- app.second.endpoint.is_initialized() ? app_query.Bind(10, *app.second.endpoint)
- : app_query.Bind(10);
+ app.second.endpoint.is_initialized()
+ ? app_query.Bind(10, *app.second.endpoint)
+ : app_query.Bind(10);
app.second.enabled.is_initialized() ? app_query.Bind(11, *app.second.enabled)
: app_query.Bind(11);
app.second.auth_token.is_initialized()
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 119a0c0519..39f9cc73cd 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -147,11 +147,21 @@ class CacheManager : public CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -163,6 +173,7 @@ class CacheManager : public CacheManagerInterface {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const;
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 9408809f1e..3b2b10d0bc 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
@@ -152,11 +152,21 @@ class CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -168,6 +178,7 @@ class CacheManagerInterface {
virtual const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const = 0;
@@ -199,8 +210,9 @@ class CacheManagerInterface {
* should be used
* @param hybrid_app_preference Hybrid app user preference
*/
- virtual void SetHybridAppPreference(const std::string& policy_app_id,
- const std::string& hybrid_app_preference) = 0;
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
/**
* @brief Allows to update 'vin' field in module_meta table.
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 e1221b613f..311ced31d2 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
@@ -565,11 +565,21 @@ class PolicyManagerImpl : public PolicyManager {
const VehicleInfo GetVehicleInfo() const OVERRIDE;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
* @brief Get cloud app policy information, all fields that aren't set for a
* given app will be filled with empty strings
* @param policy_app_id Unique application id
* @param endpoint Filled the endpoint used to connect to the cloud
* application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
* @param auth_token Filled with the token used for authentication when
* reconnecting to the cloud app
* @param cloud_transport_type Filled with the transport type used by the
@@ -581,6 +591,7 @@ class PolicyManagerImpl : public PolicyManager {
const bool GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const OVERRIDE;
@@ -591,7 +602,7 @@ class PolicyManagerImpl : public PolicyManager {
*/
void SetCloudAppEnabled(const std::string& policy_app_id,
const bool enabled) OVERRIDE;
-
+
/**
* @brief Set an app's auth token
* @param auth_token Cloud app authentication token
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 68e70c107d..9292c389b9 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -682,9 +682,24 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
return vehicle_info;
}
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+}
+
const bool CacheManager::GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
@@ -701,6 +716,9 @@ const bool CacheManager::GetCloudAppParameters(
cloud_transport_type = app_policy.cloud_transport_type.is_initialized()
? *app_policy.cloud_transport_type
: std::string();
+ certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
hybrid_app_preference =
app_policy.hybrid_app_preference.is_initialized()
? EnumToJsonString(*app_policy.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 9317708216..5aa29fc896 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -544,17 +544,28 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
const bool PolicyManagerImpl::GetCloudAppParameters(
const std::string& policy_app_id,
std::string& endpoint,
+ std::string& certificate,
std::string& auth_token,
std::string& cloud_transport_type,
std::string& hybrid_app_preference) const {
- return cache_->GetCloudAppParameters(policy_app_id, endpoint, auth_token, cloud_transport_type, hybrid_app_preference);
+ return cache_->GetCloudAppParameters(policy_app_id,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
}
-void PolicyManagerImpl::SetCloudAppEnabled(
- const std::string& policy_app_id, const bool enabled) {
+void PolicyManagerImpl::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
cache_->SetCloudAppEnabled(policy_app_id, enabled);
}