summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rd_party/CMakeLists.txt6
-rw-r--r--src/appMain/sdl_preloaded_pt.json57
-rw-r--r--src/appMain/smartDeviceLink.ini6
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h84
-rw-r--r--src/components/application_manager/include/application_manager/application.h67
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h73
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h53
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_from_hmi.h3
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h49
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h26
-rw-r--r--src/components/application_manager/rpc_plugins/CMakeLists.txt1
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h74
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h75
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h81
-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.h82
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc85
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc101
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc68
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc70
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc73
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc73
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc101
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc130
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc55
-rw-r--r--src/components/application_manager/src/app_service_manager.cc99
-rw-r--r--src/components/application_manager/src/application_impl.cc51
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc278
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc7
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc56
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc92
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc16
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc26
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc4
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc131
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h15
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc1
-rw-r--r--src/components/application_manager/test/sdl_preloaded_pt.json4
-rw-r--r--src/components/application_manager/test/sdl_pt_update.json4
-rw-r--r--src/components/config_profile/include/config_profile/profile.h12
-rw-r--r--src/components/config_profile/src/profile.cc33
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h28
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc81
-rw-r--r--src/components/include/application_manager/application_manager.h13
-rw-r--r--src/components/include/application_manager/application_manager_settings.h2
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h51
-rw-r--r--src/components/include/connection_handler/connection_handler.h16
-rw-r--r--src/components/include/connection_handler/connection_handler_observer.h7
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h70
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h71
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h6
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h2
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h14
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h8
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h5
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h22
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h22
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h22
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h22
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager.h7
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_listener.h4
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_settings.h2
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h6
-rw-r--r--src/components/include/transport_manager/common.h2
-rw-r--r--src/components/include/transport_manager/transport_adapter/device.h50
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter.h13
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter_event.h4
-rw-r--r--src/components/include/transport_manager/transport_manager.h15
-rw-r--r--src/components/include/transport_manager/transport_manager_listener.h13
-rw-r--r--src/components/include/transport_manager/transport_manager_listener_empty.h11
-rw-r--r--src/components/include/transport_manager/transport_manager_settings.h10
-rw-r--r--src/components/interfaces/HMI_API.xml374
-rw-r--r--src/components/interfaces/MOBILE_API.xml391
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h70
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h72
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h69
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h17
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h7
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml16
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc112
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc47
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc50
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc76
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_queries.cc10
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc35
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc43
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc47
-rw-r--r--src/components/policy/policy_external/test/json/PTU.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU2.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU3.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json4
-rw-r--r--src/components/policy/policy_external/test/json/PTU_without_requestType_field.json4
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json4
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json4
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json4
-rw-r--r--src/components/policy/policy_external/test/json/ptu2_requestType.json4
-rw-r--r--src/components/policy/policy_external/test/json/ptu_requestType.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_first_update.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_second_update.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_update.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json4
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json4
-rw-r--r--src/components/policy/policy_external/test/json/valid_sdl_pt_update.json4
-rw-r--r--src/components/policy/policy_external/test/sql_pt_representation_test.cc4
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h70
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h72
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h70
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h17
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h6
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc114
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc49
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc59
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc65
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc44
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc43
-rw-r--r--src/components/policy/policy_regular/test/PTU.json4
-rw-r--r--src/components/policy/policy_regular/test/PTU2.json4
-rw-r--r--src/components/policy/policy_regular/test/PTU3.json4
-rw-r--r--src/components/policy/policy_regular/test/PTU4.json4
-rw-r--r--src/components/policy/policy_regular/test/ptu2_requestType.json4
-rw-r--r--src/components/policy/policy_regular/test/ptu_requestType.json4
-rw-r--r--src/components/policy/policy_regular/test/sdl_preloaded_pt.json4
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_first_update.json4
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_second_update.json4
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_update.json4
-rw-r--r--src/components/policy/policy_regular/test/sql_pt_representation_test.cc4
-rw-r--r--src/components/policy/policy_regular/test/valid_sdl_pt_update.json4
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h4
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc4
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h7
-rw-r--r--src/components/transport_manager/CMakeLists.txt6
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_device.h67
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h98
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h89
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h178
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h10
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h64
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h19
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h18
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_impl.h20
-rw-r--r--src/components/transport_manager/src/cloud/cloud_device.cc75
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc81
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc124
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc245
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc121
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc38
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc18
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc92
-rw-r--r--src/components/transport_manager/test/CMakeLists.txt5
-rw-r--r--src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h3
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h12
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h6
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc3
-rw-r--r--src/components/transport_manager/test/transport_adapter_test.cc93
-rw-r--r--src/components/utils/include/utils/timer.h16
-rw-r--r--src/components/utils/src/timer.cc17
186 files changed, 7754 insertions, 253 deletions
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index bdb96de417..60d68e9d60 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -209,7 +209,7 @@ else()
)
endif()
-find_package(Boost 1.66.0 COMPONENTS system thread date_time filesystem)
+find_package(Boost 1.66.0 COMPONENTS system thread date_time filesystem regex)
set(BOOST_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/boost_src)
set(BOOST_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib)
SET_PROPERTY(GLOBAL PROPERTY GLOBAL_BOOST_LIBS ${BOOST_LIBS_DIRECTORY})
@@ -226,9 +226,9 @@ if (NOT ${Boost_FOUND})
URL https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
- CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem --prefix=${3RD_PARTY_INSTALL_PREFIX}
+ CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem,regex --prefix=${3RD_PARTY_INSTALL_PREFIX}
BUILD_COMMAND ./b2
- INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --with-system --with-thread --with-date_time --with-filesystem --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log
+ INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --with-system --with-thread --with-date_time --with-filesystem --with-regex --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log
INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX}
BUILD_IN_SOURCE true
)
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index d503ae34e5..06ab56bc39 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -412,6 +412,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -432,6 +433,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -452,6 +454,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -471,6 +474,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -529,6 +533,57 @@
}
}
},
+ "CloudApp":{
+ "rpcs":{
+ "SetCloudAppProperties":{
+ "hmi_levels":["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ }
+ }
+ },
+ "AppService":{
+ "rpcs":{
+ "PublishAppService":{
+ "hmi_levels":["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ },
"RemoteControl": {
"rpcs": {
"ButtonPress": {
@@ -2369,7 +2424,7 @@
"steal_focus": false,
"priority": "NONE",
"default_hmi": "NONE",
- "groups": ["Base-4"],
+ "groups": ["Base-4", "AppService"],
"RequestType": [],
"RequestSubType": []
},
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index b0513c076f..ccb377d1e6 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -202,6 +202,12 @@ TCPAdapterPort = 12345
; If the name is omitted, Core will listen on all network interfaces by binding to INADDR_ANY.
TCPAdapterNetworkInterface =
+[CloudAppConnections]
+; Value in milliseconds for time between retry attempts on a failed websocket connection
+CloudAppRetryTimeout = 1000
+; MaxNn number of retry attempts for a cloud websocket connection
+CloudAppMaxRetryAttempts = 5
+
[ProtocolHandler]
; SDL supported protocol version
MaxSupportedProtocolVersion = 5
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
new file mode 100644
index 0000000000..a15921d9f7
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * 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 Ford Motor Company nor the names of its 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_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
+
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+class ApplicationManager;
+
+/**
+ * @brief The AppServiceManager is TODO.
+ */
+class AppServiceManager {
+ public:
+ /**
+ * @brief Class constructor
+ * @param app_manager
+ */
+ AppServiceManager(ApplicationManager& app_manager);
+
+ /**
+ * @brief Class destructor
+ */
+ ~AppServiceManager();
+
+ /**
+ * @brief TODO
+ * @param manifest
+ */
+ smart_objects::SmartObject PublishAppService(
+ const smart_objects::SmartObject& manifest);
+
+ /**
+ * @brief TODO
+ * @param manifest
+ */
+ bool UnpublishAppService(const std::string service_id);
+
+ /**
+ * @brief TODO
+ * @param manifest
+ */
+ std::vector<smart_objects::SmartObject> GetAllServices();
+
+ private:
+ ApplicationManager& app_manager_;
+ std::map<std::string, smart_objects::SmartObject> published_services_;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index ad7570955e..7a59263299 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -946,6 +946,73 @@ class Application : public virtual InitialApplicationData,
*/
virtual const std::list<AppExtensionPtr>& Extensions() const = 0;
+ /**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ virtual const std::string& cloud_app_endpoint() const = 0;
+
+ /**
+ * @brief Get cloud app auth token to be used in connection handshake after
+ * websocket open.
+ * @return cloud app auth token
+ */
+ virtual const std::string& cloud_app_auth_token() const = 0;
+
+ /**
+ * @brief Get cloud app tranpsport type. Defines the type of websocket
+ * connection used.
+ * @return cloud app transport type
+ */
+ virtual const std::string& cloud_app_transport_type() const = 0;
+
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar
+ * mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ virtual const mobile_apis::HybridAppPreference::eType& hybrid_app_preference()
+ const = 0;
+
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ virtual const std::string& cloud_app_certificate() const = 0;
+
+ /**
+ * @brief Check whether the given application is a cloud app.
+ * @return true if the application is a cloud application, false otherwise.
+ */
+ virtual bool is_cloud_app() const = 0;
+
+ /**
+ * @brief Set cloud app endpoint
+ */
+ virtual void set_cloud_app_endpoint(const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set cloud app auth token
+ */
+ virtual void set_cloud_app_auth_token(const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set cloud app transport type
+ */
+ virtual void set_cloud_app_transport_type(
+ const std::string& transport_type) = 0;
+
+ /**
+ * @brief Set hybrid app preference
+ */
+ virtual void set_hybrid_app_preference(
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Set cloud app certificate
+ */
+ virtual void set_cloud_app_certificate(const std::string& certificate) = 0;
+
protected:
mutable sync_primitives::Lock hmi_states_lock_;
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 8dc3b2da20..6d627d0c67 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -409,6 +409,72 @@ class ApplicationImpl : public virtual Application,
void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) OVERRIDE;
+ /**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ const std::string& cloud_app_endpoint() const OVERRIDE;
+
+ /**
+ * @brief Get cloud app auth token to be used in connection handshake after
+ * websocket open.
+ * @return cloud app auth token
+ */
+ const std::string& cloud_app_auth_token() const OVERRIDE;
+
+ /**
+ * @brief Get cloud app tranpsport type. Defines the type of websocket
+ * connection used.
+ * @return cloud app transport type
+ */
+ const std::string& cloud_app_transport_type() const OVERRIDE;
+
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar
+ * mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference()
+ const OVERRIDE;
+
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ const std::string& cloud_app_certificate() const OVERRIDE;
+
+ /**
+ * @brief Check whether the given application is a cloud app.
+ * @return true if the application is a cloud application, false otherwise.
+ */
+ bool is_cloud_app() const OVERRIDE;
+
+ /**
+ * @brief Set cloud app endpoint
+ */
+ void set_cloud_app_endpoint(const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set cloud app auth token
+ */
+ void set_cloud_app_auth_token(const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set cloud app transport type
+ */
+ void set_cloud_app_transport_type(const std::string& transport_type) OVERRIDE;
+
+ /**
+ * @brief Set hybrid app preference
+ */
+ void set_hybrid_app_preference(const mobile_apis::HybridAppPreference::eType&
+ hybrid_app_preference) OVERRIDE;
+
+ /**
+ * @brief Set cloud app certificate
+ */
+ void set_cloud_app_certificate(const std::string& certificate) OVERRIDE;
+
protected:
/**
* @brief Clean up application folder. Persistent files will stay
@@ -513,6 +579,13 @@ class ApplicationImpl : public virtual Application,
std::list<AppExtensionPtr> extensions_;
+ // Cloud app properties
+ std::string endpoint_;
+ std::string auth_token_;
+ std::string cloud_transport_type_;
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference_;
+ std::string certificate_;
+
/**
* @brief Defines number per time in seconds limits
*/
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 6c111dbbb3..f72b02e320 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -213,6 +213,11 @@ class ApplicationManagerImpl
return *plugin_manager_;
}
+ virtual AppServiceManager& GetAppServiceManager() OVERRIDE {
+ DCHECK(app_service_manager_);
+ return *app_service_manager_;
+ }
+
std::vector<std::string> devices(
const std::string& policy_app_id) const OVERRIDE;
@@ -360,6 +365,28 @@ class ApplicationManagerImpl
void ConnectToDevice(const std::string& device_mac) OVERRIDE;
void OnHMIStartedCooperation() OVERRIDE;
+ void RefreshCloudAppInformation() OVERRIDE;
+
+ void CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id);
+
+ /**
+ * @brief Notifies the applicaiton manager that a cloud connection status has
+ * updated and should trigger an UpdateAppList RPC to the HMI
+ */
+ void OnConnectionStatusUpdated();
+
+ /**
+ * @brief Retrieve the current connection status of a cloud app
+ * @param app A cloud application
+ * @return The current CloudConnectionStatus of app
+ */
+
+ hmi_apis::Common_CloudConnectionStatus::eType GetCloudAppConnectionStatus(
+ ApplicationConstSharedPtr app) const;
+
/*
* @brief Returns unique correlation ID for HMI request
*
@@ -485,9 +512,6 @@ class ApplicationManagerImpl
// typedef for Applications list const iterator
typedef ApplictionSet::const_iterator ApplictionSetConstIt;
- DataAccessor<AppsWaitRegistrationSet> apps_waiting_for_registration() const;
- ApplicationConstSharedPtr waiting_app(const uint32_t hmi_id) const;
-
/**
* @brief Notification from PolicyHandler about PTU.
* Compares AppHMIType between saved in app and received from PTU. If they are
@@ -1382,6 +1406,7 @@ class ApplicationManagerImpl
protocol_handler::ProtocolHandler* protocol_handler_;
request_controller::RequestController request_ctrl_;
std::unique_ptr<plugin_manager::RPCPluginManager> plugin_manager_;
+ std::unique_ptr<application_manager::AppServiceManager> app_service_manager_;
/**
* @brief Map contains apps with HMI state before incoming call
@@ -1449,6 +1474,10 @@ class ApplicationManagerImpl
DeviceMap secondary_transport_devices_cache_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ pending_device_map_lock_ptr_;
+ std::map<std::string, std::string> pending_device_map_;
+
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver* metric_observer_;
#endif // TELEMETRY_MONITOR
@@ -1478,12 +1507,28 @@ class ApplicationManagerImpl
void AddMockApplication(ApplicationSharedPtr mock_app);
/**
+ * @brief Add a mock application to the pending application list without going
+ * through the formal registration process. Only for unit testing.
+ * @param mock_app the mock app to be added to the pending application list
+ */
+ void AddMockPendingApplication(ApplicationSharedPtr mock_app);
+
+ /**
* @brief set a mock media manager without running Init(). Only for unit
* testing.
- * @param mock_app the mock app to be registered
+ * @param mock_media_manager the mock media manager to be assigned
*/
void SetMockMediaManager(media_manager::MediaManager* mock_media_manager);
+ /**
+ * @brief set a mock rpc service directly. Only for unit
+ * testing.
+ * @param mock_app the mock rpc service to be assigned
+ */
+ void SetMockRPCService(rpc_service::RPCService* rpc_service) {
+ rpc_service_.reset(rpc_service);
+ }
+
virtual void SetPluginManager(
std::unique_ptr<plugin_manager::RPCPluginManager>& plugin_manager)
OVERRIDE {
diff --git a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
index 927a45c6a6..d980e98576 100644
--- a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
@@ -64,7 +64,8 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
void SendResponse(const bool success,
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code);
+ const hmi_apis::Common_Result::eType result_code,
+ const smart_objects::SmartObject* response_params = NULL);
/**
* @brief SendResponse allows to send error response to hmi
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index c8f3bcf888..8ee5ff64f6 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -398,6 +398,55 @@ class PolicyHandler : public PolicyHandlerInterface,
custom_str::CustomString GetAppName(
const std::string& policy_app_id) OVERRIDE;
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true, if the application is an enabled cloud application,
+ * otherwise - false
+ */
+ const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ void GetCloudAppParameters(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received from a
+ * mobile app
+ * @param message The SetCloudAppProperties message
+ */
+ void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) OVERRIDE;
+
virtual void OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
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 6e32853a3d..19b2daaaf4 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
@@ -76,7 +76,7 @@ extern const char* ngn_media_screen_app_name;
extern const char* vr_synonyms;
extern const char* uses_vehicle_data;
extern const char* is_media_application;
-extern const char* greyOut;
+extern const char* grey_out;
extern const char* language_desired;
extern const char* auto_activated_id;
extern const char* app_type;
@@ -188,6 +188,12 @@ extern const char* green;
extern const char* blue;
extern const char* display_layout;
extern const char* icon_resumed;
+extern const char* enabled;
+extern const char* cloud_app_auth_token;
+extern const char* cloud_transport_type;
+extern const char* hybrid_app_preference;
+extern const char* is_cloud_application;
+extern const char* cloud_connection_status;
// PutFile
extern const char* sync_file_name;
@@ -253,6 +259,7 @@ extern const char* fuel_level;
extern const char* fuel_level_state;
extern const char* instant_fuel_consumption;
extern const char* fuel_range;
+extern const char* cloud_app_vehicle_id;
extern const char* external_temp;
extern const char* turn_signal;
extern const char* vin;
@@ -293,6 +300,23 @@ extern const char* system_software_version;
extern const char* priority;
extern const char* engine_oil_life;
+// app services
+extern const char* app_service_manifest;
+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;
+extern const char* app_service_record;
+extern const char* service_id;
+extern const char* service_manifest;
+extern const char* service_published;
+extern const char* service_active;
+
// resuming
extern const char* application_commands;
extern const char* application_submenus;
diff --git a/src/components/application_manager/rpc_plugins/CMakeLists.txt b/src/components/application_manager/rpc_plugins/CMakeLists.txt
index c9ef282c12..8884b30532 100644
--- a/src/components/application_manager/rpc_plugins/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/CMakeLists.txt
@@ -32,3 +32,4 @@
add_subdirectory(vehicle_info_plugin)
add_subdirectory(sdl_rpc_plugin)
add_subdirectory(rc_rpc_plugin)
+add_subdirectory(app_service_rpc_plugin)
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
new file mode 100644
index 0000000000..e254c36587
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
@@ -0,0 +1,80 @@
+# 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 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_directories(include)
+
+set (COMMANDS_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/commands
+)
+
+set (MOBILE_COMMANDS_SOURCE_DIR
+ ${COMMANDS_SOURCE_DIR}/mobile
+)
+
+set (HMI_COMMANDS_SOURCE_DIR
+ ${COMMANDS_SOURCE_DIR}/hmi
+)
+
+collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}")
+collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}")
+collect_sources(PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
+collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands")
+
+set(LIBRARIES
+ HMI_API
+ MOBILE_API
+ ApplicationManager
+ v4_protocol_v1_2_no_extra
+ SmartObjects
+ Utils
+)
+
+if(ENABLE_LOG)
+ list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
+endif()
+
+add_library("app_service_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES})
+target_link_libraries("app_service_rpc_plugin" ${LIBRARIES})
+
+add_library("AppServiceRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
+target_link_libraries("AppServiceRpcPluginStaticLib" ${LIBRARIES})
+
+set(INSTALL_DESTINATION bin)
+
+install(TARGETS app_service_rpc_plugin
+ DESTINATION ${INSTALL_DESTINATION}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+)
+
+if(BUILD_TESTS)
+ # add_subdirectory(test)
+endif()
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h
new file mode 100644
index 0000000000..193b79e26f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h
@@ -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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
+
+#include "app_service_rpc_plugin/app_service_hmi_command_factory.h"
+#include "app_service_rpc_plugin/app_service_mobile_command_factory.h"
+#include "application_manager/application_manager.h"
+
+namespace app_service_rpc_plugin {
+namespace commands = application_manager::commands;
+namespace app_mngr = application_manager;
+
+class AppServiceCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceCommandFactory(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~AppServiceCommandFactory();
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t,
+ const application_manager::commands::Command::CommandSource)
+ const OVERRIDE;
+
+ private:
+ std::unique_ptr<AppServiceHmiCommandFactory> hmi_command_factory_;
+ std::unique_ptr<AppServiceMobileCommandFactory> mobile_command_factory_;
+};
+} // namespace app_service_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h
new file mode 100644
index 0000000000..c42b64f559
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h
@@ -0,0 +1,74 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
+
+#include "application_manager/application_manager.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+/**
+ * @brief The vehicle info hmi command factory.
+ */
+class AppServiceHmiCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceHmiCommandFactory(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const OVERRIDE;
+
+ private:
+ app_mngr::ApplicationManager& application_manager_;
+ app_mngr::rpc_service::RPCService& rpc_service_;
+ app_mngr::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+
+ app_mngr::CommandCreator& buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+
+ DISALLOW_COPY_AND_ASSIGN(AppServiceHmiCommandFactory);
+};
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h
new file mode 100644
index 0000000000..bd1e10f267
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h
@@ -0,0 +1,75 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
+
+#include "application_manager/application_manager.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+/**
+ * @brief The vehicle info mobile command factory.
+ */
+class AppServiceMobileCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceMobileCommandFactory(
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const OVERRIDE;
+
+ private:
+ app_mngr::ApplicationManager& application_manager_;
+ app_mngr::rpc_service::RPCService& rpc_service_;
+ app_mngr::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+
+ app_mngr::CommandCreator& buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+
+ DISALLOW_COPY_AND_ASSIGN(AppServiceMobileCommandFactory);
+};
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
new file mode 100644
index 0000000000..1113911a22
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
@@ -0,0 +1,81 @@
+/*
+ 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_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H
+
+#include "application_manager/command_factory.h"
+
+namespace app_service_rpc_plugin {
+// class AppServiceAppExtension;
+namespace app_mngr = application_manager;
+namespace plugins = application_manager::plugin_manager;
+
+class AppServiceRpcPlugin : public plugins::RPCPlugin {
+ public:
+ AppServiceRpcPlugin();
+
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ std::string PluginName() OVERRIDE;
+ app_mngr::CommandFactory& GetCommandFactory() OVERRIDE;
+
+ void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE;
+ void OnApplicationEvent(plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
+ /**
+ * @brief ProcessResumptionSubscription send Subscribe vehicle data requests
+ * to HMI
+ * @param app application for subscription
+ * @param ext application extension
+ */
+ // TODO
+ // void ProcessResumptionSubscription(app_mngr::Application& app,
+ // AppServiceAppExtension& ext);
+
+ private:
+ std::unique_ptr<app_mngr::CommandFactory> command_factory_;
+ app_mngr::ApplicationManager* application_manager_;
+};
+} // namespace app_service_rpc_plugin
+
+extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H
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
new file mode 100644
index 0000000000..0c7f222c1d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
@@ -0,0 +1,82 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPublishAppServiceRequest command class
+ **/
+class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASPublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPublishAppServiceRequest(
+ 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 ASPublishAppServiceRequest class destructor
+ **/
+ virtual ~ASPublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ bool ValidateManifest(smart_objects::SmartObject& manifest);
+
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h
new file mode 100644
index 0000000000..c532225632
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h
@@ -0,0 +1,80 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPublishAppServiceResponse command class
+ **/
+class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASPublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPublishAppServiceResponse(
+ 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 ASPublishAppServiceResponse class destructor
+ **/
+ virtual ~ASPublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h
new file mode 100644
index 0000000000..44d6d09fd3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h
@@ -0,0 +1,81 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/notification_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASAppServiceDataNotification command class
+ **/
+class OnASAppServiceDataNotification
+ : public app_mngr::commands::NotificationToHMI {
+ public:
+ /**
+ * @brief OnASAppServiceDataNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnASAppServiceDataNotification(
+ 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 OnASAppServiceDataNotification class destructor
+ **/
+ virtual ~OnASAppServiceDataNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h
new file mode 100644
index 0000000000..7ca20d692a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h
@@ -0,0 +1,81 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/notification_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASAppServiceDataNotificationFromHMI command class
+ **/
+class OnASAppServiceDataNotificationFromHMI
+ : public app_mngr::commands::NotificationFromHMI {
+ public:
+ /**
+ * @brief OnASAppServiceDataNotificationFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnASAppServiceDataNotificationFromHMI(
+ 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 OnASAppServiceDataNotificationFromHMI class destructor
+ **/
+ virtual ~OnASAppServiceDataNotificationFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h
new file mode 100644
index 0000000000..4bc818f9be
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h
@@ -0,0 +1,81 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_notification_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnAppServiceDataNotification command class
+ **/
+class OnAppServiceDataNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ /**
+ * @brief OnAppServiceDataNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppServiceDataNotification(
+ 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 OnAppServiceDataNotification class destructor
+ **/
+ virtual ~OnAppServiceDataNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h
new file mode 100644
index 0000000000..f163e5848b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h
@@ -0,0 +1,81 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnAppServiceDataNotificationFromMobile command class
+ **/
+class OnAppServiceDataNotificationFromMobile
+ : public app_mngr::commands::CommandNotificationFromMobileImpl {
+ public:
+ /**
+ * @brief OnAppServiceDataNotificationFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppServiceDataNotificationFromMobile(
+ 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 OnAppServiceDataNotificationFromMobile class destructor
+ **/
+ virtual ~OnAppServiceDataNotificationFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
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
new file mode 100644
index 0000000000..459fa0457e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
@@ -0,0 +1,81 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PublishAppServiceRequest command class
+ **/
+class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief PublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PublishAppServiceRequest(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 PublishAppServiceRequest class destructor
+ **/
+ virtual ~PublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ bool ValidateManifest(smart_objects::SmartObject& manifest);
+
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h
new file mode 100644
index 0000000000..a11399c9e1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h
@@ -0,0 +1,80 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PublishAppServiceResponse command class
+ **/
+class PublishAppServiceResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief PublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PublishAppServiceResponse(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 PublishAppServiceResponse class destructor
+ **/
+ virtual ~PublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ AppServiceRpcPlugin* plugin_;
+ DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
new file mode 100644
index 0000000000..0405bb3e7c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
@@ -0,0 +1,72 @@
+/*
+ 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 "app_service_rpc_plugin/app_service_command_factory.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+
+AppServiceCommandFactory::AppServiceCommandFactory(
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : hmi_command_factory_(new AppServiceHmiCommandFactory(
+ application_manager, rpc_service, hmi_capabilities, policy_handler))
+ , mobile_command_factory_(new AppServiceMobileCommandFactory(
+ application_manager, rpc_service, hmi_capabilities, policy_handler)) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+AppServiceCommandFactory::~AppServiceCommandFactory() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ return hmi_command_factory_->CreateCommand(message, source);
+ } else {
+ return mobile_command_factory_->CreateCommand(message, source);
+ }
+}
+
+bool AppServiceCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const commands::Command::CommandSource source) const {
+ return commands::Command::SOURCE_HMI == source
+ ? hmi_command_factory_->IsAbleToProcess(function_id, source)
+ : mobile_command_factory_->IsAbleToProcess(function_id, source);
+}
+} // namespace service_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
new file mode 100644
index 0000000000..e741d7bfd4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -0,0 +1,119 @@
+/*
+ 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 "app_service_rpc_plugin/app_service_hmi_command_factory.h"
+#include "application_manager/message.h"
+#include "interfaces/HMI_API.h"
+
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+namespace strings = app_mngr::strings;
+
+AppServiceHmiCommandFactory::AppServiceHmiCommandFactory(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : application_manager_(application_manager)
+ , rpc_service_(rpc_service)
+ , hmi_capabilities_(hmi_capabilities)
+ , policy_handler_(policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ UNUSED(source);
+
+ const hmi_apis::FunctionID::eType function_id =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+
+ const hmi_apis::messageType::eType message_type =
+ static_cast<hmi_apis::messageType::eType>(
+ (*message)[strings::params][strings::message_type].asInt());
+
+ auto message_type_str = "request";
+ if (hmi_apis::messageType::response == message_type) {
+ message_type_str = "response";
+ } else if (hmi_apis::messageType::error_response == message_type) {
+ message_type_str = "error response";
+ }
+
+ UNUSED(message_type_str);
+ LOG4CXX_DEBUG(logger_,
+ "HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
+
+ return buildCommandCreator(function_id, message_type, source).create(message);
+}
+
+bool AppServiceHmiCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const {
+ UNUSED(source);
+ return buildCommandCreator(function_id,
+ hmi_apis::messageType::INVALID_ENUM,
+ source).CanBeCreated();
+}
+
+app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+
+ switch (function_id) {
+ case hmi_apis::FunctionID::AppService_PublishAppService:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASPublishAppServiceRequest>()
+ : factory.GetCreator<commands::ASPublishAppServiceResponse>();
+ case hmi_apis::FunctionID::AppService_OnAppServiceData:
+ return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source
+ ? factory.GetCreator<
+ commands::OnASAppServiceDataNotificationFromHMI>()
+ : factory
+ .GetCreator<commands::OnASAppServiceDataNotification>();
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+ }
+}
+}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
new file mode 100644
index 0000000000..e0e667e975
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -0,0 +1,119 @@
+/*
+ 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 "app_service_rpc_plugin/app_service_mobile_command_factory.h"
+
+#include "application_manager/message.h"
+#include "interfaces/MOBILE_API.h"
+
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+namespace strings = app_mngr::strings;
+
+AppServiceMobileCommandFactory::AppServiceMobileCommandFactory(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : application_manager_(application_manager)
+ , rpc_service_(rpc_service)
+ , hmi_capabilities_(hmi_capabilities)
+ , policy_handler_(policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ UNUSED(source);
+
+ const mobile_apis::FunctionID::eType function_id =
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+
+ const mobile_apis::messageType::eType message_type =
+ static_cast<mobile_apis::messageType::eType>(
+ (*message)[strings::params][strings::message_type].asInt());
+
+ auto message_type_str = "request";
+ if (mobile_apis::messageType::response == message_type) {
+ message_type_str = "response";
+ } else if (mobile_apis::messageType::notification == message_type) {
+ message_type_str = "notification";
+ }
+
+ UNUSED(message_type_str);
+ LOG4CXX_DEBUG(logger_,
+ "HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
+
+ return buildCommandCreator(function_id, message_type, source).create(message);
+}
+
+bool AppServiceMobileCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const {
+ UNUSED(source);
+ return buildCommandCreator(function_id,
+ mobile_apis::messageType::INVALID_ENUM,
+ source).CanBeCreated();
+}
+
+app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+
+ switch (function_id) {
+ case mobile_apis::FunctionID::PublishAppServiceID:
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::PublishAppServiceRequest>()
+ : factory.GetCreator<commands::PublishAppServiceResponse>();
+ case mobile_apis::FunctionID::OnAppServiceDataID:
+ return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source
+ ? factory.GetCreator<
+ commands::OnAppServiceDataNotificationFromMobile>()
+ : factory.GetCreator<commands::OnAppServiceDataNotification>();
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+ }
+}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
new file mode 100644
index 0000000000..739d8bb0e2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -0,0 +1,85 @@
+/*
+ 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 "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+//#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "app_service_rpc_plugin/app_service_command_factory.h"
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+
+namespace app_service_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace strings = application_manager::strings;
+
+AppServiceRpcPlugin::AppServiceRpcPlugin() : application_manager_(nullptr) {}
+
+bool AppServiceRpcPlugin::Init(
+ application_manager::ApplicationManager& app_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler) {
+ application_manager_ = &app_manager;
+ command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
+bool AppServiceRpcPlugin::IsAbleToProcess(
+ const int32_t function_id, const commands::Command::CommandSource source) {
+ return command_factory_->IsAbleToProcess(function_id, source);
+}
+
+std::string AppServiceRpcPlugin::PluginName() {
+ return "App Service RPC Plugin";
+}
+
+app_mngr::CommandFactory& AppServiceRpcPlugin::GetCommandFactory() {
+ return *command_factory_;
+}
+
+void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
+
+void AppServiceRpcPlugin::OnApplicationEvent(
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) {}
+
+/*void AppServiceRpcPlugin::ProcessResumptionSubscription(
+ application_manager::Application& app, AppServiceAppExtension& ext) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ // TODO
+}*/
+} // namespace app_service_rpc_plugin
+
+extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+ return new app_service_rpc_plugin::AppServiceRpcPlugin();
+}
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
new file mode 100644
index 0000000000..1e235c1282
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
@@ -0,0 +1,101 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPublishAppServiceRequest::ASPublishAppServiceRequest(
+ 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)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ app_mngr::commands::Command::CommandSource::SOURCE_HMI));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+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_);
+ smart_objects::SmartObject response_params =
+ 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);
+
+ response_params[strings::app_service_record] = service_record;
+ // TODO: Add AppServiceRecord to response
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
new file mode 100644
index 0000000000..2513a92f15
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
@@ -0,0 +1,68 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPublishAppServiceResponse::ASPublishAppServiceResponse(
+ 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)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ app_mngr::commands::Command::CommandSource::SOURCE_HMI));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {}
+
+void ASPublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
new file mode 100644
index 0000000000..0cd269b04e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
@@ -0,0 +1,69 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnASAppServiceDataNotification::OnASAppServiceDataNotification(
+ 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)
+ : NotificationToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ hmi_apis::FunctionID::AppService_OnAppServiceData,
+ app_mngr::commands::Command::CommandSource::SOURCE_HMI));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {}
+
+void OnASAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+ MessageHelper::PrintSmartObject(*message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
new file mode 100644
index 0000000000..01a8e817a2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
@@ -0,0 +1,70 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI(
+ 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)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ hmi_apis::FunctionID::AppService_OnAppServiceData,
+ app_mngr::commands::Command::CommandSource::SOURCE_HMI));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+OnASAppServiceDataNotificationFromHMI::
+ ~OnASAppServiceDataNotificationFromHMI() {}
+
+void OnASAppServiceDataNotificationFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+ MessageHelper::PrintSmartObject(*message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
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
new file mode 100644
index 0000000000..33ab1a7246
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
@@ -0,0 +1,73 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnAppServiceDataNotification::OnAppServiceDataNotification(
+ 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)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ mobile_apis::FunctionID::OnAppServiceDataID,
+ app_mngr::commands::Command::CommandSource::SOURCE_MOBILE));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+OnAppServiceDataNotification::~OnAppServiceDataNotification() {}
+
+void OnAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer");
+ MessageHelper::PrintSmartObject(*message_);
+ SendNotification();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
new file mode 100644
index 0000000000..a7a8042fee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
@@ -0,0 +1,73 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile(
+ 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)
+ : CommandNotificationFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ mobile_apis::FunctionID::OnAppServiceDataID,
+ app_mngr::commands::Command::CommandSource::SOURCE_MOBILE));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+OnAppServiceDataNotificationFromMobile::
+ ~OnAppServiceDataNotificationFromMobile() {}
+
+void OnAppServiceDataNotificationFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
+ MessageHelper::PrintSmartObject(*message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
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
new file mode 100644
index 0000000000..bf1fbae4f5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -0,0 +1,101 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PublishAppServiceRequest::PublishAppServiceRequest(
+ 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)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ mobile_apis::FunctionID::PublishAppServiceID,
+ app_mngr::commands::Command::CommandSource::SOURCE_MOBILE));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+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");
+ MessageHelper::PrintSmartObject(*message_);
+
+ smart_objects::SmartObject response_params =
+ 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);
+
+ response_params[strings::app_service_record] = service_record;
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
new file mode 100644
index 0000000000..6c3e9344bf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
@@ -0,0 +1,71 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PublishAppServiceResponse::PublishAppServiceResponse(
+ 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)
+ , plugin_(NULL) {
+ auto plugin = (application_manager.GetPluginManager().FindPluginToProcess(
+ mobile_apis::FunctionID::PublishAppServiceID,
+ app_mngr::commands::Command::CommandSource::SOURCE_MOBILE));
+ if (plugin) {
+ plugin_ = dynamic_cast<AppServiceRpcPlugin*>(&(*plugin));
+ }
+}
+
+PublishAppServiceResponse::~PublishAppServiceResponse() {}
+
+void PublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
index 542fdac5f8..f8be896996 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
@@ -124,11 +124,14 @@ class RegisterAppInterfaceRequest
/**
* @brief Sends OnAppRegistered notification to HMI
*
- *@param application_impl application with changed HMI status
- *
+ * @param app application with changed HMI status
+ * @param resumption If true, resumption-related parameters will be sent to
+ *the HMI
+ * @param need_restore_vr If resumption is true, whether or not VR commands
+ *should be resumed
**/
void SendOnAppRegisteredNotificationToHMI(
- const app_mngr::Application& application_impl,
+ app_mngr::ApplicationConstSharedPtr app,
bool resumption = false,
bool need_restore_vr = false);
/*
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
new file mode 100644
index 0000000000..a3a3ea12f9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ SetCloudAppPropertiesRequest(
+ 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);
+ virtual ~SetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest);
+}; // SetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
new file mode 100644
index 0000000000..df71a2aaf5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ SetCloudAppPropertiesResponse(
+ 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);
+ virtual ~SetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesResponse);
+
+}; // SetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
index f89ae1f697..92a7020208 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
@@ -115,6 +115,8 @@ void SDLActivateAppRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis::FunctionID;
+ ApplicationConstSharedPtr app =
+ application_manager_.WaitingApplicationByID(app_id());
if (application_manager_.state_controller().IsStateActive(
HmiState::STATE_ID_DEACTIVATE_HMI)) {
LOG4CXX_DEBUG(logger_,
@@ -124,6 +126,16 @@ void SDLActivateAppRequest::Run() {
static_cast<eType>(function_id()),
hmi_apis::Common_Result::REJECTED,
"HMIDeactivate is active");
+ } else if (app && !app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ const ApplicationManagerSettings& settings =
+ application_manager_.get_settings();
+ uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
+ settings.cloud_app_max_retry_attempts());
+ application_manager_.updateRequestTimeout(
+ 0, correlation_id(), default_timeout_ + total_retry_timeout);
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ application_manager_.connection_handler().ConnectToDevice(app->device());
} else {
const uint32_t application_id = app_id();
policy_handler_.OnActivateApp(application_id, correlation_id());
@@ -181,6 +193,18 @@ void SDLActivateAppRequest::Run() {
LOG4CXX_DEBUG(logger_, "Application is registered. Activating.");
policy_handler_.OnActivateApp(application_id, correlation_id());
return;
+ } else if (app_to_activate->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ const ApplicationManagerSettings& settings =
+ application_manager_.get_settings();
+ uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
+ settings.cloud_app_max_retry_attempts());
+ application_manager_.updateRequestTimeout(
+ 0, correlation_id(), default_timeout_ + total_retry_timeout);
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ application_manager_.connection_handler().ConnectToDevice(
+ app_to_activate->device());
+ return;
}
connection_handler::DeviceHandle device_handle = app_to_activate->device();
@@ -225,8 +249,10 @@ void SDLActivateAppRequest::onTimeOut() {
using namespace hmi_apis::Common_Result;
using namespace application_manager;
unsubscribe_from_event(BasicCommunication_OnAppRegistered);
- SendErrorResponse(
- correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, "");
+ SendErrorResponse(correlation_id(),
+ SDL_ActivateApp,
+ APPLICATION_NOT_REGISTERED,
+ "App registration timed out");
}
void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
@@ -262,7 +288,7 @@ uint32_t SDLActivateAppRequest::hmi_app_id(
LOG4CXX_DEBUG(logger_, application << " section is absent in the message.");
return 0;
}
- if (so[msg_params][application].keyExists(strings::app_id)) {
+ if (!so[msg_params][application].keyExists(strings::app_id)) {
LOG4CXX_DEBUG(logger_,
strings::app_id << " section is absent in the message.");
return 0;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 7957d9e055..b346ee5798 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -346,19 +346,6 @@ void RegisterAppInterfaceRequest::Run() {
application->set_msg_version(module_version);
}
- // For resuming application need to restore hmi_app_id from resumeCtrl
- resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
- const std::string& device_mac = application->mac_address();
-
- // there is side affect with 2 mobile app with the same mobile app_id
- if (resumer.IsApplicationSaved(policy_app_id, device_mac)) {
- application->set_hmi_application_id(
- resumer.GetHMIApplicationID(policy_app_id, device_mac));
- } else {
- application->set_hmi_application_id(
- application_manager_.GenerateNewHMIAppID());
- }
-
application->set_is_media_application(
msg_params[strings::is_media_application].asBool());
@@ -451,6 +438,8 @@ void RegisterAppInterfaceRequest::Run() {
FillDeviceInfo(&device_info);
}
+ const std::string& device_mac = application->mac_address();
+
GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication);
@@ -816,8 +805,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
file_system::FileExists(application->app_icon_path());
SendResponse(true, result_code, add_info.c_str(), &response_params);
- SendOnAppRegisteredNotificationToHMI(
- *(application.get()), resumption, need_restore_vr);
if (msg_params.keyExists(strings::app_hmi_type)) {
GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(),
&(msg_params[strings::app_hmi_type]));
@@ -826,6 +813,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
// Default HMI level should be set before any permissions validation, since it
// relies on HMI level.
application_manager_.OnApplicationRegistered(application);
+ SendOnAppRegisteredNotificationToHMI(
+ application, resumption, need_restore_vr);
(*notify_upd_manager)();
// Start PTU after successfull registration
@@ -877,9 +866,7 @@ void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI(
}
void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
- const app_mngr::Application& application_impl,
- bool resumption,
- bool need_restore_vr) {
+ ApplicationConstSharedPtr app, bool resumption, bool need_restore_vr) {
using namespace smart_objects;
SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map);
if (!notification) {
@@ -903,15 +890,15 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
msg_params[strings::resume_vr_grammars] = need_restore_vr;
}
- if (application_impl.vr_synonyms()) {
- msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms());
+ if (app->vr_synonyms()) {
+ msg_params[strings::vr_synonyms] = *(app->vr_synonyms());
}
- if (application_impl.tts_name()) {
- msg_params[strings::tts_name] = *(application_impl.tts_name());
+ if (app->tts_name()) {
+ msg_params[strings::tts_name] = *(app->tts_name());
}
- const std::string policy_app_id = application_impl.policy_app_id();
+ const std::string policy_app_id = app->policy_app_id();
std::string priority;
GetPolicyHandler().GetPriority(policy_app_id, &priority);
@@ -921,100 +908,13 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
msg_params[strings::msg_params] = SmartObject(SmartType_Map);
smart_objects::SmartObject& application = msg_params[strings::application];
- application[strings::app_name] = application_impl.name();
- application[strings::app_id] = application_impl.app_id();
- application[hmi_response::policy_app_id] = policy_app_id;
- if (file_system::FileExists(application_impl.app_icon_path())) {
- application[strings::icon] = application_impl.app_icon_path();
- }
-
- const smart_objects::SmartObject* ngn_media_screen_name =
- application_impl.ngn_media_screen_name();
- if (ngn_media_screen_name) {
- application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name;
- }
-
- application[strings::hmi_display_language_desired] =
- static_cast<int32_t>(application_impl.ui_language());
-
- application[strings::is_media_application] =
- application_impl.is_media_application();
-
- const smart_objects::SmartObject* app_type = application_impl.app_types();
- if (app_type) {
- application[strings::app_type] = *app_type;
- }
-
- const policy::RequestType::State app_request_types_state =
- GetPolicyHandler().GetAppRequestTypeState(policy_app_id);
- if (policy::RequestType::State::AVAILABLE == app_request_types_state) {
- const auto request_types =
- GetPolicyHandler().GetAppRequestTypes(policy_app_id);
- application[strings::request_type] = SmartObject(SmartType_Array);
- smart_objects::SmartObject& request_types_array =
- application[strings::request_type];
-
- size_t index = 0;
- for (auto it : request_types) {
- request_types_array[index] = it;
- ++index;
- }
- } else if (policy::RequestType::State::EMPTY == app_request_types_state) {
- application[strings::request_type] = SmartObject(SmartType_Array);
- }
-
- const policy::RequestSubType::State app_request_subtypes_state =
- GetPolicyHandler().GetAppRequestSubTypeState(policy_app_id);
- if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) {
- const auto request_subtypes =
- GetPolicyHandler().GetAppRequestSubTypes(policy_app_id);
- application[strings::request_subtype] = SmartObject(SmartType_Array);
- smart_objects::SmartObject& request_subtypes_array =
- application[strings::request_subtype];
-
- size_t index = 0;
- for (auto it : request_subtypes) {
- request_subtypes_array[index] = it;
- ++index;
- }
- } else if (policy::RequestSubType::State::EMPTY ==
- app_request_subtypes_state) {
- application[strings::request_subtype] = SmartObject(SmartType_Array);
- }
-
const protocol_handler::SessionObserver& session_observer =
application_manager_.connection_handler().get_session_observer();
-
- application[strings::device_info] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& device_info = application[strings::device_info];
- MessageHelper::CreateDeviceInfo(application_impl.device(),
- session_observer,
- GetPolicyHandler(),
- application_manager_,
- &device_info);
-
- if (application_impl.secondary_device() != 0) {
- application[strings::secondary_device_info] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& secondary_device_info =
- application[strings::secondary_device_info];
- MessageHelper::CreateDeviceInfo(application_impl.secondary_device(),
- session_observer,
- GetPolicyHandler(),
- application_manager_,
- &secondary_device_info);
- }
-
- const smart_objects::SmartObject* day_color_scheme =
- application_impl.day_color_scheme();
- if (day_color_scheme) {
- application[strings::day_color_scheme] = *day_color_scheme;
- }
-
- const smart_objects::SmartObject* night_color_scheme =
- application_impl.night_color_scheme();
- if (night_color_scheme) {
- application[strings::night_color_scheme] = *night_color_scheme;
- }
+ MessageHelper::CreateHMIApplicationStruct(app,
+ session_observer,
+ GetPolicyHandler(),
+ &application,
+ application_manager_);
DCHECK(rpc_service_.ManageHMICommand(notification));
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..663881a2ea
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
@@ -0,0 +1,49 @@
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
+ 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)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
+
+void SetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if ((*message_)[strings::msg_params].empty()) {
+ LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ policy_handler_.OnSetCloudAppProperties(*message_);
+
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+}
+
+void SetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
new file mode 100644
index 0000000000..6d27ce8b3e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
@@ -0,0 +1,31 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(
+ 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)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {}
+
+void SetCloudAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugins
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 5207c7e432..8eab054be3 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
@@ -124,6 +124,8 @@
#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h"
#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 "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -337,6 +339,12 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::SendHapticDataRequest>()
: factory.GetCreator<commands::SendHapticDataResponse>();
}
+ case mobile_apis::FunctionID::SetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::SetCloudAppPropertiesResponse>();
+ }
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
index 38cbc7b069..8543a201bf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -44,6 +44,7 @@
#include "application_manager/event_engine/event.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_state_controller.h"
+#include "connection_handler/mock_connection_handler.h"
namespace test {
namespace components {
@@ -61,8 +62,10 @@ using testing::Mock;
using testing::Return;
using testing::ReturnRef;
using testing::Mock;
+using testing::Gt;
using ::testing::NiceMock;
using policy_test::MockPolicyHandlerInterface;
+using connection_handler_test::MockConnectionHandler;
using am::event_engine::Event;
namespace {
@@ -148,7 +151,7 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) {
command->Run();
}
-TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) {
+TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_REJECTED) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
(*msg)[strings::msg_params][strings::function_id] =
@@ -189,6 +192,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
.WillOnce(Return(false));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
MockAppPtr mock_app_first(CreateMockApp());
@@ -250,6 +254,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) {
.WillOnce(Return(false));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
@@ -336,6 +341,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
@@ -427,6 +433,53 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
}
#endif
+TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) {
+ MessageSharedPtr msg = CreateMessage();
+ SetCorrelationAndAppID(msg);
+
+ std::shared_ptr<SDLActivateAppRequest> command(
+ CreateCommand<SDLActivateAppRequest>(msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_, application(kAppID))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, state_controller())
+ .WillOnce(ReturnRef(mock_state_controller_));
+ EXPECT_CALL(mock_state_controller_,
+ IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
+ .WillOnce(Return(false));
+
+ const uint16_t kRetries = 3;
+ const uint32_t kRetryTimeout = 2000;
+ const uint32_t kMinimumTimeout = kRetries * kRetryTimeout;
+
+ MockApplicationManagerSettings settings;
+ EXPECT_CALL(settings, cloud_app_max_retry_attempts())
+ .WillOnce(Return(kRetries));
+ EXPECT_CALL(settings, cloud_app_retry_timeout())
+ .WillOnce(Return(kRetryTimeout));
+ EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings));
+
+ EXPECT_CALL(app_mngr_,
+ updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout)));
+
+ MockConnectionHandler connection_handler;
+ EXPECT_CALL(connection_handler, ConnectToDevice(kHandle));
+
+ EXPECT_CALL(app_mngr_, connection_handler())
+ .WillOnce(ReturnRef(connection_handler));
+
+ command->Run();
+}
+
TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
new file mode 100644
index 0000000000..edfdfa26bc
--- /dev/null
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * 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 Ford Motor Company nor the names of its 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 "application_manager/help_prompt_manager_impl.h"
+
+#include <algorithm>
+#include <iterator>
+
+#include "application_manager/application.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 "smart_objects/smart_object.h"
+#include "utils/logger.h"
+#include "encryption/hashing.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceManager")
+
+namespace {
+const size_t kLimitCommand = 30;
+}
+
+namespace application_manager {
+
+AppServiceManager::AppServiceManager(ApplicationManager& app_manager)
+ : app_manager_(app_manager) {}
+
+AppServiceManager::~AppServiceManager() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+smart_objects::SmartObject AppServiceManager::PublishAppService(
+ const smart_objects::SmartObject& manifest) {
+ std::string str_to_hash = "";
+ std::string service_id = "";
+
+ do {
+ str_to_hash = manifest[strings::service_type].asString() +
+ std::to_string(std::rand());
+ service_id = encryption::MakeHash(str_to_hash);
+ } while (published_services_.find(service_id) != published_services_.end());
+
+ smart_objects::SmartObject service_record;
+ service_record[strings::service_manifest] = manifest;
+ service_record[strings::service_id] = service_id;
+ service_record[strings::service_published] = true;
+ service_record[strings::service_active] = true;
+ published_services_.insert(std::pair<std::string, smart_objects::SmartObject>(
+ service_id, service_record));
+ return service_record;
+}
+
+bool AppServiceManager::UnpublishAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ // TODO
+ return false;
+}
+
+std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServices() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<smart_objects::SmartObject> services;
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ services.push_back(it->second);
+ }
+ return services;
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 8a611195c7..02bf5b49fe 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -964,7 +964,7 @@ void ApplicationImpl::CleanupFiles() {
application_manager_.get_settings().app_storage_folder();
directory_name += "/" + folder_name();
- if (file_system::DirectoryExists(directory_name)) {
+ if (file_system::DirectoryExists(directory_name) && !folder_name().empty()) {
std::vector<std::string> files = file_system::ListFiles(directory_name);
AppFilesMap::const_iterator app_files_it;
@@ -1163,6 +1163,55 @@ const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
return extensions_;
}
+const std::string& ApplicationImpl::cloud_app_endpoint() const {
+ return endpoint_;
+}
+
+const std::string& ApplicationImpl::cloud_app_auth_token() const {
+ return auth_token_;
+}
+
+const std::string& ApplicationImpl::cloud_app_transport_type() const {
+ return cloud_transport_type_;
+}
+
+const mobile_apis::HybridAppPreference::eType&
+ApplicationImpl::hybrid_app_preference() const {
+ return hybrid_app_preference_;
+}
+
+const std::string& ApplicationImpl::cloud_app_certificate() const {
+ return certificate_;
+}
+
+bool ApplicationImpl::is_cloud_app() const {
+ return !endpoint_.empty() &&
+ hybrid_app_preference_ != mobile_apis::HybridAppPreference::MOBILE;
+}
+
+void ApplicationImpl::set_cloud_app_endpoint(const std::string& endpoint) {
+ endpoint_ = endpoint;
+}
+
+void ApplicationImpl::set_cloud_app_auth_token(const std::string& auth_token) {
+ auth_token_ = auth_token;
+}
+
+void ApplicationImpl::set_cloud_app_transport_type(
+ const std::string& transport_type) {
+ cloud_transport_type_ = transport_type;
+}
+
+void ApplicationImpl::set_hybrid_app_preference(
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference) {
+ hybrid_app_preference_ = hybrid_app_preference;
+}
+
+void ApplicationImpl::set_cloud_app_certificate(
+ const std::string& certificate) {
+ certificate_ = certificate;
+}
+
void ApplicationImpl::PushMobileMessage(
smart_objects::SmartObjectSPtr mobile_message) {
sync_primitives::AutoLock lock(mobile_message_lock_);
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 24f27af2e2..d82eeb776c 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -98,7 +98,9 @@ DeviceTypes devicesType = {
std::make_pair(std::string("USB_IOS_DEVICE_MODE"),
hmi_apis::Common_TransportType::USB_IOS),
std::make_pair(std::string("CARPLAY_WIRELESS_IOS"),
- hmi_apis::Common_TransportType::WIFI)};
+ hmi_apis::Common_TransportType::WIFI),
+ std::make_pair(std::string("CLOUD_WEBSOCKET"),
+ hmi_apis::Common_TransportType::CLOUD_WEBSOCKET)};
}
/**
@@ -166,6 +168,8 @@ ApplicationManagerImpl::ApplicationManagerImpl(
, navi_close_app_timeout_(am_settings.stop_streaming_timeout())
, navi_end_stream_timeout_(am_settings.stop_streaming_timeout())
, state_ctrl_(*this)
+ , pending_device_map_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, application_list_update_timer_(
"AM ListUpdater",
new TimerTaskImpl<ApplicationManagerImpl>(
@@ -379,21 +383,6 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
plugin.OnApplicationEvent(plugin_manager::kApplicationRegistered, app);
};
plugin_manager_->ForEachPlugin(on_app_registered);
-
- // TODO(AOleynik): Is neccessary to be able to know that registration process
- // has been completed and default HMI level is set, otherwise policy will
- // block all the requests/notifications to mobile
- // APPLINK-20764 - introduce usage of internal events or re-implement
- event_engine::Event event(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
-
- smart_objects::SmartObject msg;
- msg[strings::params][strings::message_type] =
- hmi_apis::messageType::notification;
- msg[strings::params][strings::app_id] = app->app_id();
-
- event.set_smart_object(msg);
- event.raise(event_dispatcher());
}
void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
@@ -539,6 +528,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
app_name,
GetPolicyHandler().GetStatisticManager(),
*this));
+
if (!application) {
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
@@ -608,13 +598,48 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
// Keep HMI add id in case app is present in "waiting for registration" list
apps_to_register_list_lock_ptr_->Acquire();
- AppsWaitRegistrationSet::iterator it = apps_to_register_.find(application);
- if (apps_to_register_.end() != it) {
+ PolicyAppIdPredicate finder(application->policy_app_id());
+ ApplicationSet::iterator it =
+ std::find_if(apps_to_register_.begin(), apps_to_register_.end(), finder);
+ bool is_mismatched_cloud_app = false;
+
+ if (apps_to_register_.end() == it) {
+ DevicePredicate finder(application->device());
+ it = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), finder);
+
+ bool found = apps_to_register_.end() != it;
+ is_mismatched_cloud_app = found && (*it)->is_cloud_app() &&
+ policy_app_id != (*it)->policy_app_id();
+ } else {
application->set_hmi_application_id((*it)->hmi_app_id());
- apps_to_register_.erase(application);
+
+ // Set cloud app parameters
+ application->set_cloud_app_endpoint((*it)->cloud_app_endpoint());
+ application->set_cloud_app_certificate((*it)->cloud_app_certificate());
+ application->set_cloud_app_auth_token((*it)->cloud_app_auth_token());
+ application->set_cloud_app_transport_type(
+ (*it)->cloud_app_transport_type());
+ application->set_hybrid_app_preference((*it)->hybrid_app_preference());
+ apps_to_register_.erase(it);
}
apps_to_register_list_lock_ptr_->Release();
+ // Reject registration request if a cloud app registers with the incorrect
+ // appID
+ if (is_mismatched_cloud_app) {
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
+ message[strings::params][strings::correlation_id].asUInt(),
+ mobile_apis::Result::DISALLOWED));
+ (*response)[strings::msg_params][strings::info] =
+ "Cloud app registered with incorrect app id";
+ rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL);
+ return ApplicationSharedPtr();
+ }
+
if (!application->hmi_app_id()) {
const bool is_saved =
resume_controller().IsApplicationSaved(policy_app_id, device_mac);
@@ -779,6 +804,211 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
*this));
rpc_service_->ManageHMICommand(mixing_audio_supported_request);
resume_controller().ResetLaunchTime();
+
+ RefreshCloudAppInformation();
+}
+
+void ApplicationManagerImpl::RefreshCloudAppInformation() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string> enabled_apps;
+ GetPolicyHandler().GetEnabledCloudApps(enabled_apps);
+ std::vector<std::string>::iterator enabled_it = enabled_apps.begin();
+ std::vector<std::string>::iterator enabled_end = enabled_apps.end();
+ std::string endpoint = "";
+ std::string certificate = "";
+ std::string auth_token = "";
+ std::string cloud_transport_type = "";
+ std::string hybrid_app_preference = "";
+ bool enabled = true;
+
+ // Store old device map and clear the current map
+ pending_device_map_lock_ptr_->Acquire();
+ std::map<std::string, std::string> old_device_map = pending_device_map_;
+ pending_device_map_ = std::map<std::string, std::string>();
+ // Create a device for each newly enabled cloud app
+ for (; enabled_it != enabled_end; ++enabled_it) {
+ GetPolicyHandler().GetCloudAppParameters(*enabled_it,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+
+ pending_device_map_.insert(
+ std::pair<std::string, std::string>(endpoint, *enabled_it));
+ // Determine which endpoints were disabled by erasing all enabled apps from
+ // the old device list
+ auto old_device_it = old_device_map.find(endpoint);
+ if (old_device_it != old_device_map.end()) {
+ old_device_map.erase(old_device_it);
+ continue;
+ }
+
+ connection_handler().AddCloudAppDevice(
+ *enabled_it, endpoint, cloud_transport_type);
+ }
+ pending_device_map_lock_ptr_->Release();
+
+ int removed_app_count = 0;
+ // Clear out devices for existing cloud apps that were disabled
+ for (auto& device : old_device_map) {
+ std::string policy_app_id = device.second;
+ // First search for the disabled app within the registered apps
+ ApplicationSharedPtr app = application_by_policy_id(policy_app_id);
+ if (app.use_count() == 0) {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ // If the disabled app is not present in the registered app list, check
+ // the apps awaiting registration
+ PolicyAppIdPredicate finder(policy_app_id);
+ ApplicationSet::iterator it = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), finder);
+ if (it == apps_to_register_.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Unable to find app to remove (" << policy_app_id
+ << "), skipping");
+ continue;
+ }
+ app = *it;
+ apps_to_register_.erase(it);
+ }
+ // If the disabled app is registered, unregistered it before destroying the
+ // device
+ if (app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ GetRPCService().ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::SOURCE_SDL);
+
+ OnAppUnauthorized(app->app_id());
+ }
+ // Delete the cloud device
+ connection_handler().RemoveCloudAppDevice(app->device());
+ removed_app_count++;
+ }
+
+ // Update app list if disabled apps were removed
+ if (removed_app_count > 0) {
+ LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps");
+ SendUpdateAppList();
+ }
+}
+
+void ApplicationManagerImpl::CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string endpoint = "";
+ std::string certificate = "";
+ std::string auth_token = "";
+ std::string cloud_transport_type = "";
+ std::string hybrid_app_preference_str = "";
+ bool enabled = true;
+ std::string name = device_info.name();
+ pending_device_map_lock_ptr_->Acquire();
+ auto it = pending_device_map_.find(name);
+ if (it == pending_device_map_.end()) {
+ return;
+ }
+ pending_device_map_lock_ptr_->Release();
+
+ const std::string policy_app_id = it->second;
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ GetPolicyHandler().GetInitialAppData(
+ policy_app_id, &nicknames, &app_hmi_types);
+
+ if (!nicknames.size()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ return;
+ }
+
+ const std::string display_name = nicknames[0];
+
+ ApplicationSharedPtr application(
+ new ApplicationImpl(0,
+ policy_app_id,
+ device_info.mac_address(),
+ device_id,
+ custom_str::CustomString(display_name),
+ GetPolicyHandler().GetStatisticManager(),
+ *this));
+
+ if (!application) {
+ LOG4CXX_INFO(logger_, "Could not create application");
+ return;
+ }
+
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
+ if (file_system::FileExists(full_icon_path)) {
+ application->set_app_icon_path(full_icon_path);
+ }
+
+ GetPolicyHandler().GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference_str);
+
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference_enum;
+
+ bool convert_result = smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ StringToEnum(hybrid_app_preference_str, &hybrid_app_preference_enum);
+
+ if (!convert_result) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Could not convert string to enum: " << hybrid_app_preference_str);
+ return;
+ }
+
+ application->set_hmi_application_id(GenerateNewHMIAppID());
+ application->set_cloud_app_endpoint(endpoint);
+ application->set_cloud_app_auth_token(auth_token);
+ application->set_cloud_app_transport_type(cloud_transport_type);
+ application->set_hybrid_app_preference(hybrid_app_preference_enum);
+ application->set_cloud_app_certificate(certificate);
+
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ LOG4CXX_DEBUG(logger_,
+ "apps_to_register_ size before: " << apps_to_register_.size());
+ apps_to_register_.insert(application);
+ LOG4CXX_DEBUG(logger_,
+ "apps_to_register_ size after: " << apps_to_register_.size());
+
+ SendUpdateAppList();
+}
+
+void ApplicationManagerImpl::OnConnectionStatusUpdated() {
+ SendUpdateAppList();
+}
+
+hmi_apis::Common_CloudConnectionStatus::eType
+ApplicationManagerImpl::GetCloudAppConnectionStatus(
+ ApplicationConstSharedPtr app) const {
+ transport_manager::ConnectionStatus status =
+ connection_handler().GetConnectionStatus(app->device());
+ switch (status) {
+ case transport_manager::ConnectionStatus::CONNECTED:
+ return hmi_apis::Common_CloudConnectionStatus::CONNECTED;
+ case transport_manager::ConnectionStatus::RETRY:
+ return hmi_apis::Common_CloudConnectionStatus::RETRY;
+ case transport_manager::ConnectionStatus::PENDING:
+ case transport_manager::ConnectionStatus::CLOSING:
+ return hmi_apis::Common_CloudConnectionStatus::NOT_CONNECTED;
+ default:
+ return hmi_apis::Common_CloudConnectionStatus::INVALID_ENUM;
+ }
}
uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
@@ -1779,6 +2009,8 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state,
}
app_launch_ctrl_.reset(new app_launch::AppLaunchCtrlImpl(
*app_launch_dto_.get(), *this, settings_));
+
+ app_service_manager_.reset(new application_manager::AppServiceManager(*this));
return true;
}
@@ -3363,6 +3595,7 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
if (!ptu_result) {
return;
}
+ RefreshCloudAppInformation();
auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) {
plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated);
};
@@ -3642,6 +3875,13 @@ void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) {
applications_list_lock_ptr_->Release();
}
+void ApplicationManagerImpl::AddMockPendingApplication(
+ ApplicationSharedPtr mock_app) {
+ apps_to_register_list_lock_ptr_->Acquire();
+ apps_to_register_.insert(mock_app);
+ apps_to_register_list_lock_ptr_->Release();
+}
+
void ApplicationManagerImpl::SetMockMediaManager(
media_manager::MediaManager* mock_media_manager) {
media_manager_ = mock_media_manager;
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 ff760c2d2a..0a6865457e 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -71,7 +71,8 @@ void RequestFromHMI::SendResponse(
const bool success,
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code) {
+ const hmi_apis::Common_Result::eType result_code,
+ const smart_objects::SmartObject* response_params) {
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -81,6 +82,10 @@ void RequestFromHMI::SendResponse(
(*message)[strings::msg_params][strings::success] = success;
(*message)[strings::msg_params][strings::result_code] = result_code;
+ if (response_params) {
+ (*message)[strings::msg_params] = *response_params;
+ }
+
rpc_service_.ManageHMICommand(message);
}
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 e99db3bece..58d5171f84 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -176,6 +176,8 @@ std::pair<std::string,
mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION),
std::make_pair(strings::fuel_range,
mobile_apis::VehicleDataType::VEHICLEDATA_FUELRANGE),
+ std::make_pair(strings::cloud_app_vehicle_id,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLOUDAPPVEHICLEID),
std::make_pair(strings::external_temp,
mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP),
std::make_pair(strings::turn_signal,
@@ -1540,15 +1542,19 @@ bool MessageHelper::CreateHMIApplicationStruct(
message = smart_objects::SmartObject(smart_objects::SmartType_Map);
message[strings::app_name] = app->name();
message[strings::app_id] = app->hmi_app_id();
+
+ const std::string policy_app_id = app->policy_app_id();
+ message[hmi_response::policy_app_id] = policy_app_id;
+
const std::string icon_path = app->app_icon_path();
- if (!icon_path.empty()) {
+ if (file_system::FileExists(app->app_icon_path())) {
message[strings::icon] = icon_path;
}
if (app->IsRegistered()) {
message[strings::hmi_display_language_desired] = app->ui_language();
message[strings::is_media_application] = app->is_media_application();
} else {
- message[strings::greyOut] = app->is_greyed_out();
+ message[strings::grey_out] = app->is_greyed_out();
}
if (app->tts_name() && !app->tts_name()->empty()) {
message[json::ttsName] = *(app->tts_name());
@@ -1564,6 +1570,46 @@ bool MessageHelper::CreateHMIApplicationStruct(
message[strings::app_type] = *app_types;
}
+ const policy::RequestType::State app_request_types_state =
+ policy_handler.GetAppRequestTypeState(policy_app_id);
+ if (policy::RequestType::State::AVAILABLE == app_request_types_state) {
+ const auto request_types = policy_handler.GetAppRequestTypes(policy_app_id);
+ message[strings::request_type] =
+ SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject& request_types_array =
+ message[strings::request_type];
+
+ size_t index = 0;
+ for (auto it : request_types) {
+ request_types_array[index] = it;
+ ++index;
+ }
+ } else if (policy::RequestType::State::EMPTY == app_request_types_state) {
+ message[strings::request_type] =
+ SmartObject(smart_objects::SmartType_Array);
+ }
+
+ const policy::RequestSubType::State app_request_subtypes_state =
+ policy_handler.GetAppRequestSubTypeState(policy_app_id);
+ if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) {
+ const auto request_subtypes =
+ policy_handler.GetAppRequestSubTypes(policy_app_id);
+ message[strings::request_subtype] =
+ SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject& request_subtypes_array =
+ message[strings::request_subtype];
+
+ size_t index = 0;
+ for (auto it : request_subtypes) {
+ request_subtypes_array[index] = it;
+ ++index;
+ }
+ } else if (policy::RequestSubType::State::EMPTY ==
+ app_request_subtypes_state) {
+ message[strings::request_subtype] =
+ SmartObject(smart_objects::SmartType_Array);
+ }
+
if (day_color_scheme) {
message[strings::day_color_scheme] = *day_color_scheme;
}
@@ -1590,6 +1636,12 @@ bool MessageHelper::CreateHMIApplicationStruct(
&secondary_device_info);
}
+ message[strings::is_cloud_application] = app->is_cloud_app();
+ if (app->is_cloud_app()) {
+ message[strings::cloud_connection_status] =
+ app_mngr.GetCloudAppConnectionStatus(app);
+ }
+
return true;
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 1b64c5d7b4..3be3ef0da7 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -54,6 +54,7 @@
#include "interfaces/MOBILE_API.h"
#include "utils/file_system.h"
#include "utils/scope_guard.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/helpers.h"
#include "policy/policy_manager.h"
@@ -1845,6 +1846,97 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
+void PolicyHandler::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetEnabledCloudApps(enabled_apps);
+}
+
+void PolicyHandler::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+}
+
+const bool PolicyHandler::CheckCloudAppEnabled(
+ const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK(false);
+ bool enabled = false;
+ std::string endpoint;
+ std::string auth_token;
+ std::string certificate;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+ policy_manager_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+ return enabled;
+}
+
+void PolicyHandler::OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) {
+ POLICY_LIB_CHECK_VOID();
+ if (!message.keyExists(strings::msg_params)) {
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain mandatory section "
+ << strings::msg_params);
+ return;
+ }
+ const smart_objects::SmartObject& msg_params = message[strings::msg_params];
+ if (!msg_params.keyExists(strings::app_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain mandatory parameter "
+ << strings::app_id);
+ return;
+ }
+ std::string policy_app_id(msg_params[strings::app_id].asString());
+
+ policy_manager_->InitCloudApp(policy_app_id);
+
+ if (msg_params.keyExists(strings::enabled)) {
+ policy_manager_->SetCloudAppEnabled(policy_app_id,
+ msg_params[strings::enabled].asBool());
+
+ application_manager_.RefreshCloudAppInformation();
+ }
+ if (msg_params.keyExists(strings::cloud_app_auth_token)) {
+ policy_manager_->SetAppAuthToken(
+ policy_app_id, msg_params[strings::cloud_app_auth_token].asString());
+ }
+ if (msg_params.keyExists(strings::cloud_transport_type)) {
+ policy_manager_->SetAppCloudTransportType(
+ policy_app_id, msg_params[strings::cloud_transport_type].asString());
+ }
+ if (msg_params.keyExists(strings::hybrid_app_preference)) {
+ std::string hybrid_app_preference;
+
+ mobile_apis::HybridAppPreference::eType value =
+ static_cast<mobile_apis::HybridAppPreference::eType>(
+ msg_params[strings::hybrid_app_preference].asUInt());
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ EnumToString(value, &hybrid_app_preference);
+ policy_manager_->SetHybridAppPreference(policy_app_id,
+ hybrid_app_preference);
+ }
+}
+
uint32_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
POLICY_LIB_CHECK(0);
return policy_manager_->HeartBeatTimeout(app_id);
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index 3e77078ee5..6af8826491 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -399,7 +399,13 @@ bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application,
<< " hmi_app_id = " << application->hmi_app_id()
<< " policy_id = " << application->policy_app_id()
<< " received hash = " << hash);
- SetupDefaultHMILevel(application);
+ if (!application->is_cloud_app()) {
+ // Default HMI Level is already set before resumption in
+ // ApplicationManager::OnApplicationRegistered, and handling low bandwidth
+ // transports doesn't apply to cloud apps, so this step can be skipped for
+ // such apps
+ SetupDefaultHMILevel(application);
+ }
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
bool result = resumption_storage_->GetSavedApplication(
@@ -426,7 +432,13 @@ bool ResumeCtrlImpl::StartResumptionOnlyHMILevel(
<< application->app_id() << "with hmi_app_id "
<< application->hmi_app_id() << ", policy_app_id "
<< application->policy_app_id());
- SetupDefaultHMILevel(application);
+ if (!application->is_cloud_app()) {
+ // Default HMI Level is already set before resumption in
+ // ApplicationManager::OnApplicationRegistered, and handling low bandwidth
+ // transports doesn't apply to cloud apps, so this step can be skipped for
+ // such apps
+ SetupDefaultHMILevel(application);
+ }
const std::string& device_mac = application->mac_address();
smart_objects::SmartObject saved_app;
bool result = resumption_storage_->GetSavedApplication(
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index ff9ebb6208..1b6dfe2b8b 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -43,7 +43,7 @@ const char* ngn_media_screen_app_name = "ngnMediaScreenAppName";
const char* vr_synonyms = "vrSynonyms";
const char* uses_vehicle_data = "usesVehicleData";
const char* is_media_application = "isMediaApplication";
-const char* greyOut = "greyOut";
+const char* grey_out = "greyOut";
const char* language_desired = "languageDesired";
const char* auto_activated_id = "autoActivateID";
const char* app_type = "appType";
@@ -155,6 +155,12 @@ const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
+const char* enabled = "enabled";
+const char* cloud_app_auth_token = "cloudAppAuthToken";
+const char* cloud_transport_type = "cloudTransportType";
+const char* hybrid_app_preference = "hybridAppPreference";
+const char* is_cloud_application = "isCloudApplication";
+const char* cloud_connection_status = "cloudConnectionStatus";
// PutFile
const char* sync_file_name = "syncFileName";
@@ -220,6 +226,7 @@ const char* fuel_level = "fuelLevel";
const char* fuel_level_state = "fuelLevel_State";
const char* instant_fuel_consumption = "instantFuelConsumption";
const char* fuel_range = "fuelRange";
+const char* cloud_app_vehicle_id = "cloudAppVehicleID";
const char* external_temp = "externalTemperature";
const char* turn_signal = "turnSignal";
const char* vin = "vin";
@@ -260,6 +267,23 @@ const char* system_software_version = "systemSoftwareVersion";
const char* priority = "priority";
const char* engine_oil_life = "engineOilLife";
+// app services
+const char* app_service_manifest = "appServiceManifest";
+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";
+const char* app_service_record = "appServiceRecord";
+const char* service_id = "serviceID";
+const char* service_manifest = "serviceManifest";
+const char* service_published = "servicePublished";
+const char* service_active = "serviceActive";
+
// resuming
const char* application_commands = "applicationCommands";
const char* application_submenus = "applicationSubMenus";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 3d44709657..5e912ca3be 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -475,7 +475,9 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
return result;
}
- const bool is_active_app_exist = (bool)app_mngr_.active_application();
+ ApplicationConstSharedPtr active_app = app_mngr_.active_application();
+ const bool is_active_app_exist =
+ (active_app.use_count() != 0) && active_app->app_id() != app->app_id();
if (is_audio_app) {
if (does_audio_app_with_same_type_exist) {
result = app_mngr_.GetDefaultHmiLevel(app);
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index 7e57b51329..4ea44e5aca 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -96,6 +96,14 @@ connection_handler::DeviceHandle kDeviceId = 12345u;
const std::string kAppId = "someID";
const uint32_t kConnectionKey = 1232u;
const std::string kAppName = "appName";
+
+// Cloud application params
+const std::string kEndpoint = "endpoint";
+const std::string kAuthToken = "auth_token";
+const std::string kCertificate = "cert";
+const std::string kTransportType = "WS";
+const mobile_api::HybridAppPreference::eType kHybridAppPreference =
+ mobile_api::HybridAppPreference::CLOUD;
} // namespace
class ApplicationManagerImplTest : public ::testing::Test {
@@ -122,11 +130,11 @@ class ApplicationManagerImplTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
CreateAppManager();
- ON_CALL(mock_connection_handler_, GetDataOnSessionKey(_, _, _, &kDeviceId))
- .WillByDefault(DoAll(SetArgPointee<3u>(app_id_), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnSessionKey(_, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
ON_CALL(mock_connection_handler_, get_session_observer())
.WillByDefault(ReturnRef(mock_session_observer_));
- app_manager_impl_->SetRPCService(mock_rpc_service_);
+ app_manager_impl_->SetMockRPCService(mock_rpc_service_);
app_manager_impl_->resume_controller().set_resumption_storage(
mock_storage_);
app_manager_impl_->set_connection_handler(&mock_connection_handler_);
@@ -200,7 +208,7 @@ class ApplicationManagerImplTest : public ::testing::Test {
NiceMock<policy_test::MockPolicySettings> mock_policy_settings_;
std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_;
- std::unique_ptr<rpc_service::RPCService> mock_rpc_service_;
+ MockRPCService* mock_rpc_service_;
NiceMock<con_test::MockConnectionHandler> mock_connection_handler_;
NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_;
NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_;
@@ -1413,6 +1421,121 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_TRUE(file_system::RemoveDirectory(kDirectoryName, true));
}
+TEST_F(ApplicationManagerImplTest,
+ RegisterApplication_CloudAppRegisterSuccess) {
+ std::shared_ptr<MockApplication> waiting_app =
+ std::make_shared<MockApplication>();
+ ON_CALL(*waiting_app, device()).WillByDefault(Return(kDeviceId));
+ EXPECT_CALL(*waiting_app, cloud_app_endpoint())
+ .WillOnce(ReturnRef(kEndpoint));
+ EXPECT_CALL(*waiting_app, cloud_app_auth_token())
+ .WillOnce(ReturnRef(kAuthToken));
+ EXPECT_CALL(*waiting_app, cloud_app_certificate())
+ .WillOnce(ReturnRef(kCertificate));
+ EXPECT_CALL(*waiting_app, cloud_app_transport_type())
+ .WillOnce(ReturnRef(kTransportType));
+ EXPECT_CALL(*waiting_app, hybrid_app_preference())
+ .WillOnce(ReturnRef(kHybridAppPreference));
+ ON_CALL(*waiting_app, is_cloud_app()).WillByDefault(Return(true));
+ EXPECT_CALL(*waiting_app, policy_app_id()).WillRepeatedly(Return(kAppId));
+ app_manager_impl_->AddMockPendingApplication(waiting_app);
+
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+ EXPECT_CALL(*mock_rpc_service_,
+ ManageMobileCommand(_, commands::Command::SOURCE_SDL)).Times(0);
+ smart_objects::SmartObject request_for_registration(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& params =
+ request_for_registration[strings::msg_params];
+ params[strings::app_id] = kAppId;
+ params[strings::language_desired] = mobile_api::Language::EN_US;
+ params[strings::hmi_display_language_desired] = mobile_api::Language::EN_US;
+
+ request_for_registration[strings::params][strings::connection_key] =
+ kConnectionKey;
+ request_for_registration[strings::msg_params][strings::app_name] = kAppName;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version] = APIVersion::kAPIV2;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version] = APIVersion::kAPIV3;
+
+ request_for_registration[strings::params][strings::protocol_version] =
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
+
+ smart_objects::SmartObjectSPtr request_for_registration_ptr =
+ std::make_shared<smart_objects::SmartObject>(request_for_registration);
+
+ ApplicationSharedPtr application =
+ app_manager_impl_->RegisterApplication(request_for_registration_ptr);
+
+ EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ application->protocol_version());
+ EXPECT_EQ(APIVersion::kAPIV2,
+ application->version().min_supported_api_version);
+ EXPECT_EQ(APIVersion::kAPIV3,
+ application->version().max_supported_api_version);
+ EXPECT_EQ(kEndpoint, application->cloud_app_endpoint());
+ EXPECT_EQ(kAuthToken, application->cloud_app_auth_token());
+ EXPECT_EQ(kCertificate, application->cloud_app_certificate());
+ EXPECT_EQ(kTransportType, application->cloud_app_transport_type());
+ EXPECT_EQ(kHybridAppPreference, application->hybrid_app_preference());
+}
+
+TEST_F(ApplicationManagerImplTest,
+ RegisterApplication_CloudAppRegisterFailed_DISALLOWED) {
+ std::shared_ptr<MockApplication> waiting_app =
+ std::make_shared<MockApplication>();
+ EXPECT_CALL(*waiting_app, device()).WillRepeatedly(Return(kDeviceId));
+ EXPECT_CALL(*waiting_app, is_cloud_app()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*waiting_app, policy_app_id())
+ .WillRepeatedly(Return("Fake" + kAppId));
+ app_manager_impl_->AddMockPendingApplication(waiting_app);
+
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+ EXPECT_CALL(*mock_rpc_service_,
+ ManageMobileCommand(_, commands::Command::SOURCE_SDL))
+ .WillOnce(Return(true));
+ smart_objects::SmartObject request_for_registration(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& params =
+ request_for_registration[strings::msg_params];
+ params[strings::app_id] = kAppId;
+ params[strings::language_desired] = mobile_api::Language::EN_US;
+ params[strings::hmi_display_language_desired] = mobile_api::Language::EN_US;
+
+ request_for_registration[strings::params][strings::connection_key] =
+ kConnectionKey;
+ request_for_registration[strings::msg_params][strings::app_name] = kAppName;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version] = APIVersion::kAPIV2;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version] = APIVersion::kAPIV3;
+
+ request_for_registration[strings::params][strings::protocol_version] =
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
+
+ smart_objects::SmartObjectSPtr request_for_registration_ptr =
+ std::make_shared<smart_objects::SmartObject>(request_for_registration);
+
+ ApplicationSharedPtr application =
+ app_manager_impl_->RegisterApplication(request_for_registration_ptr);
+ EXPECT_EQ(0, application.use_count());
+}
+
} // application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index fe16e8ce6e..d5b3752936 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -342,6 +342,21 @@ class MockApplication : public ::application_manager::Application {
const std::list<application_manager::AppExtensionPtr>&());
MOCK_CONST_METHOD0(is_remote_control_supported, bool());
MOCK_METHOD1(set_remote_control_supported, void(const bool allow));
+ MOCK_CONST_METHOD0(cloud_app_endpoint, const std::string&());
+ MOCK_CONST_METHOD0(cloud_app_auth_token, const std::string&());
+ MOCK_CONST_METHOD0(cloud_app_transport_type, const std::string&());
+ MOCK_CONST_METHOD0(hybrid_app_preference,
+ const mobile_apis::HybridAppPreference::eType&());
+ MOCK_CONST_METHOD0(cloud_app_certificate, const std::string&());
+ MOCK_CONST_METHOD0(is_cloud_app, bool());
+ MOCK_METHOD1(set_cloud_app_endpoint, void(const std::string& endpoint));
+ MOCK_METHOD1(set_cloud_app_auth_token, void(const std::string& auth_token));
+ MOCK_METHOD1(set_cloud_app_transport_type,
+ void(const std::string& transport_type));
+ MOCK_METHOD1(set_hybrid_app_preference,
+ void(const mobile_apis::HybridAppPreference::eType&
+ hybrid_app_preference));
+ MOCK_METHOD1(set_cloud_app_certificate, void(const std::string& certificate));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index 1c2339096c..2413421c7f 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -153,6 +153,7 @@ class ResumeCtrlTest : public ::testing::Test {
ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kMacAddress_));
ON_CALL(*mock_app_, device()).WillByDefault(Return(kTestDevId_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kTestAppId_));
+ ON_CALL(*mock_app_, is_cloud_app()).WillByDefault(Return(false));
}
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
index 59e3f947c3..ad264c8518 100644
--- a/src/components/application_manager/test/sdl_preloaded_pt.json
+++ b/src/components/application_manager/test/sdl_preloaded_pt.json
@@ -363,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -383,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -403,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -422,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json
index 23c75e8475..17b07f797f 100644
--- a/src/components/application_manager/test/sdl_pt_update.json
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -1600,6 +1600,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1618,6 +1619,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1638,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1653,6 +1656,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 57e925cd43..4846648b2b 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -413,6 +413,16 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::string& transport_manager_tcp_adapter_network_interface()
const OVERRIDE;
+ /**
+ * @brief Returns retry timeout for cloud app connections
+ */
+ uint32_t cloud_app_retry_timeout() const OVERRIDE;
+
+ /**
+ * @brief Returns maximum retry attempts for cloud app connections
+ */
+ uint16_t cloud_app_max_retry_attempts() const OVERRIDE;
+
// TransportManageMMESettings interface
const std::string& event_mq_name() const OVERRIDE;
@@ -960,6 +970,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
std::string system_files_path_;
uint16_t transport_manager_tcp_adapter_port_;
std::string transport_manager_tcp_adapter_network_interface_;
+ uint32_t cloud_app_retry_timeout_;
+ uint16_t cloud_app_max_retry_attempts_;
std::string tts_delimiter_;
uint32_t audio_data_stopped_timeout_;
uint32_t video_data_stopped_timeout_;
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 57984324aa..38afdbf35b 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -81,6 +81,7 @@ const char* kMediaManagerSection = "MEDIA MANAGER";
const char* kGlobalPropertiesSection = "GLOBAL PROPERTIES";
const char* kVrCommandsSection = "VR COMMANDS";
const char* kTransportManagerSection = "TransportManager";
+const char* kCloudAppTransportSection = "CloudAppConnections";
const char* kApplicationManagerSection = "ApplicationManager";
const char* kFilesystemRestrictionsSection = "FILESYSTEM RESTRICTIONS";
const char* kIAPSection = "IAP";
@@ -154,6 +155,8 @@ const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion";
const char* kUseLastStateKey = "UseLastState";
const char* kTCPAdapterPortKey = "TCPAdapterPort";
const char* kTCPAdapterNetworkInterfaceKey = "TCPAdapterNetworkInterface";
+const char* kCloudAppRetryTimeoutKey = "CloudAppRetryTimeout";
+const char* kCloudAppMaxRetryAttemptsKey = "CloudAppMaxRetryAttempts";
const char* kServerPortKey = "ServerPort";
const char* kVideoStreamingPortKey = "VideoStreamingPort";
const char* kAudioStreamingPortKey = "AudioStreamingPort";
@@ -318,6 +321,8 @@ const uint32_t kDefaultHubProtocolIndex = 0;
const uint32_t kDefaultHeartBeatTimeout = 0;
const uint16_t kDefaultMaxSupportedProtocolVersion = 5;
const uint16_t kDefautTransportManagerTCPPort = 12345;
+const uint16_t kDefaultCloudAppRetryTimeout = 1000;
+const uint16_t kDefaultCloudAppMaxRetryAttempts = 5;
const uint16_t kDefaultServerPort = 8087;
const uint16_t kDefaultVideoStreamingPort = 5050;
const uint16_t kDefaultAudioStreamingPort = 5080;
@@ -452,6 +457,8 @@ Profile::Profile()
, supported_diag_modes_()
, system_files_path_(kDefaultSystemFilesPath)
, transport_manager_tcp_adapter_port_(kDefautTransportManagerTCPPort)
+ , cloud_app_retry_timeout_(kDefaultCloudAppRetryTimeout)
+ , cloud_app_max_retry_attempts_(kDefaultCloudAppMaxRetryAttempts)
, tts_delimiter_(kDefaultTtsDelimiter)
, audio_data_stopped_timeout_(kDefaultAudioDataStoppedTimeout)
, video_data_stopped_timeout_(kDefaultVideoDataStoppedTimeout)
@@ -784,6 +791,14 @@ const std::string& Profile::transport_manager_tcp_adapter_network_interface()
return transport_manager_tcp_adapter_network_interface_;
}
+uint32_t Profile::cloud_app_retry_timeout() const {
+ return cloud_app_retry_timeout_;
+}
+
+uint16_t Profile::cloud_app_max_retry_attempts() const {
+ return cloud_app_max_retry_attempts_;
+}
+
const std::string& Profile::tts_delimiter() const {
return tts_delimiter_;
}
@@ -1769,6 +1784,24 @@ void Profile::UpdateValues() {
kTCPAdapterNetworkInterfaceKey,
kTransportManagerSection);
+ ReadUIntValue(&cloud_app_retry_timeout_,
+ kDefaultCloudAppRetryTimeout,
+ kCloudAppTransportSection,
+ kCloudAppRetryTimeoutKey);
+
+ LOG_UPDATED_VALUE(cloud_app_retry_timeout_,
+ kCloudAppRetryTimeoutKey,
+ kCloudAppTransportSection);
+
+ ReadUIntValue(&cloud_app_max_retry_attempts_,
+ kDefaultCloudAppMaxRetryAttempts,
+ kCloudAppTransportSection,
+ kCloudAppMaxRetryAttemptsKey);
+
+ LOG_UPDATED_VALUE(cloud_app_max_retry_attempts_,
+ kCloudAppMaxRetryAttemptsKey,
+ kCloudAppTransportSection);
+
// Event MQ
ReadStringValue(
&event_mq_name_, kDefaultEventMQ, kTransportManagerSection, kEventMQKey);
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
index 1ab70ce702..e9e7ba47a3 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
@@ -102,11 +102,21 @@ class ConnectionHandlerImpl
/**
* \brief Connects to all services of device
- * \param deviceHandle Handle of device to connect to
+ * \param device_handle Handle of device to connect to
*/
void ConnectToDevice(connection_handler::DeviceHandle device_handle) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ transport_manager::ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const OVERRIDE;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -120,6 +130,12 @@ class ConnectionHandlerImpl
void ConnectToAllDevices() OVERRIDE;
+ void AddCloudAppDevice(const std::string& policy_app_id,
+ const std::string& endpoint,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ void RemoveCloudAppDevice(const DeviceHandle device_id) OVERRIDE;
+
void StartTransportManager() OVERRIDE;
void OnDeviceListUpdated(
@@ -162,6 +178,16 @@ class ConnectionHandlerImpl
void OnScanDevicesFailed(
const transport_manager::SearchDeviceError& error) OVERRIDE;
+ void OnConnectionStatusUpdated() OVERRIDE;
+
+ /**
+ * \brief Notifies about pending connection.
+ *
+ * \param connection_id ID of new connection.
+ **/
+ void OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
/**
* \brief Notifies about established connection.
*
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 478127c42a..679cbd1af0 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -142,6 +142,11 @@ void ConnectionHandlerImpl::OnDeviceAdded(
LOG4CXX_AUTO_TRACE(logger_);
auto handle = device_info.device_handle();
+ LOG4CXX_DEBUG(logger_,
+ "OnDeviceAdded!!!: " << handle << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
+
Device device(handle,
device_info.name(),
device_info.mac_address(),
@@ -244,11 +249,55 @@ void ConnectionHandlerImpl::OnScanDevicesFailed(
LOG4CXX_WARN(logger_, "Scan devices failed. " << error.text());
}
-void ConnectionHandlerImpl::OnConnectionEstablished(
+void ConnectionHandlerImpl::OnConnectionStatusUpdated() {
+ connection_handler_observer_->OnConnectionStatusUpdated();
+}
+
+void ConnectionHandlerImpl::OnConnectionPending(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "OnConnectionEstablished!!!: "
+ << device_info.device_handle() << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
+ DeviceMap::iterator it = device_list_.find(device_info.device_handle());
+ if (device_list_.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown device!");
+ return;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Add Pending Connection #" << connection_id << " to the list.");
+
+ sync_primitives::AutoWriteLock lock(connection_list_lock_);
+ if (connection_list_.find(connection_id) == connection_list_.end()) {
+ Connection* connection =
+ new Connection(connection_id,
+ device_info.device_handle(),
+ this,
+ get_settings().heart_beat_timeout());
+
+ connection_list_.insert(
+ ConnectionList::value_type(connection_id, connection));
+
+ connection_handler::DeviceHandle device_id =
+ connection->connection_device_handle();
+ connection_handler_observer_->CreatePendingApplication(
+ connection_id, device_info, device_id);
+ }
+}
+
+void ConnectionHandlerImpl::OnConnectionEstablished(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "OnConnectionEstablished!!!: "
+ << device_info.device_handle() << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
DeviceMap::iterator it = device_list_.find(device_info.device_handle());
if (device_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown device!");
@@ -257,12 +306,14 @@ void ConnectionHandlerImpl::OnConnectionEstablished(
LOG4CXX_DEBUG(logger_,
"Add Connection #" << connection_id << " to the list.");
sync_primitives::AutoWriteLock lock(connection_list_lock_);
- connection_list_.insert(ConnectionList::value_type(
- connection_id,
- new Connection(connection_id,
- device_info.device_handle(),
- this,
- get_settings().heart_beat_timeout())));
+ if (connection_list_.find(connection_id) == connection_list_.end()) {
+ connection_list_.insert(ConnectionList::value_type(
+ connection_id,
+ new Connection(connection_id,
+ device_info.device_handle(),
+ this,
+ get_settings().heart_beat_timeout())));
+ }
}
void ConnectionHandlerImpl::OnConnectionFailed(
@@ -1245,6 +1296,11 @@ void ConnectionHandlerImpl::ConnectToDevice(
}
}
+transport_manager::ConnectionStatus ConnectionHandlerImpl::GetConnectionStatus(
+ const DeviceHandle& device_handle) const {
+ return transport_manager_.GetConnectionStatus(device_handle);
+}
+
void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac,
const std::string& bundle_id) const {
for (DeviceMap::const_iterator i = device_list_.begin();
@@ -1267,6 +1323,17 @@ void ConnectionHandlerImpl::ConnectToAllDevices() {
}
}
+void ConnectionHandlerImpl::AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const std::string& endpoint,
+ const std::string& cloud_transport_type) {
+ transport_manager_.AddCloudDevice(endpoint, cloud_transport_type);
+}
+
+void ConnectionHandlerImpl::RemoveCloudAppDevice(const DeviceHandle device_id) {
+ transport_manager_.RemoveCloudDevice(device_id);
+}
+
void ConnectionHandlerImpl::StartTransportManager() {
LOG4CXX_AUTO_TRACE(logger_);
transport_manager_.Visibility(true);
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index e6e5c89f45..b542a66b83 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -51,6 +51,7 @@
#include "application_manager/hmi_interfaces.h"
#include "policy/policy_types.h"
#include "application_manager/plugin_manager/rpc_plugin_manager.h"
+#include "application_manager/app_service_manager.h"
namespace resumption {
class LastState;
}
@@ -188,6 +189,8 @@ class ApplicationManager {
virtual plugin_manager::RPCPluginManager& GetPluginManager() = 0;
+ virtual AppServiceManager& GetAppServiceManager() = 0;
+
#ifdef BUILD_TESTS
virtual void SetPluginManager(
std::unique_ptr<plugin_manager::RPCPluginManager>& plugin_manager) = 0;
@@ -427,6 +430,16 @@ class ApplicationManager {
virtual void OnHMIStartedCooperation() = 0;
+ virtual void RefreshCloudAppInformation() = 0;
+
+ /**
+ * @brief Retrieve the current connection status of a cloud app
+ * @param app A cloud application
+ * @return The current CloudConnectionStatus of app
+ */
+ virtual hmi_apis::Common_CloudConnectionStatus::eType
+ GetCloudAppConnectionStatus(ApplicationConstSharedPtr app) const = 0;
+
virtual bool IsHMICooperating() const = 0;
/**
* @brief Notifies all components interested in Vehicle Data update
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 8fdca4125f..fc16f1f1ed 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -85,6 +85,8 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& audio_stream_file() const = 0;
virtual bool use_full_app_id() const = 0;
+ virtual uint32_t cloud_app_retry_timeout() const = 0;
+ virtual uint16_t cloud_app_max_retry_attempts() const = 0;
virtual bool use_db_for_resumption() const = 0;
virtual const uint32_t& app_resumption_save_persistent_data_timeout()
const = 0;
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index ee9274ead7..8c8a12ced3 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -437,6 +437,57 @@ class PolicyHandlerInterface {
* @return Structure with vehicle information
*/
virtual const VehicleInfo GetVehicleInfo() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true if the application is an enabled cloud application,
+ * false otherwise
+ */
+ virtual const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received from a
+ * mobile app
+ * @param message The SetCloudAppProperties message
+ */
+ virtual void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index a50760b547..a4058c7078 100644
--- a/src/components/include/connection_handler/connection_handler.h
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -80,6 +80,16 @@ class ConnectionHandler {
connection_handler::DeviceHandle device_handle) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual transport_manager::ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const = 0;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -93,6 +103,12 @@ class ConnectionHandler {
virtual void ConnectToAllDevices() = 0;
+ virtual void AddCloudAppDevice(const std::string& policy_app_id,
+ const std::string& endpoint,
+ const std::string& cloud_transport_type) = 0;
+
+ virtual void RemoveCloudAppDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Close the connection revoked by Policy
* @param connection_key pair of connection and session id
diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h
index 154a2a8e34..f683318ada 100644
--- a/src/components/include/connection_handler/connection_handler_observer.h
+++ b/src/components/include/connection_handler/connection_handler_observer.h
@@ -161,6 +161,13 @@ class ConnectionHandlerObserver {
*/
virtual void OnSecondaryTransportEndedCallback(const int32_t session_key) = 0;
+ virtual void OnConnectionStatusUpdated() = 0;
+
+ virtual void CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id) = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 57f6d2f802..92c0305279 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -523,6 +523,76 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief Gets meta information
* @return meta information
*/
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index ee0bae7118..b2d48585f4 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -503,6 +503,77 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU. *
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index 7f5f17a93d..04029adda3 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -91,6 +91,8 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(SetPluginManager,
void(std::unique_ptr<RPCPluginManager>& plugin_manager));
+ MOCK_METHOD0(GetAppServiceManager, application_manager::AppServiceManager&());
+
MOCK_CONST_METHOD1(
application_by_hmi_app,
application_manager::ApplicationSharedPtr(uint32_t hmi_app_id));
@@ -166,6 +168,10 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_METHOD0(RefreshCloudAppInformation, void());
+ MOCK_CONST_METHOD1(GetCloudAppConnectionStatus,
+ hmi_apis::Common_CloudConnectionStatus::eType(
+ application_manager::ApplicationConstSharedPtr app));
MOCK_CONST_METHOD0(IsHMICooperating, bool());
MOCK_METHOD2(IviInfoUpdated,
void(mobile_apis::VehicleDataType::eType vehicle_info,
diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h
index cfabf41b91..0f9ca194b1 100644
--- a/src/components/include/test/application_manager/mock_application_manager_settings.h
+++ b/src/components/include/test/application_manager/mock_application_manager_settings.h
@@ -90,6 +90,8 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(video_stream_file, const std::string&());
MOCK_CONST_METHOD0(audio_stream_file, const std::string&());
MOCK_CONST_METHOD0(use_full_app_id, bool());
+ MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t());
+ MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t());
MOCK_CONST_METHOD0(use_db_for_resumption, bool());
MOCK_CONST_METHOD0(app_resumption_save_persistent_data_timeout,
const uint32_t&());
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index cb47147074..02a0d73086 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -213,6 +213,20 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
GetAppRequestTypes,
const std::vector<std::string>(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD1(CheckCloudAppEnabled,
+ const bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD7(GetCloudAppParameters,
+ void(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(OnSetCloudAppProperties,
+ void(const smart_objects::SmartObject& message));
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index 2de3a0f9a7..219ee7b561 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -60,9 +60,17 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
MOCK_METHOD0(StartTransportManager, void());
MOCK_METHOD1(ConnectToDevice,
void(connection_handler::DeviceHandle device_handle));
+ MOCK_CONST_METHOD1(
+ GetConnectionStatus,
+ transport_manager::ConnectionStatus(const DeviceHandle& device_handle));
MOCK_CONST_METHOD2(RunAppOnDevice,
void(const std::string&, const std::string&));
MOCK_METHOD0(ConnectToAllDevices, void());
+ MOCK_METHOD3(AddCloudAppDevice,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD1(RemoveCloudAppDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(CloseRevokedConnection, void(uint32_t connection_key));
MOCK_METHOD1(CloseConnection, void(ConnectionHandle connection_handle));
MOCK_METHOD1(GetConnectionSessionsCount, uint32_t(uint32_t connection_key));
diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
index a9e4349bec..0a8e71c085 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
@@ -74,6 +74,11 @@ class MockConnectionHandlerObserver
const int32_t session_key));
MOCK_METHOD1(OnSecondaryTransportEndedCallback,
void(const int32_t session_key));
+ MOCK_METHOD0(OnConnectionStatusUpdated, void());
+ MOCK_METHOD3(CreatePendingApplication,
+ void(const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index a4d50d7cc2..da2b4cc2a1 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -76,6 +76,28 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD1(IsDeviceConsentCached, bool(const std::string& device_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD7(GetCloudAppParameters,
+ void(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_CONST_METHOD1(GetDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD2(SetDeviceConsent,
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index aeabf8fdcb..72dcb147e3 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -184,6 +184,28 @@ class MockPolicyManager : public PolicyManager {
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD7(GetCloudAppParameters,
+ void(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index 440000dbff..24fe9b2393 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -63,6 +63,28 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD0(TimeoutResponse, int());
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD7(GetCloudAppParameters,
+ void(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
MOCK_METHOD2(GetUserFriendlyMsg,
std::vector<UserFriendlyMessage>(
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 0e06e9c1a3..a5ce488e1a 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -181,6 +181,28 @@ class MockPolicyManager : public PolicyManager {
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD7(GetCloudAppParameters,
+ void(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h
index cc8bd5ab85..40168c9c37 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager.h
@@ -59,7 +59,14 @@ class MockTransportManager : public ::transport_manager::TransportManager,
MOCK_METHOD1(Init, int(resumption::LastState& last_state));
MOCK_METHOD0(Reinit, int());
MOCK_METHOD0(SearchDevices, int());
+ MOCK_METHOD2(AddCloudDevice,
+ void(const std::string& endpoint,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD1(RemoveCloudDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(ConnectDevice, int(const DeviceHandle));
+ MOCK_CONST_METHOD1(
+ GetConnectionStatus,
+ transport_manager::ConnectionStatus(const DeviceHandle& device_handle));
MOCK_METHOD1(DisconnectDevice, int(const DeviceHandle));
MOCK_METHOD1(Disconnect, int(const ConnectionUID));
MOCK_METHOD1(DisconnectForce, int(const ConnectionUID));
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
index 133dabe732..04408f945b 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_listener.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
@@ -55,6 +55,10 @@ class MockTransportManagerListener : public TransportManagerListener {
MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
MOCK_METHOD0(OnScanDevicesFinished, void());
MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
+ MOCK_METHOD0(OnConnectionStatusUpdated, void());
+ MOCK_METHOD2(OnConnectionPending,
+ void(const DeviceInfo& device_info,
+ const ConnectionUID connection_id));
MOCK_METHOD2(OnConnectionEstablished,
void(const DeviceInfo& device_info,
const ConnectionUID connection_id));
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
index 3e7c8f36f7..bed0d5e6e6 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
@@ -63,6 +63,8 @@ class MockTransportManagerSettings
MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t());
MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface,
std::string&());
+ MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t());
+ MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t());
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
index eff0abdcd3..3864c3f6f9 100644
--- a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
@@ -35,6 +35,7 @@
#include "gmock/gmock.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
+#include "transport_manager/transport_adapter/device.h"
namespace test {
namespace components {
@@ -66,6 +67,9 @@ class MockTransportAdapter
MOCK_METHOD1(ConnectDevice,
::transport_manager::transport_adapter::TransportAdapter::Error(
const ::transport_manager::DeviceUID& device_handle));
+ MOCK_CONST_METHOD1(GetConnectionStatus,
+ ::transport_manager::ConnectionStatus(
+ const ::transport_manager::DeviceUID& device_handle));
MOCK_METHOD2(RunAppOnDevice, void(const std::string&, const std::string&));
MOCK_CONST_METHOD0(IsClientOriginatedConnectSupported, bool());
MOCK_METHOD0(
@@ -105,6 +109,8 @@ class MockTransportAdapter
transport_manager::SwitchableDevices());
MOCK_CONST_METHOD0(GetTransportConfiguration,
transport_manager::transport_adapter::TransportConfig());
+ MOCK_METHOD1(CreateDevice, void(const std::string& uid));
+
#ifdef TELEMETRY_MONITOR
MOCK_METHOD0(GetTelemetryObserver,
::transport_manager::TMTelemetryObserver*());
diff --git a/src/components/include/transport_manager/common.h b/src/components/include/transport_manager/common.h
index 58bcf6bb17..b36dcde67e 100644
--- a/src/components/include/transport_manager/common.h
+++ b/src/components/include/transport_manager/common.h
@@ -56,6 +56,8 @@ enum {
E_INTERNAL_ERROR
};
+enum ConnectionStatus { INVALID = -1, PENDING, RETRY, CONNECTED, CLOSING };
+
/**
* @brief Type definition for variable that hold handle of device.
*/
diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h
index 1ac1424477..ad035245d8 100644
--- a/src/components/include/transport_manager/transport_adapter/device.h
+++ b/src/components/include/transport_manager/transport_adapter/device.h
@@ -58,7 +58,9 @@ class Device {
Device(const std::string& name, const DeviceUID& unique_device_id)
: name_(name)
, unique_device_id_(unique_device_id)
- , keep_on_disconnect_(false) {}
+ , keep_on_disconnect_(false)
+ , status_(ConnectionStatus::PENDING)
+ , retry_count_(0) {}
/**
* Constructor for creating device supporting transport switch
@@ -73,7 +75,9 @@ class Device {
: name_(name)
, unique_device_id_(unique_device_id)
, transport_switch_id_(transport_switch_id)
- , keep_on_disconnect_(false) {}
+ , keep_on_disconnect_(false)
+ , status_(ConnectionStatus::PENDING)
+ , retry_count_(0) {}
/**
* @brief Destructor.
@@ -132,6 +136,44 @@ class Device {
}
/**
+ * @brief Get @link status_ @endlink value
+ * @return current value
+ */
+ inline ConnectionStatus connection_status() const {
+ return status_;
+ }
+
+ /**
+ * @brief Set @link status_ @endlink value
+ * @param status new value
+ */
+ inline void set_connection_status(ConnectionStatus status) {
+ status_ = status;
+ }
+
+ /**
+ * @brief Get @link retry_count_ @endlink value
+ * @return current value
+ */
+ inline uint16_t retry_count() const {
+ return retry_count_;
+ }
+
+ /**
+ * @brief Increment @link retry_count_ @endlink value
+ */
+ inline void next_retry() {
+ retry_count_++;
+ }
+
+ /**
+ * @brief Reset @link retry_count_ @endlink value to 0
+ */
+ inline void reset_retry_count() {
+ retry_count_ = 0;
+ }
+
+ /**
* @brief transport_switch_id Returns id used for transport switching
* flow of device. Filled if applicable, otherwise - empty.
*/
@@ -160,6 +202,10 @@ class Device {
*finished.
**/
bool keep_on_disconnect_;
+
+ ConnectionStatus status_;
+
+ uint16_t retry_count_;
};
typedef std::shared_ptr<Device> DeviceSptr;
typedef std::vector<DeviceSptr> DeviceVector;
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
index ebbf7dae28..2b3efd3624 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -64,6 +64,7 @@ enum DeviceType {
IOS_BT,
IOS_USB,
TCP,
+ CLOUD_WEBSOCKET,
IOS_USB_HOST_MODE,
IOS_USB_DEVICE_MODE,
IOS_CARPLAY_WIRELESS, // running on iAP over Carplay wireless transport
@@ -196,6 +197,16 @@ class TransportAdapter {
virtual Error ConnectDevice(const DeviceUID& device_handle) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual ConnectionStatus GetConnectionStatus(
+ const DeviceUID& device_handle) const = 0;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -327,6 +338,8 @@ class TransportAdapter {
*/
virtual TransportConfig GetTransportConfiguration() const = 0;
+ virtual void CreateDevice(const std::string& uid) = 0;
+
#ifdef TELEMETRY_MONITOR
/**
* @brief Return Time metric observer
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
index fd1d693067..63d1678ed0 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
@@ -58,7 +58,9 @@ enum class EventTypeEnum {
ON_COMMUNICATION_ERROR,
ON_UNEXPECTED_DISCONNECT,
ON_TRANSPORT_SWITCH_REQUESTED,
- ON_TRANSPORT_CONFIG_UPDATED
+ ON_TRANSPORT_CONFIG_UPDATED,
+ ON_CONNECT_PENDING,
+ ON_CONNECTION_STATUS_UPDATED
};
class TransportAdapterEvent {
diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h
index 0847886c46..2596ba1b77 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -75,6 +75,11 @@ class TransportManager {
**/
virtual int SearchDevices() = 0;
+ virtual void AddCloudDevice(const std::string& endpoint,
+ const std::string& cloud_transport_type) = 0;
+
+ virtual void RemoveCloudDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -85,6 +90,16 @@ class TransportManager {
virtual int ConnectDevice(const DeviceHandle device_id) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const = 0;
+
+ /**
* @brief Disconnect from all applications connected on device.
*
* @param device_id Handle of device to Disconnect from.
diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h
index 6c3f6e2eaa..22ee519a67 100644
--- a/src/components/include/transport_manager/transport_manager_listener.h
+++ b/src/components/include/transport_manager/transport_manager_listener.h
@@ -101,6 +101,19 @@ class TransportManagerListener {
virtual void OnScanDevicesFailed(const SearchDeviceError& error) = 0;
/**
+ * @brief Reaction to the event, when the cloud connection status is updated.
+ */
+ virtual void OnConnectionStatusUpdated() = 0;
+
+ /**
+ * @brief Reaction to the event, when connection is pending.
+ *
+ * @param devcie_info Variable that hold information about device.
+ * @param connection_id connection unique identifier.
+ */
+ virtual void OnConnectionPending(const DeviceInfo& device_info,
+ const ConnectionUID connection_id) = 0;
+ /**
* @brief Reaction to the event, when connection is established.
*
* @param devcie_info Variable that hold information about device.
diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h
index 08b2b77c30..193a86819c 100644
--- a/src/components/include/transport_manager/transport_manager_listener_empty.h
+++ b/src/components/include/transport_manager/transport_manager_listener_empty.h
@@ -59,6 +59,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnFindNewApplicationsRequest() OVERRIDE {}
+ void OnConnectionStatusUpdated() OVERRIDE {}
+
/**
* @brief Reaction to the event, when the device is found.
*
@@ -99,6 +101,15 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnScanDevicesFailed(const SearchDeviceError& error) OVERRIDE {}
/**
+ * @brief Reaction to the event, when connection is pending.
+ *
+ * @param devcie_info Variable that hold information about device.
+ * @param connection_id connection unique identifier.
+ */
+ void OnConnectionPending(const DeviceInfo& device_info,
+ const ConnectionUID connection_id) OVERRIDE {}
+
+ /**
* @brief Reaction to the event, when connection is established.
*
* @param devcie_info Variable that hold information about device.
diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h
index 3912bbe747..cbc1516c29 100644
--- a/src/components/include/transport_manager/transport_manager_settings.h
+++ b/src/components/include/transport_manager/transport_manager_settings.h
@@ -69,6 +69,16 @@ class TransportManagerSettings : public TransportManagerMMESettings {
*/
virtual const std::string& transport_manager_tcp_adapter_network_interface()
const = 0;
+
+ /**
+ * @brief Returns retry timeout for cloud app connections
+ */
+ virtual uint32_t cloud_app_retry_timeout() const = 0;
+
+ /**
+ * @brief Returns maximum retry attempts for cloud app connections
+ */
+ virtual uint16_t cloud_app_max_retry_attempts() const = 0;
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 97df559ef5..2a9be1954b 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -72,6 +72,7 @@
<element name="USB_IOS"/>
<element name="USB_AOA"/>
<element name="WIFI"/>
+ <element name="CLOUD_WEBSOCKET"/>
</enum>
<enum name="ButtonName">
@@ -291,6 +292,18 @@
<element name="REMOTE_CONTROL" />
</enum>
+<enum name="CloudConnectionStatus">
+ <element name="NOT_CONNECTED">
+ <description>No active websocket session or ongoing connection attempts</description>
+ </element>
+ <element name="CONNECTED">
+ <description>Websocket is active</description>
+ </element>
+ <element name="RETRY">
+ <description>Websocket connection failed and retry attempts are ongoing</description>
+ </element>
+</enum>
+
<enum name="WayPointType">
<description>Describes what kind of waypoint is requested/provided.</description>
<element name="ALL" />
@@ -1094,6 +1107,7 @@
<element name="VEHICLEDATA_FUELRANGE" />
<element name="VEHICLEDATA_ENGINEOILLIFE" />
<element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" />
+ <element name="VEHICLEDATA_CLOUDAPPVEHICLEID" />
</enum>
<enum name="WiperStatus">
@@ -2618,16 +2632,18 @@
<description>If SDL omits this parameter - none RequestType is allowed for this app</description>
<description>(either this is a pre-registered app or such is dictated by policies).</description>
</param>
- <param name="requestSubType" type="String" maxlength="100" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>
- The list of SystemRequest's requestSubTypes allowed by policies for the named application.
- If the app sends a requestSubType which is not specified in this list, then that request should be rejected.
- An empty array signifies that any value of requestSubType is allowed for this app.
- If this parameter is omitted, then a request with any value of requestSubType is now allowed for this app
- </description>
+ <param name="requestSubType" type="String" maxlength="100" minsize="0" maxsize="100" array="true" mandatory="false">
+ <description>
+ The list of SystemRequest's requestSubTypes allowed by policies for the named application.
+ If the app sends a requestSubType which is not specified in this list, then that request should be rejected.
+ An empty array signifies that any value of requestSubType is allowed for this app.
+ If this parameter is omitted, then a request with any value of requestSubType is now allowed for this app
+ </description>
</param>
<param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
<param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ <param name="isCloudApplication" type="Boolean" mandatory="false"></param>
+ <param name="cloudConnectionStatus" type="Common.CloudConnectionStatus" mandatory="false"></param>
</struct>
<struct name="MenuParams">
@@ -3341,6 +3357,284 @@
<description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
</param>
</struct>
+
+ <struct name="SyncMsgVersion">
+ <description>Specifies the version number of the SmartDeviceLink protocol that is supported by the mobile application or app service</description>
+
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10" mandatory="true">
+ <description>The major version indicates versions that is not-compatible to previous versions.</description>
+ </param>
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
+ <description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
+ </param>
+ <param name="patchVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>The patch version indicates a fix to existing functionality in a previous version that should still be able to be run on an older version </description>
+ </param>
+ </struct>
+
+ <!-- App Services -->
+
+ <enum name="AppServiceType">
+ <element name="MEDIA"/>
+ <element name="WEATHER"/>
+ </enum>
+
+ <struct name="MediaServiceManifest">
+ </struct>
+
+ <enum name="MediaType">
+ <element name="MUSIC"/>
+ <element name="PODCAST"/>
+ <element name="AUDIOBOOK"/>
+ <element name="OTHER"/>
+ </enum>
+
+ <struct name="MediaServiceData">
+ <description>This data is related to what a media service should provide</description>
+
+ <param name="mediaType" type="Common.MediaType" mandatory="false">
+ <description>The type of the currently playing or paused track.</description>
+ </param>
+
+ <param name="mediaTitle" type="String" mandatory="false">
+ <description>
+ Music: The name of the current track
+ Podcast: The name of the current episode
+ Audiobook: The name of the current chapter
+ </description>
+ </param>
+
+ <param name="mediaArtist" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album artist
+ Podcast: The provider of the podcast (hosts, network, company)
+ Audiobook: The book author's name
+ </description>
+ </param>
+
+ <param name="mediaAlbum" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album
+ Podcast: The name of the current podcast show
+ Audiobook: The name of the current book
+ </description>
+ </param>
+
+ <param name="playlistName" type="String" mandatory="false">
+ <description>
+ Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ </description>
+ </param>
+
+ <param name="isExplicit" type="Boolean" mandatory="false">
+ <description> Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content</description>
+ </param>
+
+ <param name="trackPlaybackProgress" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the track in seconds
+ Podcast: The current progress of the episode in seconds
+ Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="trackPlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the track in seconds
+ Podcast: The total duration of the episode in seconds
+ Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackProgess" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the playback queue in seconds
+ Podcast: The current progress of the playback queue in seconds
+ Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the playback queue in seconds
+ Podcast: The total duration of the playback queue in seconds
+ Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queueCurrentTrackNumber" type="Integer" mandatory="false">
+ <description>
+ Music: The current number (1 based) of the track in the playback queue
+ Podcast: The current number (1 based) of the episode in the playback queue
+ Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ </description>
+ </param>
+
+ <param name="queueTotalTrackCount" type="Integer" mandatory="false">
+ <description>
+ Music: The total number of tracks in the playback queue
+ Podcast: The total number of episodes in the playback queue
+ Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ </description>
+ </param>
+ </struct>
+
+ <struct name="WeatherServiceManifest" since="5.1">
+ <param name="currentForecastSupported" type="Boolean" mandatory="false"/>
+ <param name="maxMultidayForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxHourlyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxMinutelyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="weatherForLocationSupported" type="Boolean" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherAlert" since="5.1">
+ <param name="title" type="String" mandatory="false"/>
+ <param name="summary" type="String" mandatory="false"/>
+ <param name="expires" type="Common.DateTime" mandatory="false"/>
+ <param name="regions" type="String" array="true" minsize="1" maxsize="99" mandatory="false"/>
+ <param name="severity" type="String" mandatory="false"/>
+ <param name="timeIssued" type="Common.DateTime" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherData" since="5.1">
+ <param name="currentTemperature" type="Common.Temperature" mandatory="false"/>
+ <param name="temperatureHigh" type="Common.Temperature" mandatory="false"/>
+ <param name="temperatureLow" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperature" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperatureHigh" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperatureLow" type="Common.Temperature" mandatory="false"/>
+
+ <param name="weatherSummary" type="String" mandatory="false"/>
+ <param name="time" type="Common.DateTime" mandatory="false"/>
+ <param name="humidity" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage humidity </description>
+ </param>
+ <param name="cloudCover" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage cloud cover </description>
+ </param>
+ <param name="moonPhase" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon </description>
+ </param>
+
+ <param name="windBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="windGust" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+ <param name="windSpeed" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+
+ <param name="nearestStormBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="nearestStormDistance" type="Integer" mandatory="false">
+ <description> In km </description>
+ </param>
+ <param name="precipAccumulation" type="Float" mandatory="false">
+ <description> cm </description>
+ </param>
+ <param name="precipIntensity" type="Float" mandatory="false">
+ <description> cm of water per hour </description>
+ </param>
+ <param name="precipProbability" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage chance </description>
+ </param>
+ <param name="precipType" type="String" mandatory="false">
+ <description> e.g. "rain", "snow", "sleet", "hail" </description>
+ </param>
+ <param name="visibility" type="Float" mandatory="false">
+ <description> In km </description>
+ </param>
+
+ <param name="weatherIconImageName" type="String" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherServiceData" since="5.1">
+ <description> This data is related to what a weather service would provide</description>
+ <param name="location" type="Common.LocationDetails" mandatory="true"/>
+ <param name="currentForecast" type="Common.WeatherData" mandatory="false"/>
+ <param name="minuteForecast" type="Common.WeatherData" array="true" minsize="15" maxsize="60" mandatory="false"/>
+ <param name="hourlyForecast" type="Common.WeatherData" array="true" minsize="1" maxsize="96" mandatory="false"/>
+ <param name="multidayForecast" type="Common.WeatherData" array="true" minsize="1" maxsize="30" mandatory="false"/>
+ <param name="alerts" type="Common.WeatherAlert" array="true" minsize="1" maxsize="10" mandatory="false">
+ <description> This array should be ordered with the first object being the current day</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>
+
+ <param name="serviceName" type="String" mandatory="false">
+ <description> Unique name of this service </description>
+ </param>
+
+ <param name="serviceType" type="Common.AppServiceType" mandatory="true">
+ <description> The type of service that is to be offered by this app </description>
+ </param>
+
+ <param name="serviceIcon" type="String" mandatory="false">
+ <description> The file name of the icon to be associated with this service. Most likely the same as the appIcon. </description>
+ </param>
+
+ <param name="allowAppConsumers" type="Boolean" mandatory="false" defvalue="false">
+ <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>
+
+ <param name="handledRPCs" type="Integer" array="true" mandatory="false">
+ <description> This field contains the Function IDs for the RPCs that this service intends to handle correctly. This means the service will provide meaningful responses. </description>
+ </param>
+
+ <param name="mediaServiceManifest" type="Common.MediaServiceManifest" mandatory="false"/>
+ <param name="weatherServiceManifest" type="Common.WeatherServiceManifest" mandatory="false"/>
+ </struct>
+
+ <struct name="AppServiceRecord">
+ <description> This is the record of an app service publisher that the module has. It should contain the most up to date information including the service's active state</description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> A unique ID tied to this specific service record. The ID is supplied by the module that services publish themselves. </description>
+ </param>
+
+ <param name="serviceManifest" type="Common.AppServiceManifest" mandatory="true">
+ <description> Manifest for the service that this record is for.</description>
+ </param>
+
+ <param name="servicePublished" type="Boolean" mandatory="true">
+ <description> If true, the service is published and available. If false, the service has likely just been unpublished, and should be considered unavailable.</description>
+ </param>
+
+ <param name="serviceActive" type="Boolean" mandatory="true">
+ <description> If true, the service is the active primary service of the supplied service type. It will receive all potential RPCs that are passed through to that service type. If false, it is not the primary service of the supplied type. See servicePublished for its availability. </description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceData">
+ <description> Contains all the current data of the app service. The serviceType will link to which of the service data objects are included in this object. (eg if service type equals MEDIA, the mediaServiceData param should be included.</description>
+
+ <param name="serviceType" type="Common.AppServiceType" mandatory="true"/>
+ <param name="serviceID" type="String" mandatory="true"/>
+
+ <param name="mediaServiceData" type="Common.MediaServiceData" mandatory="false"/>
+ <param name="weatherServiceData" type="Common.WeatherServiceData" mandatory="false"/>
+ </struct>
+
+ <!-- End App Services -->
</interface>
@@ -4950,6 +5244,10 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -4967,6 +5265,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="SubscribeVehicleData" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="false">
@@ -5038,6 +5337,10 @@
<param name="electronicParkBrakeStatus" type="Common.VehicleDataResult" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -5055,6 +5358,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="UnsubscribeVehicleData" messagetype="request">
<description>
@@ -5132,6 +5436,10 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -5149,6 +5457,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="UnsubscribeVehicleData" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="false">
@@ -5220,6 +5529,10 @@
<param name="electronicParkBrakeStatus" type="Common.VehicleDataResult" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -5237,6 +5550,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="GetVehicleData" messagetype="request">
<description>Non periodic vehicle data read request.</description>
@@ -5312,6 +5626,11 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5327,6 +5646,8 @@
<param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
<function name="GetVehicleData" messagetype="response">
<param name="gps" type="Common.GPSData" mandatory="false">
@@ -5401,6 +5722,11 @@
<param name="electronicParkBrakeStatus" type="Common.ElectronicParkBrakeStatus" mandatory="false">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5416,6 +5742,8 @@
<param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
<function name="OnVehicleData" messagetype="notification">
<description>Callback for the periodic and non periodic vehicle data read function.</description>
@@ -5488,6 +5816,11 @@
<param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
<description>Current angle of the steering wheel (in deg)</description>
</param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5503,6 +5836,8 @@
<param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
</interface>
@@ -5780,4 +6115,29 @@
</function>
</interface>
+
+<interface name="AppService" version="1.0.0" date="2019-01-20">
+ <description>Interface used for interacting with app services as a producer or consumer</description>
+ <function name="PublishAppService" messagetype="request">
+ <description>Registers a service offered by this app on the module</description>
+
+ <param name="appServiceManifest" type="Common.AppServiceManifest" mandatory="true">
+ <description> The manifest of the service that wishes to be published.</description>
+ </param>
+ </function>
+
+ <function name="PublishAppService" messagetype="response">
+ <description>Response to the request to register a service offered by this app on the module</description>
+
+ <param name="appServiceRecord" type="Common.AppServiceRecord" mandatory="false">
+ <description> If the request was successful, this object will be the current status of the service record for the published service. This will include the Core supplied service ID.</description>
+ </param>
+ </function>
+
+ <function name="OnAppServiceData" messagetype="notification">
+ <description>This notification includes the data that is updated from the specific service. HMI->SDL if the HMI is a producer, SDL->HMI if the HMI is a consumer</description>
+
+ <param name="serviceData" type="Common.AppServiceData" mandatory="true"/>
+ </function>
+</interface>
</interfaces>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 76fc6ef2d1..65a88ac22a 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
-<interface name="SmartDeviceLink RAPI" version="5.0.0" minVersion="1.0" date="2018-10-03">
+<interface name="SmartDeviceLink RAPI" version="5.1.0" minVersion="1.0" date="2018-10-03">
<enum name="Result" internal_scope="base" since="1.0">
<element name="SUCCESS">
<description>The request succeeded</description>
@@ -542,8 +542,16 @@
<element name="VEHICLEDATA_FUELRANGE" since="5.0" />
<element name="VEHICLEDATA_ENGINEOILLIFE" since="5.0" />
<element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" since="5.0" />
+ <element name="VEHICLEDATA_CLOUDAPPVEHICLEID" since="5.1"/>
</enum>
+ <enum name="HybridAppPreference" since="5.1">
+ <description>Enumeration for the user's preference of which app type to use when both are available</description>
+ <element name="MOBILE" />
+ <element name="CLOUD" />
+ <element name="BOTH" />
+ </enum>
+
<enum name="ButtonName" since="1.0">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
<element name="OK" />
@@ -937,7 +945,7 @@
<description>Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) and also enables lossless compression.</description>
</element>
</enum>
-
+
<enum name="AudioStreamingIndicator" since="5.0">
<element name="PLAY_PAUSE">
<description>
@@ -2608,6 +2616,8 @@
<element name="UnsubscribeWayPointsID" value="47" hexvalue="2F" since="4.1" />
<element name="GetSystemCapabilityID" value="48" hexvalue="30" since="4.5" />
<element name="SendHapticDataID" value="49" hexvalue="31" since="4.5" />
+ <element name="SetCloudAppPropertiesID" value="50" hexvalue="32" since="5.1" />
+ <element name="PublishAppServiceID" value="52" hexvalue="34" since="5.1" />
<!--
Base Notifications
@@ -2632,6 +2642,7 @@
<element name="OnInteriorVehicleDataID" value="32783" hexvalue="800F" since="4.5" />
<element name="OnWayPointChangeID" value="32784" hexvalue="8010" since="4.1" />
<element name="OnRCStatusID" value="32785" hexvalue="8011" since="5.0" />
+ <element name="OnAppServiceDataID" value="32786" hexvalue="8012" since="5.1" />
<!--
Ford Specific Request / Response RPCs
@@ -3699,6 +3710,270 @@
<description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
</param>
</struct>
+
+ <!-- App Services -->
+
+ <enum name="AppServiceType" since="5.1">
+ <element name="MEDIA"/>
+ <element name="WEATHER"/>
+ </enum>
+
+ <struct name="MediaServiceManifest" since="5.1">
+ </struct>
+
+ <enum name="MediaType" since="5.1">
+ <element name="MUSIC"/>
+ <element name="PODCAST"/>
+ <element name="AUDIOBOOK"/>
+ <element name="OTHER"/>
+ </enum>
+
+ <struct name="MediaServiceData" since="5.1">
+ <description>This data is related to what a media service should provide</description>
+
+ <param name="mediaType" type="MediaType" mandatory="false">
+ <description>The type of the currently playing or paused track.</description>
+ </param>
+
+ <param name="mediaTitle" type="String" mandatory="false">
+ <description>
+ Music: The name of the current track
+ Podcast: The name of the current episode
+ Audiobook: The name of the current chapter
+ </description>
+ </param>
+
+ <param name="mediaArtist" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album artist
+ Podcast: The provider of the podcast (hosts, network, company)
+ Audiobook: The book author's name
+ </description>
+ </param>
+
+ <param name="mediaAlbum" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album
+ Podcast: The name of the current podcast show
+ Audiobook: The name of the current book
+ </description>
+ </param>
+
+ <param name="playlistName" type="String" mandatory="false">
+ <description>
+ Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ </description>
+ </param>
+
+ <param name="isExplicit" type="Boolean" mandatory="false">
+ <description> Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content</description>
+ </param>
+
+ <param name="trackPlaybackProgress" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the track in seconds
+ Podcast: The current progress of the episode in seconds
+ Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="trackPlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the track in seconds
+ Podcast: The total duration of the episode in seconds
+ Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackProgess" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the playback queue in seconds
+ Podcast: The current progress of the playback queue in seconds
+ Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the playback queue in seconds
+ Podcast: The total duration of the playback queue in seconds
+ Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queueCurrentTrackNumber" type="Integer" mandatory="false">
+ <description>
+ Music: The current number (1 based) of the track in the playback queue
+ Podcast: The current number (1 based) of the episode in the playback queue
+ Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ </description>
+ </param>
+
+ <param name="queueTotalTrackCount" type="Integer" mandatory="false">
+ <description>
+ Music: The total number of tracks in the playback queue
+ Podcast: The total number of episodes in the playback queue
+ Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ </description>
+ </param>
+ </struct>
+
+ <struct name="WeatherServiceManifest" since="5.1">
+ <param name="currentForecastSupported" type="Boolean" mandatory="false"/>
+ <param name="maxMultidayForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxHourlyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxMinutelyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="weatherForLocationSupported" type="Boolean" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherAlert" since="5.1">
+ <param name="title" type="String" mandatory="false"/>
+ <param name="summary" type="String" mandatory="false"/>
+ <param name="expires" type="DateTime" mandatory="false"/>
+ <param name="regions" type="String" array="true" minsize="1" maxsize="99" mandatory="false"/>
+ <param name="severity" type="String" mandatory="false"/>
+ <param name="timeIssued" type="DateTime" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherData" since="5.1">
+ <param name="currentTemperature" type="Temperature" mandatory="false"/>
+ <param name="temperatureHigh" type="Temperature" mandatory="false"/>
+ <param name="temperatureLow" type="Temperature" mandatory="false"/>
+ <param name="apparentTemperature" type="Temperature" mandatory="false"/>
+ <param name="apparentTemperatureHigh" type="Temperature" mandatory="false"/>
+ <param name="apparentTemperatureLow" type="Temperature" mandatory="false"/>
+
+ <param name="weatherSummary" type="String" mandatory="false"/>
+ <param name="time" type="DateTime" mandatory="false"/>
+ <param name="humidity" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage humidity </description>
+ </param>
+ <param name="cloudCover" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage cloud cover </description>
+ </param>
+ <param name="moonPhase" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon </description>
+ </param>
+
+ <param name="windBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="windGust" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+ <param name="windSpeed" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+
+ <param name="nearestStormBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="nearestStormDistance" type="Integer" mandatory="false">
+ <description> In km </description>
+ </param>
+ <param name="precipAccumulation" type="Float" mandatory="false">
+ <description> cm </description>
+ </param>
+ <param name="precipIntensity" type="Float" mandatory="false">
+ <description> cm of water per hour </description>
+ </param>
+ <param name="precipProbability" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage chance </description>
+ </param>
+ <param name="precipType" type="String" mandatory="false">
+ <description> e.g. "rain", "snow", "sleet", "hail" </description>
+ </param>
+ <param name="visibility" type="Float" mandatory="false">
+ <description> In km </description>
+ </param>
+
+ <param name="weatherIconImageName" type="String" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherServiceData" since="5.1">
+ <description> This data is related to what a weather service would provide</description>
+ <param name="location" type="LocationDetails" mandatory="true"/>
+ <param name="currentForecast" type="WeatherData" mandatory="false"/>
+ <param name="minuteForecast" type="WeatherData" array="true" minsize="15" maxsize="60" mandatory="false"/>
+ <param name="hourlyForecast" type="WeatherData" array="true" minsize="1" maxsize="96" mandatory="false"/>
+ <param name="multidayForecast" type="WeatherData" array="true" minsize="1" maxsize="30" mandatory="false"/>
+ <param name="alerts" type="WeatherAlert" array="true" minsize="1" maxsize="10" mandatory="false">
+ <description> This array should be ordered with the first object being the current day</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>
+
+ <param name="serviceName" type="String" mandatory="false">
+ <description> Unique name of this service</description>
+ </param>
+
+ <param name="serviceType" type="AppServiceType" mandatory="true">
+ <description>The type of service that is to be offered by this app</description>
+ </param>
+
+ <param name="serviceIcon" type="String" mandatory="false">
+ <description> The file name of the icon to be associated with this service. Most likely the same as the appIcon.</description>
+ </param>
+
+ <param name="allowAppConsumers" type="Boolean" mandatory="false" defvalue="false">
+ <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>
+
+ <param name="handledRPCs" type="Integer" array="true" mandatory="false">
+ <description> This field contains the Function IDs for the RPCs that this service intends to handle correctly. This means the service will provide meaningful responses. </description>
+ </param>
+
+ <param name="mediaServiceManifest" type="MediaServiceManifest" mandatory="false"/>
+ <param name="weatherServiceManifest" type="WeatherServiceManifest" mandatory="false"/>
+ </struct>
+
+ <struct name="AppServiceRecord" since="5.1">
+ <description> This is the record of an app service publisher that the module has. It should contain the most up to date information including the service's active state</description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> A unique ID tied to this specific service record. The ID is supplied by the module that services publish themselves. </description>
+ </param>
+
+ <param name="serviceManifest" type="AppServiceManifest" mandatory="true">
+ <description> Manifest for the service that this record is for.</description>
+ </param>
+
+ <param name="servicePublished" type="Boolean" mandatory="true">
+ <description> If true, the service is published and available. If false, the service has likely just been unpublished, and should be considered unavailable.</description>
+ </param>
+
+ <param name="serviceActive" type="Boolean" mandatory="true">
+ <description> If true, the service is the active primary service of the supplied service type. It will receive all potential RPCs that are passed through to that service type. If false, it is not the primary service of the supplied type. See servicePublished for its availability. </description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceData" since="5.1">
+ <description> Contains all the current data of the app service. The serviceType will link to which of the service data objects are included in this object. (eg if service type equals MEDIA, the mediaServiceData param should be included.</description>
+
+ <param name="serviceType" type="AppServiceType" mandatory="true"/>
+ <param name="serviceID" type="String" mandatory="true"/>
+
+ <param name="mediaServiceData" type="MediaServiceData" mandatory="false"/>
+ <param name="weatherServiceData" type="WeatherServiceData" mandatory="false"/>
+ </struct>
+
+ <!-- End App Services -->
<!-- Requests/Responses -->
@@ -4939,7 +5214,10 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
-
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -5054,7 +5332,10 @@
<param name="electronicParkBrakeStatus" type="VehicleDataResult" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
-
+ <param name="cloudAppVehicleID" type="VehicleDataResult" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -5147,6 +5428,9 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -5260,6 +5544,9 @@
<param name="electronicParkBrakeStatus" type="VehicleDataResult" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="VehicleDataResult" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="VehicleDataResult" mandatory="false">
@@ -5356,6 +5643,9 @@
<param name="electronicParkBrakeStatus" type="Boolean" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -5473,6 +5763,9 @@
<param name="electronicParkBrakeStatus" type="ElectronicParkBrakeStatus" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="ECallInfo" mandatory="false">
@@ -6607,6 +6900,87 @@
</param>
</function>
+ <function name="SetCloudAppProperties" functionID="SetCloudAppPropertiesID" messagetype="request" since="5.1">
+ <description>
+ RPC used to enable/disable a cloud application and set authentication data
+ </description>
+ <param name="appName" type="String" maxlength="100" mandatory="true"></param>
+ <param name="appID" type="String" maxlength="100" mandatory="true"></param>
+ <param name="enabled" type="Boolean" mandatory="false">
+ <description>If true, cloud app will be included in HMI RPC UpdateAppList</description>
+ </param>
+ <param name="cloudAppAuthToken" type="String" maxlength="100" mandatory="false">
+ <description>Used to authenticate websocket connection on app activation</description>
+ </param>
+ <param name="cloudTransportType" type="String" maxlength="100" mandatory="false">
+ <description>Specifies the connection type Core should use</description>
+ </param>
+ <param name="hybridAppPreference" type="HybridAppPreference" mandatory="false">
+ <description>Specifies the user preference to use the cloud app version or mobile app version when both are available</description>
+ </param>
+ </function>
+
+ <function name="SetCloudAppProperties" functionID="SetCloudAppPropertiesID" messagetype="response" since="5.1">
+ <description>
+ The response to registerAppInterface
+ </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="INVALID_DATA" />
+ <element name="OUT_OF_MEMORY" />
+ <element name="TOO_MANY_PENDING_REQUESTS" />
+ <element name="GENERIC_ERROR" />
+ <element name="DUPLICATE_NAME" />
+ <element name="TOO_MANY_APPLICATIONS" />
+ <element name="APPLICATION_REGISTERED_ALREADY" />
+ <element name="UNSUPPORTED_VERSION" />
+ <element name="WRONG_LANGUAGE" />
+ <element name="DISALLOWED" />
+ <element name="WARNINGS" />
+ <element name="RESUME_FAILED" />
+ </param>
+ </function>
+
+ <function name="PublishAppService" functionID="PublishAppServiceID" messagetype="request" since="5.1">
+ <description>Registers a service offered by this app on the module</description>
+
+ <param name="appServiceManifest" type="AppServiceManifest" mandatory="true">
+ <description> The manifest of the service that wishes to be published.</description>
+ </param>
+ </function>
+
+ <function name="PublishAppService" functionID="PublishAppServiceID" messagetype="response" since="5.1">
+ <description>Response to the request to register a service offered by this app on the module</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"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="appServiceRecord" type="AppServiceRecord" mandatory="false">
+ <description> If the request was successful, this object will be the current status of the service record for the published service. This will include the Core supplied service ID.</description>
+ </param>
+ </function>
+
<!-- Notifications -->
<function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification" since="1.0">
@@ -6732,6 +7106,9 @@
<param name="electronicParkBrakeStatus" type="ElectronicParkBrakeStatus" mandatory="false" since="5.0">
<description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
</param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false" since="5.1">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
<!-- Ford Specific Vehicle Data -->
<param name="eCallInfo" type="ECallInfo" mandatory="false">
@@ -6896,6 +7273,12 @@
<description>Contains a list (zero or more) of module types that are free to access for the application.</description>
</param>
</function>
+
+ <function name="OnAppServiceData" functionID="OnAppServiceDataID" messagetype="notification" since="5.1">
+ <description>This notification includes the data that is updated from the specific service</description>
+
+ <param name="serviceData" type="AppServiceData" mandatory="true"/>
+ </function>
<!-- ~~~~~~~~~~~~~~~~~~ -->
<!-- Ford Specific APIs -->
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index d30e7cea24..3344b149e4 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -159,6 +159,76 @@ class CacheManager : public CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id);
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled);
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token);
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type);
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference);
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index bb9ce14c7f..6a172e6f4b 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -166,6 +166,78 @@ class CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 3837dda1fa..399c95170d 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -571,6 +571,75 @@ class PolicyManagerImpl : public PolicyManager {
const VehicleInfo GetVehicleInfo() const OVERRIDE;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ void GetCloudAppParameters(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+ void InitCloudApp(const std::string& policy_app_id) OVERRIDE;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) OVERRIDE;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) OVERRIDE;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU. *
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 34864c5602..0b571823f9 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
@@ -96,6 +96,7 @@ enum Parameter {
P_FUEL_RANGE,
P_TIRE_PRESSURE_VALUE,
P_TPMS,
+ P_CLOUD_APP_VEHICLE_ID,
P_LONGTITUDE_DEGREES,
P_LATITUDE_DEGREES,
P_LOCATION_NAME,
@@ -181,6 +182,12 @@ bool IsValidEnum(ModuleType val);
const char* EnumToJsonString(ModuleType val);
bool EnumFromJsonString(const std::string& literal, ModuleType* result);
+enum HybridAppPreference { HAP_MOBILE, HAP_CLOUD, HAP_BOTH };
+bool IsValidEnum(HybridAppPreference val);
+const char* EnumToJsonString(HybridAppPreference val);
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result);
+
/**
* @brief Enumeration FunctionID.
*
@@ -434,6 +441,16 @@ enum FunctionID {
SendHapticDataID = 49,
/**
+ * @brief SetCloudAppPropertiesID.
+ */
+ SetCloudAppPropertiesID = 50,
+
+ /**
+ * @brief PublishAppServiceID
+ */
+ PublishAppServiceID = 52,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h
index 68e29a97ee..f37531eb63 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/types.h
@@ -177,6 +177,13 @@ struct ApplicationParams : PolicyBase {
Optional<Integer<uint16_t, 0, 65225> > memory_kb;
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
mutable Optional<ModuleTypes> moduleType;
+ Optional<String<0, 65535> > certificate;
+ // Cloud application params
+ Optional<Enum<HybridAppPreference> > hybrid_app_preference;
+ Optional<String<0, 255> > endpoint;
+ Optional<Boolean> enabled;
+ Optional<String<0, 65535> > auth_token;
+ Optional<String<0, 255> > cloud_transport_type;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
index 26af165506..5ed852cf45 100644
--- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
+++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
@@ -56,6 +56,7 @@
<element name="fuelRange" />
<element name="tirePressureValue" />
<element name="tpms" />
+ <element name="cloudAppVehicleID" />
</enum>
<enum name="AppHMIType">
@@ -70,6 +71,12 @@
<element name="TESTING" />
<element name="SYSTEM" />
</enum>
+
+ <enum name="HybridAppPreference">
+ <element name="MOBILE" />
+ <element name="CLOUD" />
+ <element name="BOTH" />
+ </enum>
<!-- Common parameters end -->
<!-- app_policies section start -->
@@ -92,8 +99,15 @@
<param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/>
<param name="watchdog_timer_ms" type="Integer" minvalue="1"
maxvalue="65225" mandatory="false"/>
- <param name="certificate" type="String" minlength="0" maxlength="255"
+ <param name="certificate" type="String" minlength="0" maxlength="65535"
+ mandatory="false" />
+ <param name="endpoint" type="String" minlength="0" maxlength="255" mandatory="false" />
+ <param name="enabled" type="Boolean" mandatory="false" />
+ <param name="auth_token" type="String" minlength="0" maxlength="65535"
+ mandatory="false" />
+ <param name="cloud_transport_type" type="String" minlength="0" maxlength="255"
mandatory="false" />
+ <param name="hybrid_app_preference" type="HybridAppPreference" mandatory="false" />
</struct>
<typedef name="HmiLevels" type="HmiLevel" array="true"
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index c2c2e91257..8cec6ef91c 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1389,6 +1389,118 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
return vehicle_info;
}
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+}
+
+void CacheManager::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ endpoint = app_policy.endpoint.is_initialized() ? *app_policy.endpoint
+ : std::string();
+ auth_token = app_policy.auth_token.is_initialized() ? *app_policy.auth_token
+ : std::string();
+ cloud_transport_type = app_policy.cloud_transport_type.is_initialized()
+ ? *app_policy.cloud_transport_type
+ : std::string();
+ certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
+ hybrid_app_preference =
+ app_policy.hybrid_app_preference.is_initialized()
+ ? EnumToJsonString(*app_policy.hybrid_app_preference)
+ : std::string();
+ enabled = app_policy.enabled.is_initialized() && *app_policy.enabled;
+ }
+}
+
+void CacheManager::InitCloudApp(const std::string& policy_app_id) {
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator default_iter =
+ policies.find(kDefaultId);
+ policy_table::ApplicationPolicies::const_iterator app_iter =
+ policies.find(policy_app_id);
+ if (default_iter != policies.end()) {
+ if (app_iter == policies.end()) {
+ policies[policy_app_id] = policies[kDefaultId];
+ }
+ }
+ // Add cloud app specific policies
+ Backup();
+}
+
+void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.enabled = enabled;
+ }
+}
+
+void CacheManager::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.auth_token = auth_token;
+ }
+}
+
+void CacheManager::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.cloud_transport_type = cloud_transport_type;
+ }
+}
+
+void CacheManager::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ policy_table::HybridAppPreference value;
+ bool valid = EnumFromJsonString(hybrid_app_preference, &value);
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter && valid) {
+ *(*policy_iter).second.hybrid_app_preference = value;
+ }
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index a603f122e2..0844edd8eb 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -725,6 +725,53 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
+void PolicyManagerImpl::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ cache_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+}
+
+void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
+ cache_->InitCloudApp(policy_app_id);
+}
+
+void PolicyManagerImpl::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ cache_->SetCloudAppEnabled(policy_app_id, enabled);
+}
+
+void PolicyManagerImpl::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ cache_->SetAppAuthToken(policy_app_id, auth_token);
+}
+
+void PolicyManagerImpl::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
+}
+
+void PolicyManagerImpl::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ cache_->SetHybridAppPreference(policy_app_id, hybrid_app_preference);
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
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 27db505e3f..72dd7aea72 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1,4 +1,5 @@
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
@@ -137,6 +138,8 @@ bool IsValidEnum(Parameter val) {
return true;
case P_FUELRANGE:
return true;
+ case P_CLOUD_APP_VEHICLE_ID:
+ return true;
case P_ODOMETER:
return true;
case P_TIREPRESSURE:
@@ -232,6 +235,8 @@ const char* EnumToJsonString(Parameter val) {
return "instantFuelConsumption";
case P_FUELRANGE:
return "fuelRange";
+ case P_CLOUD_APP_VEHICLE_ID:
+ return "cloudAppVehicleID";
case P_ODOMETER:
return "odometer";
case P_TIREPRESSURE:
@@ -336,6 +341,9 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) {
} else if ("fuelRange" == literal) {
*result = P_FUELRANGE;
return true;
+ } else if ("cloudAppVehicleID" == literal) {
+ *result = P_CLOUD_APP_VEHICLE_ID;
+ return true;
} else if ("odometer" == literal) {
*result = P_ODOMETER;
return true;
@@ -840,6 +848,38 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
}
}
+bool IsValidEnum(HybridAppPreference val) {
+ return strlen(EnumToJsonString(val)) > 0;
+}
+
+const char* EnumToJsonString(HybridAppPreference val) {
+ switch (val) {
+ case HAP_MOBILE:
+ return "MOBILE";
+ case HAP_CLOUD:
+ return "CLOUD";
+ case HAP_BOTH:
+ return "BOTH";
+ default:
+ return "";
+ }
+}
+
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result) {
+ if ("MOBILE" == literal) {
+ *result = HAP_MOBILE;
+ return true;
+ } else if ("CLOUD" == literal) {
+ *result = HAP_CLOUD;
+ return true;
+ } else if ("BOTH" == literal) {
+ *result = HAP_BOTH;
+ return true;
+ }
+ return false;
+}
+
bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
if ("RegisterAppInterface" == literal) {
*result = RegisterAppInterfaceID;
@@ -1081,6 +1121,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("SetCloudAppProperties" == literal) {
+ *result = SetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("PublishAppService" == literal) {
+ *result = PublishAppServiceID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index 5922a020e6..977448dacd 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -241,7 +241,14 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, RequestSubType(impl::ValueMember(value__, "RequestSubType"))
, memory_kb(impl::ValueMember(value__, "memory_kb"), 0)
, heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms"))
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , moduleType(impl::ValueMember(value__, "moduleType"))
+ , certificate(impl::ValueMember(value__, "certificate"), "not_specified")
+ , hybrid_app_preference(impl::ValueMember(value__, "hybrid_app_preference"))
+ , endpoint(impl::ValueMember(value__, "endpoint"))
+ , enabled(impl::ValueMember(value__, "enabled"))
+ , auth_token(impl::ValueMember(value__, "auth_token"))
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -253,6 +260,13 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField(
"heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
impl::WriteJsonField("moduleType", moduleType, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
+ impl::WriteJsonField(
+ "hybrid_app_preference", hybrid_app_preference, &result__);
+ impl::WriteJsonField("endpoint", endpoint, &result__);
+ impl::WriteJsonField("enabled", enabled, &result__);
+ impl::WriteJsonField("auth_token", auth_token, &result__);
+ impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
return result__;
}
@@ -277,6 +291,24 @@ bool ApplicationParams::is_valid() const {
if (!moduleType.is_valid()) {
return false;
}
+ if (!certificate.is_valid()) {
+ return false;
+ }
+ if (!endpoint.is_valid()) {
+ return false;
+ }
+ if (!enabled.is_valid()) {
+ return false;
+ }
+ if (!auth_token.is_valid()) {
+ return false;
+ }
+ if (!cloud_transport_type.is_valid()) {
+ return false;
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -309,6 +341,24 @@ bool ApplicationParams::struct_empty() const {
if (moduleType.is_initialized()) {
return false;
}
+ if (certificate.is_initialized()) {
+ return false;
+ }
+ if (endpoint.is_initialized()) {
+ return false;
+ }
+ if (enabled.is_initialized()) {
+ return false;
+ }
+ if (auth_token.is_initialized()) {
+ return false;
+ }
+ if (cloud_transport_type.is_initialized()) {
+ return false;
+ }
+ if (hybrid_app_preference.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -357,6 +407,25 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!moduleType.is_valid()) {
moduleType.ReportErrors(&report__->ReportSubobject("moduleType"));
}
+ if (!certificate.is_valid()) {
+ certificate.ReportErrors(&report__->ReportSubobject("certificate"));
+ }
+ if (!endpoint.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("endpoint"));
+ }
+ if (!enabled.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("enabled"));
+ }
+ if (!auth_token.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("auth_token"));
+ }
+ if (!cloud_transport_type.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("cloud_transport_type"));
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ moduleType.ReportErrors(
+ &report__->ReportSubobject("hybrid_app_preference"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -367,6 +436,11 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
memory_kb.SetPolicyTableType(pt_type);
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
moduleType.SetPolicyTableType(pt_type);
+ certificate.SetPolicyTableType(pt_type);
+ endpoint.SetPolicyTableType(pt_type);
+ enabled.SetPolicyTableType(pt_type);
+ cloud_transport_type.SetPolicyTableType(pt_type);
+ hybrid_app_preference.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
index afb1180692..32320b6d6c 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
@@ -205,7 +205,10 @@ const std::string kUpdateGroupPermissions =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application`(`id`, `keep_context`, `steal_focus`, "
" `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, "
- " `heart_beat_timeout_ms`) VALUES( ?, ?, ?, ?, ?, ?, ?, ?) ";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, "
+ " `cloud_transport_type`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -232,8 +235,9 @@ const std::string kSelectPreconsentedGroupsId =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, "
- "`steal_focus`, "
- " `memory_kb`, `heart_beat_timeout_ms` FROM `application`";
+ " `steal_focus`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ " `hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token` "
+ " `cloud_transport_type` FROM `application`";
const std::string kSelectFunctionalGroupNames =
"SELECT `id`, `user_consent_prompt`, `name`"
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index a43b22a3b8..43961815d6 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -752,6 +752,25 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
app_query.Bind(5, app.second.is_null());
app_query.Bind(6, *app.second.memory_kb);
app_query.Bind(7, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
+ app.second.certificate.is_initialized()
+ ? app_query.Bind(8, *app.second.certificate)
+ : app_query.Bind(8);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(9,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(9);
+ app.second.endpoint.is_initialized()
+ ? app_query.Bind(10, *app.second.endpoint)
+ : app_query.Bind(10);
+ app.second.enabled.is_initialized() ? app_query.Bind(11, *app.second.enabled)
+ : app_query.Bind(11);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(12, *app.second.auth_token)
+ : app_query.Bind(12);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(13, *app.second.cloud_transport_type)
+ : app_query.Bind(13);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -873,6 +892,22 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
params.steal_focus = query.GetBoolean(4);
*params.memory_kb = query.GetInteger(5);
*params.heart_beat_timeout_ms = query.GetUInteger(6);
+ if (!query.IsNull(7)) {
+ *params.certificate = query.GetString(7);
+ }
+
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(8), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(9);
+ if (!query.IsNull(10)) {
+ *params.enabled = query.GetBoolean(10);
+ }
+ *params.auth_token = query.GetString(11);
+ *params.cloud_transport_type = query.GetString(12);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index 97d75731ea..162d6957e7 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -98,6 +98,9 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `hmi_level`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
"); "
+ "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
"CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
" `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL, "
@@ -147,6 +150,12 @@ const std::string kCreateSchema =
" `is_predata` BOOLEAN, "
" `memory_kb` INTEGER NOT NULL, "
" `heart_beat_timeout_ms` INTEGER NOT NULL, "
+ " `certificate` VARCHAR(65535), "
+ " `hybrid_app_preference_value` VARCHAR(255), "
+ " `endpoint` VARCHAR(255), "
+ " `enabled` BOOLEAN, "
+ " `auth_token` VARCHAR(65535), "
+ " `cloud_transport_type` VARCHAR(255), "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -154,11 +163,17 @@ const std::string kCreateSchema =
" CONSTRAINT `fk_application_priorities1` "
" FOREIGN KEY(`priority_value`) "
" REFERENCES `priority`(`value`) "
+ " CONSTRAINT `fk_application_hybrid_app_preference1` "
+ " FOREIGN KEY(`hybrid_app_preference_value`) "
+ " REFERENCES `hybrid_app_preference`(`value`) "
"); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
" ON `application`(`default_hmi`); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_application_hybrid_app_preference1` "
+ " ON `application`(`hybrid_app_preference_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
" `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
@@ -430,6 +445,9 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
@@ -532,6 +550,7 @@ const std::string kDropSchema =
"`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
"DROP TABLE IF EXISTS `notifications_by_priority`; "
"DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `hybrid_app_preference`; "
"DROP TABLE IF EXISTS `priority`; "
"DROP TABLE IF EXISTS `functional_group`; "
"DROP TABLE IF EXISTS `module_config`; "
@@ -628,8 +647,10 @@ const std::string kInsertRpcWithParameter =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
- "`is_revoked`, `memory_kb`,"
- " `heart_beat_timeout_ms`) VALUES (?,?,?,?,?)";
+ "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ "`cloud_transport_type`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -752,7 +773,9 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms` FROM `application`";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -849,15 +872,19 @@ const std::string kDeleteAppGroupByApplicationId =
const std::string kInsertApplicationFull =
"INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
- "`is_predata`, "
- " `memory_kb`, `heart_beat_timeout_ms`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
+ " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
+ " `auth_token`, `cloud_transport_type`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms` FROM `application` WHERE `id` = ?";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` "
+ "FROM `application` "
+ "WHERE `id` = ?";
const std::string kSelectDBVersion =
"SELECT `db_version_hash` from `_internal_data`";
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index c8b367c8ec..b794d4c3a6 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -761,6 +761,23 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
*params.memory_kb = query.GetInteger(2);
*params.heart_beat_timeout_ms = query.GetUInteger(3);
+ if (!query.IsNull(4)) {
+ *params.certificate = query.GetString(4);
+ }
+
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(6);
+ if (!query.IsNull(7)) {
+ *params.enabled = query.GetBoolean(7);
+ }
+ *params.auth_token = query.GetString(8);
+ *params.cloud_transport_type = query.GetString(9);
+
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -1035,6 +1052,24 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app_query.Bind(2, app.second.is_null());
app_query.Bind(3, *app.second.memory_kb);
app_query.Bind(4, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
+ app.second.certificate.is_initialized()
+ ? app_query.Bind(5, *app.second.certificate)
+ : app_query.Bind(5);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(6,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(6);
+ app.second.endpoint.is_initialized() ? app_query.Bind(7, *app.second.endpoint)
+ : app_query.Bind(7);
+ app.second.enabled.is_initialized() ? app_query.Bind(8, *app.second.enabled)
+ : app_query.Bind(8);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(9, *app.second.auth_token)
+ : app_query.Bind(9);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(10, *app.second.cloud_transport_type)
+ : app_query.Bind(10);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -2125,6 +2160,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(7, source_app.GetBoolean(6));
query.Bind(8, source_app.GetInteger(7));
query.Bind(9, source_app.GetInteger(8));
+ source_app.IsNull(9) ? query.Bind(10)
+ : query.Bind(10, source_app.GetString(9));
+ source_app.IsNull(10) ? query.Bind(11)
+ : query.Bind(11, source_app.GetString(10));
+ source_app.IsNull(11) ? query.Bind(12)
+ : query.Bind(12, source_app.GetString(11));
+ source_app.IsNull(12) ? query.Bind(13)
+ : query.Bind(13, source_app.GetBoolean(12));
+ source_app.IsNull(13) ? query.Bind(14)
+ : query.Bind(14, source_app.GetString(13));
+ source_app.IsNull(14) ? query.Bind(15)
+ : query.Bind(15, source_app.GetString(14));
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
diff --git a/src/components/policy/policy_external/test/json/PTU.json b/src/components/policy/policy_external/test/json/PTU.json
index 4cd71d6004..c5f4b90120 100644
--- a/src/components/policy/policy_external/test/json/PTU.json
+++ b/src/components/policy/policy_external/test/json/PTU.json
@@ -485,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -509,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -533,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -556,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU2.json b/src/components/policy/policy_external/test/json/PTU2.json
index 9c9436144e..01cca4a6fd 100644
--- a/src/components/policy/policy_external/test/json/PTU2.json
+++ b/src/components/policy/policy_external/test/json/PTU2.json
@@ -485,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -509,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -533,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -556,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU3.json b/src/components/policy/policy_external/test/json/PTU3.json
index 279051e7bf..f48f246114 100644
--- a/src/components/policy/policy_external/test/json/PTU3.json
+++ b/src/components/policy/policy_external/test/json/PTU3.json
@@ -485,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -509,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -533,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -556,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
index 08027f2786..1e99e7442c 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
@@ -1605,6 +1605,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1623,6 +1624,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1641,6 +1643,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1658,6 +1661,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
index a88bcfbd08..dc40c3a182 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
@@ -1608,6 +1608,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1626,6 +1627,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1644,6 +1646,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1661,6 +1664,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
index 250bfb21f2..3fcc71ca72 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
@@ -1605,6 +1605,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1623,6 +1624,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1641,6 +1643,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1658,6 +1661,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
index 85910c098c..03a5e8d203 100644
--- a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
+++ b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
@@ -1604,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1622,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1657,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
index 1c1b04ca2b..b5dd0bfff5 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
index 51690d7b8e..8fa8e6f3d0 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
index cfa6c4010c..589cdc7a81 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/ptu2_requestType.json b/src/components/policy/policy_external/test/json/ptu2_requestType.json
index d7177f2251..9b580b2a08 100644
--- a/src/components/policy/policy_external/test/json/ptu2_requestType.json
+++ b/src/components/policy/policy_external/test/json/ptu2_requestType.json
@@ -497,6 +497,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -521,6 +522,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -545,6 +547,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -568,6 +571,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/ptu_requestType.json b/src/components/policy/policy_external/test/json/ptu_requestType.json
index 6a531dd2ad..8d18a9e336 100644
--- a/src/components/policy/policy_external/test/json/ptu_requestType.json
+++ b/src/components/policy/policy_external/test/json/ptu_requestType.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
index 59e3f947c3..ad264c8518 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
@@ -363,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -383,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -403,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -422,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
index a4491fd449..909fd2cb2f 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
@@ -2321,6 +2321,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -2343,6 +2344,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -2365,6 +2367,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -2386,6 +2389,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
index 83c4ccf15c..87fac7c76c 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
@@ -497,6 +497,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -521,6 +522,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -545,6 +547,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -568,6 +571,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json b/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
index 7b882c6ceb..440963ba48 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
@@ -1622,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1658,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1675,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_second_update.json b/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
index 7d90275328..5900acbcfb 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
@@ -1622,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1658,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1675,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_update.json b/src/components/policy/policy_external/test/json/sdl_pt_update.json
index 807b0eb312..b3affeb91d 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_update.json
@@ -1606,6 +1606,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1624,6 +1625,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1642,6 +1644,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1659,6 +1662,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
index 3d0a004dbe..639d0143c8 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
index 6a36f1f9c5..53216cab3d 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
index 3303d56844..a529dc9a3b 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
index e7a33ba2c0..a57791e248 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
index 08739f9d6a..5a633e7c95 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
index 21396b8cac..86c121491b 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
index 5aa467a23c..2b57912016 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
@@ -496,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -520,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -544,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -567,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json b/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
index 5827ab287a..35e6b1d1a6 100644
--- a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
+++ b/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
@@ -1598,6 +1598,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1616,6 +1617,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1634,6 +1636,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1651,6 +1654,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
index b0f340b0f2..fddc5e631e 100644
--- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
@@ -406,8 +406,8 @@ TEST_F(SQLPTRepresentationTest,
query.Prepare(query_select);
query.Next();
- // 33 - is current total tables number created by schema
- const int policy_tables_number = 33;
+ // 34 - is current total tables number created by schema
+ const int policy_tables_number = 34;
ASSERT_EQ(policy_tables_number, query.GetInteger(0));
const std::string query_select_count_of_iap_buffer_full =
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index 48e00f7049..8c8f0c55c6 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -147,6 +147,76 @@ class CacheManager : public CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id);
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled);
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token);
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type);
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference);
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index 10a6ea7f89..50b546ecc5 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -152,6 +152,78 @@ class CacheManagerInterface {
virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ virtual void GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const = 0;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 51d4ee88aa..20a37717a7 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -565,6 +565,76 @@ class PolicyManagerImpl : public PolicyManager {
const VehicleInfo GetVehicleInfo() const OVERRIDE;
/**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get cloud app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id Unique application id
+ * @param enabled Whether or not the app is enabled
+ * @param endpoint Filled with the endpoint used to connect to the cloud
+ * application
+ * @param certificate Filled with the certificate used to for creating a
+ * secure connection to the cloud application
+ * @param auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ * @param cloud_transport_type Filled with the transport type used by the
+ * cloud application (ex. "WSS")
+ * @param hybrid_app_preference Filled with the hybrid app preference for the
+ * cloud application set by the user
+ */
+ void GetCloudAppParameters(const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const OVERRIDE;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+
+ void InitCloudApp(const std::string& policy_app_id) OVERRIDE;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) OVERRIDE;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) OVERRIDE;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU. *
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 1f10db9f6f..f8f4e9e029 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
@@ -86,6 +86,7 @@ enum Parameter {
P_STEERINGWHEELANGLE,
P_ENGINEOILLIFE,
P_MYKEY,
+ P_CLOUD_APP_VEHICLE_ID,
P_AIRBAGSTATUS,
P_BODYINFORMATION,
P_CLUSTERMODESTATUS,
@@ -167,6 +168,12 @@ bool IsValidEnum(ModuleType val);
const char* EnumToJsonString(ModuleType val);
bool EnumFromJsonString(const std::string& literal, ModuleType* result);
+enum HybridAppPreference { HAP_MOBILE, HAP_CLOUD, HAP_BOTH };
+bool IsValidEnum(HybridAppPreference val);
+const char* EnumToJsonString(HybridAppPreference val);
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result);
+
/**
* @brief Enumeration FunctionID.
*
@@ -420,6 +427,16 @@ enum FunctionID {
SendHapticDataID = 49,
/**
+ * @brief SetCloudAppPropertiesID.
+ */
+ SetCloudAppPropertiesID = 50,
+
+ /**
+ * @brief PublishAppServiceID
+ */
+ PublishAppServiceID = 52,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h
index e201251745..58f07492c4 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h
@@ -144,6 +144,12 @@ struct ApplicationParams : PolicyBase {
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
Optional<String<0, 255> > certificate;
mutable Optional<ModuleTypes> moduleType;
+ // Cloud application params
+ Optional<Enum<HybridAppPreference> > hybrid_app_preference;
+ Optional<String<0, 255> > endpoint;
+ Optional<Boolean> enabled;
+ Optional<String<0, 65535> > auth_token;
+ Optional<String<0, 255> > cloud_transport_type;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index bd95fc8e7c..ca61a338f1 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -682,6 +682,120 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
return vehicle_info;
}
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+}
+
+void CacheManager::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ endpoint = app_policy.endpoint.is_initialized() ? *app_policy.endpoint
+ : std::string();
+ auth_token = app_policy.auth_token.is_initialized() ? *app_policy.auth_token
+ : std::string();
+ cloud_transport_type = app_policy.cloud_transport_type.is_initialized()
+ ? *app_policy.cloud_transport_type
+ : std::string();
+ certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
+ hybrid_app_preference =
+ app_policy.hybrid_app_preference.is_initialized()
+ ? EnumToJsonString(*app_policy.hybrid_app_preference)
+ : std::string();
+ enabled = app_policy.enabled.is_initialized() && *app_policy.enabled;
+ }
+}
+
+void CacheManager::InitCloudApp(const std::string& policy_app_id) {
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator default_iter =
+ policies.find(kDefaultId);
+ policy_table::ApplicationPolicies::const_iterator app_iter =
+ policies.find(policy_app_id);
+
+ if (default_iter != policies.end()) {
+ if (app_iter == policies.end()) {
+ policies[policy_app_id] = policies[kDefaultId];
+ }
+ }
+ // Add cloud app specific policies
+
+ Backup();
+}
+
+void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.enabled = enabled;
+ }
+}
+
+void CacheManager::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.auth_token = auth_token;
+ }
+}
+
+void CacheManager::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.cloud_transport_type = cloud_transport_type;
+ }
+}
+
+void CacheManager::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ policy_table::HybridAppPreference value;
+ bool valid = EnumFromJsonString(hybrid_app_preference, &value);
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter && valid) {
+ *(*policy_iter).second.hybrid_app_preference = value;
+ }
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 4985035629..9b2392a015 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -217,7 +217,7 @@ void FilterInvalidApplicationParameters(
}
app_params.AppHMIType->swap(valid_app_hmi_types);
- // Filter RquestTypes array
+ // Filter RequestTypes array
policy_table::RequestTypes valid_request_types;
const policy_table::RequestTypes& request_types = *(app_params.RequestType);
for (const auto& request_type : request_types) {
@@ -544,6 +544,53 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
+void PolicyManagerImpl::GetCloudAppParameters(
+ const std::string& policy_app_id,
+ bool& enabled,
+ std::string& endpoint,
+ std::string& certificate,
+ std::string& auth_token,
+ std::string& cloud_transport_type,
+ std::string& hybrid_app_preference) const {
+ cache_->GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+}
+
+void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
+ cache_->InitCloudApp(policy_app_id);
+}
+
+void PolicyManagerImpl::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ cache_->SetCloudAppEnabled(policy_app_id, enabled);
+}
+
+void PolicyManagerImpl::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ cache_->SetAppAuthToken(policy_app_id, auth_token);
+}
+
+void PolicyManagerImpl::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
+}
+
+void PolicyManagerImpl::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ cache_->SetHybridAppPreference(policy_app_id, hybrid_app_preference);
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
const PTString& app_id,
const PTString& hmi_level,
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 428e18d0bd..f53b27776d 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -1,5 +1,5 @@
-// This file is generated, do not edit
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
@@ -138,6 +138,8 @@ bool IsValidEnum(Parameter val) {
return true;
case P_FUELRANGE:
return true;
+ case P_CLOUD_APP_VEHICLE_ID:
+ return true;
case P_ODOMETER:
return true;
case P_TIREPRESSURE:
@@ -204,6 +206,8 @@ const char* EnumToJsonString(Parameter val) {
return "instantFuelConsumption";
case P_FUELRANGE:
return "fuelRange";
+ case P_CLOUD_APP_VEHICLE_ID:
+ return "cloudAppVehicleID";
case P_ODOMETER:
return "odometer";
case P_TIREPRESSURE:
@@ -280,6 +284,9 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) {
} else if ("fuelRange" == literal) {
*result = P_FUELRANGE;
return true;
+ } else if ("cloudAppVehicleID" == literal) {
+ *result = P_CLOUD_APP_VEHICLE_ID;
+ return true;
} else if ("odometer" == literal) {
*result = P_ODOMETER;
return true;
@@ -662,6 +669,7 @@ bool IsValidEnum(ModuleType val) {
return false;
}
}
+
const char* EnumToJsonString(ModuleType val) {
switch (val) {
case MT_CLIMATE:
@@ -709,6 +717,38 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
return false;
}
+bool IsValidEnum(HybridAppPreference val) {
+ return strlen(EnumToJsonString(val)) > 0;
+}
+
+const char* EnumToJsonString(HybridAppPreference val) {
+ switch (val) {
+ case HAP_MOBILE:
+ return "MOBILE";
+ case HAP_CLOUD:
+ return "CLOUD";
+ case HAP_BOTH:
+ return "BOTH";
+ default:
+ return "";
+ }
+}
+
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result) {
+ if ("MOBILE" == literal) {
+ *result = HAP_MOBILE;
+ return true;
+ } else if ("CLOUD" == literal) {
+ *result = HAP_CLOUD;
+ return true;
+ } else if ("BOTH" == literal) {
+ *result = HAP_BOTH;
+ return true;
+ }
+ return false;
+}
+
bool IsValidEnum(FunctionID val) {
switch (val) {
case RegisterAppInterfaceID:
@@ -807,6 +847,10 @@ bool IsValidEnum(FunctionID val) {
return true;
case SendHapticDataID:
return true;
+ case SetCloudAppPropertiesID:
+ return true;
+ case PublishAppServiceID:
+ return true;
case OnHMIStatusID:
return true;
case OnAppInterfaceUnregisteredID:
@@ -954,6 +998,10 @@ const char* EnumToJsonString(FunctionID val) {
return "GetSystemCapability";
case SendHapticDataID:
return "SendHapticData";
+ case SetCloudAppPropertiesID:
+ return "SetCloudAppProperties";
+ case PublishAppServiceID:
+ return "PublishAppService";
case OnHMIStatusID:
return "OnHMIStatus";
case OnAppInterfaceUnregisteredID:
@@ -1243,6 +1291,15 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
*result = SendHapticDataID;
return true;
}
+ if ("SetCloudAppProperties" == literal) {
+ *result = SetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("PublishAppService" == literal) {
+ *result = PublishAppServiceID;
+ return true;
+ }
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index 851ed1bd18..88564df050 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -168,7 +168,13 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, memory_kb(impl::ValueMember(value__, "memory_kb"), 0)
, heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms"))
, certificate(impl::ValueMember(value__, "certificate"), "not_specified")
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , moduleType(impl::ValueMember(value__, "moduleType"))
+ , hybrid_app_preference(impl::ValueMember(value__, "hybrid_app_preference"))
+ , endpoint(impl::ValueMember(value__, "endpoint"))
+ , enabled(impl::ValueMember(value__, "enabled"))
+ , auth_token(impl::ValueMember(value__, "auth_token"))
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -180,7 +186,14 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("memory_kb", memory_kb, &result__);
impl::WriteJsonField(
"heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("moduleType", moduleType, &result__);
+ impl::WriteJsonField(
+ "hybrid_app_preference", hybrid_app_preference, &result__);
+ impl::WriteJsonField("endpoint", endpoint, &result__);
+ impl::WriteJsonField("enabled", enabled, &result__);
+ impl::WriteJsonField("auth_token", auth_token, &result__);
+ impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
return result__;
}
@@ -212,6 +225,21 @@ bool ApplicationParams::is_valid() const {
if (!moduleType.is_valid()) {
return false;
}
+ if (!endpoint.is_valid()) {
+ return false;
+ }
+ if (!enabled.is_valid()) {
+ return false;
+ }
+ if (!auth_token.is_valid()) {
+ return false;
+ }
+ if (!cloud_transport_type.is_valid()) {
+ return false;
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -250,6 +278,21 @@ bool ApplicationParams::struct_empty() const {
if (moduleType.is_initialized()) {
return false;
}
+ if (endpoint.is_initialized()) {
+ return false;
+ }
+ if (enabled.is_initialized()) {
+ return false;
+ }
+ if (auth_token.is_initialized()) {
+ return false;
+ }
+ if (cloud_transport_type.is_initialized()) {
+ return false;
+ }
+ if (hybrid_app_preference.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -288,6 +331,22 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!moduleType.is_valid()) {
moduleType.ReportErrors(&report__->ReportSubobject("moduleType"));
}
+ if (!endpoint.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("endpoint"));
+ }
+ if (!enabled.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("enabled"));
+ }
+ if (!auth_token.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("auth_token"));
+ }
+ if (!cloud_transport_type.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("cloud_transport_type"));
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ moduleType.ReportErrors(
+ &report__->ReportSubobject("hybrid_app_preference"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -300,6 +359,10 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
certificate.SetPolicyTableType(pt_type);
moduleType.SetPolicyTableType(pt_type);
+ endpoint.SetPolicyTableType(pt_type);
+ enabled.SetPolicyTableType(pt_type);
+ cloud_transport_type.SetPolicyTableType(pt_type);
+ hybrid_app_preference.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index f5ccffce3b..297031d4c0 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -84,6 +84,9 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `hmi_level`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
"); "
+ "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
"CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
" `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL, "
@@ -133,7 +136,12 @@ const std::string kCreateSchema =
" `is_predata` BOOLEAN, "
" `memory_kb` INTEGER NOT NULL, "
" `heart_beat_timeout_ms` INTEGER NOT NULL, "
- " `certificate` VARCHAR(45), "
+ " `certificate` VARCHAR(65535), "
+ " `hybrid_app_preference_value` VARCHAR(255), "
+ " `endpoint` VARCHAR(255), "
+ " `enabled` BOOLEAN, "
+ " `auth_token` VARCHAR(65535), "
+ " `cloud_transport_type` VARCHAR(255), "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -141,11 +149,17 @@ const std::string kCreateSchema =
" CONSTRAINT `fk_application_priorities1` "
" FOREIGN KEY(`priority_value`) "
" REFERENCES `priority`(`value`) "
+ " CONSTRAINT `fk_application_hybrid_app_preference1` "
+ " FOREIGN KEY(`hybrid_app_preference_value`) "
+ " REFERENCES `hybrid_app_preference`(`value`) "
"); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
" ON `application`(`default_hmi`); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_application_hybrid_app_preference1` "
+ " ON `application`(`hybrid_app_preference_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
" `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
@@ -391,6 +405,9 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
@@ -491,6 +508,7 @@ const std::string kDropSchema =
"`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
"DROP TABLE IF EXISTS `notifications_by_priority`; "
"DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `hybrid_app_preference`; "
"DROP TABLE IF EXISTS `priority`; "
"DROP TABLE IF EXISTS `functional_group`; "
"DROP TABLE IF EXISTS `module_config`; "
@@ -578,8 +596,10 @@ const std::string kInsertRpcWithParameter =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
- "`is_revoked`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate`) VALUES (?,?,?,?,?,?)";
+ "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ "`cloud_transport_type`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -688,7 +708,9 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms`, `certificate` FROM `application`";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -785,15 +807,19 @@ const std::string kDeleteAppGroupByApplicationId =
const std::string kInsertApplicationFull =
"INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
- "`is_predata`, "
- " `memory_kb`, `heart_beat_timeout_ms`, `certificate`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
+ " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
+ " `auth_token`, `cloud_transport_type`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = "
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` "
+ "FROM `application` "
+ "WHERE `id` = "
"?";
const std::string kSelectDBVersion =
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 75f8be74eb..9282caf535 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -716,12 +716,24 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
params.priority = priority;
*params.memory_kb = query.GetInteger(2);
-
*params.heart_beat_timeout_ms = query.GetUInteger(3);
- if (!query.IsNull(3)) {
+ if (!query.IsNull(4)) {
*params.certificate = query.GetString(4);
}
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(6);
+ if (!query.IsNull(7)) {
+ *params.enabled = query.GetBoolean(7);
+ }
+ *params.auth_token = query.GetString(8);
+ *params.cloud_transport_type = query.GetString(9);
+
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -984,6 +996,22 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app.second.certificate.is_initialized()
? app_query.Bind(5, *app.second.certificate)
: app_query.Bind(5);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(6,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(6);
+ app.second.endpoint.is_initialized() ? app_query.Bind(7, *app.second.endpoint)
+ : app_query.Bind(7);
+ app.second.enabled.is_initialized() ? app_query.Bind(8, *app.second.enabled)
+ : app_query.Bind(8);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(9, *app.second.auth_token)
+ : app_query.Bind(9);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(10, *app.second.cloud_transport_type)
+ : app_query.Bind(10);
+
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -2084,6 +2112,17 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
query.Bind(9, source_app.GetInteger(8));
source_app.IsNull(9) ? query.Bind(10)
: query.Bind(10, source_app.GetString(9));
+ source_app.IsNull(10) ? query.Bind(11)
+ : query.Bind(11, source_app.GetString(10));
+ source_app.IsNull(11) ? query.Bind(12)
+ : query.Bind(12, source_app.GetString(11));
+ source_app.IsNull(12) ? query.Bind(13)
+ : query.Bind(13, source_app.GetBoolean(12));
+ source_app.IsNull(13) ? query.Bind(14)
+ : query.Bind(14, source_app.GetString(13));
+ source_app.IsNull(14) ? query.Bind(15)
+ : query.Bind(15, source_app.GetString(14));
+
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
return false;
diff --git a/src/components/policy/policy_regular/test/PTU.json b/src/components/policy/policy_regular/test/PTU.json
index 2f4735dd66..dbf16598f0 100644
--- a/src/components/policy/policy_regular/test/PTU.json
+++ b/src/components/policy/policy_regular/test/PTU.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU2.json b/src/components/policy/policy_regular/test/PTU2.json
index 806ab8bcc0..2c0063f69a 100644
--- a/src/components/policy/policy_regular/test/PTU2.json
+++ b/src/components/policy/policy_regular/test/PTU2.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU3.json b/src/components/policy/policy_regular/test/PTU3.json
index 28396be29a..d579fd3e3f 100644
--- a/src/components/policy/policy_regular/test/PTU3.json
+++ b/src/components/policy/policy_regular/test/PTU3.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU4.json b/src/components/policy/policy_regular/test/PTU4.json
index 4592e228df..84b6404010 100644
--- a/src/components/policy/policy_regular/test/PTU4.json
+++ b/src/components/policy/policy_regular/test/PTU4.json
@@ -362,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -382,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -402,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -421,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/ptu2_requestType.json b/src/components/policy/policy_regular/test/ptu2_requestType.json
index 2a05a94f8b..9013971990 100644
--- a/src/components/policy/policy_regular/test/ptu2_requestType.json
+++ b/src/components/policy/policy_regular/test/ptu2_requestType.json
@@ -498,6 +498,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -522,6 +523,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -546,6 +548,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -569,6 +572,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/ptu_requestType.json b/src/components/policy/policy_regular/test/ptu_requestType.json
index b0d9117568..892a77f970 100644
--- a/src/components/policy/policy_regular/test/ptu_requestType.json
+++ b/src/components/policy/policy_regular/test/ptu_requestType.json
@@ -498,6 +498,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -522,6 +523,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -546,6 +548,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -569,6 +572,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
index 59e3f947c3..ad264c8518 100644
--- a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
+++ b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
@@ -363,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -383,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -403,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -422,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/sdl_pt_first_update.json b/src/components/policy/policy_regular/test/sdl_pt_first_update.json
index 7b882c6ceb..440963ba48 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_first_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_first_update.json
@@ -1622,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1658,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1675,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_pt_second_update.json b/src/components/policy/policy_regular/test/sdl_pt_second_update.json
index 7d90275328..5900acbcfb 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_second_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_second_update.json
@@ -1622,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1658,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1675,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_pt_update.json b/src/components/policy/policy_regular/test/sdl_pt_update.json
index 909e4d5238..6f5e223cae 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_update.json
@@ -1600,6 +1600,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1618,6 +1619,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1638,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1653,6 +1656,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
index 7d192515dc..030dc374dd 100644
--- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
@@ -426,8 +426,8 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->RefreshDB());
// Check PT structure destroyed and tables number is 0
- // There are 29 tables in the database, now.
- const int32_t total_tables_number = 29;
+ // There are 30 tables in the database, now.
+ const int32_t total_tables_number = 30;
ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select));
const char* query_select_count_of_iap_buffer_full =
"SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`";
diff --git a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
index 5827ab287a..35e6b1d1a6 100644
--- a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
+++ b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
@@ -1598,6 +1598,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1616,6 +1617,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1634,6 +1636,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1651,6 +1654,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index 3e7d64e9d2..ccf6082a18 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -512,6 +512,10 @@ class ProtocolHandlerImpl
void OnTMMessageSendFailed(const transport_manager::DataSendError& error,
const RawMessagePtr message) OVERRIDE;
+ void OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
+
void OnConnectionEstablished(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) OVERRIDE;
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index d03030b747..ee2dc73780 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -1087,6 +1087,10 @@ void ProtocolHandlerImpl::OnTMMessageSendFailed(
<< "Error_text: " << error.text());
}
+void ProtocolHandlerImpl::OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) {}
+
void ProtocolHandlerImpl::OnConnectionEstablished(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
index cbba5bd7cd..942b491927 100644
--- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
@@ -220,11 +220,10 @@ class EnumConversionHelper {
static bool EnumToString(const EnumType value, std::string* str) {
const char* cstr;
- if (EnumToCString(value, &cstr)) {
- return false;
- }
- if (str) {
+ bool success = EnumToCString(value, &cstr);
+ if (success && str) {
*str = cstr;
+ return true;
}
return false;
}
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index 2f734b3a05..286e62b795 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -72,6 +72,11 @@ else()
)
endif()
+if(BUILD_CLOUD_APP_SUPPORT)
+ GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+ list(APPEND LIBRARIES boost_system boost_regex -L${BOOST_LIBS_DIRECTORY})
+endif()
+
if(BUILD_USB_SUPPORT)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(EXCLUDE_PATHS
@@ -129,3 +134,4 @@ endif()
if(BUILD_TESTS)
add_subdirectory(test)
endif()
+
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
new file mode 100644
index 0000000000..47a82e7921
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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.
+ */
+
+/**
+ * \file Cloud_device.h
+ * \brief CloudDevice class header file.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
+
+#include "transport_manager/transport_adapter/device.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class CloudDevice : public Device {
+ public:
+ CloudDevice(std::string& host, std::string& port, std::string& name);
+
+ virtual const std::string& GetHost() const;
+
+ virtual const std::string& GetPort() const;
+
+ protected:
+ virtual bool IsSameAs(const Device* other_device) const;
+
+ virtual ApplicationList GetApplicationList() const;
+
+ private:
+ const std::string host_;
+ const std::string port_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h
new file mode 100644
index 0000000000..ef1754a6e7
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h
@@ -0,0 +1,98 @@
+/*
+ * \file cloud_websocket_connection_factory.h
+ * \brief CloudWebsocketConnectionFactory class header file.
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
+
+#include "transport_manager/transport_adapter/server_connection_factory.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TransportAdapterController;
+
+/**
+ * @brief Create connections.
+ */
+class CloudWebsocketConnectionFactory : public ServerConnectionFactory {
+ public:
+ /**
+ * @brief Constructor.
+ *
+ * @param controller Pointer to the device adapter controller.
+ */
+ CloudWebsocketConnectionFactory(TransportAdapterController* controller);
+
+ protected:
+ /**
+ * @brief Start cloud websocket connection factory.
+ */
+ virtual TransportAdapter::Error Init();
+
+ /**
+ * @brief Create cloud boost websocket connection.
+ *
+ * @param device_uid Device unique identifier.
+ * @param ap_handle Handle of application.
+ */
+ virtual TransportAdapter::Error CreateConnection(
+ const DeviceUID& device_uid, const ApplicationHandle& app_handle);
+
+ /**
+ * @brief
+ */
+ virtual void Terminate();
+
+ /**
+ * @brief Check for initialization.
+ *
+ * @return true - initialized.
+ * false - not initialized.
+ */
+ virtual bool IsInitialised() const;
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CloudWebsocketConnectionFactory();
+
+ private:
+ TransportAdapterController* controller_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
new file mode 100644
index 0000000000..d52e4b307d
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
@@ -0,0 +1,89 @@
+/*
+ * \file cloud_websocket_transport_adapter.h
+ * \brief Cloud Websocket Transport Adapterclass header file.
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+
+#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+/**
+ * @brief Cloud transport adapter that uses websockets.
+ */
+class CloudWebsocketTransportAdapter : public TransportAdapterImpl {
+ public:
+ /**
+ * @brief Constructor.
+ */
+ explicit CloudWebsocketTransportAdapter(
+ resumption::LastState& last_state,
+ const TransportManagerSettings& settings);
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CloudWebsocketTransportAdapter();
+
+ protected:
+ /**
+ * @brief Return type of device.
+ *
+ * @return String with device type.
+ */
+ virtual DeviceType GetDeviceType() const;
+
+ /**
+ * @brief Store adapter state in last state singleton
+ */
+ virtual void Store() const;
+
+ /**
+ * @brief Restore adapter state from last state singleton
+ *
+ * @return True on success false otherwise
+ */
+ virtual bool Restore();
+
+ void CreateDevice(const std::string& uid) OVERRIDE;
+
+ private:
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_TRANSPORT_ADAPTER_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
new file mode 100644
index 0000000000..da3a80e1b2
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
@@ -0,0 +1,178 @@
+/*
+ * \file websocket_client_connection.h
+ * \brief WebsocketClientConnection class header file.
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_WEBSOCKET_CLIENT_CONNECTION_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_WEBSOCKET_CLIENT_CONNECTION_H_
+
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#include <boost/asio/connect.hpp>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/ssl/stream.hpp>
+#include <cstdlib>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <string>
+#include <thread>
+#include "transport_manager/transport_adapter/connection.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/message_queue.h"
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+namespace websocket =
+ boost::beast::websocket; // from <boost/beast/websocket.hpp>
+using ::utils::MessageQueue;
+
+typedef std::queue<protocol_handler::RawMessagePtr> AsyncQueue;
+typedef protocol_handler::RawMessagePtr Message;
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TransportAdapterController;
+
+/**
+ * @brief Class responsible for communication over bluetooth sockets.
+ */
+class WebsocketClientConnection
+ : public std::enable_shared_from_this<WebsocketClientConnection>,
+ public Connection {
+ public:
+ /**
+ * @brief Constructor.
+ *
+ * @param device_uid Device unique identifier.
+ * @param app_handle Handle of device.
+ * @param controller Pointer to the device adapter controller.
+ */
+ WebsocketClientConnection(const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ TransportAdapterController* controller);
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebsocketClientConnection();
+
+ /**
+ * @brief Check if we can start the connection attempt and establish
+ *connection status.
+ *
+ * @param error contains information of any error that occurred during
+ *connection attempt.
+ *
+ * @return result that states whether we successfully connected or not.
+ */
+ TransportAdapter::Error Start();
+
+ /**
+ * @brief Send data frame.
+ *
+ * @param message Smart pointer to the raw message.
+ *
+ * @return Error Information about possible reason of sending data failure.
+ */
+ TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message);
+
+ /**
+ * @brief Disconnect the current connection.
+ *
+ * @return Error Information about possible reason of Disconnect failure.
+ */
+ TransportAdapter::Error Disconnect();
+
+ void Shutdown();
+
+ void Recv(boost::system::error_code ec);
+
+ void OnRead(boost::system::error_code ec, std::size_t bytes_transferred);
+
+ private:
+ TransportAdapterController* controller_;
+ boost::asio::io_context ioc_;
+ tcp::resolver resolver_;
+ websocket::stream<tcp::socket> ws_;
+ boost::beast::flat_buffer buffer_;
+ std::string host_;
+ std::string text_;
+
+ std::atomic_bool shutdown_;
+
+ typedef std::queue<protocol_handler::RawMessagePtr> FrameQueue;
+ FrameQueue frames_to_send_;
+ mutable sync_primitives::Lock frames_to_send_mutex_;
+
+ MessageQueue<Message, AsyncQueue> message_queue_;
+
+ class LoopThreadDelegate : public threads::ThreadDelegate {
+ public:
+ LoopThreadDelegate(MessageQueue<Message, AsyncQueue>* message_queue,
+ WebsocketClientConnection* handler);
+
+ virtual void threadMain() OVERRIDE;
+ virtual void exitThreadMain() OVERRIDE;
+
+ void OnWrite();
+
+ void SetShutdown();
+
+ private:
+ void DrainQueue();
+ MessageQueue<Message, AsyncQueue>& message_queue_;
+ WebsocketClientConnection& handler_;
+ sync_primitives::Lock queue_lock_;
+ sync_primitives::ConditionalVariable queue_new_items_;
+ std::atomic_bool write_pending_;
+ std::atomic_bool shutdown_;
+
+ sync_primitives::Lock write_lock_;
+ };
+
+ LoopThreadDelegate* thread_delegate_;
+ threads::Thread* write_thread_;
+ std::thread io_service_thread_;
+
+ const DeviceUID device_uid_;
+ const ApplicationHandle app_handle_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_BLUETOOTH_BLUETOOTH_SOCKET_CONNECTION_H_
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
index 69d76b4b2b..6d97a55a70 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
@@ -100,6 +100,16 @@ class TransportAdapterController {
const ApplicationHandle& app_handle) = 0;
/**
+ * @brief Set state of specified connection - PENDING and launch
+ *OnConnectPending event in device adapter listener.
+ *
+ * @param devcie_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ */
+ virtual void ConnectPending(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) = 0;
+
+ /**
* @brief Make state of specified connection - ESTABLISHED and launch
*OnConnectDone event in device adapter listener.
*
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
index 078f93b32f..68d5ba3067 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
@@ -41,6 +41,7 @@
#include "utils/lock.h"
#include "utils/rwlock.h"
+#include "utils/timer.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
@@ -61,6 +62,8 @@ class DeviceScanner;
class ServerConnectionFactory;
class ClientConnectionListener;
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
+
/*
* @brief Implementation of device adapter class.
**/
@@ -147,6 +150,22 @@ class TransportAdapterImpl : public TransportAdapter,
const DeviceUID& device_handle) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ ConnectionStatus GetConnectionStatus(
+ const DeviceUID& device_handle) const OVERRIDE;
+
+ /**
+ * @brief Notifies the application manager that a cloud connection status has
+ * updated and should trigger an UpdateAppList RPC to the HMI
+ */
+ void ConnectionStatusUpdated(DeviceSptr device, ConnectionStatus status);
+
+ /**
* @brief Disconnect from specified session.
*
* @param devcie_handle Device unique identifier.
@@ -306,6 +325,16 @@ class TransportAdapterImpl : public TransportAdapter,
const CommunicationError& error) OVERRIDE;
/**
+ * @brief Set state of specified connection - PENDING and launch
+ *OnConnectPending event in device adapter listener.
+ *
+ * @param devcie_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ */
+ void ConnectPending(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) OVERRIDE;
+
+ /**
* @brief Set state of specified connection - ESTABLISHED and launch
*OnConnectDone event in device adapter listener.
*
@@ -434,6 +463,10 @@ class TransportAdapterImpl : public TransportAdapter,
return TransportConfig();
}
+ void CreateDevice(const std::string& uid) OVERRIDE {
+ return;
+ }
+
/**
* @brief Return name of device.
*
@@ -533,6 +566,23 @@ class TransportAdapterImpl : public TransportAdapter,
TransportAdapter::Error ConnectDevice(DeviceSptr device);
/**
+ * @brief Reattempt the last failed connection to a device
+ */
+ void RetryConnection();
+
+ /**
+ * @brief Clear any retry timers which have been completed
+ */
+ void ClearCompletedTimers();
+
+ /**
+ * @brief Retrieve the next device available for a reattempted connection
+ * @return The handle first device with an expired retry timer if present,
+ * otherwise an empty string
+ */
+ DeviceUID GetNextRetryDevice();
+
+ /**
* @brief Remove specified device
* @param device_handle Device unique identifier.
*/
@@ -564,7 +614,7 @@ class TransportAdapterImpl : public TransportAdapter,
ConnectionSPtr connection;
DeviceUID device_id;
ApplicationHandle app_handle;
- enum { NEW, ESTABLISHED, FINALISING } state;
+ enum { NEW, ESTABLISHED, FINALISING, PENDING } state;
};
/**
@@ -594,6 +644,18 @@ class TransportAdapterImpl : public TransportAdapter,
ConnectionMap connections_;
/**
+ * @brief Queue of retry timers.
+ */
+ std::queue<std::pair<TimerSPtr, DeviceUID> > retry_timer_pool_;
+ sync_primitives::Lock retry_timer_pool_lock_;
+
+ /**
+ * @brief Queue of completed retry timers.
+ */
+ std::queue<std::pair<TimerSPtr, DeviceUID> > completed_timer_pool_;
+ sync_primitives::Lock completed_timer_pool_lock_;
+
+ /**
* @brief Mutex restricting access to connections map.
**/
mutable sync_primitives::RWLock connections_lock_;
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
index 4606bac2d4..a0e0a51c1e 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
@@ -92,6 +92,25 @@ class TransportAdapterListener {
const TransportAdapter* adapter) = 0;
/**
+ * @brief Reaction to connection status update
+ * @param adapter Current transport adapter
+ */
+ virtual void OnConnectionStatusUpdated(const TransportAdapter* adapter) = 0;
+
+ /**
+ * @brief Search specified device adapter in the container of shared pointers
+ * to device adapters to be sure it is available,
+ * launch event ON_CONNECT_PENDING in transport manager.
+ *
+ * @param device_adater Pointer to the device adapter.
+ * @param device_handle Device unique identifier.
+ * @param app_id Handle of application.
+ */
+ virtual void OnConnectPending(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id) = 0;
+
+ /**
* @brief Search specified device adapter in the container of shared pointers
*to device adapters to be sure it is available,
* launch event ON_CONNECT_DONE in transport manager.
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
index a744400279..0c9c6ef6a2 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
@@ -88,6 +88,24 @@ class TransportAdapterListenerImpl
virtual void OnFindNewApplicationsRequest(const TransportAdapter* adapter);
/**
+ * @brief Passes notification to that the cloud conection status has updated
+ */
+ virtual void OnConnectionStatusUpdated(const TransportAdapter* adapter);
+
+ /**
+ * @brief Search specified device adapter in the container of shared pointers
+ * to device adapters to be sure it is available,
+ * launch event ON_CONNECT_PENDING in transport manager.
+ *
+ * @param device_adater Pointer to the device adapter.
+ * @param device_handle Device unique identifier.
+ * @param app_id Handle of application.
+ */
+ virtual void OnConnectPending(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id);
+
+ /**
* @brief Search specified device adapter in the container of shared pointers
*to device adapters to be sure it is available,
* launch event ON_CONNECT_DONE in transport manager.
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
index c1df49f91b..4b75f4aaa8 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
@@ -43,7 +43,6 @@
#include <functional>
#include "utils/timer.h"
-#include "utils/timer_task_impl.h"
#include "utils/rwlock.h"
#include "transport_manager/transport_manager.h"
@@ -140,6 +139,11 @@ class TransportManagerImpl
**/
int SearchDevices() OVERRIDE;
+ void AddCloudDevice(const std::string& endpoint,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ void RemoveCloudDevice(const DeviceHandle device_id) OVERRIDE;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -150,6 +154,16 @@ class TransportManagerImpl
int ConnectDevice(const DeviceHandle device_id) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const OVERRIDE;
+
+ /**
* @brief Disconnect from all applications connected on device.
*
* @param device_id Handle of device to Disconnect from.
@@ -365,7 +379,7 @@ class TransportManagerImpl
* @brief Converter variable (Device ID -> Device Handle; Device Handle ->
* Device ID)
*/
- Handle2GUIDConverter converter_;
+ mutable Handle2GUIDConverter converter_;
#ifdef BUILD_TESTS
public:
@@ -380,7 +394,7 @@ class TransportManagerImpl
int connection_id_counter_;
sync_primitives::RWLock connections_lock_;
std::vector<ConnectionInternal> connections_;
- sync_primitives::RWLock device_to_adapter_map_lock_;
+ mutable sync_primitives::RWLock device_to_adapter_map_lock_;
typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap;
DeviceToAdapterMap device_to_adapter_map_;
std::vector<TransportAdapter*> transport_adapters_;
diff --git a/src/components/transport_manager/src/cloud/cloud_device.cc b/src/components/transport_manager/src/cloud/cloud_device.cc
new file mode 100644
index 0000000000..184fcc10cc
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_device.cc
@@ -0,0 +1,75 @@
+/*
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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 "transport_manager/cloud/cloud_device.h"
+
+#include "utils/logger.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudDevice::CloudDevice(std::string& host,
+ std::string& port,
+ std::string& name)
+ : Device(name, std::string(name)), host_(host), port_(port) {}
+
+bool CloudDevice::IsSameAs(const Device* other) const {
+ LOG4CXX_TRACE(logger_, "enter. device: " << other);
+
+ const CloudDevice* other_cloud_device =
+ dynamic_cast<const CloudDevice*>(other);
+
+ if (host_ != other_cloud_device->GetHost()) {
+ return false;
+ }
+ if (port_ != other_cloud_device->GetPort()) {
+ return false;
+ }
+ return true;
+}
+
+ApplicationList CloudDevice::GetApplicationList() const {
+ return ApplicationList{0};
+}
+
+const std::string& CloudDevice::GetHost() const {
+ return host_;
+}
+
+const std::string& CloudDevice::GetPort() const {
+ return port_;
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
new file mode 100644
index 0000000000..cdc27ed8ef
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
@@ -0,0 +1,81 @@
+/*
+ * \file cloud_websocket_connection_factory.cc
+ * \brief CloudWebsocketConnectionFactory class source file.
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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 "transport_manager/transport_adapter/transport_adapter_controller.h"
+#include "transport_manager/cloud/cloud_websocket_connection_factory.h"
+#include "transport_manager/cloud/websocket_client_connection.h"
+#include "utils/logger.h"
+
+#include "transport_manager/cloud/cloud_device.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudWebsocketConnectionFactory::CloudWebsocketConnectionFactory(
+ TransportAdapterController* controller)
+ : controller_(controller) {}
+
+TransportAdapter::Error CloudWebsocketConnectionFactory::Init() {
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection(
+ const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::shared_ptr<WebsocketClientConnection> connection =
+ std::make_shared<WebsocketClientConnection>(
+ device_uid, app_handle, controller_);
+ controller_->ConnectionCreated(connection, device_uid, app_handle);
+ TransportAdapter::Error error = connection->Start();
+ if (TransportAdapter::OK != error) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Cloud Websocket connection::Start() failed with error: " << error);
+ }
+ return error;
+}
+
+void CloudWebsocketConnectionFactory::Terminate() {}
+
+bool CloudWebsocketConnectionFactory::IsInitialised() const {
+ return true;
+}
+
+CloudWebsocketConnectionFactory::~CloudWebsocketConnectionFactory() {}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
new file mode 100644
index 0000000000..5093e6c2af
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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 "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "transport_manager/cloud/cloud_websocket_connection_factory.h"
+
+#include "transport_manager/cloud/cloud_device.h"
+#include "transport_manager/cloud/websocket_client_connection.h"
+
+#include <boost/regex.hpp>
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter(
+ resumption::LastState& last_state, const TransportManagerSettings& settings)
+ : TransportAdapterImpl(NULL,
+ new CloudWebsocketConnectionFactory(this),
+ NULL,
+ last_state,
+ settings) {}
+
+CloudWebsocketTransportAdapter::~CloudWebsocketTransportAdapter() {}
+
+DeviceType CloudWebsocketTransportAdapter::GetDeviceType() const {
+ return CLOUD_WEBSOCKET;
+}
+
+void CloudWebsocketTransportAdapter::Store() const {}
+
+bool CloudWebsocketTransportAdapter::Restore() {
+ return true;
+}
+
+void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
+ boost::regex pattern(
+ "(wss?):\\/\\/([A-Z\\d\\.-]{2,})\\.?([A-Z]{2,})?(:\\d{2,4})\\/",
+ boost::regex::icase);
+ std::string str = uid;
+ if (!boost::regex_match(str, pattern)) {
+ LOG4CXX_DEBUG(logger_, "Invalid Endpoint: " << uid);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Valid Endpoint: " << uid);
+
+ // Port after second colon in valid endpoint string
+ std::size_t pos_port = uid.find(":");
+ pos_port = uid.find(":", pos_port + 1);
+
+ // Extract host and port from endpoint string
+ boost::regex group_pattern(
+ "(wss?:\\/\\/)([A-Z\\d\\.-]{2,}\\.?([A-Z]{2,})?)(:)(\\d{2,4})(\\/)");
+ boost::smatch results;
+
+ std::string host = "";
+ std::string port = "";
+ if (boost::regex_search(str, results, group_pattern)) {
+ host = results[2];
+ port = results[5];
+
+ LOG4CXX_DEBUG(logger_,
+ "Results: " << results[0] << " " << results[1] << " "
+ << results[2] << " " << results[3] << " "
+ << results[4] << " " << results[5] << " ");
+ } else {
+ LOG4CXX_DEBUG(logger_, "Invalid Pattern: " << uid);
+ return;
+ }
+
+ std::string device_id = uid;
+
+ LOG4CXX_DEBUG(logger_,
+ "Creating Cloud Device For Host: " << host
+ << " and Port: " << port);
+
+ auto cloud_device = std::make_shared<CloudDevice>(host, port, device_id);
+
+ DeviceVector devices{cloud_device};
+
+ SearchDeviceDone(devices);
+
+ // Create connection object, do not start until app is activated
+ std::shared_ptr<WebsocketClientConnection> connection =
+ std::make_shared<WebsocketClientConnection>(uid, 0, this);
+
+ ConnectionCreated(connection, uid, 0);
+ ConnectPending(uid, 0);
+
+ return;
+}
+}
+}
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
new file mode 100644
index 0000000000..e001e8877d
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -0,0 +1,245 @@
+/*
+ *
+ * Copyright (c) 2018, 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 Ford Motor Company nor the names of its 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 "transport_manager/cloud/websocket_client_connection.h"
+#include "transport_manager/cloud/cloud_device.h"
+
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+#include "utils/logger.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+WebsocketClientConnection::WebsocketClientConnection(
+ const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ TransportAdapterController* controller)
+ : controller_(controller)
+ , resolver_(ioc_)
+ , ws_(ioc_)
+ , shutdown_(false)
+ , thread_delegate_(new LoopThreadDelegate(&message_queue_, this))
+ , write_thread_(threads::CreateThread("WS Async Send", thread_delegate_))
+ , device_uid_(device_uid)
+ , app_handle_(app_handle) {}
+
+WebsocketClientConnection::~WebsocketClientConnection() {
+ ioc_.stop();
+ if (io_service_thread_.joinable()) {
+ io_service_thread_.join();
+ }
+}
+
+TransportAdapter::Error WebsocketClientConnection::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DeviceSptr device = controller_->FindDevice(device_uid_);
+ CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get());
+ auto const host = cloud_device->GetHost();
+ auto const port = cloud_device->GetPort();
+ boost::system::error_code ec;
+ auto const results = resolver_.resolve(host, port, ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, "Could not resolve host/port: " << str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+ boost::asio::connect(ws_.next_layer(), results.begin(), results.end(), ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not connect to websocket: " << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+ ws_.handshake(host, "/", ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not complete handshake with host/port: " << host << ":"
+ << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+ ws_.binary(true);
+ write_thread_->start(threads::ThreadOptions());
+ controller_->ConnectDone(device_uid_, app_handle_);
+
+ // Start async read
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+
+ // Start IO Service thread. Allows for async reads without blocking.
+ io_service_thread_ = std::thread([&]() {
+ ioc_.run();
+ LOG4CXX_DEBUG(logger_, "Ending Boost IO Thread");
+ });
+
+ LOG4CXX_DEBUG(logger_,
+ "Successfully started websocket connection @: " << host << ":"
+ << port);
+
+ return TransportAdapter::OK;
+}
+
+void WebsocketClientConnection::Recv(boost::system::error_code ec) {
+ if (shutdown_) {
+ return;
+ }
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return;
+ }
+
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+}
+
+void WebsocketClientConnection::OnRead(boost::system::error_code ec,
+ std::size_t bytes_transferred) {
+ boost::ignore_unused(bytes_transferred);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ controller_->ConnectionAborted(
+ device_uid_, app_handle_, CommunicationError());
+ return;
+ }
+
+ std::string data_str = boost::beast::buffers_to_string(buffer_.data());
+ LOG4CXX_DEBUG(logger_, "Cloud Transport Received: " << data_str);
+
+ ssize_t size = (ssize_t)buffer_.size();
+ const uint8_t* data = boost::asio::buffer_cast<const uint8_t*>(
+ boost::beast::buffers_front(buffer_.data()));
+
+ ::protocol_handler::RawMessagePtr frame(
+ new protocol_handler::RawMessage(0, 0, data, size));
+
+ controller_->DataReceiveDone(device_uid_, app_handle_, frame);
+
+ buffer_.consume(buffer_.size());
+ Recv(ec);
+}
+
+TransportAdapter::Error WebsocketClientConnection::SendData(
+ ::protocol_handler::RawMessagePtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(frames_to_send_mutex_);
+ message_queue_.push(message);
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error WebsocketClientConnection::Disconnect() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Shutdown();
+ return TransportAdapter::OK;
+}
+
+void WebsocketClientConnection::Shutdown() {
+ shutdown_ = true;
+
+ if (thread_delegate_) {
+ thread_delegate_->SetShutdown();
+ write_thread_->join();
+ delete thread_delegate_;
+ }
+ if (buffer_.size()) {
+ buffer_.consume(buffer_.size());
+ }
+ controller_->DisconnectDone(device_uid_, app_handle_);
+}
+
+WebsocketClientConnection::LoopThreadDelegate::LoopThreadDelegate(
+ MessageQueue<Message, AsyncQueue>* message_queue,
+ WebsocketClientConnection* handler)
+ : message_queue_(*message_queue), handler_(*handler), shutdown_(false) {}
+
+void WebsocketClientConnection::LoopThreadDelegate::threadMain() {
+ while (!message_queue_.IsShuttingDown() && !shutdown_) {
+ DrainQueue();
+ message_queue_.wait();
+ }
+ DrainQueue();
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::exitThreadMain() {
+ shutdown_ = true;
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::DrainQueue() {
+ while (!message_queue_.empty()) {
+ Message message_ptr;
+ message_queue_.pop(message_ptr);
+ if (!shutdown_) {
+ boost::system::error_code ec;
+ handler_.ws_.write(
+ boost::asio::buffer(message_ptr->data(), message_ptr->data_size()));
+ if (ec) {
+ LOG4CXX_ERROR(logger_, "Error writing to websocket");
+ handler_.Shutdown();
+ handler_.controller_->DataSendFailed(handler_.device_uid_,
+ handler_.app_handle_,
+ message_ptr,
+ DataSendError());
+ }
+ }
+ }
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::SetShutdown() {
+ shutdown_ = true;
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index 346139cbd2..34d5a29abd 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -31,8 +31,9 @@
*/
#include "config_profile/profile.h"
-#include "utils/logger.h"
#include "utils/helpers.h"
+#include "utils/logger.h"
+#include "utils/timer_task_impl.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
#include "transport_manager/transport_adapter/transport_adapter_listener.h"
@@ -60,7 +61,9 @@ DeviceTypes devicesType = {
std::make_pair(DeviceType::IOS_USB_DEVICE_MODE,
std::string("USB_IOS_DEVICE_MODE")),
std::make_pair(DeviceType::IOS_CARPLAY_WIRELESS,
- std::string("CARPLAY_WIRELESS_IOS"))};
+ std::string("CARPLAY_WIRELESS_IOS")),
+ std::make_pair(DeviceType::CLOUD_WEBSOCKET,
+ std::string("CLOUD_WEBSOCKET"))};
}
TransportAdapterImpl::TransportAdapterImpl(
@@ -207,17 +210,21 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
}
connections_lock_.AcquireForWriting();
+
+ std::pair<DeviceUID, ApplicationHandle> connection_key =
+ std::make_pair(device_id, app_handle);
const bool already_exists =
- connections_.end() !=
- connections_.find(std::make_pair(device_id, app_handle));
+ connections_.end() != connections_.find(connection_key);
+ ConnectionInfo& info = connections_[connection_key];
if (!already_exists) {
- ConnectionInfo& info = connections_[std::make_pair(device_id, app_handle)];
info.app_handle = app_handle;
info.device_id = device_id;
info.state = ConnectionInfo::NEW;
}
+ const bool pending_app = ConnectionInfo::PENDING == info.state;
connections_lock_.Release();
- if (already_exists) {
+
+ if (already_exists && !pending_app) {
LOG4CXX_TRACE(logger_, "exit with ALREADY_EXISTS");
return ALREADY_EXISTS;
}
@@ -239,6 +246,33 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
DeviceSptr device = FindDevice(device_handle);
if (device) {
TransportAdapter::Error err = ConnectDevice(device);
+ if (FAIL == err && GetDeviceType() == DeviceType::CLOUD_WEBSOCKET) {
+ LOG4CXX_TRACE(logger_,
+ "Error occurred while connecting cloud app: " << err);
+ // Update retry count
+ if (device->retry_count() >=
+ get_settings().cloud_app_max_retry_attempts()) {
+ device->reset_retry_count();
+ ConnectionStatusUpdated(device, ConnectionStatus::PENDING);
+ return err;
+ } else if (device->connection_status() == ConnectionStatus::PENDING) {
+ ConnectionStatusUpdated(device, ConnectionStatus::RETRY);
+ }
+
+ device->next_retry();
+
+ // Start timer for next retry
+ TimerSPtr retry_timer(std::make_shared<timer::Timer>(
+ "RetryConnectionTimer",
+ new timer::TimerTaskImpl<TransportAdapterImpl>(
+ this, &TransportAdapterImpl::RetryConnection)));
+ sync_primitives::AutoLock locker(retry_timer_pool_lock_);
+ retry_timer_pool_.push(std::make_pair(retry_timer, device_handle));
+ retry_timer->Start(get_settings().cloud_app_retry_timeout(),
+ timer::kSingleShot);
+ } else if (OK == err) {
+ ConnectionStatusUpdated(device, ConnectionStatus::CONNECTED);
+ }
LOG4CXX_TRACE(logger_, "exit with error: " << err);
return err;
} else {
@@ -247,6 +281,60 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
}
}
+void TransportAdapterImpl::RetryConnection() {
+ ClearCompletedTimers();
+ const DeviceUID device_id = GetNextRetryDevice();
+ if (device_id.empty()) {
+ LOG4CXX_ERROR(logger_,
+ "Unable to find timer, ignoring RetryConnection request");
+ return;
+ }
+ ConnectDevice(device_id);
+}
+
+void TransportAdapterImpl::ClearCompletedTimers() {
+ // Cleanup any retry timers which have completed execution
+ sync_primitives::AutoLock locker(completed_timer_pool_lock_);
+ while (!completed_timer_pool_.empty()) {
+ auto timer_entry = completed_timer_pool_.front();
+ if (timer_entry.first->is_completed()) {
+ completed_timer_pool_.pop();
+ }
+ }
+}
+
+DeviceUID TransportAdapterImpl::GetNextRetryDevice() {
+ sync_primitives::AutoLock retry_locker(retry_timer_pool_lock_);
+ if (retry_timer_pool_.empty()) {
+ return std::string();
+ }
+ auto timer_entry = retry_timer_pool_.front();
+ retry_timer_pool_.pop();
+
+ // Store reference for cleanup later
+ sync_primitives::AutoLock completed_locker(completed_timer_pool_lock_);
+ completed_timer_pool_.push(timer_entry);
+
+ return timer_entry.second;
+}
+
+ConnectionStatus TransportAdapterImpl::GetConnectionStatus(
+ const DeviceUID& device_handle) const {
+ DeviceSptr device = FindDevice(device_handle);
+ return device.use_count() == 0 ? ConnectionStatus::INVALID
+ : device->connection_status();
+}
+
+void TransportAdapterImpl::ConnectionStatusUpdated(DeviceSptr device,
+ ConnectionStatus status) {
+ device->set_connection_status(status);
+ for (TransportAdapterListenerList::iterator it = listeners_.begin();
+ it != listeners_.end();
+ ++it) {
+ (*it)->OnConnectionStatusUpdated(this);
+ }
+}
+
TransportAdapter::Error TransportAdapterImpl::Disconnect(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
LOG4CXX_TRACE(logger_,
@@ -276,6 +364,8 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice(
}
Error error = OK;
+ DeviceSptr device = FindDevice(device_id);
+ ConnectionStatusUpdated(device, ConnectionStatus::CLOSING);
std::vector<ConnectionInfo> to_disconnect;
connections_lock_.AcquireForReading();
@@ -395,6 +485,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
LOG4CXX_TRACE(logger_, "exit with TRUE. Condition: same_device_found");
return existing_device;
} else {
+ device->set_connection_status(ConnectionStatus::PENDING);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
@@ -743,6 +834,24 @@ DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
return ret;
}
+void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
+ const ApplicationHandle& app_handle) {
+ connections_lock_.AcquireForReading();
+ ConnectionMap::iterator it_conn =
+ connections_.find(std::make_pair(device_id, app_handle));
+ if (it_conn != connections_.end()) {
+ ConnectionInfo& info = it_conn->second;
+ info.state = ConnectionInfo::PENDING;
+ }
+ connections_lock_.Release();
+
+ for (TransportAdapterListenerList::iterator it = listeners_.begin();
+ it != listeners_.end();
+ ++it) {
+ (*it)->OnConnectPending(this, device_id, app_handle);
+ }
+}
+
void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id,
const ApplicationHandle& app_handle) {
LOG4CXX_TRACE(logger_,
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
index 544cdde999..4ef685adbc 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
@@ -116,6 +116,44 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest(
LOG4CXX_TRACE(logger_, "exit");
}
+void TransportAdapterListenerImpl::OnConnectionStatusUpdated(
+ const TransportAdapter* adapter) {
+ LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ const TransportAdapterEvent event(EventTypeEnum::ON_CONNECTION_STATUS_UPDATED,
+ transport_adapter_,
+ "",
+ 0,
+ ::protocol_handler::RawMessagePtr(),
+ BaseErrorPtr(new BaseError()));
+ if (transport_manager_ != NULL &&
+ transport_manager::E_SUCCESS !=
+ transport_manager_->ReceiveEventFromDevice(event)) {
+ LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ }
+ LOG4CXX_TRACE(logger_, "exit");
+}
+
+void TransportAdapterListenerImpl::OnConnectPending(
+ const TransportAdapter* adapter,
+ const DeviceUID& device,
+ const ApplicationHandle& application_id) {
+ LOG4CXX_TRACE(logger_,
+ "enter adapter*: " << adapter << ", device: " << &device
+ << ", application_id: " << &application_id);
+ const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_PENDING,
+ transport_adapter_,
+ device,
+ application_id,
+ ::protocol_handler::RawMessagePtr(),
+ BaseErrorPtr(new BaseError()));
+ if (transport_manager_ != NULL &&
+ transport_manager::E_SUCCESS !=
+ transport_manager_->ReceiveEventFromDevice(event)) {
+ LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ }
+ LOG4CXX_TRACE(logger_, "exit");
+}
+
void TransportAdapterListenerImpl::OnConnectDone(
const TransportAdapter* adapter,
const DeviceUID& device,
diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index 196ad09af4..bf692de24c 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -44,6 +44,10 @@
#include "transport_manager/usb/usb_aoa_adapter.h"
#endif // USB_SUPPORT
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#endif
+
#if defined(BUILD_TESTS)
#include "transport_manager/iap2_emulation/iap2_transport_adapter.h"
#endif // BUILD_TEST
@@ -101,6 +105,20 @@ int TransportManagerDefault::Init(resumption::LastState& last_state) {
ta_usb = NULL;
#endif // USB_SUPPORT
+#if defined CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+ transport_adapter::TransportAdapterImpl* ta_cloud =
+ new transport_adapter::CloudWebsocketTransportAdapter(
+ last_state, get_settings()); // Todo add retry connection logic from
+ // ini to initializer.
+#ifdef TELEMETRY_MONITOR
+ if (metric_observer_) {
+ ta_cloud->SetTelemetryObserver(metric_observer_);
+ }
+#endif // TELEMETRY_MONITOR
+ AddTransportAdapter(ta_cloud);
+ ta_cloud = NULL;
+#endif
+
#if defined BUILD_TESTS
const uint16_t iap2_bt_emu_port = 23456;
transport_adapter::IAP2BluetoothEmulationTransportAdapter*
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index 2b0296debb..301132d26f 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -129,6 +129,30 @@ void TransportManagerImpl::ReconnectionTimeout() {
device_to_reconnect_);
}
+void TransportManagerImpl::AddCloudDevice(
+ const std::string& endpoint, const std::string& cloud_transport_type) {
+ // todo put conversion into own function
+ transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN;
+ if (cloud_transport_type == "WS") {
+ type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
+ } else {
+ return;
+ }
+
+ std::vector<TransportAdapter*>::iterator ta = transport_adapters_.begin();
+ for (; ta != transport_adapters_.end(); ++ta) {
+ if ((*ta)->GetDeviceType() == type) {
+ (*ta)->CreateDevice(endpoint);
+ }
+ }
+
+ return;
+}
+
+void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
+ DisconnectDevice(device_handle);
+}
+
int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
@@ -157,6 +181,22 @@ int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
return err;
}
+ConnectionStatus TransportManagerImpl::GetConnectionStatus(
+ const DeviceHandle& device_handle) const {
+ DeviceUID device_id = converter_.HandleToUid(device_handle);
+
+ sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
+ DeviceToAdapterMap::const_iterator it =
+ device_to_adapter_map_.find(device_id);
+ if (it == device_to_adapter_map_.end()) {
+ LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_handle);
+ LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
+ return ConnectionStatus::INVALID;
+ }
+ transport_adapter::TransportAdapter* ta = it->second;
+ return ta->GetConnectionStatus(device_id);
+}
+
int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
@@ -954,7 +994,12 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST");
break;
}
- case EventTypeEnum::ON_CONNECT_DONE: {
+ case EventTypeEnum::ON_CONNECTION_STATUS_UPDATED: {
+ RaiseEvent(&TransportManagerListener::OnConnectionStatusUpdated);
+ LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECTION_STATUS_UPDATED");
+ break;
+ }
+ case EventTypeEnum::ON_CONNECT_PENDING: {
const DeviceHandle device_handle = converter_.UidToHandle(
event.device_uid, event.transport_adapter->GetConnectionType());
AddConnection(ConnectionInternal(this,
@@ -964,12 +1009,55 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
event.application_id,
device_handle));
RaiseEvent(
- &TransportManagerListener::OnConnectionEstablished,
+ &TransportManagerListener::OnConnectionPending,
DeviceInfo(device_handle,
event.device_uid,
event.transport_adapter->DeviceName(event.device_uid),
event.transport_adapter->GetConnectionType()),
connection_id_counter_);
+ LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_PENDING");
+ break;
+ }
+ case EventTypeEnum::ON_CONNECT_DONE: {
+ const DeviceHandle device_handle = converter_.UidToHandle(
+ event.device_uid, event.transport_adapter->GetConnectionType());
+
+ int connection_id = 0;
+ std::vector<ConnectionInternal>::iterator it = connections_.begin();
+ std::vector<ConnectionInternal>::iterator end = connections_.end();
+ for (; it != end; ++it) {
+ if (it->transport_adapter != event.transport_adapter) {
+ continue;
+ } else if (it->Connection::device != event.device_uid) {
+ continue;
+ } else if (it->Connection::application != event.application_id) {
+ continue;
+ } else if (it->device_handle_ != device_handle) {
+ continue;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Connection Object Already Exists");
+ connection_id = it->Connection::id;
+ break;
+ }
+ }
+
+ if (it == end) {
+ AddConnection(ConnectionInternal(this,
+ event.transport_adapter,
+ ++connection_id_counter_,
+ event.device_uid,
+ event.application_id,
+ device_handle));
+ connection_id = connection_id_counter_;
+ }
+
+ RaiseEvent(
+ &TransportManagerListener::OnConnectionEstablished,
+ DeviceInfo(device_handle,
+ event.device_uid,
+ event.transport_adapter->DeviceName(event.device_uid),
+ event.transport_adapter->GetConnectionType()),
+ connection_id);
LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE");
break;
}
diff --git a/src/components/transport_manager/test/CMakeLists.txt b/src/components/transport_manager/test/CMakeLists.txt
index 240784436b..5288d8c697 100644
--- a/src/components/transport_manager/test/CMakeLists.txt
+++ b/src/components/transport_manager/test/CMakeLists.txt
@@ -75,6 +75,11 @@ if (BUILD_BT_SUPPORT)
endif()
endif()
+if(BUILD_CLOUD_APP_SUPPORT)
+ GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+ list(APPEND LIBRARIES boost_system boost_regex crypto ssl -L${BOOST_LIBS_DIRECTORY})
+endif()
+
create_test("transport_manager_test" "${SOURCES}" "${LIBRARIES}")
file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
index 58e143342a..4eaf34d041 100644
--- a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
@@ -56,6 +56,9 @@ class MockTransportManagerListener : public TransportManagerListener {
MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
MOCK_METHOD0(OnScanDevicesFinished, void());
MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
+ MOCK_METHOD2(OnConnectionPending,
+ void(const DeviceInfo& device_info,
+ const ConnectionUID connection_id));
MOCK_METHOD2(OnConnectionEstablished,
void(const DeviceInfo& device_info,
const ConnectionUID connection_id));
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
index 384f55605a..3a1422cee1 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
@@ -36,6 +36,8 @@
#include "gmock/gmock.h"
#include "transport_manager/transport_manager_settings.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/transport_adapter/device.h"
+#include "transport_manager/common.h"
using ::transport_manager::transport_adapter::TransportAdapterImpl;
using ::transport_manager::transport_adapter::DeviceScanner;
@@ -70,15 +72,17 @@ class MockTransportAdapterImpl : public TransportAdapterImpl {
}
virtual ~MockTransportAdapterImpl() {}
- virtual DeviceType GetDeviceType() const {
- return DeviceType::UNKNOWN;
- }
-
MOCK_CONST_METHOD0(Store, void());
MOCK_METHOD0(Restore, bool());
MOCK_CONST_METHOD1(FindDevice,
transport_manager::transport_adapter::DeviceSptr(
const DeviceUID& device_id));
+ MOCK_METHOD2(ConnectionStatusUpdated,
+ void(transport_manager::transport_adapter::DeviceSptr device,
+ ::transport_manager::ConnectionStatus status));
+ MOCK_CONST_METHOD0(GetDeviceType,
+ ::transport_manager::transport_adapter::DeviceType());
+ MOCK_METHOD0(RetryConnection, void());
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
index dce23189c8..f7bebf69c3 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
@@ -59,6 +59,12 @@ class MockTransportAdapterListener : public TransportAdapterListener {
const SearchDeviceError& error));
MOCK_METHOD1(OnFindNewApplicationsRequest,
void(const TransportAdapter* adapter));
+ MOCK_METHOD1(OnConnectionStatusUpdated,
+ void(const TransportAdapter* adapter));
+ MOCK_METHOD3(OnConnectPending,
+ void(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id));
MOCK_METHOD1(OnDeviceListUpdated,
void(const TransportAdapter* transport_adapter));
MOCK_METHOD3(OnConnectDone,
diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc
index 5205d6ae3c..f44f8785aa 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -73,6 +73,9 @@ class MockTransportAdapterController : public TransportAdapterController {
void(ConnectionSPtr connection,
const DeviceUID& device_handle,
const ApplicationHandle& app_handle));
+ MOCK_METHOD2(ConnectPending,
+ void(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle));
MOCK_METHOD2(ConnectDone,
void(const DeviceUID& device_handle,
const ApplicationHandle& app_handle));
diff --git a/src/components/transport_manager/test/transport_adapter_test.cc b/src/components/transport_manager/test/transport_adapter_test.cc
index 9e602332c6..dafabf4504 100644
--- a/src/components/transport_manager/test/transport_adapter_test.cc
+++ b/src/components/transport_manager/test/transport_adapter_test.cc
@@ -31,14 +31,15 @@
*/
#include "gtest/gtest.h"
-#include "transport_manager/transport_adapter/mock_device_scanner.h"
+#include "transport_manager/mock_transport_manager_settings.h"
#include "transport_manager/transport_adapter/mock_client_connection_listener.h"
-#include "transport_manager/transport_adapter/mock_server_connection_factory.h"
-#include "transport_manager/transport_adapter/mock_device.h"
#include "transport_manager/transport_adapter/mock_connection.h"
-#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
+#include "transport_manager/transport_adapter/mock_device.h"
+#include "transport_manager/transport_adapter/mock_device_scanner.h"
+#include "transport_manager/transport_adapter/mock_server_connection_factory.h"
#include "transport_manager/transport_adapter/mock_transport_adapter_impl.h"
-#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
+#include "utils/test_async_waiter.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
#include "transport_manager/transport_adapter/transport_adapter_listener.h"
@@ -73,6 +74,11 @@ class TransportAdapterTest : public ::testing::Test {
.WillByDefault(Return(true));
}
+ void SetDefaultExpectations(MockTransportAdapterImpl& adapter) {
+ ON_CALL(adapter, GetDeviceType())
+ .WillByDefault(Return(DeviceType::UNKNOWN));
+ }
+
NiceMock<MockTransportManagerSettings> transport_manager_settings;
resumption::LastStateImpl last_state_;
std::string dev_id;
@@ -89,6 +95,7 @@ TEST_F(TransportAdapterTest, Init) {
clientMock,
last_state_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -123,6 +130,7 @@ TEST_F(TransportAdapterTest, SearchDevices_DeviceNotInitialized) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockTransportAdapterImpl transport_adapter(
dev_mock, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -138,6 +146,7 @@ TEST_F(TransportAdapterTest, SearchDevices_DeviceInitialized) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockTransportAdapterImpl transport_adapter(
dev_mock, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -153,6 +162,7 @@ TEST_F(TransportAdapterTest, SearchDevices_DeviceInitialized) {
TEST_F(TransportAdapterTest, SearchDeviceDone_DeviceExisting) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -169,6 +179,7 @@ TEST_F(TransportAdapterTest, SearchDeviceDone_DeviceExisting) {
TEST_F(TransportAdapterTest, SearchDeviceFailed) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -183,6 +194,7 @@ TEST_F(TransportAdapterTest, SearchDeviceFailed) {
TEST_F(TransportAdapterTest, AddDevice) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -200,6 +212,7 @@ TEST_F(TransportAdapterTest, Connect_ServerNotSupported) {
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
MockTransportAdapterImpl transport_adapter(
NULL, NULL, clientMock, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -217,6 +230,7 @@ TEST_F(TransportAdapterTest, Connect_ServerNotInitialized) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -234,6 +248,7 @@ TEST_F(TransportAdapterTest, Connect_Success) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -252,6 +267,7 @@ TEST_F(TransportAdapterTest, Connect_DeviceAddedTwice) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -274,6 +290,7 @@ TEST_F(TransportAdapterTest, Connect_DeviceAddedTwice) {
TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -292,12 +309,14 @@ TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) {
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::FAIL, res);
+ EXPECT_NE(ConnectionStatus::CONNECTED, mockdev->connection_status());
}
TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -318,6 +337,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -341,14 +361,53 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
}
+TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded_ConnectFailedRetry) {
+ MockServerConnectionFactory* server_mock = new MockServerConnectionFactory();
+ MockTransportAdapterImpl transport_adapter(
+ NULL, server_mock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+
+ EXPECT_CALL(*server_mock, Init()).WillOnce(Return(TransportAdapter::OK));
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ transport_adapter.AddDevice(mockdev);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+
+ int app_handle = 1;
+ std::vector<int> int_list = {app_handle};
+ EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(int_list));
+
+ EXPECT_CALL(*server_mock, IsInitialised()).WillOnce(Return(true));
+ EXPECT_CALL(*server_mock, CreateConnection(uniq_id, app_handle))
+ .WillOnce(Return(TransportAdapter::FAIL));
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, GetDeviceType())
+ .WillOnce(Return(DeviceType::CLOUD_WEBSOCKET));
+ EXPECT_CALL(transport_manager_settings, cloud_app_max_retry_attempts())
+ .WillOnce(Return(0));
+ TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
+ EXPECT_EQ(TransportAdapter::FAIL, res);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ EXPECT_CALL(*server_mock, Terminate());
+}
+
TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -372,6 +431,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
// Try to connect device second time
@@ -382,6 +442,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error newres = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, newres);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
}
@@ -390,6 +451,7 @@ TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -420,6 +482,7 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -439,9 +502,11 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true));
EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id))
+ .WillRepeatedly(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle);
@@ -451,6 +516,7 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
TransportAdapter::Error new_res = transport_adapter.DisconnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, new_res);
+ EXPECT_EQ(ConnectionStatus::CLOSING, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
}
@@ -459,6 +525,7 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -484,6 +551,7 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) {
.WillOnce(Return(TransportAdapter::OK));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
std::shared_ptr<MockConnection> mock_connection =
std::make_shared<MockConnection>();
@@ -507,6 +575,7 @@ TEST_F(TransportAdapterTest, AbortedConnectSuccess) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -533,6 +602,7 @@ TEST_F(TransportAdapterTest, SendData) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
dev_mock, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -574,6 +644,7 @@ TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) {
clientMock,
last_state_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -609,6 +680,7 @@ TEST_F(TransportAdapterTest, StartClientListening_ClientNotInitialized) {
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
MockTransportAdapterImpl transport_adapter(
dev_mock, NULL, clientMock, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -630,6 +702,7 @@ TEST_F(TransportAdapterTest, StartClientListening) {
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
MockTransportAdapterImpl transport_adapter(
dev_mock, NULL, clientMock, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -656,6 +729,7 @@ TEST_F(TransportAdapterTest, StopClientListening_Success) {
clientMock,
last_state_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -690,6 +764,7 @@ TEST_F(TransportAdapterTest, FindNewApplicationsRequest) {
clientMock,
last_state_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -711,6 +786,7 @@ TEST_F(TransportAdapterTest, FindNewApplicationsRequest) {
TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -735,6 +811,7 @@ TEST_F(TransportAdapterTest, FindEstablishedConnection) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -764,6 +841,7 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_NoDeviseWithAskedId_UNSUCCESS) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
std::shared_ptr<MockDevice> mock_device =
std::make_shared<MockDevice>("test_device_name", "test_device_uid0");
@@ -783,6 +861,7 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_DeviseWithAskedIdWasFound_SUCCESS) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
std::shared_ptr<MockDevice> mock_device =
std::make_shared<MockDevice>("test_device_name", device_uid);
@@ -814,6 +893,7 @@ TEST_F(TransportAdapterTest, StopDevice) {
TEST_F(TransportAdapterTest, TransportConfigUpdated) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -832,6 +912,7 @@ TEST_F(TransportAdapterTest, TransportConfigUpdated) {
TEST_F(TransportAdapterTest, GetTransportConfigration) {
MockTransportAdapterImpl transport_adapter(
NULL, NULL, NULL, last_state_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
diff --git a/src/components/utils/include/utils/timer.h b/src/components/utils/include/utils/timer.h
index e391db992c..b012b97e6a 100644
--- a/src/components/utils/include/utils/timer.h
+++ b/src/components/utils/include/utils/timer.h
@@ -102,6 +102,8 @@ class Timer {
*/
bool is_running() const;
+ bool is_completed() const;
+
/**
* @brief Gets current timer timeout
* @return Current timeout in milliseconds.
@@ -119,7 +121,7 @@ class Timer {
* @brief Constructor
* @param timer Timer instance pointer for callback calling
*/
- TimerDelegate(const Timer* timer, sync_primitives::Lock& state_lock_ref);
+ TimerDelegate(Timer* timer, sync_primitives::Lock& state_lock_ref);
/**
* @brief Sets timer timeout
@@ -161,7 +163,7 @@ class Timer {
void exitThreadMain() OVERRIDE;
private:
- const Timer* timer_;
+ Timer* timer_;
Milliseconds timeout_;
/**
@@ -187,13 +189,13 @@ class Timer {
* Not thread-safe
* @param timeout Timer timeout
*/
- void StartDelegate(const Milliseconds timeout) const;
+ void StartDelegate(const Milliseconds timeout);
/**
* @brief Sets up timer delegate to stop state.
* Not thread-safe
*/
- void StopDelegate() const;
+ void StopDelegate();
/**
* @brief Starts timer thread.
@@ -211,14 +213,14 @@ class Timer {
* @brief Callback called on timeout.
* Not thread-safe
*/
- void OnTimeout() const;
+ void OnTimeout();
const std::string name_;
TimerTask* task_;
mutable sync_primitives::Lock state_lock_;
- mutable std::unique_ptr<TimerDelegate> delegate_;
+ std::unique_ptr<TimerDelegate> delegate_;
threads::Thread* thread_;
/**
@@ -226,6 +228,8 @@ class Timer {
*/
bool single_shot_;
+ bool completed_flag_;
+
DISALLOW_COPY_AND_ASSIGN(Timer);
};
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index b819b56f54..68693dfc55 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -49,7 +49,8 @@ timer::Timer::Timer(const std::string& name, TimerTask* task)
, state_lock_()
, delegate_(new TimerDelegate(this, state_lock_))
, thread_(threads::CreateThread(name_.c_str(), delegate_.get()))
- , single_shot_(true) {
+ , single_shot_(true)
+ , completed_flag_(false) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(!name_.empty());
DCHECK(task_);
@@ -76,6 +77,7 @@ void timer::Timer::Start(const Milliseconds timeout,
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(state_lock_);
StopThread();
+ completed_flag_ = false;
switch (timer_type) {
case kSingleShot: {
single_shot_ = true;
@@ -106,17 +108,21 @@ bool timer::Timer::is_running() const {
return !delegate_->stop_flag();
}
+bool timer::Timer::is_completed() const {
+ return completed_flag_;
+}
+
timer::Milliseconds timer::Timer::timeout() const {
sync_primitives::AutoLock auto_lock(state_lock_);
return delegate_->timeout();
}
-void timer::Timer::StartDelegate(const Milliseconds timeout) const {
+void timer::Timer::StartDelegate(const Milliseconds timeout) {
delegate_->set_stop_flag(false);
delegate_->set_timeout(timeout);
}
-void timer::Timer::StopDelegate() const {
+void timer::Timer::StopDelegate() {
delegate_->set_stop_flag(true);
delegate_->set_timeout(0);
}
@@ -148,7 +154,7 @@ void timer::Timer::StopThread() {
}
}
-void timer::Timer::OnTimeout() const {
+void timer::Timer::OnTimeout() {
{
sync_primitives::AutoLock auto_lock(state_lock_);
if (single_shot_) {
@@ -158,10 +164,11 @@ void timer::Timer::OnTimeout() const {
DCHECK_OR_RETURN_VOID(task_);
task_->run();
+ completed_flag_ = true;
}
timer::Timer::TimerDelegate::TimerDelegate(
- const Timer* timer, sync_primitives::Lock& state_lock_ref)
+ Timer* timer, sync_primitives::Lock& state_lock_ref)
: timer_(timer)
, timeout_(0)
, stop_flag_(true)