summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2019-03-06 15:02:13 -0500
committerjacobkeeler <jacob.keeler@livioradio.com>2019-03-06 15:02:13 -0500
commit2396b961e40c471680bba84f20fa0d90fe68e579 (patch)
tree939eb879ccd5d77ffb061bc113dec3618032198a
parent82f77e91d31a8a5507c8cdd2388e24642e1c846f (diff)
parent222ec0566594288744d73ef30174e714bd6f29ce (diff)
downloadsdl_core-2396b961e40c471680bba84f20fa0d90fe68e579.tar.gz
Merge remote-tracking branch 'origin/feature/base_app_services_implementation' into feature/forwarded_request_timeout
-rw-r--r--src/appMain/sdl_preloaded_pt.json6
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h49
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h10
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h3
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h7
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc353
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc7
-rw-r--r--src/components/application_manager/src/app_service_manager.cc240
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc11
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc4
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc2
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc24
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc7
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h3
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc6
-rw-r--r--src/components/interfaces/HMI_API.xml156
-rw-r--r--src/components/interfaces/MOBILE_API.xml174
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h5
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc5
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h5
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc9
-rw-r--r--src/components/smart_objects/src/smart_object.cc3
-rw-r--r--src/components/utils/include/utils/file_system.h13
-rw-r--r--src/components/utils/src/file_system.cc20
43 files changed, 1605 insertions, 199 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 8041a0d4e9..fcd92e6df5 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -200,6 +200,12 @@
"LIMITED",
"NONE"]
},
+ "GetFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
"RegisterAppInterface": {
"hmi_levels": ["BACKGROUND",
"FULL",
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 386b473f3d..d6d13a209a 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
@@ -58,6 +58,8 @@ class ApplicationManager;
*/
class AppServiceManager {
public:
+ const std::string kEmbeddedService = "EMBEDDED_SERVICE";
+
/**
* @brief Class constructor
* @param app_manager
@@ -96,14 +98,6 @@ class AppServiceManager {
/**
* @brief TODO
* @param service_id
- * @param service_published
- */
- void SetServicePublished(const std::string service_id,
- bool service_published);
-
- /**
- * @brief TODO
- * @param service_id
*/
bool SetDefaultService(const std::string service_id);
@@ -132,38 +126,57 @@ class AppServiceManager {
std::vector<smart_objects::SmartObject> GetAllServices();
void GetProviderByType(const std::string& service_type,
+ bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service);
void GetProviderByID(const std::string& service_id,
+ bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service);
- std::pair<std::string, AppService> ActiveServiceByType(
- std::string service_type);
+ AppService* ActiveServiceByType(std::string service_type);
- std::pair<std::string, AppService> EmbeddedServiceForType(
- std::string service_type);
+ AppService* EmbeddedServiceForType(std::string service_type);
- std::pair<std::string, AppService> FindServiceByName(std::string name);
+ AppService* FindServiceByName(std::string name);
- std::pair<std::string, AppService> FindServiceByID(std::string service_id);
+ AppService* FindServiceByID(std::string service_id);
std::string DefaultServiceByType(std::string service_type);
+ /**
+ * @brief TODO
+ * @param service_id
+ * @param service_published
+ */
+ void SetServicePublished(const std::string service_id,
+ bool service_published);
+
+ /**
+ * @brief TODO
+ * @param out_params
+ */
+ bool UpdateNavigationCapabilities(smart_objects::SmartObject& out_params);
+
private:
- void GetProviderFromService(const AppService& service,
- ApplicationSharedPtr& app,
- bool& hmi_service);
ApplicationManager& app_manager_;
resumption::LastState& last_state_;
+
+ sync_primitives::RecursiveLock published_services_lock_;
std::map<std::string, AppService> published_services_;
- void BroadcastAppServiceUpdate(smart_objects::SmartObject& msg_params);
void AppServiceUpdated(
const smart_objects::SmartObject& service_record,
const mobile_apis::ServiceUpdateReason::eType update_reason,
smart_objects::SmartObject& msg_params);
+ void GetProviderFromService(const AppService& service,
+ bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+ AppService* FindServiceByPolicyAppID(std::string policy_app_id,
+ std::string type);
+ std::string GetPolicyAppID(AppService service);
};
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index a5ecd7274b..e12c6de3ab 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -159,10 +159,12 @@ class CommandRequestImpl : public CommandImpl,
* @param info Provides additional human readable info regarding the result
* @param response_params Additional params in response
*/
- void SendResponse(const bool success,
- const mobile_apis::Result::eType& result_code,
- const char* info = NULL,
- const smart_objects::SmartObject* response_params = NULL);
+ void SendResponse(
+ const bool success,
+ const mobile_apis::Result::eType& result_code,
+ const char* info = NULL,
+ const smart_objects::SmartObject* response_params = NULL,
+ const std::vector<uint8_t> binary_data = std::vector<uint8_t>());
/**
* @brief Check syntax of string from mobile
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index fd16d57740..8a8e50bf1c 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -881,6 +881,9 @@ class MessageHelper {
static smart_objects::SmartObject CreateAppServiceCapabilities(
std::vector<smart_objects::SmartObject>& all_services);
+ static void BroadcastCapabilityUpdate(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 33fc3bd7d5..5d030dace6 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -200,6 +200,7 @@ extern const char* cloud_connection_status;
// PutFile
extern const char* sync_file_name;
extern const char* file_name;
+extern const char* file_path;
extern const char* file_type;
extern const char* file_size;
extern const char* crc32_check_sum;
@@ -308,8 +309,6 @@ extern const char* service_name;
extern const char* service_type;
extern const char* service_icon;
extern const char* allow_app_consumers;
-extern const char* uri_prefix;
-extern const char* uri_scheme;
extern const char* rpc_spec_version;
extern const char* handled_rpcs;
extern const char* media_service_manifest;
@@ -318,6 +317,7 @@ extern const char* service_id;
extern const char* service_manifest;
extern const char* service_published;
extern const char* service_active;
+extern const char* app_service_id;
extern const char* service_data;
extern const char* request_service_active;
extern const char* app_services;
@@ -326,6 +326,7 @@ extern const char* updated_app_service_record;
extern const char* service_records;
extern const char* activate;
extern const char* set_as_default;
+extern const char* origin_app;
// resuming
extern const char* application_commands;
@@ -393,6 +394,8 @@ extern const char* const keyboard_layout_supported;
extern const char* const keypress_mode_supported;
extern const char* const limited_characters_list_supported;
extern const char* const auto_complete_text_supported;
+extern const char* const send_location_enabled;
+extern const char* const get_way_points_enabled;
extern const char* const entity_type;
extern const char* const entity_id;
extern const char* const status;
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
index ec2c00a714..4433444602 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
@@ -69,8 +69,6 @@ class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
virtual void Run();
private:
- bool ValidateManifest(smart_objects::SmartObject& manifest);
-
DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
index 72e4f1c629..d70f279658 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
@@ -68,8 +68,6 @@ class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl {
virtual void Run();
private:
- bool ValidateManifest(smart_objects::SmartObject& manifest);
-
DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
index 8f52268f19..2b66993d8f 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -57,10 +57,29 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ std::string hmi_origin_id =
+ application_manager_.get_settings().hmi_origin_id();
+ if (!msg_params.keyExists(strings::origin_app)) {
+ if (hmi_origin_id.empty()) {
+ smart_objects::SmartObject response_params;
+ response_params[strings::info] =
+ "No HMI origin ID to use for interaction passthrough";
+ SendResponse(
+ false,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_DATA,
+ &response_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+ msg_params[strings::origin_app] = hmi_origin_id;
+ }
+
std::string service_id = msg_params[strings::service_id].asString();
auto service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
- if (service.first.empty()) {
+ if (!service) {
smart_objects::SmartObject response_params;
response_params[strings::info] = "The requested service ID does not exist";
SendResponse(false,
@@ -80,9 +99,8 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() {
}
// Only activate service if it is not already active
- bool activate_service =
- request_service_active &&
- !service.second.record[strings::service_active].asBool();
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
if (activate_service) {
application_manager_.GetAppServiceManager().ActivateAppService(service_id);
}
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 5e20ca20d1..b816016fa7 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
@@ -51,23 +51,6 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest(
ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {}
-bool ASPublishAppServiceRequest::ValidateManifest(
- smart_objects::SmartObject& manifest) {
- if (manifest.keyExists(strings::uri_scheme)) {
- Json::Value value;
- Json::Reader reader;
- if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) {
- SendResponse(
- false,
- (*message_)[strings::params][strings::correlation_id].asUInt(),
- hmi_apis::FunctionID::AppService_PublishAppService,
- hmi_apis::Common_Result::INVALID_DATA);
- return false;
- }
- }
- return true;
-}
-
void ASPublishAppServiceRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI");
@@ -75,9 +58,6 @@ void ASPublishAppServiceRequest::Run() {
smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject manifest =
(*message_)[strings::msg_params][strings::app_service_manifest];
- if (!ValidateManifest(manifest)) {
- return;
- }
smart_objects::SmartObject service_record =
application_manager_.GetAppServiceManager().PublishAppService(
manifest, false, UINT32_MAX);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
index b54071068f..0d387785ee 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
@@ -70,16 +70,16 @@ void GetAppServiceDataRequest::Run() {
std::string service_type =
(*message_)[strings::msg_params][strings::service_type].asString();
- bool subscribe = false;
- if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) {
- subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool();
- }
-
ApplicationSharedPtr app = application_manager_.application(connection_key());
-
- if (subscribe) {
+ if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) {
+ bool subscribe =
+ (*message_)[strings::msg_params][strings::subscribe].asBool();
auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
- ext.SubscribeToAppService(service_type);
+ if (subscribe) {
+ ext.SubscribeToAppService(service_type);
+ } else {
+ ext.UnsubscribeFromAppService(service_type);
+ }
}
SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
index a016d1fe16..2c6ba414e0 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
@@ -61,10 +61,27 @@ OnAppServiceDataNotification::~OnAppServiceDataNotification() {}
void OnAppServiceDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer");
- MessageHelper::PrintSmartObject(*message_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service) {
+ LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published");
+ return;
+ } else if (!service->record[strings::service_manifest]
+ [strings::allow_app_consumers].asBool()) {
+ LOG4CXX_ERROR(logger_,
+ "Service does not allow for app consumers, skipping mobile "
+ "OnAppServiceData notification");
+ return;
+ }
std::string service_type =
- (*message_)[strings::msg_params][strings::service_type].asString();
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type].asString();
auto subscribed_to_app_service_predicate =
[service_type](const ApplicationSharedPtr app) {
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
index 9623cffd36..9e262f0ca3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -66,7 +66,7 @@ void PerformAppServiceInteractionRequest::Run() {
std::string service_id = msg_params[strings::service_id].asString();
auto service =
application_manager_.GetAppServiceManager().FindServiceByID(service_id);
- if (service.first.empty()) {
+ if (!service) {
SendResponse(false,
mobile_apis::Result::INVALID_ID,
"The requested service ID does not exist");
@@ -81,9 +81,8 @@ void PerformAppServiceInteractionRequest::Run() {
}
// Only activate service if it is not already active
- bool activate_service =
- request_service_active &&
- !service.second.record[strings::service_active].asBool();
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
if (activate_service) {
if (app->is_foreground()) {
// App is in foreground, we can just activate the service
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 05210208ca..22d8e50c3a 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
@@ -55,21 +55,6 @@ PublishAppServiceRequest::PublishAppServiceRequest(
PublishAppServiceRequest::~PublishAppServiceRequest() {}
-bool PublishAppServiceRequest::ValidateManifest(
- smart_objects::SmartObject& manifest) {
- if (manifest.keyExists(strings::uri_scheme)) {
- Json::Value value;
- Json::Reader reader;
- if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) {
- SendResponse(false,
- mobile_apis::Result::INVALID_DATA,
- "Provided uriScheme was not valid JSON");
- return false;
- }
- }
- return true;
-}
-
void PublishAppServiceRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key());
@@ -79,9 +64,6 @@ void PublishAppServiceRequest::Run() {
smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject manifest =
(*message_)[strings::msg_params][strings::app_service_manifest];
- if (!ValidateManifest(manifest)) {
- return;
- }
ApplicationSharedPtr app = application_manager_.application(connection_key());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
new file mode 100644
index 0000000000..fd241da3c4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathRequest command class
+ **/
+class BCGetFilePathRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BCGetFilePathRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathRequest class destructor
+ **/
+ virtual ~BCGetFilePathRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_sdl_RPC_PLUGIN_INCLUDE_sdl_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
new file mode 100644
index 0000000000..2a6025cbdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathResponse command class
+ **/
+class BCGetFilePathResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BCGetFilePathResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathResponse class destructor
+ **/
+ virtual ~BCGetFilePathResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
new file mode 100644
index 0000000000..d4182ea004
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetFileRequest command class
+ **/
+class GetFileRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief GetFileRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetFileRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetFileRequest class destructor
+ **/
+ virtual ~GetFileRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ bool GetFilePath(std::string& file_path, bool& forward_to_hmi);
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ private:
+ std::string file_name_;
+ mobile_apis::FileType::eType file_type_;
+ uint32_t length_;
+ uint32_t offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(GetFileRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
new file mode 100644
index 0000000000..bc191d224c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetFileResponse command class
+ **/
+class GetFileResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief GetFileResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetFileResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetFileResponse class destructor
+ **/
+ virtual ~GetFileResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetFileResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
new file mode 100644
index 0000000000..b735cd9bdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathRequest::BCGetFilePathRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathRequest::~BCGetFilePathRequest() {}
+
+void BCGetFilePathRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
new file mode 100644
index 0000000000..b86ab6a2b8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathResponse::BCGetFilePathResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathResponse::~BCGetFilePathResponse() {}
+
+void BCGetFilePathResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_GetFilePath);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
index d0c33e76d9..73ec1137a8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -70,9 +70,21 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
[strings::system_capability_type].asInt());
switch (system_capability_type) {
case hmi_apis::Common_SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
msg_params[strings::system_capability][strings::navigation_capability] =
- *hmi_capabilities_.navigation_capability();
+ nav_capability;
+ } else {
+ return;
}
break;
}
@@ -80,6 +92,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
if (hmi_capabilities_.phone_capability()) {
msg_params[strings::system_capability][strings::phone_capability] =
*hmi_capabilities_.phone_capability();
+ } else {
+ return;
}
break;
}
@@ -90,6 +104,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
if (hmi_capabilities_.rc_capability()) {
msg_params[strings::system_capability][strings::rc_capability] =
*hmi_capabilities_.rc_capability();
+ } else {
+ return;
}
break;
}
@@ -98,6 +114,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
msg_params[strings::system_capability]
[strings::video_streaming_capability] =
*hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
}
break;
case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
new file mode 100644
index 0000000000..c0fbcee146
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
@@ -0,0 +1,353 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/app_service_manager.h"
+#include "utils/file_system.h"
+#include <boost/crc.hpp>
+
+namespace {
+/**
+* Calculates CRC32 checksum
+* @param binary_data - input data for which CRC32 should be calculated
+* @return calculated CRC32 checksum
+*/
+uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) {
+ const std::size_t file_size = binary_data.size();
+ boost::crc_32_type result;
+ result.process_bytes(&binary_data[0], file_size);
+ return result.checksum();
+}
+
+} // namespace
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileRequest::GetFileRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , file_name_("")
+ , file_type_(mobile_apis::FileType::INVALID_ENUM)
+ , length_(0)
+ , offset_(0) {}
+
+GetFileRequest::~GetFileRequest() {}
+
+bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
+ std::string path = application_manager_.get_settings().app_storage_folder();
+ auto connect_key = connection_key();
+ forward_to_hmi = false;
+
+ if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) {
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::app_service_id].asString();
+ LOG4CXX_DEBUG(logger_,
+ "Finding storage directory for service id: " << service_id);
+
+ AppService* app_service_info =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (app_service_info) {
+ if (app_service_info->mobile_service) {
+ connect_key = app_service_info->connection_key;
+ } else {
+ forward_to_hmi = true;
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Using current storage directory");
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(connect_key);
+ file_path = path + "/" + app->folder_name();
+ return true;
+}
+
+void GetFileRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Received GetFile request");
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ file_name_ = (*message_)[strings::msg_params][strings::file_name].asString();
+
+ if (!file_system::IsFileNameValid(file_name_)) {
+ LOG4CXX_ERROR(logger_,
+ "File name " << file_name_ << " contains forbidden symbols.");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "File name contains forbidden symbols",
+ &response_params);
+ return;
+ }
+
+ // Initialize other params with default values. If exists overwrite the values
+ LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values");
+
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ file_type_ = static_cast<mobile_apis::FileType::eType>(
+ (*message_)[strings::msg_params][strings::file_type].asInt());
+ }
+
+ // Check if file exists on system (may have to use app service id to get the
+ // correct app folder)
+ LOG4CXX_DEBUG(logger_, "Check if file exists on system");
+ std::string file_path;
+ bool forward_to_hmi;
+
+ if (GetFilePath(file_path, forward_to_hmi)) {
+ if (forward_to_hmi) {
+ LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI");
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath,
+ &(*message_)[strings::msg_params],
+ true);
+ return;
+ }
+ } else {
+ LOG4CXX_ERROR(logger_, "Could not get file path");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Could not get file path",
+ &response_params);
+ return;
+ }
+
+ const std::string full_path = file_path + "/" + file_name_;
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ // Handle offset
+ LOG4CXX_DEBUG(logger_, "Handle offset and length parameters");
+ const uint64_t file_size = file_system::FileSize(full_path);
+
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(logger_,
+ "Offset " << offset_ << " greater than file size "
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+
+ // Load data from file as binary data
+ LOG4CXX_DEBUG(logger_, "Load binary data from file");
+ std::vector<uint8_t> bin_data;
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Unable to read from file",
+ &response_params);
+ return;
+ }
+
+ // Construct response message
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ response_params[strings::offset] = offset_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ response_params[strings::length] = length_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] = file_type_;
+ }
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ SendResponse(true,
+ mobile_apis::Result::SUCCESS,
+ "File uploaded",
+ &response_params,
+ bin_data);
+}
+
+void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) {
+ return;
+ }
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+
+ if (!success) {
+ auto msg_params = event_message[strings::msg_params];
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(false, result, info, &msg_params);
+ return;
+ }
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::vector<uint8_t> bin_data;
+
+ if (event_message[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] =
+ event_message[strings::msg_params][strings::file_type];
+ }
+
+ if (event_message[strings::msg_params].keyExists(strings::file_path)) {
+ std::string full_path =
+ event_message[strings::msg_params][strings::file_path].asString();
+
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ const uint64_t file_size = file_system::FileSize(full_path);
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(logger_,
+ "Offset " << offset_ << " greater than file size "
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Failed to read from file",
+ &response_params);
+ return;
+ }
+
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ } else {
+ LOG4CXX_ERROR(logger_, "HMI did not return a file path: ");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "HMI did not return a file path",
+ &response_params);
+ return;
+ }
+
+ SendResponse(true, result, "File uploaded", &response_params, bin_data);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
new file mode 100644
index 0000000000..2ea8dde02a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileResponse::GetFileResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetFileResponse::~GetFileResponse() {}
+
+void GetFileResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Sending GetFile response");
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
index b551db0008..63a4416139 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
@@ -83,10 +83,20 @@ void GetSystemCapabilityRequest::Run() {
switch (response_type) {
case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
if (hmi_capabilities.navigation_capability()) {
+ has_nav_capability = true;
+ auto nav_capability = *hmi_capabilities.navigation_capability();
+ }
+
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
response_params[strings::system_capability]
- [strings::navigation_capability] =
- *hmi_capabilities.navigation_capability();
+ [strings::navigation_capability] = nav_capability;
} else {
SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
index 0745bc08dc..b5e3a73ee4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -36,9 +36,21 @@ void OnSystemCapabilityUpdatedNotification::Run() {
switch (system_capability_type) {
case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
msg_params[strings::system_capability][strings::navigation_capability] =
- *hmi_capabilities_.navigation_capability();
+ nav_capability;
+ } else {
+ return;
}
break;
}
@@ -46,6 +58,8 @@ void OnSystemCapabilityUpdatedNotification::Run() {
if (hmi_capabilities_.phone_capability()) {
msg_params[strings::system_capability][strings::phone_capability] =
*hmi_capabilities_.phone_capability();
+ } else {
+ return;
}
break;
}
@@ -56,6 +70,8 @@ void OnSystemCapabilityUpdatedNotification::Run() {
if (hmi_capabilities_.rc_capability()) {
msg_params[strings::system_capability][strings::rc_capability] =
*hmi_capabilities_.rc_capability();
+ } else {
+ return;
}
break;
}
@@ -64,6 +80,8 @@ void OnSystemCapabilityUpdatedNotification::Run() {
msg_params[strings::system_capability]
[strings::video_streaming_capability] =
*hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
}
break;
case mobile_apis::SystemCapabilityType::APP_SERVICES: {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index dc94474b9d..3cfe4d7118 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -240,6 +240,8 @@
#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
@@ -842,6 +844,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UISendHapticDataRequest>()
: factory.GetCreator<commands::UISendHapticDataResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_GetFilePath: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::BCGetFilePathRequest>()
+ : factory.GetCreator<commands::BCGetFilePathResponse>();
+ }
case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: {
return factory
.GetCreator<commands::OnBCSystemCapabilityUpdatedNotification>();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 77be545e0b..f12dcbb485 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -127,6 +127,8 @@
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
#include "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -234,6 +236,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::PutFileRequest>()
: factory.GetCreator<commands::PutFileResponse>();
}
+ case mobile_apis::FunctionID::GetFileID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetFileRequest>()
+ : factory.GetCreator<commands::GetFileResponse>();
+ }
case mobile_apis::FunctionID::DeleteFileID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteFileRequest>()
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index f26bcaf01f..24c21dc201 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -36,13 +36,13 @@
#include <iterator>
#include "application_manager/application.h"
-#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/smart_object_keys.h"
#include "encryption/hashing.h"
#include "resumption/last_state.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/logger.h"
#include "smart_objects/enum_schema_item.h"
@@ -70,6 +70,7 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
std::string str_to_hash = "";
std::string service_id = "";
+ published_services_lock_.Acquire();
do {
str_to_hash = manifest[strings::service_type].asString() +
std::to_string(std::rand());
@@ -88,33 +89,48 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
app_service.record = service_record;
std::string service_type = manifest[strings::service_type].asString();
- Json::Value& dictionary = last_state_.get_dictionary();
- app_service.default_service =
- (dictionary[kAppServiceSection][kDefaults][service_type].asString() ==
- manifest[strings::service_name].asString());
- published_services_.insert(
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (default_app_id.empty() && !mobile_service) {
+ auto embedded_services = app_manager_.get_settings().embedded_services();
+ for (auto it = embedded_services.begin(); it != embedded_services.end();
+ ++it) {
+ if (*it == service_type) {
+ Json::Value& dictionary = last_state_.get_dictionary();
+ dictionary[kAppServiceSection][kDefaults][service_type] =
+ kEmbeddedService;
+ default_app_id = kEmbeddedService;
+ }
+ }
+ }
+ app_service.default_service = GetPolicyAppID(app_service) == default_app_id;
+
+ auto ret = published_services_.insert(
std::pair<std::string, AppService>(service_id, app_service));
+ smart_objects::SmartObject& published_record = ret.first->second.record;
+ published_services_lock_.Release();
smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
AppServiceUpdated(
service_record, mobile_apis::ServiceUpdateReason::PUBLISHED, msg_params);
- BroadcastAppServiceUpdate(msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
// Activate the new service if it is the default for its service type, or if
// no service is active of its service type
- std::pair<std::string, AppService> active_service =
- ActiveServiceByType(service_type);
- if (active_service.first.empty() || app_service.default_service) {
+ AppService* active_service = ActiveServiceByType(service_type);
+ if (!active_service || app_service.default_service) {
ActivateAppService(service_id);
}
- return service_record;
+ return published_record;
}
bool AppServiceManager::UnpublishAppService(const std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
-
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
@@ -124,24 +140,26 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) {
SetServicePublished(service_id, false);
smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
- auto record = it->second.record;
+ auto& record = it->second.record;
if (record[strings::service_active].asBool()) {
record[strings::service_active] = false;
// Activate embedded service, if available
auto embedded_service = EmbeddedServiceForType(
record[strings::service_manifest][strings::service_type].asString());
- if (!embedded_service.first.empty()) {
- embedded_service.second.record[strings::service_active] = true;
- AppServiceUpdated(embedded_service.second.record,
+ if (embedded_service) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
msg_params);
}
}
AppServiceUpdated(
- it->second.record, mobile_apis::ServiceUpdateReason::REMOVED, msg_params);
- BroadcastAppServiceUpdate(msg_params);
+ record, mobile_apis::ServiceUpdateReason::REMOVED, msg_params);
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
published_services_.erase(it);
return true;
@@ -150,6 +168,7 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) {
void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Unpublishing all app services: " << connection_key);
+ sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
if (it->second.connection_key == connection_key) {
@@ -160,6 +179,7 @@ void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.begin();
// Activate all services published by the app
for (; it != published_services_.end(); ++it) {
@@ -172,6 +192,7 @@ void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<smart_objects::SmartObject> services;
+ sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
services.push_back(it->second.record);
@@ -180,11 +201,12 @@ std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() {
}
void AppServiceManager::GetProviderByType(const std::string& service_type,
+ bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
LOG4CXX_AUTO_TRACE(logger_);
auto active_service = ActiveServiceByType(service_type);
- if (active_service.first.empty()) {
+ if (!active_service) {
LOG4CXX_ERROR(logger_,
"There is no active service for the given service type: "
<< service_type);
@@ -192,13 +214,15 @@ void AppServiceManager::GetProviderByType(const std::string& service_type,
}
LOG4CXX_DEBUG(logger_, "Found provider for service type: " << service_type);
- GetProviderFromService(active_service.second, app, hmi_service);
+ GetProviderFromService(*active_service, mobile_consumer, app, hmi_service);
}
void AppServiceManager::GetProviderByID(const std::string& service_id,
+ bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
@@ -206,13 +230,20 @@ void AppServiceManager::GetProviderByID(const std::string& service_id,
}
LOG4CXX_DEBUG(logger_, "Found provider with service ID: " << service_id);
- GetProviderFromService(it->second, app, hmi_service);
+ GetProviderFromService(it->second, mobile_consumer, app, hmi_service);
}
void AppServiceManager::GetProviderFromService(const AppService& service,
+ bool mobile_consumer,
ApplicationSharedPtr& app,
bool& hmi_service) {
LOG4CXX_AUTO_TRACE(logger_);
+ if (mobile_consumer &&
+ !service.record[strings::service_manifest][strings::allow_app_consumers]
+ .asBool()) {
+ LOG4CXX_ERROR(logger_, "Service does not support app consumers");
+ return;
+ }
bool mobile_service = service.mobile_service;
if (mobile_service) {
app = app_manager_.application(service.connection_key);
@@ -224,6 +255,7 @@ void AppServiceManager::GetProviderFromService(const AppService& service,
bool AppServiceManager::SetDefaultService(const std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
@@ -234,24 +266,25 @@ bool AppServiceManager::SetDefaultService(const std::string service_id) {
std::string service_type =
service.record[strings::service_manifest][strings::service_type]
.asString();
- std::string default_service_name = DefaultServiceByType(service_type);
- if (!default_service_name.empty()) {
- auto default_service = FindServiceByName(default_service_name);
- if (!default_service.first.empty()) {
- default_service.second.default_service = false;
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (!default_app_id.empty()) {
+ auto default_service =
+ FindServiceByPolicyAppID(default_app_id, service_type);
+ if (default_service) {
+ default_service->default_service = false;
}
}
service.default_service = true;
Json::Value& dictionary = last_state_.get_dictionary();
dictionary[kAppServiceSection][kDefaults][service_type] =
- service.record[strings::service_manifest][strings::service_name]
- .asString();
+ GetPolicyAppID(service);
return true;
}
bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
@@ -275,6 +308,7 @@ bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
bool AppServiceManager::ActivateAppService(const std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
@@ -288,13 +322,15 @@ bool AppServiceManager::ActivateAppService(const std::string service_id) {
}
smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
const std::string service_type =
service[strings::service_manifest][strings::service_type].asString();
auto active_service = ActiveServiceByType(service_type);
- if (!active_service.first.empty()) {
- active_service.second.record[strings::service_active] = false;
- AppServiceUpdated(active_service.second.record,
+ if (active_service) {
+ active_service->record[strings::service_active] = false;
+ AppServiceUpdated(active_service->record,
mobile_apis::ServiceUpdateReason::DEACTIVATED,
msg_params);
}
@@ -302,12 +338,24 @@ bool AppServiceManager::ActivateAppService(const std::string service_id) {
AppServiceUpdated(
service, mobile_apis::ServiceUpdateReason::ACTIVATED, msg_params);
- BroadcastAppServiceUpdate(msg_params);
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ if (service_type == navi_service_type) {
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::NAVIGATION;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ }
return true;
}
bool AppServiceManager::DeactivateAppService(const std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
@@ -326,9 +374,9 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) {
const std::string service_type =
service[strings::service_manifest][strings::service_type].asString();
auto embedded_service = EmbeddedServiceForType(service_type);
- if (!embedded_service.first.empty()) {
- embedded_service.second.record[strings::service_active] = true;
- AppServiceUpdated(embedded_service.second.record,
+ if (embedded_service) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
msg_params);
}
@@ -336,68 +384,84 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) {
}
if (send_update) {
- BroadcastAppServiceUpdate(msg_params);
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
}
return true;
}
-std::pair<std::string, AppService> AppServiceManager::ActiveServiceByType(
- std::string service_type) {
+AppService* AppServiceManager::ActiveServiceByType(std::string service_type) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
if (it->second.record[strings::service_manifest][strings::service_type]
.asString() == service_type &&
it->second.record[strings::service_published].asBool() &&
it->second.record[strings::service_active].asBool()) {
- return *it;
+ return &(it->second);
}
}
- AppService empty;
- return std::make_pair(std::string(), empty);
+ return NULL;
}
-std::pair<std::string, AppService> AppServiceManager::EmbeddedServiceForType(
+AppService* AppServiceManager::EmbeddedServiceForType(
std::string service_type) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
if (it->second.record[strings::service_manifest][strings::service_type]
.asString() == service_type &&
!it->second.mobile_service) {
- return *it;
+ return &(it->second);
}
}
- AppService empty;
- return std::make_pair(std::string(), empty);
+ return NULL;
}
-std::pair<std::string, AppService> AppServiceManager::FindServiceByName(
- std::string name) {
+AppService* AppServiceManager::FindServiceByName(std::string name) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
if (it->second.record[strings::service_manifest][strings::service_name]
.asString() == name) {
- return *it;
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByPolicyAppID(
+ std::string policy_app_id, std::string type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() != type) {
+ continue;
+ }
+
+ if (policy_app_id == GetPolicyAppID(it->second)) {
+ return &(it->second);
}
}
- AppService empty;
- return std::make_pair(std::string(), empty);
+ return NULL;
}
-std::pair<std::string, AppService> AppServiceManager::FindServiceByID(
- std::string service_id) {
+AppService* AppServiceManager::FindServiceByID(std::string service_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
- AppService empty;
- return std::make_pair(std::string(), empty);
+ return NULL;
}
-
- return *it;
+ return &(it->second);
}
std::string AppServiceManager::DefaultServiceByType(std::string service_type) {
@@ -412,6 +476,7 @@ std::string AppServiceManager::DefaultServiceByType(std::string service_type) {
void AppServiceManager::SetServicePublished(const std::string service_id,
bool service_published) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
auto it = published_services_.find(service_id);
if (it == published_services_.end()) {
LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
@@ -420,30 +485,49 @@ void AppServiceManager::SetServicePublished(const std::string service_id,
it->second.record[strings::service_published] = service_published;
}
-void AppServiceManager::BroadcastAppServiceUpdate(
- smart_objects::SmartObject& msg_params) {
+std::string AppServiceManager::GetPolicyAppID(AppService service) {
+ if (service.mobile_service) {
+ auto app = app_manager_.application(service.connection_key);
+ return app ? app->policy_app_id() : std::string();
+ }
+ return kEmbeddedService;
+}
+
+bool AppServiceManager::UpdateNavigationCapabilities(
+ smart_objects::SmartObject& out_params) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ auto service = ActiveServiceByType(navi_service_type);
+ if (!service) {
+ return false;
+ }
- msg_params[strings::system_capability][strings::system_capability_type] =
- mobile_apis::SystemCapabilityType::APP_SERVICES;
- message[strings::params][strings::message_type] = MessageType::kNotification;
- message[strings::msg_params] = msg_params;
-
- // Construct and send mobile notification
- message[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
- smart_objects::SmartObjectSPtr notification =
- std::make_shared<smart_objects::SmartObject>(message);
- app_manager_.GetRPCService().ManageMobileCommand(
- notification, commands::Command::CommandSource::SOURCE_SDL);
-
- // Construct and send HMI notification
- message[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
- smart_objects::SmartObjectSPtr hmi_notification =
- std::make_shared<smart_objects::SmartObject>(message);
- app_manager_.GetRPCService().ManageHMICommand(hmi_notification);
+ if (!out_params.keyExists(strings::send_location_enabled)) {
+ out_params[strings::send_location_enabled] = false;
+ }
+ if (!out_params.keyExists(strings::get_way_points_enabled)) {
+ out_params[strings::get_way_points_enabled] = false;
+ }
+
+ if (!service->record[strings::service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ return true;
+ }
+
+ smart_objects::SmartObject& handled_rpcs =
+ service->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
+ if (handled_rpcs[i].asInt() == mobile_apis::FunctionID::SendLocationID) {
+ out_params[strings::send_location_enabled] = true;
+ } else if (handled_rpcs[i].asInt() ==
+ mobile_apis::FunctionID::GetWayPointsID) {
+ out_params[strings::get_way_points_enabled] = true;
+ }
+ }
+ return true;
}
void AppServiceManager::AppServiceUpdated(
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index fcca87b235..344831f882 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -266,7 +266,8 @@ void CommandRequestImpl::SendResponse(
const bool success,
const mobile_apis::Result::eType& result_code,
const char* info,
- const smart_objects::SmartObject* response_params) {
+ const smart_objects::SmartObject* response_params,
+ const std::vector<uint8_t> binary_data) {
LOG4CXX_AUTO_TRACE(logger_);
{
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -291,7 +292,9 @@ void CommandRequestImpl::SendResponse(
CommandImpl::protocol_version_;
response[strings::params][strings::connection_key] = connection_key();
response[strings::params][strings::function_id] = function_id();
-
+ if (!binary_data.empty()) {
+ response[strings::params][strings::binary_data] = binary_data;
+ }
if (response_params) {
response[strings::msg_params] = *response_params;
}
@@ -431,12 +434,12 @@ void CommandRequestImpl::SendProviderRequest(
std::string service_type =
(*msg)[strings::msg_params][strings::service_type].asString();
application_manager_.GetAppServiceManager().GetProviderByType(
- service_type, app, hmi_destination);
+ service_type, true, app, hmi_destination);
} else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
std::string service_id =
(*msg)[strings::msg_params][strings::service_id].asString();
application_manager_.GetAppServiceManager().GetProviderByID(
- service_id, app, hmi_destination);
+ service_id, true, app, hmi_destination);
}
if (hmi_destination) {
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index 86473f5fca..0adb389e76 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -174,12 +174,12 @@ void RequestFromHMI::SendProviderRequest(
std::string service_type =
(*msg)[strings::msg_params][strings::service_type].asString();
application_manager_.GetAppServiceManager().GetProviderByType(
- service_type, app, hmi_destination);
+ service_type, false, app, hmi_destination);
} else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
std::string service_id =
(*msg)[strings::msg_params][strings::service_id].asString();
application_manager_.GetAppServiceManager().GetProviderByID(
- service_id, app, hmi_destination);
+ service_id, false, app, hmi_destination);
}
if (hmi_destination) {
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 1d1dbe6996..9aff403e09 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -103,6 +103,8 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnEventChanged] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_GetFilePath] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 124ec80312..7db2308c2c 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -327,6 +327,30 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::message_type] = MessageType::kNotification;
+ message[strings::msg_params] = msg_params;
+
+ // Construct and send mobile notification
+ message[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::CommandSource::SOURCE_SDL);
+
+ // Construct and send HMI notification
+ message[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
+ smart_objects::SmartObjectSPtr hmi_notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageHMICommand(hmi_notification);
+}
+
smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
std::vector<smart_objects::SmartObject>& all_services) {
smart_objects::SmartObject app_service_capabilities(
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 8df9a5cfbd..402a15ae60 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -167,6 +167,7 @@ const char* cloud_connection_status = "cloudConnectionStatus";
// PutFile
const char* sync_file_name = "syncFileName";
const char* file_name = "fileName";
+const char* file_path = "filePath";
const char* file_type = "fileType";
const char* file_size = "fileSize";
const char* crc32_check_sum = "crc";
@@ -275,8 +276,6 @@ const char* service_name = "serviceName";
const char* service_type = "serviceType";
const char* service_icon = "serviceIcon";
const char* allow_app_consumers = "allowAppConsumers";
-const char* uri_prefix = "uriPrefix";
-const char* uri_scheme = "uriScheme";
const char* rpc_spec_version = "rpcSpecVersion";
const char* handled_rpcs = "handledRPCs";
const char* media_service_manifest = "mediaServiceManifest";
@@ -285,6 +284,7 @@ const char* service_id = "serviceID";
const char* service_manifest = "serviceManifest";
const char* service_published = "servicePublished";
const char* service_active = "serviceActive";
+const char* app_service_id = "appServiceId";
const char* service_data = "serviceData";
const char* request_service_active = "requestServiceActive";
const char* app_services = "appServices";
@@ -293,6 +293,7 @@ const char* updated_app_service_record = "updatedAppServiceRecord";
const char* service_records = "serviceRecords";
const char* activate = "activate";
const char* set_as_default = "setAsDefault";
+const char* origin_app = "originApp";
// resuming
const char* application_commands = "applicationCommands";
@@ -353,6 +354,8 @@ const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
const char* const auto_complete_text_supported = "autoCompleteTextSupported";
+const char* const send_location_enabled = "sendLocationEnabled";
+const char* const get_way_points_enabled = "getWayPointsEnabled";
const char* const entity_type = "entityType";
const char* const entity_id = "entityID";
const char* const status = "status";
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 8d9cf9d7ef..7889774fae 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -311,6 +311,9 @@ class MockMessageHelper {
MOCK_METHOD1(CreateAppServiceCapabilities,
smart_objects::SmartObject(
std::vector<smart_objects::SmartObject>& all_services));
+ MOCK_METHOD2(BroadcastCapabilityUpdate,
+ void(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 0fe82e0dfb..b3b3327ca9 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -577,4 +577,10 @@ smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
return MockMessageHelper::message_helper_mock()->CreateAppServiceCapabilities(
all_services);
}
+
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->BroadcastCapabilityUpdate(
+ msg_params, app_mngr);
+}
} // namespace application_manager
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 7eead66618..e927280718 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -3368,6 +3368,7 @@
<enum name="AppServiceType">
<element name="MEDIA"/>
<element name="WEATHER"/>
+ <element name="NAVIGATION"/>
</enum>
<struct name="MediaServiceManifest">
@@ -3556,6 +3557,110 @@
</param>
</struct>
+ <struct name="NavigationServiceManifest">
+ <param name="acceptsWayPoints" type="Boolean" mandatory="false">
+ <description> Informs the subscriber if this service can actually accept way points. </description>
+ </param>
+ </struct>
+
+ <enum name="NavigationAction">
+ <element name="TURN">
+ <description> Using this action plus a supplied direction can give the type of turn. </description>
+ </element>
+ <element name="EXIT"/>
+ <element name="STAY"/>
+ <element name="MERGE"/>
+ <element name="FERRY"/>
+ <element name="CAR_SHUTTLE_TRAIN"/>
+ <element name="WAYPOINT"/>
+ </enum>
+
+ <enum name="NavigationJunction">
+ <element name="REGULAR">
+ <description> A junction that represents a standard intersection with a single road crossing another. </description>
+ </element>
+ <element name="BIFURCATION">
+ <description> A junction where the road splits off into two paths; a fork in the road. </description>
+ </element>
+ <element name="MULTI_CARRIAGEWAY">
+ <description> A junction that has multiple intersections and paths. </description>
+ </element>
+ <element name="ROUNDABOUT">
+ <description> A junction where traffic moves in a single direction around a central, non-traversable point to reach one of the connecting roads. </description>
+ </element>
+ <element name="TRAVERSABLE_ROUNDABOUT">
+ <description> Similar to a roundabout, however the center of the roundabout is fully traversable. Also known as a mini-roundabout. </description>
+ </element>
+ <element name="JUGHANDLE">
+ <description> A junction where lefts diverge to the right, then curve to the left, converting a left turn to a crossing maneuver. </description>
+ </element>
+ <element name="ALL_WAY_YIELD">
+ <description> Multiple way intersection that allows traffic to flow based on priority; most commonly right of way and first in, first out. </description>
+ </element>
+ <element name="TURN_AROUND">
+ <description> A junction designated for traffic turn arounds. </description>
+ </element>
+ </enum>
+
+ <enum name="Direction">
+ <element name="LEFT"/>
+ <element name="RIGHT"/>
+ </enum>
+
+ <struct name="NavigationInstruction">
+ <param name="locationDetails" type="Common.LocationDetails" mandatory="true"/>
+
+ <param name="action" type="Common.NavigationAction" mandatory="true"/>
+
+ <param name="eta" type="Common.DateTime" mandatory="false"/>
+
+ <param name="bearing" type="Integer" minvalue="0" maxvalue="359" mandatory="false">
+ <description> The angle at which this instruction takes place. For example, 0 would mean straight, less than 45 is bearing right, greater than 135 is sharp right, between 45 and 135 is a regular right, and 180 is a U-Turn, etc. </description>
+ </param>
+
+ <param name="junctionType" type="Common.NavigationJunction" mandatory="false"/>
+
+ <param name="drivingSide" type="Common.Direction" mandatory="false">
+ <description> Used to infer which side of the road this instruction takes place. For a U-Turn (Action=Turn, direction=180) this will determine which direction the turn should take place. </description>
+ </param>
+
+ <param name="details" type="String" mandatory="false">
+ <description> This is a string representation of this instruction, used to display instructions to the users. This is not intended to be read aloud to the users, see the param prompt in NavigationServiceData for that. </description>
+ </param>
+
+ <param name="image" type="Common.Image" mandatory="false">
+ <description> An image representation of this instruction. </description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceData">
+ <description> This data is related to what a navigation service would provide.</description>
+
+ <param name="timeStamp" type="Common.DateTime" mandatory="true">
+ <description> This is the timestamp of when the data was generated. This is to ensure any time or distance given in the data can accurately be adjusted if necessary. </description>
+ </param>
+
+ <param name="origin" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destination" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destinationETA" type="Common.DateTime" mandatory="false"/>
+
+ <param name="instructions" type="Common.NavigationInstruction" array="true" mandatory="false">
+ <description> This array should be ordered with all remaining instructions. The start of this array should always contain the next instruction.</description>
+ </param>
+
+ <param name="nextInstructionETA" type="Common.DateTime" mandatory="false"/>
+ <param name="nextInstructionDistance" type="Float" mandatory="false">
+ <description>The distance to this instruction from current location. This should only be updated ever .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and the next instruction. </description>
+ </param>
+ <param name="nextInstructionDistanceScale" type="Float" mandatory="false">
+ <description>Distance till next maneuver (starting from) from previous maneuver.</description>
+ </param>
+
+ <param name="prompt" type="String" mandatory="false">
+ <description>This is a prompt message that should be conveyed to the user through either display or voice (TTS). This param will change often as it should represent the following: approaching instruction, post instruction, alerts that affect the current navigation session, etc.</description>
+ </param>
+ </struct>
+
<struct name="AppServiceManifest">
<description> This manifest contains all the information necessary for the service to be published, activated, and consumers able to interact with it </description>
@@ -3575,14 +3680,6 @@
<description> If true, app service consumers beyond the IVI system will be able to access this service. If false, only the IVI system will be able consume the service. If not provided, it is assumed to be false. </description>
</param>
- <param name="uriPrefix" type="String" mandatory="false">
- <description> The URI prefix for this service. If provided, all PerformAppServiceInteraction requests must start with it. </description>
- </param>
-
- <param name="uriScheme" type="String" mandatory="false">
- <description> This is a custom schema for this service. SDL will not do any verification on this param past that it has a correctly formated JSON Object as its base. The uriScheme should contain all available actions to be taken through a PerformAppServiceInteraction request from an app service consumer. </description>
- </param>
-
<param name="rpcSpecVersion" type="Common.SyncMsgVersion" mandatory="false">
<description> This is the max RPC Spec version the app service understands. This is important during the RPC passthrough functionality. If not included, it is assumed the max version of the module is acceptable. </description>
</param>
@@ -3593,6 +3690,7 @@
<param name="mediaServiceManifest" type="Common.MediaServiceManifest" mandatory="false"/>
<param name="weatherServiceManifest" type="Common.WeatherServiceManifest" mandatory="false"/>
+ <param name="navigationServiceManifest" type="Common.NavigationServiceManifest" mandatory="false"/>
</struct>
<struct name="AppServiceRecord">
@@ -3623,6 +3721,7 @@
<param name="mediaServiceData" type="Common.MediaServiceData" mandatory="false"/>
<param name="weatherServiceData" type="Common.WeatherServiceData" mandatory="false"/>
+ <param name="navigationServiceData" type="Common.NavigationServiceData" mandatory="false"/>
</struct>
<enum name="ServiceUpdateReason">
@@ -3644,17 +3743,17 @@
</enum>
<struct name="AppServiceCapability">
- <param name="updateReason" type="ServiceUpdateReason" mandatory="false">
+ <param name="updateReason" type="Common.ServiceUpdateReason" mandatory="false">
<description> Only included in OnSystemCapabilityUpdated. Update reason for service record.</description>
</param>
- <param name="updatedAppServiceRecord" type="AppServiceRecord" mandatory="true">
+ <param name="updatedAppServiceRecord" type="Common.AppServiceRecord" mandatory="true">
<description>Service record for a specific app service provider</description>
</param>
</struct>
<struct name="AppServicesCapabilities">
<description>Capabilities of app services including what service types are supported and the current state of services.</description>
- <param name="appServices" type="AppServiceCapability" array="true" mandatory="false">
+ <param name="appServices" type="Common.AppServiceCapability" array="true" mandatory="false">
<description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
</param>
</struct>
@@ -3672,22 +3771,22 @@
<struct name="SystemCapabilities">
<description>The systemCapabilityType identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
- <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ <param name="systemCapabilityType" type="Common.SystemCapabilityType" mandatory="true">
<description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other para included.</description>
</param>
- <param name="navigationCapability" type="NavigationCapability" mandatory="false">
+ <param name="navigationCapability" type="Common.NavigationCapability" mandatory="false">
<description>Describes extended capabilities for onboard navigation system </description>
</param>
- <param name="phoneCapability" type="PhoneCapability" mandatory="false">
+ <param name="phoneCapability" type="Common.PhoneCapability" mandatory="false">
<description>Describes extended capabilities of the module's phone feature</description>
</param>
- <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
+ <param name="videoStreamingCapability" type="Common.VideoStreamingCapability" mandatory="false">
<description>Describes extended capabilities of the module's phone feature</description>
</param>
- <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
+ <param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false">
<description>Describes extended capabilities of the module's phone feature</description>
</param>
- <param name="appServicesCapabilities" type="AppServicesCapabilities" mandatory="false">
+ <param name="appServicesCapabilities" type="Common.AppServicesCapabilities" mandatory="false">
<description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
</param>
</struct>
@@ -4080,6 +4179,29 @@
</param>
</function>
+ <function name="GetFilePath" messagetype="request">
+ <description>This request is sent to retrieve a file path from the HMI.</description>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File name that should be retrieved.</description>
+ </param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ <param name="appServiceId" type="String" mandatory="false">
+ <description> ID of the service that should have uploaded the requested file.</description>
+ </param>
+ </function>
+
+ <function name="GetFilePath" messagetype="response">
+ <description> HMI handles the request internally and returns the file path with the response.</description>
+ <param name="filePath" type="String" mandatory="false">
+ <description>Path to file in hmi</description>
+ </param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ </function>
+
<!-- Policies -->
<function name="GetSystemInfo" messagetype="request">
<description>Request from SDL to HMI to obtain information about head unit system.</description>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 185b9d8773..f1ec069882 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -2620,6 +2620,7 @@
<element name="PublishAppServiceID" value="52" hexvalue="34" since="5.1" />
<element name="GetAppServiceDataID" value="53" hexvalue="35" since="5.1" />
<element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" />
+ <element name="GetFileID" value="54" hexvalue="36" since="5.1" />
<!--
Base Notifications
@@ -3702,6 +3703,7 @@
<enum name="AppServiceType" since="5.1">
<element name="MEDIA"/>
<element name="WEATHER"/>
+ <element name="NAVIGATION"/>
</enum>
<struct name="MediaServiceManifest" since="5.1">
@@ -3890,6 +3892,110 @@
</param>
</struct>
+ <struct name="NavigationServiceManifest">
+ <param name="acceptsWayPoints" type="Boolean" mandatory="false">
+ <description> Informs the subscriber if this service can actually accept way points. </description>
+ </param>
+ </struct>
+
+ <enum name="NavigationAction">
+ <element name="TURN">
+ <description> Using this action plus a supplied direction can give the type of turn. </description>
+ </element>
+ <element name="EXIT"/>
+ <element name="STAY"/>
+ <element name="MERGE"/>
+ <element name="FERRY"/>
+ <element name="CAR_SHUTTLE_TRAIN"/>
+ <element name="WAYPOINT"/>
+ </enum>
+
+ <enum name="NavigationJunction">
+ <element name="REGULAR">
+ <description> A junction that represents a standard intersection with a single road crossing another. </description>
+ </element>
+ <element name="BIFURCATION">
+ <description> A junction where the road splits off into two paths; a fork in the road. </description>
+ </element>
+ <element name="MULTI_CARRIAGEWAY">
+ <description> A junction that has multiple intersections and paths. </description>
+ </element>
+ <element name="ROUNDABOUT">
+ <description> A junction where traffic moves in a single direction around a central, non-traversable point to reach one of the connecting roads. </description>
+ </element>
+ <element name="TRAVERSABLE_ROUNDABOUT">
+ <description> Similar to a roundabout, however the center of the roundabout is fully traversable. Also known as a mini-roundabout. </description>
+ </element>
+ <element name="JUGHANDLE">
+ <description> A junction where lefts diverge to the right, then curve to the left, converting a left turn to a crossing maneuver. </description>
+ </element>
+ <element name="ALL_WAY_YIELD">
+ <description> Multiple way intersection that allows traffic to flow based on priority; most commonly right of way and first in, first out. </description>
+ </element>
+ <element name="TURN_AROUND">
+ <description> A junction designated for traffic turn arounds. </description>
+ </element>
+ </enum>
+
+ <enum name="Direction">
+ <element name="LEFT"/>
+ <element name="RIGHT"/>
+ </enum>
+
+ <struct name="NavigationInstruction">
+ <param name="locationDetails" type="LocationDetails" mandatory="true"/>
+
+ <param name="action" type="NavigationAction" mandatory="true"/>
+
+ <param name="eta" type="DateTime" mandatory="false"/>
+
+ <param name="bearing" type="Integer" minvalue="0" maxvalue="359" mandatory="false">
+ <description> The angle at which this instruction takes place. For example, 0 would mean straight, less than 45 is bearing right, greater than 135 is sharp right, between 45 and 135 is a regular right, and 180 is a U-Turn, etc. </description>
+ </param>
+
+ <param name="junctionType" type="NavigationJunction" mandatory="false"/>
+
+ <param name="drivingSide" type="Direction" mandatory="false">
+ <description> Used to infer which side of the road this instruction takes place. For a U-Turn (Action=Turn, direction=180) this will determine which direction the turn should take place. </description>
+ </param>
+
+ <param name="details" type="String" mandatory="false">
+ <description> This is a string representation of this instruction, used to display instructions to the users. This is not intended to be read aloud to the users, see the param prompt in NavigationServiceData for that. </description>
+ </param>
+
+ <param name="image" type="Image" mandatory="false">
+ <description> An image representation of this instruction. </description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceData">
+ <description> This data is related to what a navigation service would provide.</description>
+
+ <param name="timeStamp" type="DateTime" mandatory="true">
+ <description> This is the timestamp of when the data was generated. This is to ensure any time or distance given in the data can accurately be adjusted if necessary. </description>
+ </param>
+
+ <param name="origin" type="LocationDetails" mandatory="false"/>
+ <param name="destination" type="LocationDetails" mandatory="false"/>
+ <param name="destinationETA" type="DateTime" mandatory="false"/>
+
+ <param name="instructions" type="NavigationInstruction" array="true" mandatory="false">
+ <description> This array should be ordered with all remaining instructions. The start of this array should always contain the next instruction.</description>
+ </param>
+
+ <param name="nextInstructionETA" type="DateTime" mandatory="false"/>
+ <param name="nextInstructionDistance" type="Float" mandatory="false">
+ <description>The distance to this instruction from current location. This should only be updated ever .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and the next instruction. </description>
+ </param>
+ <param name="nextInstructionDistanceScale" type="Float" mandatory="false">
+ <description>Distance till next maneuver (starting from) from previous maneuver.</description>
+ </param>
+
+ <param name="prompt" type="String" mandatory="false">
+ <description>This is a prompt message that should be conveyed to the user through either display or voice (TTS). This param will change often as it should represent the following: approaching instruction, post instruction, alerts that affect the current navigation session, etc.</description>
+ </param>
+ </struct>
+
<struct name="AppServiceManifest" since="5.1">
<description> This manifest contains all the information necessary for the service to be published, activated, and consumers able to interact with it </description>
@@ -3909,14 +4015,6 @@
<description> If true, app service consumers beyond the IVI system will be able to access this service. If false, only the IVI system will be able consume the service. If not provided, it is assumed to be false. </description>
</param>
- <param name="uriPrefix" type="String" mandatory="false">
- <description> The URI prefix for this service. If provided, all PerformAppServiceInteraction requests must start with it. </description>
- </param>
-
- <param name="uriScheme" type="String" mandatory="false">
- <description> This is a custom schema for this service. SDL will not do any verification on this param past that it has a correctly formated JSON Object as its base. The uriScheme should contain all available actions to be taken through a PerformAppServiceInteraction request from an app service consumer. </description>
- </param>
-
<param name="rpcSpecVersion" type="SyncMsgVersion" mandatory="false">
<description> This is the max RPC Spec version the app service understands. This is important during the RPC passthrough functionality. If not included, it is assumed the max version of the module is acceptable. </description>
</param>
@@ -3927,6 +4025,7 @@
<param name="mediaServiceManifest" type="MediaServiceManifest" mandatory="false"/>
<param name="weatherServiceManifest" type="WeatherServiceManifest" mandatory="false"/>
+ <param name="navigationServiceManifest" type="NavigationServiceManifest" mandatory="false"/>
</struct>
<struct name="AppServiceRecord" since="5.1">
@@ -3957,6 +4056,7 @@
<param name="mediaServiceData" type="MediaServiceData" mandatory="false"/>
<param name="weatherServiceData" type="WeatherServiceData" mandatory="false"/>
+ <param name="navigationServiceData" type="NavigationServiceData" mandatory="false"/>
</struct>
<enum name="ServiceUpdateReason" since="5.1">
@@ -6349,6 +6449,64 @@
</param>
</function>
+ <function name ="GetFile" functionID="GetFileID" messagetype="request">
+ <description>This request is sent to the module to retrieve a file</description>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File name that should be retrieved</description>
+ </param>
+ <param name="appServiceId" type="String" mandatory="false">
+ <description>ID of the service that should have uploaded the requested file.</description>
+ </param>
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks if offset is set to 0, then length is the total length of the file to be downloaded</description>
+ </param>
+ </function>
+
+ <function name="GetFile" functionID="GetFileID" messagetype="response">
+ <description>This response includes the data that is requested from the specific service</description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="FILE_NOT_FOUND"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <!-- Specific response data -->
+ <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+
+ <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks if offset is set to 0, then length is the total length of the file to be downloaded</description>
+ </param>
+
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>File type that is being sent in response.</description>
+ </param>
+
+ <param name="crc" type="Integer" minvalue="0" maxvalue="4294967295" mandatory="false">
+ <description>Additional CRC32 checksum to protect data integrity up to 512 Mbits</description>
+ </param>
+ </function>
+
<function name="DeleteFile" functionID="DeleteFileID" messagetype="request" since="3.0">
<description>
Used to delete a file resident on the module in the app's local cache.
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 d795721863..d2cf995e95 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
@@ -456,6 +456,11 @@ enum FunctionID {
GetAppServiceDataID = 53,
/**
+ * @brief GetFileID
+ */
+ GetFileID = 54,
+
+ /**
* @brief PerformAppServiceInteractionID.
*/
PerformAppServiceInteractionID = 55,
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index 718bafa905..2a3d944f33 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1131,6 +1131,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("GetFile" == literal) {
+ *result = GetFileID;
+ return true;
+ }
+
if ("GetAppServiceData" == literal) {
*result = GetAppServiceDataID;
return true;
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index 16f0ef3d67..5b496a4fbd 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -442,6 +442,11 @@ enum FunctionID {
GetAppServiceDataID = 53,
/**
+ * @brief GetFileID
+ */
+ GetFileID = 54,
+
+ /**
* @brief PerformAppServiceInteractionID.
*/
PerformAppServiceInteractionID = 55,
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index 25f6d778fc..113ba8c527 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -851,6 +851,8 @@ bool IsValidEnum(FunctionID val) {
return true;
case PublishAppServiceID:
return true;
+ case GetFileID:
+ return true;
case GetAppServiceDataID:
return true;
case PerformAppServiceInteractionID:
@@ -1010,6 +1012,8 @@ const char* EnumToJsonString(FunctionID val) {
return "SetCloudAppProperties";
case PublishAppServiceID:
return "PublishAppService";
+ case GetFileID:
+ return "GetFile";
case GetAppServiceDataID:
return "GetAppServiceData";
case PerformAppServiceInteractionID:
@@ -1318,6 +1322,11 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("GetFile" == literal) {
+ *result = GetFileID;
+ return true;
+ }
+
if ("GetAppServiceData" == literal) {
*result = GetAppServiceDataID;
return true;
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index 1322757ab1..3235dd619e 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -701,6 +701,9 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
case SmartType_Integer:
newData.int_value = OtherObject.m_data.int_value;
break;
+ case SmartType_UInteger:
+ newData.int_value = OtherObject.m_data.int_value;
+ break;
case SmartType_Double:
newData.double_value = OtherObject.m_data.double_value;
break;
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index e26fef34bb..e6e5fdc0d4 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -241,6 +241,19 @@ bool WriteBinaryFile(const std::string& name,
*/
bool ReadBinaryFile(const std::string& name, std::vector<uint8_t>& result);
+/**
+ * @brief Reads from file
+ *
+ * @param name path to file
+ * @param result read data
+ * @param offset number of bytes to be ignored from begining of file
+ * @return returns true if the operation is successfully.
+ */
+bool ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length);
+
bool ReadFile(const std::string& name, std::string& result);
/**
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index f98aeda056..430cf40da0 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -316,6 +316,26 @@ bool file_system::ReadBinaryFile(const std::string& name,
return true;
}
+bool file_system::ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length) {
+ if (!FileExists(name) || !IsAccessible(name, R_OK)) {
+ return false;
+ }
+
+ std::ifstream file(name.c_str(), std::ios_base::binary);
+ file.ignore(offset);
+ std::ostringstream ss;
+ std::string s;
+ s.resize(length);
+ file.read(&s[0], length);
+
+ result.resize(s.length());
+ std::copy(s.begin(), s.end(), result.begin());
+ return true;
+}
+
bool file_system::ReadFile(const std::string& name, std::string& result) {
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
return false;