summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2019-05-01 10:25:00 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2019-05-01 10:25:00 -0400
commit3b71054b5ed96df87a6e74800333b0f9de0ae9cd (patch)
treeb65aefc90375c8da089b807addbeca20d168176c
parent9eaacc0ea091e34b5c5a84e7c12b75ca4dc68cfa (diff)
parent79f16deef3c24b4e9c3147c057d2468bad0754b4 (diff)
downloadsdl_core-3b71054b5ed96df87a6e74800333b0f9de0ae9cd.tar.gz
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--src/appMain/sdl_preloaded_pt.json5
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h15
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc3
-rw-r--r--src/components/application_manager/src/app_service_manager.cc44
-rw-r--r--src/components/application_manager/src/application_impl.cc4
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc14
-rw-r--r--src/components/application_manager/test/app_service_manager_test.cc9
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc8
-rw-r--r--src/components/interfaces/HMI_API.xml2
-rw-r--r--src/components/interfaces/MOBILE_API.xml20
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc5
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc5
-rw-r--r--src/components/transport_manager/CMakeLists.txt9
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc3
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc6
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc12
-rw-r--r--src/components/transport_manager/test/transport_adapter_test.cc2
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc4
22 files changed, 234 insertions, 28 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 8f006426f9..4e39a735d1 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -1144,6 +1144,11 @@
"hmi_levels": ["BACKGROUND",
"FULL",
"LIMITED"]
+ },
+ "OnWayPointChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
}
}
},
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h
index 9690d7cd46..5080748f17 100644
--- a/src/components/application_manager/include/application_manager/app_service_manager.h
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -81,7 +81,8 @@ class AppServiceManager {
* app. False, if published by the embedded system.
* @param connection_key - If mobile_service is true, the connection key of
* the app publishing this service.
- * @return The app service record of the published app service
+ * @return The app service record of the published app service on success, a
+ * Null SmartObject value on failure
*/
virtual smart_objects::SmartObject PublishAppService(
const smart_objects::SmartObject& manifest,
@@ -197,7 +198,7 @@ class AppServiceManager {
/**
* @brief Get the service with a given service ID.
- * @param service_type - The service ID
+ * @param service_id - The service ID
* @return A pointer to requested service on success, NULL on failure
*/
virtual AppService* FindServiceByID(const std::string service_id);
@@ -247,6 +248,16 @@ class AppServiceManager {
std::string DefaultServiceByType(const std::string service_type);
AppService* FindServiceByPolicyAppID(const std::string policy_app_id,
const std::string type);
+
+ /**
+ * @brief Get the service of a given type published by a given provider.
+ * @param connection_key - The connection key of the service provider
+ * @param service_type - The service type
+ * @return A pointer to requested service on success, NULL on failure
+ */
+ AppService* FindServiceByProvider(const uint32_t connection_key,
+ const std::string service_type);
+ AppService* FindServiceByName(std::string name);
std::string GetPolicyAppID(AppService service);
};
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
index 637240666d..35a3e8a6b3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
@@ -63,13 +63,23 @@ void ASPublishAppServiceRequest::Run() {
smart_objects::SmartObject service_record =
application_manager_.GetAppServiceManager().PublishAppService(manifest,
false);
+ if (service_record.empty()) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ hmi_apis::Common_Result::REJECTED,
+ "Failed to publish service",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
response_params[strings::app_service_record] = service_record;
SendResponse(true,
(*message_)[strings::params][strings::correlation_id].asUInt(),
hmi_apis::FunctionID::AppService_PublishAppService,
hmi_apis::Common_Result::SUCCESS,
- &response_params);
+ &response_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
index 05266f834b..575aa5ca28 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
@@ -32,6 +32,8 @@
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
+#include "application_manager/app_service_manager.h"
+
namespace app_service_rpc_plugin {
using namespace application_manager;
namespace commands {
@@ -54,6 +56,39 @@ OnASAppServiceDataNotificationFromHMI::
void OnASAppServiceDataNotificationFromHMI::Run() {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id].asString();
+ AppService* service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(
+ logger_, "No published services exist with service ID: " << service_id);
+ return;
+ } else if (service->mobile_service) {
+ LOG4CXX_ERROR(logger_, "Service was not published by the HMI");
+ return;
+ } else if (!service->record[strings::service_active].asBool()) {
+ LOG4CXX_ERROR(logger_, "Service is not active");
+ return;
+ }
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type].asString();
+ std::string published_service_type =
+ service->record[strings::service_manifest][strings::service_type]
+ .asString();
+ if (published_service_type != service_type) {
+ LOG4CXX_ERROR(logger_,
+ "Service type mismatch, expected "
+ << service_type
+ << ", but service was published with type "
+ << published_service_type);
+ return;
+ }
+
SendNotificationToConsumers(
mobile_apis::FunctionID::eType::OnAppServiceDataID);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
index 7bb62d298d..2e92bd19bb 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
@@ -31,6 +31,7 @@
*/
#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h"
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
@@ -60,11 +61,13 @@ void OnAppServiceDataNotificationFromMobile::Run() {
LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
MessageHelper::PrintSmartObject(*message_);
+ uint32_t app_connection_key = connection_key();
std::string service_type =
(*message_)[strings::msg_params][strings::service_data]
[strings::service_type].asString();
- ApplicationSharedPtr app = application_manager_.application(connection_key());
+ ApplicationSharedPtr app =
+ application_manager_.application(app_connection_key);
bool result = policy_handler_.CheckAppServiceParameters(
app->policy_app_id(), std::string(), service_type, NULL);
@@ -76,6 +79,36 @@ void OnAppServiceDataNotificationFromMobile::Run() {
return;
}
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id].asString();
+ AppService* service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(
+ logger_, "No published services exist with service ID: " << service_id);
+ return;
+ } else if (!service->mobile_service ||
+ service->connection_key != app_connection_key) {
+ LOG4CXX_ERROR(logger_, "Service was not published by this application");
+ return;
+ } else if (!service->record[strings::service_active].asBool()) {
+ LOG4CXX_ERROR(logger_, "Service is not active");
+ return;
+ }
+
+ std::string published_service_type =
+ service->record[strings::service_manifest][strings::service_type]
+ .asString();
+ if (published_service_type != service_type) {
+ LOG4CXX_ERROR(logger_,
+ "Service type mismatch, expected "
+ << service_type
+ << ", but service was published with type "
+ << published_service_type);
+ return;
+ }
+
SendNotificationToConsumers(
hmi_apis::FunctionID::eType::AppService_OnAppServiceData);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
index bb0855d42f..86819b44ad 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -99,8 +99,7 @@ void PublishAppServiceRequest::Run() {
if (!result) {
SendResponse(false,
mobile_apis::Result::DISALLOWED,
- "Service disallowed by policies",
- NULL);
+ "Service disallowed by policies");
return;
}
@@ -111,6 +110,13 @@ void PublishAppServiceRequest::Run() {
smart_objects::SmartObject service_record =
application_manager_.GetAppServiceManager().PublishAppService(
manifest, true, connection_key());
+
+ if (service_record.empty()) {
+ SendResponse(
+ false, mobile_apis::Result::REJECTED, "Failed to publish service");
+ return;
+ }
+
if (app->IsFullscreen()) {
// Service should be activated if app is in the foreground
application_manager_.GetAppServiceManager().ActivateAppService(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
index b6d44a4511..6658f41005 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
@@ -106,10 +106,13 @@ void OnExitApplicationNotification::Run() {
application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
return;
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
case Common_ApplicationExitReason::CLOSE_CLOUD_CONNECTION: {
application_manager_.DisconnectCloudApp(app_impl);
break;
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
default: {
LOG4CXX_WARN(logger_, "Unhandled reason");
return;
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index 1711180980..bab8147d9f 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -70,6 +70,20 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
std::string str_to_hash = "";
std::string service_id = "";
+ std::string service_type = manifest[strings::service_type].asString();
+
+ if (FindServiceByProvider(connection_key, service_type)) {
+ LOG4CXX_WARN(logger_,
+ "Service already exists for this provider, rejecting");
+ return smart_objects::SmartObject();
+ }
+
+ if (manifest.keyExists(strings::service_name) &&
+ FindServiceByName(manifest[strings::service_name].asString())) {
+ LOG4CXX_WARN(logger_, "A service already exists with this name, rejecting");
+ return smart_objects::SmartObject();
+ }
+
published_services_lock_.Acquire();
do {
str_to_hash = manifest[strings::service_type].asString() +
@@ -88,8 +102,6 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
service_record[strings::service_active] = false;
app_service.record = service_record;
- std::string service_type = manifest[strings::service_type].asString();
-
std::string default_app_id = DefaultServiceByType(service_type);
if (default_app_id.empty() && !mobile_service) {
auto embedded_services = app_manager_.get_settings().embedded_services();
@@ -378,7 +390,7 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) {
auto embedded_service = EmbeddedServiceForType(service_type);
if (embedded_service &&
embedded_service->record[strings::service_id].asString() !=
- service[strings::service_id].asString()) {
+ service_id) {
embedded_service->record[strings::service_active] = true;
AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
@@ -456,6 +468,32 @@ AppService* AppServiceManager::FindServiceByID(const std::string service_id) {
return &(it->second);
}
+AppService* AppServiceManager::FindServiceByProvider(
+ const uint32_t connection_key, const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto& service : published_services_) {
+ if (service.second.connection_key == connection_key &&
+ service.second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type) {
+ return &(service.second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByName(std::string name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto& service : published_services_) {
+ if (service.second.record[strings::service_manifest][strings::service_name]
+ .asString() == name) {
+ return &(service.second);
+ }
+ }
+ return NULL;
+}
+
std::string AppServiceManager::DefaultServiceByType(
const std::string service_type) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 3d17da51ce..615d3c72cd 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -1185,7 +1185,11 @@ const std::string& ApplicationImpl::cloud_app_certificate() const {
}
bool ApplicationImpl::is_cloud_app() const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ return false;
+#else
return !endpoint_.empty();
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
void ApplicationImpl::set_cloud_app_endpoint(const std::string& endpoint) {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index b0a0514e77..a071edbbfc 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -892,6 +892,10 @@ void ApplicationManagerImpl::SetIconFileFromSystemRequest(
}
void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
std::string endpoint;
std::string certificate;
std::string auth_token;
@@ -929,9 +933,14 @@ void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
// Create device in pending state
LOG4CXX_DEBUG(logger_, "Re-adding the cloud app device");
connection_handler().AddCloudAppDevice(policy_app_id, properties);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
void ApplicationManagerImpl::RefreshCloudAppInformation() {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
LOG4CXX_AUTO_TRACE(logger_);
if (is_stopping()) {
return;
@@ -1082,6 +1091,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps");
SendUpdateAppList();
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
void ApplicationManagerImpl::CreatePendingApplication(
@@ -1216,6 +1226,9 @@ void ApplicationManagerImpl::OnConnectionStatusUpdated() {
hmi_apis::Common_CloudConnectionStatus::eType
ApplicationManagerImpl::GetCloudAppConnectionStatus(
ApplicationConstSharedPtr app) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ return hmi_apis::Common_CloudConnectionStatus::INVALID_ENUM;
+#else
transport_manager::ConnectionStatus status =
connection_handler().GetConnectionStatus(app->device());
switch (status) {
@@ -1229,6 +1242,7 @@ ApplicationManagerImpl::GetCloudAppConnectionStatus(
default:
return hmi_apis::Common_CloudConnectionStatus::INVALID_ENUM;
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
uint32_t ApplicationManagerImpl::GetNextMobileCorrelationID() {
diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc
index 960e8e31f6..526bbbdb7d 100644
--- a/src/components/application_manager/test/app_service_manager_test.cc
+++ b/src/components/application_manager/test/app_service_manager_test.cc
@@ -120,8 +120,11 @@ class AppServiceManagerTest : public testing::Test {
}
smart_objects::SmartObject PublishService(
- uint32_t connection_key = kConnectionKey, bool first_run = true) {
- smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+ uint32_t connection_key = kConnectionKey,
+ std::string service_name = kServiceName,
+ bool first_run = true) {
+ smart_objects::SmartObject manifest =
+ GenerateMediaManifest(true, service_name);
Json::Value empty_json;
EXPECT_CALL(mock_last_state_, get_dictionary())
@@ -326,7 +329,7 @@ TEST_F(AppServiceManagerTest, ActivateAppService_TwoApps_SUCCESS) {
// Register two services with the same service type, the first is activated
// automatically
auto record = PublishService();
- auto record2 = PublishService(kConnectionKey + 1, false);
+ auto record2 = PublishService(kConnectionKey + 1, kServiceName + "2", false);
// No capability update
smart_objects::SmartObject syscap_update_activated;
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 e4951880de..83e7717b7c 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -103,6 +103,7 @@ const std::string kAppId = "someID";
const uint32_t kConnectionKey = 1232u;
const std::string kAppName = "appName";
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
// Cloud application params
const std::string kEndpoint = "endpoint";
const std::string kEndpoint2 = "https://fakesdlcloudapptesting.com:8080";
@@ -113,6 +114,7 @@ const mobile_api::HybridAppPreference::eType kHybridAppPreference =
mobile_api::HybridAppPreference::CLOUD;
const std::string kHybridAppPreferenceStr = "CLOUD";
const bool kEnabled = true;
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
} // namespace
class ApplicationManagerImplTest : public ::testing::Test {
@@ -224,8 +226,9 @@ class ApplicationManagerImplTest : public ::testing::Test {
connection_handler::DeviceHandle secondary_device_handle,
std::string secondary_transport_device_string);
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
void AddCloudAppToPendingDeviceMap();
-
+#endif
uint32_t app_id_;
NiceMock<policy_test::MockPolicySettings> mock_policy_settings_;
std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_;
@@ -1447,6 +1450,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_TRUE(file_system::RemoveDirectory(kDirectoryName, true));
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
void ApplicationManagerImplTest::AddCloudAppToPendingDeviceMap() {
app_manager_impl_->SetMockPolicyHandler(mock_policy_handler_);
std::vector<std::string> enabled_apps{"1234"};
@@ -1659,7 +1663,7 @@ TEST_F(ApplicationManagerImplTest,
app_manager_impl_->RegisterApplication(request_for_registration_ptr);
EXPECT_EQ(0, application.use_count());
}
-
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 1861e49893..55a3a99e9d 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -3682,7 +3682,7 @@
</param>
<param name="serviceType" type="String" mandatory="true">
- <description> The type of service that is to be offered by this app </description>
+ <description> The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core. </description>
</param>
<param name="serviceIcon" type="Common.Image" mandatory="false">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 990f86ee5a..9bc321fde8 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
-<interface name="SmartDeviceLink RAPI" version="5.1.0" minVersion="1.0" date="2019-03-18">
+<interface name="SmartDeviceLink RAPI" version="5.1.0" minVersion="1.0" date="2019-03-19">
<enum name="Result" internal_scope="base" since="1.0">
<element name="SUCCESS">
<description>The request succeeded</description>
@@ -967,7 +967,7 @@
<description>Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) and also enables lossless compression.</description>
</element>
</enum>
-
+
<enum name="AudioStreamingIndicator" since="5.0">
<element name="PLAY_PAUSE">
<description>
@@ -4028,7 +4028,7 @@
</param>
<param name="serviceType" type="String" mandatory="true">
- <description> The type of service that is to be offered by this app </description>
+ <description> The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core. </description>
</param>
<param name="serviceIcon" type="Image" mandatory="false">
@@ -4099,7 +4099,7 @@
<description> The service has been deactivated as the primary service of its type</description>
</element>
<element name="MANIFEST_UPDATE">
- <description> The service has updated its manifest. This could imply updated capabilities. Note: Currently unimplemented </description>
+ <description> The service has updated its manifest. This could imply updated capabilities</description>
</element>
</enum>
@@ -7156,6 +7156,10 @@
<element name="DISALLOWED"/>
<element name="WARNINGS"/>
</param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
</function>
<function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="request" since="5.1">
@@ -7183,6 +7187,10 @@
<element name="DISALLOWED"/>
<element name="WARNINGS"/>
</param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
</function>
<function name="PublishAppService" functionID="PublishAppServiceID" messagetype="request" since="5.1">
@@ -7225,8 +7233,8 @@
<description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
<param name="serviceType" type="String" mandatory="true">
- <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
- </param>
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
<param name="subscribe" type="Boolean" mandatory="false">
<description> If true, the consumer is requesting to subscribe to all future updates from the service publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed if it was previously subscribed.</description>
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 4a738aa6ed..96bb45a6c1 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1391,6 +1391,10 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
void CacheManager::GetEnabledCloudApps(
std::vector<std::string>& enabled_apps) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ enabled_apps.clear();
+ return;
+#else
const policy_table::ApplicationPolicies& policies =
pt_->policy_table.app_policies_section.apps;
for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
@@ -1401,6 +1405,7 @@ void CacheManager::GetEnabledCloudApps(
enabled_apps.push_back((*it).first);
}
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
bool CacheManager::GetCloudAppParameters(
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 991c6a1363..2556a07709 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -684,6 +684,10 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
void CacheManager::GetEnabledCloudApps(
std::vector<std::string>& enabled_apps) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ enabled_apps.clear();
+ return;
+#else
const policy_table::ApplicationPolicies& policies =
pt_->policy_table.app_policies_section.apps;
for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
@@ -694,6 +698,7 @@ void CacheManager::GetEnabledCloudApps(
enabled_apps.push_back((*it).first);
}
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
bool CacheManager::GetCloudAppParameters(
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index f1edb6e298..11986ee9fa 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -76,17 +76,22 @@ endif()
if(BUILD_CLOUD_APP_SUPPORT)
GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
list(APPEND LIBRARIES boost_system boost_regex -L${BOOST_LIBS_DIRECTORY})
+else()
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/cloud
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/cloud
+ )
endif()
if(BUILD_USB_SUPPORT)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(EXCLUDE_PATHS
+ list(APPEND EXCLUDE_PATHS
${COMPONENTS_DIR}/transport_manager/include/transport_manager/usb/qnx
${COMPONENTS_DIR}/transport_manager/src/usb/qnx
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
- set(EXCLUDE_PATHS
+ list(APPEND EXCLUDE_PATHS
${COMPONENTS_DIR}/transport_manager/include/transport_manager/usb/libusb
${COMPONENTS_DIR}/transport_manager/src/usb/libusb
)
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 8298042d41..452a4c197c 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
@@ -87,7 +87,8 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
// Extract host and port from endpoint string
boost::regex group_pattern(
"(wss?:\\/\\/)([A-Z\\d\\.-]{2,}\\.?([A-Z]{2,})?)(:)(\\d{2,5})(\\/"
- "[A-Z\\d\\.-]+)*\\/?");
+ "[A-Z\\d\\.-]+)*\\/?",
+ boost::regex::icase);
boost::smatch results;
std::string str = uid;
diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index 41487b054b..71fc41ada9 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -46,7 +46,7 @@
#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
-#endif
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
#if defined(BUILD_TESTS)
#include "transport_manager/iap2_emulation/iap2_transport_adapter.h"
@@ -105,7 +105,7 @@ int TransportManagerDefault::Init(resumption::LastState& last_state) {
ta_usb = NULL;
#endif // USB_SUPPORT
-#if defined CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
transport_adapter::TransportAdapterImpl* ta_cloud =
new transport_adapter::CloudWebsocketTransportAdapter(last_state,
get_settings());
@@ -116,7 +116,7 @@ int TransportManagerDefault::Init(resumption::LastState& last_state) {
#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta_cloud);
ta_cloud = NULL;
-#endif
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
#if defined BUILD_TESTS
const uint16_t iap2_bt_emu_port = 23456;
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index 2d93b898b4..0c49401c80 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -50,7 +50,9 @@
#include "transport_manager/transport_manager_listener.h"
#include "transport_manager/transport_manager_listener_empty.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#endif
#include "transport_manager/transport_adapter/transport_adapter_event.h"
#include "config_profile/profile.h"
@@ -133,6 +135,9 @@ void TransportManagerImpl::ReconnectionTimeout() {
void TransportManagerImpl::AddCloudDevice(
const transport_manager::transport_adapter::CloudAppProperties&
cloud_properties) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+#else
transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN;
if (cloud_properties.cloud_transport_type == "WS") {
type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
@@ -156,12 +161,17 @@ void TransportManagerImpl::AddCloudDevice(
cloud_properties);
}
}
-
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
return;
}
void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
DisconnectDevice(device_handle);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
}
int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
diff --git a/src/components/transport_manager/test/transport_adapter_test.cc b/src/components/transport_manager/test/transport_adapter_test.cc
index 5abfa4dfdd..1c707678a0 100644
--- a/src/components/transport_manager/test/transport_adapter_test.cc
+++ b/src/components/transport_manager/test/transport_adapter_test.cc
@@ -478,6 +478,7 @@ TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) {
EXPECT_CALL(*serverMock, Terminate());
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
TEST_F(TransportAdapterTest, FindPending) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
@@ -608,6 +609,7 @@ TEST_F(TransportAdapterTest,
EXPECT_CALL(*serverMock, Terminate());
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index dbf0899a1b..c7d7024658 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -190,6 +190,7 @@ class TransportManagerImplTest : public ::testing::Test {
tm_.TestHandle(test_event);
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
void HandlePending() {
TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_PENDING,
mock_adapter_,
@@ -207,6 +208,7 @@ class TransportManagerImplTest : public ::testing::Test {
tm_.TestHandle(test_event);
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
void HandleConnectionFailed() {
TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_FAIL,
@@ -423,6 +425,7 @@ TEST_F(TransportManagerImplTest, DisconnectDevice_DeviceNotConnected) {
EXPECT_EQ(E_INVALID_HANDLE, tm_.DisconnectDevice(device_handle_));
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
TEST_F(TransportManagerImplTest, Pending) {
// Calling HandlePending twice verifies the connection_id stays the same if
// the connection exists.
@@ -448,6 +451,7 @@ TEST_F(TransportManagerImplTest, Pending) {
tm_.TestHandle(test_event);
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
TEST_F(TransportManagerImplTest, Disconnect) {
// Arrange