summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-11-16 13:09:47 -0500
committerJackLivio <jack@livio.io>2018-11-16 13:09:47 -0500
commitfbfe1fc119aaecd5cf0a1c9dfd495089ae20dc49 (patch)
tree402c3251d5942e2ff97919f0379ef4e5875cd562
parent00a81813d4de6e20bda021d4c19d7054f27d875c (diff)
downloadsdl_core-fbfe1fc119aaecd5cf0a1c9dfd495089ae20dc49.tar.gz
Clean up application and app manager code
-rw-r--r--src/components/application_manager/include/application_manager/application.h45
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h45
-rw-r--r--src/components/application_manager/src/application_impl.cc10
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc19
-rw-r--r--src/components/config_profile/include/config_profile/profile.h4
-rw-r--r--src/components/config_profile/src/profile.cc2
-rw-r--r--src/components/include/transport_manager/transport_manager_settings.h2
7 files changed, 104 insertions, 23 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index ef11de90d2..b68fc083d7 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -946,26 +946,61 @@ class Application : public virtual InitialApplicationData,
*/
virtual const std::list<AppExtensionPtr>& Extensions() const = 0;
- virtual std::string cloud_app_endpoint() = 0;
+ /**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ const virtual std::string cloud_app_endpoint() = 0;
- virtual std::string cloud_app_authtoken() = 0;
+ /**
+ * @brief Get cloud app authtoken to be used in connection handshake after websocket open.
+ * @return cloud app authtoken
+ */
+ const virtual std::string cloud_app_authtoken() = 0;
- virtual std::string cloud_app_transport_type() = 0;
+ /**
+ * @brief Get cloud app tranpsport type. Defines the type of websocket connection used.
+ * @return cloud app transport type
+ */
+ const virtual std::string cloud_app_transport_type() = 0;
- virtual std::string hybrid_app_preference() = 0;
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ const virtual std::string hybrid_app_preference() = 0;
- virtual std::string cloud_app_certificate() = 0;
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ const virtual std::string cloud_app_certificate() = 0;
+ /**
+ * @brief Set cloud app endpoint
+ */
virtual void set_cloud_app_endpoint(const std::string& endpoint) = 0;
+ /**
+ * @brief Set cloud app auth token
+ */
virtual void set_cloud_app_auth_token(const std::string& auth_token) = 0;
+ /**
+ * @brief Set cloud app transport type
+ */
virtual void set_cloud_app_transport_type(
const std::string& transport_type) = 0;
+ /**
+ * @brief Set hybrid app preference
+ */
virtual void set_hybrid_app_preference(
const std::string& hybrid_app_preference) = 0;
+ /**
+ * @brief Set cloud app certificate
+ */
virtual void set_cloud_app_certificate(const std::string& certificate) = 0;
protected:
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 5a1a385d1e..74b2be0934 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -409,25 +409,60 @@ class ApplicationImpl : public virtual Application,
void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) OVERRIDE;
- std::string cloud_app_endpoint() OVERRIDE;
+ /**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ const std::string cloud_app_endpoint() OVERRIDE;
- std::string cloud_app_authtoken() OVERRIDE;
+ /**
+ * @brief Get cloud app authtoken to be used in connection handshake after websocket open.
+ * @return cloud app authtoken
+ */
+ const std::string cloud_app_authtoken() OVERRIDE;
- std::string cloud_app_transport_type() OVERRIDE;
+ /**
+ * @brief Get cloud app tranpsport type. Defines the type of websocket connection used.
+ * @return cloud app transport type
+ */
+ const std::string cloud_app_transport_type() OVERRIDE;
- std::string hybrid_app_preference() OVERRIDE;
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ const std::string hybrid_app_preference() OVERRIDE;
- std::string cloud_app_certificate() OVERRIDE;
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ const std::string cloud_app_certificate() OVERRIDE;
+ /**
+ * @brief Set cloud app endpoint
+ */
void set_cloud_app_endpoint(const std::string& endpoint) OVERRIDE;
+ /**
+ * @brief Set cloud app auth token
+ */
void set_cloud_app_auth_token(const std::string& auth_token) OVERRIDE;
+ /**
+ * @brief Set cloud app transport type
+ */
void set_cloud_app_transport_type(const std::string& transport_type) OVERRIDE;
+ /**
+ * @brief Set hybrid app preference
+ */
void set_hybrid_app_preference(
const std::string& hybrid_app_preference) OVERRIDE;
+ /**
+ * @brief Set cloud app certificate
+ */
void set_cloud_app_certificate(const std::string& certificate) OVERRIDE;
protected:
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 027beb9313..c92823bf77 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -1163,23 +1163,23 @@ const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
return extensions_;
}
-std::string ApplicationImpl::cloud_app_endpoint() {
+const std::string ApplicationImpl::cloud_app_endpoint() {
return endpoint_;
}
-std::string ApplicationImpl::cloud_app_authtoken() {
+const std::string ApplicationImpl::cloud_app_authtoken() {
return auth_token_;
}
-std::string ApplicationImpl::cloud_app_transport_type() {
+const std::string ApplicationImpl::cloud_app_transport_type() {
return cloud_transport_type_;
}
-std::string ApplicationImpl::hybrid_app_preference() {
+const std::string ApplicationImpl::hybrid_app_preference() {
return hybrid_app_preference_;
}
-std::string ApplicationImpl::cloud_app_certificate() {
+const std::string ApplicationImpl::cloud_app_certificate() {
return certificate_;
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index c5daf4bdc0..c55adf84cb 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -816,7 +816,6 @@ void ApplicationManagerImpl::CreatePendingApplication(
connection_handler::DeviceHandle device_id) {
LOG4CXX_AUTO_TRACE(logger_);
- std::string policy_app_id = "";
std::string endpoint = "";
std::string certificate = "";
std::string auth_token = "";
@@ -829,7 +828,19 @@ void ApplicationManagerImpl::CreatePendingApplication(
return;
}
- policy_app_id = it->second;
+ const std::string policy_app_id = it->second;
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ GetPolicyHandler().GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types);
+
+ if (!nicknames.size()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ return;
+ }
+
+ const std::string display_name = nicknames[0];
ApplicationSharedPtr application(new ApplicationImpl(
0,
@@ -837,7 +848,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
device_info.mac_address(),
device_id,
custom_str::CustomString(
- "CloudApp"), // todo replace this with policy nick name
+ display_name),
GetPolicyHandler().GetStatisticManager(),
*this));
@@ -846,7 +857,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
return;
}
- GetPolicyHandler().GetCloudAppParameters(*it,
+ GetPolicyHandler().GetCloudAppParameters(policy_app_id,
endpoint,
certificate,
auth_token,
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index b332ed69f5..4846648b2b 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -416,7 +416,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
/**
* @brief Returns retry timeout for cloud app connections
*/
- uint16_t cloud_app_retry_timeout() const OVERRIDE;
+ uint32_t cloud_app_retry_timeout() const OVERRIDE;
/**
* @brief Returns maximum retry attempts for cloud app connections
@@ -970,7 +970,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
std::string system_files_path_;
uint16_t transport_manager_tcp_adapter_port_;
std::string transport_manager_tcp_adapter_network_interface_;
- uint16_t cloud_app_retry_timeout_;
+ uint32_t cloud_app_retry_timeout_;
uint16_t cloud_app_max_retry_attempts_;
std::string tts_delimiter_;
uint32_t audio_data_stopped_timeout_;
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 5b4c2e5f93..c10f81a869 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -791,7 +791,7 @@ const std::string& Profile::transport_manager_tcp_adapter_network_interface()
return transport_manager_tcp_adapter_network_interface_;
}
-uint16_t Profile::cloud_app_retry_timeout() const {
+uint32_t Profile::cloud_app_retry_timeout() const {
return cloud_app_retry_timeout_;
}
diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h
index 30a5a98ae9..cbc1516c29 100644
--- a/src/components/include/transport_manager/transport_manager_settings.h
+++ b/src/components/include/transport_manager/transport_manager_settings.h
@@ -73,7 +73,7 @@ class TransportManagerSettings : public TransportManagerMMESettings {
/**
* @brief Returns retry timeout for cloud app connections
*/
- virtual uint16_t cloud_app_retry_timeout() const = 0;
+ virtual uint32_t cloud_app_retry_timeout() const = 0;
/**
* @brief Returns maximum retry attempts for cloud app connections