summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-11-27 15:08:05 -0500
committerJackLivio <jack@livio.io>2018-11-27 15:08:05 -0500
commitb6d7da141931249923729c9f14ae5bf9109e9a82 (patch)
tree6c3403d6cd7e140c34531b49c13dfa9e1d761e7b
parent848139e3ee4b764def96cc8e41bfb7c45a1161e6 (diff)
downloadsdl_core-b6d7da141931249923729c9f14ae5bf9109e9a82.tar.gz
Address Comments and Remove Unused Code
-rw-r--r--src/appMain/smartDeviceLink.ini2
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc5
-rw-r--r--src/components/config_profile/src/profile.cc2
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc2
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter.h21
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_device.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h20
-rw-r--r--src/components/transport_manager/src/cloud/cloud_device.cc19
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc15
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc2
10 files changed, 24 insertions, 68 deletions
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index ac3e1c983a..ccb377d1e6 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -202,7 +202,7 @@ TCPAdapterPort = 12345
; If the name is omitted, Core will listen on all network interfaces by binding to INADDR_ANY.
TCPAdapterNetworkInterface =
-[Cloud App Connections]
+[CloudAppConnections]
; Value in milliseconds for time between retry attempts on a failed websocket connection
CloudAppRetryTimeout = 1000
; MaxNn number of retry attempts for a cloud websocket connection
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 1cec8b5ca2..ef008b7200 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -795,8 +795,10 @@ void ApplicationManagerImpl::CollectCloudAppInformation() {
std::string auth_token = "";
std::string cloud_transport_type = "";
std::string hybrid_app_preference = "";
+ bool enabled = true;
for (; it != end; ++it) {
GetPolicyHandler().GetCloudAppParameters(*it,
+ enabled,
endpoint,
certificate,
auth_token,
@@ -821,7 +823,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
std::string auth_token = "";
std::string cloud_transport_type = "";
std::string hybrid_app_preference_str = "";
-
+ bool enabled = true;
std::string name = device_info.name();
auto it = pending_device_map_.find(name);
if (it == pending_device_map_.end()) {
@@ -858,6 +860,7 @@ void ApplicationManagerImpl::CreatePendingApplication(
}
GetPolicyHandler().GetCloudAppParameters(policy_app_id,
+ enabled,
endpoint,
certificate,
auth_token,
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index c10f81a869..38afdbf35b 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -81,7 +81,7 @@ const char* kMediaManagerSection = "MEDIA MANAGER";
const char* kGlobalPropertiesSection = "GLOBAL PROPERTIES";
const char* kVrCommandsSection = "VR COMMANDS";
const char* kTransportManagerSection = "TransportManager";
-const char* kCloudAppTransportSection = "Cloud App Connections";
+const char* kCloudAppTransportSection = "CloudAppConnections";
const char* kApplicationManagerSection = "ApplicationManager";
const char* kFilesystemRestrictionsSection = "FILESYSTEM RESTRICTIONS";
const char* kIAPSection = "IAP";
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 318224fcc7..ed2522593c 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -266,7 +266,6 @@ void ConnectionHandlerImpl::OnConnectionPending(
LOG4CXX_DEBUG(logger_,
"Add Pending Connection #" << connection_id << " to the list.");
- // todo maybe create a seperate "pending_connection_list"
sync_primitives::AutoWriteLock lock(connection_list_lock_);
if (connection_list_.find(connection_id) == connection_list_.end()) {
Connection* connection =
@@ -280,7 +279,6 @@ void ConnectionHandlerImpl::OnConnectionPending(
connection_handler::DeviceHandle device_id =
connection->connection_device_handle();
- // uint32_t app_id = KeyFromPair(connection_id, session_id);
connection_handler_observer_->CreatePendingApplication(
connection_id, device_info, device_id);
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
index 4aa6e901ad..aae4a8b569 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -71,21 +71,6 @@ enum DeviceType {
UNKNOWN
};
-enum HybridAppPreference { // todo find correct place for this enum defintion.
- MOBILE,
- CLOUD,
- BOTH
-};
-
-struct CloudAppProperties {
- std::string endpoint;
- std::string certificate;
- bool enabled;
- std::string auth_token;
- DeviceType cloud_transport_type;
- HybridAppPreference hybrid_app_preference;
-};
-
typedef std::map<DeviceType, std::string> DeviceTypes;
/**
@@ -105,12 +90,6 @@ typedef std::list<TransportAdapterListener*> TransportAdapterListenerList;
typedef std::map<std::string, std::string> TransportConfig;
/**
- * @brief Type definition of container indexed by app id that contains
- * connection information for all cloud apps.
- */
-typedef std::map<std::string, CloudAppProperties> CloudAppTransportConfig;
-
-/**
* @brief TransportConfig keys
*/
extern const char* tc_enabled;
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
index 8eac8c6f75..47a82e7921 100644
--- a/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
@@ -47,9 +47,9 @@ class CloudDevice : public Device {
public:
CloudDevice(std::string& host, std::string& port, std::string& name);
- virtual const std::string& GetHost();
+ virtual const std::string& GetHost() const;
- virtual const std::string& GetPort();
+ virtual const std::string& GetPort() const;
protected:
virtual bool IsSameAs(const Device* other_device) const;
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
index 546ab71fbd..d52e4b307d 100644
--- a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
@@ -58,18 +58,6 @@ class CloudWebsocketTransportAdapter : public TransportAdapterImpl {
*/
virtual ~CloudWebsocketTransportAdapter();
- /**
- * @brief Notification that transport's configuration is updated
- *
- * @param new_config The new configuration of the transport
- */
- void CloudTransportConfigUpdated(const CloudAppTransportConfig& new_config);
-
- /**
- * @brief Returns the transport's configuration information
- */
- CloudAppTransportConfig GetCloudTransportConfiguration() const;
-
protected:
/**
* @brief Return type of device.
@@ -93,14 +81,6 @@ class CloudWebsocketTransportAdapter : public TransportAdapterImpl {
void CreateDevice(const std::string& uid) OVERRIDE;
private:
- /**
- * @brief Keeps transport specific configuration
- *
- * Cloud websocket transport uses following information:
- * - "enabled": whether the transport is currently enabled or not. Value can
- * be "true" or "false".
- */
- CloudAppTransportConfig transport_config_;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/cloud/cloud_device.cc b/src/components/transport_manager/src/cloud/cloud_device.cc
index 6196bcc87e..90a485c069 100644
--- a/src/components/transport_manager/src/cloud/cloud_device.cc
+++ b/src/components/transport_manager/src/cloud/cloud_device.cc
@@ -46,21 +46,28 @@ CloudDevice::CloudDevice(std::string& host,
bool CloudDevice::IsSameAs(const Device* other) const {
LOG4CXX_TRACE(logger_, "enter. device: " << other);
- bool result = false;
- return result;
+
+ const CloudDevice* other_cloud_device =
+ dynamic_cast<const CloudDevice*>(other);
+
+ if (host_ != other_cloud_device->GetHost()) {
+ return false;
+ }
+ if (port_ != other_cloud_device->GetPort()) {
+ return false;
+ }
+ return true;
}
-// todo implement getApplicationList
-// to be populated by policies
ApplicationList CloudDevice::GetApplicationList() const {
return ApplicationList{100};
}
-const std::string& CloudDevice::GetHost() {
+const std::string& CloudDevice::GetHost() const {
return host_;
}
-const std::string& CloudDevice::GetPort() {
+const std::string& CloudDevice::GetPort() const {
return port_;
}
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
index 874f158145..24efdfb2a4 100644
--- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -53,23 +53,13 @@ CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter(
CloudWebsocketTransportAdapter::~CloudWebsocketTransportAdapter() {}
-void CloudWebsocketTransportAdapter::CloudTransportConfigUpdated(
- const CloudAppTransportConfig& new_config) {}
-
-CloudAppTransportConfig
-CloudWebsocketTransportAdapter::GetCloudTransportConfiguration() const {
- return transport_config_;
-}
-
DeviceType CloudWebsocketTransportAdapter::GetDeviceType() const {
return CLOUD_WEBSOCKET;
}
-void CloudWebsocketTransportAdapter::Store() const {
-} // todo decide if this is needed
+void CloudWebsocketTransportAdapter::Store() const {}
-bool CloudWebsocketTransportAdapter::Restore() { // todo decide if resumption
- // is needed
+bool CloudWebsocketTransportAdapter::Restore() {
return true;
}
@@ -95,7 +85,6 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
"Creating Cloud Device For Host: " << host
<< " and Port: " << port);
- // todo get nickname from policies to name device
auto cloud_device = std::make_shared<CloudDevice>(host, port, device_id);
DeviceVector devices{cloud_device};
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
index 0912a07999..4f585c8efb 100644
--- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2017, Ford Motor Company
+ * Copyright (c) 2018, Livio
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without