summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-04-17 09:21:57 -0400
committerGitHub <noreply@github.com>2019-04-17 09:21:57 -0400
commit4e09fc9eabcfccb1a7cc6f13c34a1028d4abc75f (patch)
tree27d377975eef39ab4030fa26ad25dc41e86bbd24
parent49c7864f63268b3b314bf98e9c47a4c0b3613573 (diff)
parent9b3d77829b5241a7b23bfbe450d69036d41d5d91 (diff)
downloadsdl_core-4e09fc9eabcfccb1a7cc6f13c34a1028d4abc75f.tar.gz
Merge pull request #2853 from smartdevicelink/release/5.1.05.1.0
Release/5.1.0
-rw-r--r--.github/ISSUE_TEMPLATE.md4
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md4
-rw-r--r--.travis.yml2
-rw-r--r--CMakeLists.txt9
-rw-r--r--src/3rd_party/CMakeLists.txt12
-rw-r--r--src/appMain/CMakeLists.txt1
-rwxr-xr-xsrc/appMain/hmi_capabilities.json8
-rw-r--r--src/appMain/life_cycle_impl.cc2
-rw-r--r--src/appMain/main.cc2
-rw-r--r--src/appMain/sdl_preloaded_pt.json134
-rw-r--r--src/appMain/smartDeviceLink.ini16
-rw-r--r--src/appMain/test/low_voltage_signals_handler_test.cc12
-rw-r--r--src/components/application_manager/CMakeLists.txt1
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h255
-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.h126
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h7
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h1
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h30
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h73
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h73
-rw-r--r--src/components/application_manager/include/application_manager/commands/notification_from_hmi.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_from_hmi.h50
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event.h105
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h36
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h51
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_observer.h35
-rw-r--r--src/components/application_manager/include/application_manager/helpers/application_helper.h12
-rw-r--r--src/components/application_manager/include/application_manager/hmi_interfaces.h3
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h2
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h14
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h48
-rw-r--r--src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h1
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h87
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h1
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h3
-rw-r--r--src/components/application_manager/include/application_manager/rpc_handler_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/rpc_passing_handler.h123
-rw-r--r--src/components/application_manager/include/application_manager/rpc_service_impl.h13
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h41
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h1
-rw-r--r--src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h2
-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.txt84
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h131
-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.h73
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h98
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h99
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h80
-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.h79
-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.h79
-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.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_from_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h89
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h80
-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.h80
-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.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h89
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc122
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc77
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc191
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc159
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc89
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc126
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc164
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc76
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc129
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc84
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc188
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc126
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt40
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc151
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc135
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc217
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h84
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h16
-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/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h83
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc167
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc4
-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/get_cloud_app_properties_request.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc356
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc177
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc200
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc43
-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/commands/mobile/system_request.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc140
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc38
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc89
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc38
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc7
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_db.cc2
-rw-r--r--src/components/application_manager/src/app_service_manager.cc555
-rw-r--r--src/components/application_manager/src/application_impl.cc50
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc637
-rw-r--r--src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc24
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc127
-rw-r--r--src/components/application_manager/src/commands/command_request_to_mobile.cc72
-rw-r--r--src/components/application_manager/src/commands/command_response_from_mobile.cc71
-rw-r--r--src/components/application_manager/src/commands/notification_from_hmi.cc20
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc213
-rw-r--r--src/components/application_manager/src/event_engine/event.cc12
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher_impl.cc72
-rw-r--r--src/components/application_manager/src/event_engine/event_observer.cc23
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc18
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc12
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc4
-rw-r--r--src/components/application_manager/src/hmi_state.cc36
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc113
-rw-r--r--src/components/application_manager/src/plugin_manager/plugin_keys.cc14
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc219
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc16
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc2
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc120
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc441
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc160
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc41
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc5
-rw-r--r--src/components/application_manager/src/system_time/system_time_handler_impl.cc4
-rwxr-xr-xsrc/components/application_manager/test/CMakeLists.txt1
-rw-r--r--src/components/application_manager/test/app_service_manager_test.cc439
-rw-r--r--src/components/application_manager/test/application_impl_test.cc8
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc271
-rw-r--r--src/components/application_manager/test/command_holder_test.cc14
-rw-r--r--src/components/application_manager/test/commands/CMakeLists.txt1
-rw-r--r--src/components/application_manager/test/commands/command_impl_test.cc11
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc92
-rw-r--r--src/components/application_manager/test/help_prompt_manager_test.cc9
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc2
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/command_request_test.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_app_service_manager.h95
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h15
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h20
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h8
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt1
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc11
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc17
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc168
-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.json12
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc141
-rw-r--r--src/components/config_profile/CMakeLists.txt1
-rw-r--r--src/components/config_profile/include/config_profile/profile.h20
-rw-r--r--src/components/config_profile/src/profile.cc101
-rw-r--r--src/components/connection_handler/CMakeLists.txt1
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h46
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc113
-rw-r--r--src/components/formatters/CMakeLists.txt1
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h10
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h10
-rw-r--r--src/components/formatters/include/formatters/CSmartFactory.h8
-rw-r--r--src/components/formatters/include/formatters/formatter_json_rpc.h6
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv1.cc12
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv2.cc12
-rw-r--r--src/components/formatters/src/formatter_json_rpc.cc6
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc2
-rw-r--r--src/components/include/application_manager/application_manager.h35
-rw-r--r--src/components/include/application_manager/application_manager_settings.h5
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h86
-rw-r--r--src/components/include/application_manager/policies/policy_handler_observer.h3
-rw-r--r--src/components/include/application_manager/rpc_handler.h5
-rw-r--r--src/components/include/application_manager/rpc_service.h15
-rw-r--r--src/components/include/connection_handler/connection_handler.h26
-rw-r--r--src/components/include/connection_handler/connection_handler_observer.h11
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h10
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h113
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_listener.h10
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h114
-rw-r--r--src/components/include/protocol/bson_object_keys.h1
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h46
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h7
-rw-r--r--src/components/include/test/application_manager/mock_rpc_service.h9
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h26
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_observer.h3
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h11
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h8
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h35
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h3
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h35
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h36
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h3
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h35
-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.h23
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter_event.h4
-rw-r--r--src/components/include/transport_manager/transport_manager.h16
-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/CMakeLists.txt1
-rw-r--r--src/components/interfaces/HMI_API.xml678
-rw-r--r--src/components/interfaces/MOBILE_API.xml759
-rw-r--r--src/components/media_manager/CMakeLists.txt1
-rw-r--r--src/components/policy/policy_external/CMakeLists.txt1
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h111
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h113
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h117
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h48
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h60
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml22
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_queries.h9
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_representation.h6
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc182
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc94
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc88
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc220
-rw-r--r--src/components/policy/policy_external/src/policy_table/validation.cc8
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_queries.cc12
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc70
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc115
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc225
-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.json12
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_test.cc31
-rw-r--r--src/components/policy/policy_external/test/sql_pt_representation_test.cc4
-rw-r--r--src/components/policy/policy_regular/CMakeLists.txt1
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h111
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h112
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h118
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h47
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h61
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_queries.h9
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_representation.h7
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc184
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc96
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc114
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc210
-rw-r--r--src/components/policy/policy_regular/src/policy_table/validation.cc8
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc116
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc223
-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/policy_manager_impl_test.cc31
-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.cc43
-rw-r--r--src/components/policy/policy_regular/test/valid_sdl_pt_update.json12
-rw-r--r--src/components/protocol/src/bson_object_keys.cc1
-rw-r--r--src/components/protocol_handler/CMakeLists.txt1
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h14
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc66
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc222
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h1
-rw-r--r--src/components/security_manager/CMakeLists.txt1
-rw-r--r--src/components/smart_objects/CMakeLists.txt1
-rw-r--r--src/components/smart_objects/include/smart_objects/always_false_schema_item.h13
-rw-r--r--src/components/smart_objects/include/smart_objects/always_true_schema_item.h13
-rw-r--r--src/components/smart_objects/include/smart_objects/array_schema_item.h24
-rw-r--r--src/components/smart_objects/include/smart_objects/default_shema_item.h16
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h41
-rw-r--r--src/components/smart_objects/include/smart_objects/number_schema_item.h16
-rw-r--r--src/components/smart_objects/include/smart_objects/object_schema_item.h23
-rw-r--r--src/components/smart_objects/include/smart_objects/schema_item.h19
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h7
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_schema.h23
-rw-r--r--src/components/smart_objects/include/smart_objects/string_schema_item.h13
-rw-r--r--src/components/smart_objects/src/always_false_schema_item.cc3
-rw-r--r--src/components/smart_objects/src/always_true_schema_item.cc3
-rw-r--r--src/components/smart_objects/src/array_schema_item.cc15
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc25
-rw-r--r--src/components/smart_objects/src/schema_item.cc8
-rw-r--r--src/components/smart_objects/src/smart_object.cc9
-rw-r--r--src/components/smart_objects/src/smart_schema.cc15
-rw-r--r--src/components/smart_objects/src/string_schema_item.cc3
-rw-r--r--src/components/telemetry_monitor/CMakeLists.txt1
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h2
-rw-r--r--src/components/transport_manager/CMakeLists.txt7
-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.h107
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h205
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h14
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h68
-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.h21
-rw-r--r--src/components/transport_manager/src/cloud/cloud_device.cc79
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc85
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc128
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc358
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc160
-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.cc17
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc136
-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_controller.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.cc6
-rw-r--r--src/components/transport_manager/test/transport_adapter_test.cc224
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc44
-rw-r--r--src/components/utils/CMakeLists.txt1
-rw-r--r--src/components/utils/include/utils/file_system.h13
-rw-r--r--src/components/utils/include/utils/timer.h16
-rw-r--r--src/components/utils/src/file_system.cc20
-rw-r--r--src/components/utils/src/timer.cc17
445 files changed, 23039 insertions, 1106 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 1b58b20e86..d62fd997a0 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,4 +1,4 @@
-[Delete any non-applicable sections, but we may ask for more information.]
+[Delete any non-applicable sections, but we may ask for more information. Please reference the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) for further instructions on how to enter an issue.]
### Bug Report
[Summary]
@@ -20,4 +20,4 @@
* Testing Against: [What you tested with to observe this behavior. Proxy, App, HMI etc.]
##### Test Case, Sample Code, and / or Example App
-[Paste a link to a PR, gist, or other code that exemplifies this behavior] \ No newline at end of file
+[Paste a link to a PR, gist, or other code that exemplifies this behavior]
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 83c3261f9b..301a22eafe 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA.
+[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA, and the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) document for more information on how to enter a pull request. Once this PR is ready for review, please request one from @theresalech.
Delete the above section when you've read it.]
@@ -30,4 +30,4 @@ This PR makes **[no / minor / major]** API changes.
- [ ] [Task 2]
### CLA
-- [ ] I have signed [the CLA](https://docs.google.com/forms/d/e/1FAIpQLSdsgJY33VByaX482zHzi-xUm49JNnmuJOyAM6uegPQ2LXYVfA/viewform) \ No newline at end of file
+- [ ] I have signed [the CLA](https://docs.google.com/forms/d/e/1FAIpQLSdsgJY33VByaX482zHzi-xUm49JNnmuJOyAM6uegPQ2LXYVfA/viewform)
diff --git a/.travis.yml b/.travis.yml
index 7f7df359b4..7060f4f33f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: cpp
-dist: trusty
+dist: xenial
sudo: required
only:
- master
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a180b6cf9..38bb95c9fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features rela
option(BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF)
option(BUILD_BT_SUPPORT "Bluetooth support" ON)
option(BUILD_USB_SUPPORT "libusb support" ON)
+option(BUILD_CLOUD_APP_SUPPORT "Cloud App Transport Support" ON)
option(BUILD_BACKTRACE_SUPPORT "backtrace support" ON)
option(BUILD_TESTS "Possibility to build and run tests" OFF)
option(TELEMETRY_MONITOR "Enable profiling time test util" ON)
@@ -235,7 +236,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
-set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wuninitialized -Wvla")
+set(EXCLUDE_ERROR_FLAGS "-Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations")
+set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror ${EXCLUDE_ERROR_FLAGS} -Wuninitialized -Wvla")
if (USE_GOLD_LD)
execute_process(COMMAND ld -v OUTPUT_VARIABLE result)
@@ -315,6 +317,11 @@ if (BUILD_BT_SUPPORT)
message(STATUS "Bluetooth support enabled")
endif()
+if (BUILD_CLOUD_APP_SUPPORT)
+ add_definitions(-DCLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ message(STATUS "Cloud app websocket support enabled")
+endif()
+
if (BUILD_BACKTRACE_SUPPORT)
add_definitions(-DBACKTRACE_SUPPORT)
message(STATUS "Backtrace support enabled")
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index bdb96de417..c0c6bbfa67 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -209,11 +209,12 @@ else()
)
endif()
-find_package(Boost 1.66.0 COMPONENTS system thread date_time filesystem)
+set(BOOST_ROOT ${3RD_PARTY_INSTALL_PREFIX})
+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(BOOST_INCLUDE_DIR ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE)
SET_PROPERTY(GLOBAL PROPERTY GLOBAL_BOOST_LIBS ${BOOST_LIBS_DIRECTORY})
-set(BOOST_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include )
if (NOT ${Boost_FOUND})
message(STATUS "Did not find boost. Downloading and installing boost 1.66")
set(BOOST_INSTALL_COMMAND ./b2 install)
@@ -226,15 +227,12 @@ 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
)
-
- set(BOOST_INCLUDE_DIR ${BOOST_ROOT_DIR}/Boost-prefix/src/Boost)
- set(BOOST_LIB_DIR ${BOOST_ROOT_DIR}/Boost-prefix/src/Boost/stage/lib/)
else()
add_custom_target(Boost) # empty target, Boost is already installed
endif()
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index fe9a6af3f7..d543280d75 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -76,6 +76,7 @@ include_directories(
# Create object library
add_library("LowVoltageHandlerObjLibrary" OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/low_voltage_signals_handler.cc
)
+add_dependencies("LowVoltageHandlerObjLibrary" Boost)
set (SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index 93292d1023..873c80d32e 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -6,7 +6,7 @@
"JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO"
],
"displayCapabilities": {
- "displayType": "GEN2_8_DMA",
+ "displayType": "SDL_GENERIC",
"displayName": "GENERIC_DISPLAY",
"textFields": [{
"name": "mainField1",
@@ -921,9 +921,9 @@
}
},
"VehicleInfo": {
- "make": "Ford",
- "model": "Fiesta",
- "modelYear": "2013",
+ "make": "SDL",
+ "model": "Generic",
+ "modelYear": "2019",
"trim": "SE"
},
"SyncMessageVersion": {
diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc
index b87191d937..efc627f33a 100644
--- a/src/appMain/life_cycle_impl.cc
+++ b/src/appMain/life_cycle_impl.cc
@@ -111,6 +111,7 @@ bool LifeCycleImpl::StartComponents() {
media_manager_ = new media_manager::MediaManagerImpl(*app_manager_, profile_);
app_manager_->set_connection_handler(connection_handler_);
+ app_manager_->AddPolicyObserver(protocol_handler_);
if (!app_manager_->Init(*last_state_, media_manager_)) {
LOG4CXX_ERROR(logger_, "Application manager init failed.");
return false;
@@ -134,7 +135,6 @@ bool LifeCycleImpl::StartComponents() {
security_manager_->AddListener(app_manager_);
app_manager_->AddPolicyObserver(security_manager_);
- app_manager_->AddPolicyObserver(protocol_handler_);
if (!crypto_manager_->Init()) {
LOG4CXX_ERROR(logger_, "CryptoManager initialization fail.");
return false;
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index 752cfb7bb9..4e91b91216 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -43,7 +43,9 @@
// ----------------------------------------------------------------------------
+#ifdef ENABLE_LOG
#include "utils/log_message_loop_thread.h"
+#endif // ENABLE_LOG
#include "utils/logger.h"
#include "appMain/life_cycle_impl.h"
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index d503ae34e5..8f006426f9 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -180,6 +180,12 @@
"LIMITED",
"NONE"]
},
+ "OnSystemCapabilityUpdated": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
"PerformAudioPassThru": {
"hmi_levels": ["FULL",
"LIMITED"]
@@ -193,7 +199,7 @@
"FULL",
"LIMITED",
"NONE"]
- },
+ },
"RegisterAppInterface": {
"hmi_levels": ["BACKGROUND",
"FULL",
@@ -412,6 +418,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -432,6 +439,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -452,6 +460,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -471,6 +480,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -529,6 +539,128 @@
}
}
},
+ "CloudAppStore": {
+ "rpcs": {
+ "SetCloudAppProperties":{
+ "hmi_levels":["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetCloudAppProperties":{
+ "hmi_levels":["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "CloudApp": {
+ "rpcs": {
+ "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"
+ ]
+ }
+ }
+ },
+ "AppServiceProvider": {
+ "rpcs": {
+ "PublishAppService": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "GetAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "OnAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "PerformAppServiceInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "AppServiceConsumer": {
+ "rpcs": {
+ "GetFile": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "GetAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "OnAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "PerformAppServiceInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ }
+ }
+ },
"RemoteControl": {
"rpcs": {
"ButtonPress": {
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index b0513c076f..54c2395c47 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
@@ -363,3 +369,13 @@ EnableAppLaunchIOS = true
; Note: this configuration is applied even if multiple-transports feature is not enabled.
;AudioServiceTransports = TCP_WIFI, IAP_CARPLAY, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE, IAP_USB, AOA_USB
;VideoServiceTransports = TCP_WIFI, IAP_CARPLAY, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE, IAP_USB, AOA_USB
+
+[AppServices]
+; The ID used to fill the originApp field when the HMI sends a PerformAppServiceInteraction request
+HMIOriginID = "HMI_ID"
+
+; Services that exist on the module. Values are of AppServiceType in RPC Spec. These services will be used as default and app services will only become primary service publisher with direct user interaction. These services will also be a fallback if no app service publisher is registered with the system of that type.
+EmbeddedServices = MEDIA, WEATHER, NAVIGATION
+
+; Additional time added to RPC timeout when passing through to App service
+RpcPassThroughTimeout = 10000 \ No newline at end of file
diff --git a/src/appMain/test/low_voltage_signals_handler_test.cc b/src/appMain/test/low_voltage_signals_handler_test.cc
index 14210df71d..2dea9447c6 100644
--- a/src/appMain/test/low_voltage_signals_handler_test.cc
+++ b/src/appMain/test/low_voltage_signals_handler_test.cc
@@ -36,7 +36,6 @@
#include "gtest/gtest.h"
#include "appMain/test/mock_life_cycle.h"
#include "utils/mock_signals_posix.h"
-#include "config_profile/profile.h"
#include "utils/macro.h"
namespace test {
@@ -45,6 +44,10 @@ using ::testing::_;
using ::testing::Return;
using ::testing::InSequence;
+const int kLowVoltageSignalOffset = 1;
+const int kWakeUpSignalOffset = 2;
+const int kIgnitionOffSignalOffset = 3;
+
class LowVoltageSignalsHandlerTest : public ::testing::Test {
protected:
LowVoltageSignalsHandlerTest()
@@ -52,10 +55,8 @@ class LowVoltageSignalsHandlerTest : public ::testing::Test {
, mock_signals_posix_(*utils::MockSignalsPosix::signals_posix_mock()) {}
void SetUp() OVERRIDE {
- profile_.set_config_file_name("smartDeviceLink.ini");
- signals_offset_ = {profile_.low_voltage_signal_offset(),
- profile_.wake_up_signal_offset(),
- profile_.ignition_off_signal_offset()};
+ signals_offset_ = {
+ kLowVoltageSignalOffset, kWakeUpSignalOffset, kIgnitionOffSignalOffset};
low_voltage_signals_handler_ =
std::unique_ptr<main_namespace::LowVoltageSignalsHandler>(
@@ -63,7 +64,6 @@ class LowVoltageSignalsHandlerTest : public ::testing::Test {
*mock_life_cycle_.get(), signals_offset_));
}
- profile::Profile profile_;
main_namespace::LowVoltageSignalsOffset signals_offset_;
std::unique_ptr<main_namespace::LowVoltageSignalsHandler>
low_voltage_signals_handler_;
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index 67a7136a62..625e119270 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -61,6 +61,7 @@ include_directories (
${ENCRYPTION_INCLUDE_DIRECTORY}
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${BSON_INCLUDE_DIRECTORY}
)
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..9690d7cd46
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -0,0 +1,255 @@
+/*
+ * 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 "application_manager/application.h"
+#include "application_manager/rpc_passing_handler.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace resumption {
+class LastState;
+}
+
+namespace application_manager {
+
+struct AppService {
+ uint32_t connection_key;
+ bool mobile_service;
+ bool default_service = false;
+ smart_objects::SmartObject record;
+};
+
+class RPCPassingHandler;
+class ApplicationManager;
+/**
+ * @brief The AppServiceManager is TODO.
+ */
+class AppServiceManager {
+ public:
+ const std::string kEmbeddedService = "EMBEDDED_SERVICE";
+
+ /**
+ * @brief Class constructor
+ * @param app_manager
+ */
+ AppServiceManager(ApplicationManager& app_manager,
+ resumption::LastState& last_state);
+
+ /**
+ * @brief Class destructor
+ */
+ virtual ~AppServiceManager();
+
+ /**
+ * @brief Publish an app service. This service will be activated if it is the
+ * default service for its type, or if it is the first service to register of
+ * its type.
+ * @param manifest - The app service manifest of the service to be published
+ * @param mobile_service - True, if the service is being published by a mobile
+ * app. False, if published by the embedded system.
+ * @param connection_key - If mobile_service is true, the connection key of
+ * the app publishing this service.
+ * @return The app service record of the published app service
+ */
+ virtual smart_objects::SmartObject PublishAppService(
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key = 0u);
+
+ /**
+ * @brief Unpublish an existing app service
+ * @param service_id - The ID of the app service to be deleted.
+ * @return True on success, false otherwise
+ */
+ virtual bool UnpublishAppService(const std::string service_id);
+
+ /**
+ * @brief Callback for when an application is activated. Will activate all
+ * services which were published by this app.
+ * @param app - The application that was activated.
+ */
+ virtual void OnAppActivated(ApplicationConstSharedPtr app);
+
+ /**
+ * @brief Unpublish any published services for a given mobile application
+ * @param connection_key - The connection key of the application from which
+ * all published services should be deleted.
+ */
+ virtual void UnpublishServices(const uint32_t connection_key);
+
+ /**
+ * @brief Sets a service to the default service for its type
+ * @param service_id - The ID of the service to become the default
+ * @return True on success, false otherwise
+ */
+ virtual bool SetDefaultService(const std::string service_id);
+
+ /**
+ * @brief Removes a service from the list of default services.
+ * @param service_id - The ID of the existing default service.
+ * @return True on success, false otherwise
+ */
+ virtual bool RemoveDefaultService(const std::string service_id);
+
+ /**
+ * @brief Activate an existing service
+ * @param service_id - The ID of the service to be activated.
+ * @return True if the service is active, false otherwise
+ */
+ virtual bool ActivateAppService(const std::string service_id);
+
+ /**
+ * @brief Deactivate an existing active service
+ * @param service_id - The ID of the service to be deactivated.
+ * @return True if the service was deactivated, false otherwise
+ */
+ virtual bool DeactivateAppService(const std::string service_id);
+
+ /**
+ * @brief Get a list of all published service records.
+ * @return A list of all all published service records.
+ */
+ virtual std::vector<smart_objects::SmartObject> GetAllServiceRecords();
+
+ /**
+ * @brief Get a list of all active app services.
+ * @return A list of all all active app services.
+ */
+ virtual std::vector<AppService> GetActiveServices();
+
+ /**
+ * @brief Retrieve the active service provider for a given service type
+ * @param service_type - The service type of the provider to be retrieved
+ * @param mobile_consumer - True, if the consumer trying to communicate with
+ * the provider is a mobile application
+ * @param app - Output parameter that will be filled with the application
+ * providing the requested service on success, unchanged on failure
+ * @param hmi_service - Output parameter set to true if the service
+ * provider is the HMI, unchanged on failure
+ */
+ virtual void GetProviderByType(const std::string& service_type,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Retrieve the service provider with a given service ID
+ * @param service_type - The service type of the provider to be retrieved
+ * @param mobile_consumer - True, if the consumer trying to communicate with
+ * the provider is a mobile application
+ * @param app - Output parameter that will be filled with the application
+ * providing the requested service on success, unchanged on failure
+ * @param hmi_service - Output parameter set to true if the service
+ * provider is the HMI, unchanged on failure
+ */
+ virtual void GetProviderByID(const std::string& service_id,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Get the active service for a given service type.
+ * @param service_type - The service type
+ * @return A pointer to the active service for the given service type on
+ * success, NULL on failure
+ */
+ virtual AppService* ActiveServiceForType(const std::string service_type);
+
+ /**
+ * @brief Get the embedded service for a given service type.
+ * @param service_type - The service type
+ * @return A pointer to the embedded service for the given service type on
+ * success, NULL on failure
+ */
+ virtual AppService* EmbeddedServiceForType(const std::string service_type);
+
+ /**
+ * @brief Get the service with a given service ID.
+ * @param service_type - The service ID
+ * @return A pointer to requested service on success, NULL on failure
+ */
+ virtual AppService* FindServiceByID(const std::string service_id);
+
+ /**
+ * @brief Update a navigation system capability struct with the capabilities
+ * of the active navigation service.
+ * @param out_params - The struct to be modified
+ * @return True on success, false otherwise (if there was no active NAVIGATION
+ * service)
+ */
+ virtual bool UpdateNavigationCapabilities(
+ smart_objects::SmartObject& out_params);
+
+ /**
+ * @brief Get the RPCPassingHandler tied to this object
+ * @return The RPCPassingHandler tied to this object
+ */
+ virtual RPCPassingHandler& GetRPCPassingHandler();
+
+ private:
+ ApplicationManager& app_manager_;
+ resumption::LastState& last_state_;
+
+ sync_primitives::RecursiveLock published_services_lock_;
+ std::map<std::string, AppService> published_services_;
+ RPCPassingHandler rpc_passing_handler_;
+
+ void SetServicePublished(const std::string service_id,
+ bool service_published);
+ void AppServiceUpdated(
+ const smart_objects::SmartObject& service_record,
+ const mobile_apis::ServiceUpdateReason::eType update_reason,
+ smart_objects::SmartObject& msg_params);
+ void GetProviderFromService(const AppService& service,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Get the policy app ID of the default service provider for a given
+ * service type.
+ * @param service_type - The service type
+ * @return The policy app ID of the default service provider for the given
+ * service type on success, "" on failure
+ */
+ std::string DefaultServiceByType(const std::string service_type);
+ AppService* FindServiceByPolicyAppID(const std::string policy_app_id,
+ const std::string type);
+ std::string GetPolicyAppID(AppService service);
+};
+
+} // 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..b4d8ca857e 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& auth_token() const = 0;
+
+ /**
+ * @brief Get cloud app transport 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_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..ff34d2a96a 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& auth_token() const OVERRIDE;
+
+ /**
+ * @brief Get cloud app transport 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_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..738458ef26 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
@@ -42,6 +42,7 @@
#include <memory>
#include "application_manager/application_manager.h"
+#include "application_manager/app_service_manager.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/message.h"
#include "application_manager/message_helper.h"
@@ -117,6 +118,14 @@ struct CommandParametersPermissions;
typedef std::map<std::string, hmi_apis::Common_TransportType::eType>
DeviceTypes;
+struct AppIconInfo {
+ std::string endpoint;
+ bool pending_request;
+ AppIconInfo();
+ AppIconInfo(std::string ws_endpoint, bool pending)
+ : endpoint(ws_endpoint), pending_request(pending) {}
+};
+
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
typedef std::shared_ptr<timer::Timer> TimerSPtr;
@@ -156,6 +165,7 @@ class ApplicationManagerImpl
bool Stop() OVERRIDE;
DataAccessor<ApplicationSet> applications() const OVERRIDE;
+ DataAccessor<AppsWaitRegistrationSet> pending_applications() const OVERRIDE;
ApplicationSharedPtr application(uint32_t app_id) const OVERRIDE;
ApplicationSharedPtr active_application() const OVERRIDE;
@@ -164,6 +174,10 @@ class ApplicationManagerImpl
uint32_t hmi_app_id) const OVERRIDE;
ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const OVERRIDE;
+ ApplicationSharedPtr application_by_name(
+ const std::string& app_name) const OVERRIDE;
+ ApplicationSharedPtr pending_application_by_policy_id(
+ const std::string& policy_app_id) const OVERRIDE;
std::vector<ApplicationSharedPtr> applications_by_button(
uint32_t button) OVERRIDE;
@@ -194,6 +208,9 @@ class ApplicationManagerImpl
void SendDriverDistractionState(ApplicationSharedPtr application);
+ void SendGetIconUrlNotifications(const uint32_t connection_key,
+ ApplicationSharedPtr application);
+
ApplicationSharedPtr application(
const std::string& device_id,
const std::string& policy_app_id) const OVERRIDE;
@@ -213,6 +230,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 +382,44 @@ class ApplicationManagerImpl
void ConnectToDevice(const std::string& device_mac) OVERRIDE;
void OnHMIStartedCooperation() OVERRIDE;
+ void DisconnectCloudApp(ApplicationSharedPtr app) OVERRIDE;
+
+ void RefreshCloudAppInformation() OVERRIDE;
+
+ void CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id);
+
+ void SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info);
+
+ std::string PolicyIDByIconUrl(const std::string url) OVERRIDE;
+
+ void SetIconFileFromSystemRequest(const std::string policy_id) OVERRIDE;
+
+ /**
+ * @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 to mobile request
+ *
+ * @return Unique correlation ID
+ */
+ uint32_t GetNextMobileCorrelationID() OVERRIDE;
+
/*
* @brief Returns unique correlation ID for HMI request
*
@@ -476,18 +536,12 @@ class ApplicationManagerImpl
// typedef for Applications list
typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet;
- typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
- AppsWaitRegistrationSet;
-
// typedef for Applications list iterator
typedef ApplictionSet::iterator ApplictionSetIt;
// 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
@@ -678,6 +732,15 @@ class ApplicationManagerImpl
uint32_t new_timeout_value) OVERRIDE;
/**
+ * @brief TODO
+ *
+ * @param connection_key Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ */
+ void IncreaseForwardedRequestTimeout(uint32_t connection_key,
+ uint32_t mobile_correlation_id) OVERRIDE;
+
+ /**
* @brief AddPolicyObserver allows to subscribe needed component to events
* from policy.
*
@@ -962,6 +1025,14 @@ class ApplicationManagerImpl
}
};
+ struct AppNamePredicate {
+ std::string app_name_;
+ AppNamePredicate(const std::string& app_name) : app_name_(app_name) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? app->name() == app_name_ : false;
+ }
+ };
+
/**
* @brief Sends UpdateAppList notification to HMI
*/
@@ -1078,7 +1149,8 @@ class ApplicationManagerImpl
mobile_apis::MOBILE_API& mobile_so_factory();
bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
- Message& output);
+ Message& output,
+ const bool allow_unknown_parameters = false);
template <typename ApplicationList>
void PrepareApplicationListSO(ApplicationList app_list,
@@ -1382,6 +1454,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
@@ -1404,6 +1477,7 @@ class ApplicationManagerImpl
hmi_apis::HMI_API* hmi_so_factory_;
mobile_apis::MOBILE_API* mobile_so_factory_;
+ static uint32_t mobile_corelation_id_;
static uint32_t corelation_id_;
static const uint32_t max_corelation_id_;
@@ -1449,6 +1523,13 @@ 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_;
+
+ sync_primitives::Lock app_icon_map_lock_ptr_;
+ std::map<std::string, AppIconInfo> app_icon_map_;
+
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver* metric_observer_;
#endif // TELEMETRY_MONITOR
@@ -1478,18 +1559,47 @@ 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);
+ }
+
+ /**
+ * @brief set a mock rpc service directly. Only for unit
+ * testing.
+ * @param mock_app the mock rpc service to be assigned
+ */
+ void SetMockPolicyHandler(policy::PolicyHandlerInterface* policy_handler) {
+ policy_handler_.reset(policy_handler);
+ }
+
virtual void SetPluginManager(
std::unique_ptr<plugin_manager::RPCPluginManager>& plugin_manager)
OVERRIDE {
plugin_manager_.reset(plugin_manager.release());
}
+ virtual void SetAppServiceManager(AppServiceManager* app_service_manager) {
+ app_service_manager_.reset(app_service_manager);
+ }
+
private:
#endif
diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h
index f8ea7db24d..d832995b8d 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -112,7 +112,12 @@ class Command {
*/
virtual void SetAllowedToTerminate(const bool allowed) = 0;
- enum CommandSource { SOURCE_SDL, SOURCE_MOBILE, SOURCE_HMI };
+ enum CommandSource {
+ SOURCE_SDL,
+ SOURCE_MOBILE,
+ SOURCE_HMI,
+ SOURCE_SDL_TO_HMI
+ };
};
typedef smart_objects::SmartObjectSPtr MessageSharedPtr;
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index 4859f73a55..dd1592c4aa 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -37,6 +37,7 @@
#include "application_manager/event_engine/event_observer.h"
#include "application_manager/application_manager.h"
#include "application_manager/smart_object_keys.h"
+#include "policy/policy_types.h"
#include "utils/logger.h"
namespace application_manager {
diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
index 8741dae540..e8485a3abc 100644
--- a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
@@ -53,6 +53,11 @@ class CommandNotificationFromMobileImpl : public CommandImpl {
virtual bool CleanUp();
virtual void Run();
void SendNotification();
+ void SendNotificationToMobile();
+ void SendNotificationToHMI(
+ const hmi_apis::FunctionID::eType& hmi_function_id);
+ void SendNotificationToConsumers(
+ const hmi_apis::FunctionID::eType& hmi_function_id);
private:
DISALLOW_COPY_AND_ASSIGN(CommandNotificationFromMobileImpl);
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index 27aa93d1d8..e12c6de3ab 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -149,6 +149,8 @@ class CommandRequestImpl : public CommandImpl,
*/
virtual void on_event(const event_engine::Event& event);
+ virtual void on_event(const event_engine::MobileEvent& event);
+
/*
* @brief Creates Mobile response
*
@@ -157,10 +159,12 @@ class CommandRequestImpl : public CommandImpl,
* @param info Provides additional human readable info regarding the result
* @param response_params Additional params in response
*/
- void SendResponse(const bool success,
- const mobile_apis::Result::eType& result_code,
- const char* info = NULL,
- const smart_objects::SmartObject* response_params = NULL);
+ void SendResponse(
+ const bool success,
+ const mobile_apis::Result::eType& result_code,
+ const char* info = NULL,
+ const smart_objects::SmartObject* response_params = NULL,
+ const std::vector<uint8_t> binary_data = std::vector<uint8_t>());
/**
* @brief Check syntax of string from mobile
@@ -170,6 +174,16 @@ class CommandRequestImpl : public CommandImpl,
*/
bool CheckSyntax(const std::string& str, bool allow_empty_line = false);
+ void SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events = false);
+
+ void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
+ smart_objects::SmartObjectSPtr msg,
+ bool use_events = false);
+
/*
* @brief Sends HMI request
*
@@ -235,6 +249,14 @@ class CommandRequestImpl : public CommandImpl,
bool HasDisallowedParams() const;
/**
+ * @brief Checks result code from Mobile for single RPC
+ * @param result_code contains result code from Mobile response
+ * @return true if result code complies successful result codes,
+ * false otherwise.
+ */
+ bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) const;
+
+ /**
* @brief Checks result code from HMI for single RPC
* and returns parameter for sending to mobile app.
* @param result_code contains result code from HMI response
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h
new file mode 100644
index 0000000000..a1e63561bf
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h
@@ -0,0 +1,73 @@
+/*
+ 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_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
+
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/application_manager.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class CommandRequestToMobile : public CommandImpl {
+ public:
+ CommandRequestToMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ ~CommandRequestToMobile();
+ bool Init() OVERRIDE;
+ bool CleanUp() OVERRIDE;
+ void Run() OVERRIDE;
+ void SendRequest();
+
+ /*
+ * @brief Retrieves application ID
+ */
+ inline uint32_t application_id() const {
+ return (*message_)[strings::msg_params][strings::app_id].asUInt();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CommandRequestToMobile);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h
new file mode 100644
index 0000000000..65983d82f8
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h
@@ -0,0 +1,73 @@
+/*
+ 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_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
+
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/application_manager.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class CommandResponseFromMobile : public CommandImpl {
+ public:
+ CommandResponseFromMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ ~CommandResponseFromMobile();
+ bool Init() OVERRIDE;
+ bool CleanUp() OVERRIDE;
+ void Run() OVERRIDE;
+ void SendResponse();
+
+ /*
+ * @brief Retrieves application ID
+ */
+ inline uint32_t application_id() const {
+ return (*message_)[strings::msg_params][strings::app_id].asUInt();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CommandResponseFromMobile);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
index 8bbbd0e3de..25cfd7b207 100644
--- a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
@@ -53,8 +53,14 @@ class NotificationFromHMI : public CommandImpl {
virtual bool CleanUp();
virtual void Run();
void SendNotificationToMobile(const MessageSharedPtr& message);
+ void SendNotificationToMobile(
+ const MessageSharedPtr& message,
+ const mobile_apis::FunctionID::eType& mobile_function_id);
+ void SendNotificationToHMI(MessageSharedPtr& message);
void CreateHMIRequest(const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const;
+ void SendNotificationToConsumers(
+ const mobile_apis::FunctionID::eType& mobile_function_id);
private:
DISALLOW_COPY_AND_ASSIGN(NotificationFromHMI);
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..4464056175 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
@@ -55,16 +55,22 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
virtual bool CleanUp();
virtual void Run();
virtual void on_event(const event_engine::Event& event);
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
/**
* @brief SendResponse allows to send response to hmi
* @param correlation_id the correlation id for the rfesponse.
* @param function_id the function id for which response will be sent
* @param result_code the result code.
+ * @param response_params extra response params.
+ * @param source command source.
*/
- 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);
+ 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 smart_objects::SmartObject* response_params = NULL,
+ commands::Command::CommandSource source = commands::Command::SOURCE_HMI);
/**
* @brief SendResponse allows to send error response to hmi
@@ -72,11 +78,39 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
* @param function_id the function id for which response will be sent
* @param result_code the result code.
* @param error_message info message for error.
+ * @param source command source.
*/
- void SendErrorResponse(const uint32_t correlation_id,
- const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code,
- const std::string error_message);
+ void SendErrorResponse(
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code,
+ const std::string error_message,
+ commands::Command::CommandSource source = commands::Command::SOURCE_HMI);
+
+ void SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events = false);
+
+ void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
+ const ApplicationSharedPtr app,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events);
+
+ void SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events);
+
+ bool ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id);
+
+ protected:
+ bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) const;
+
+ bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const;
private:
/**
diff --git a/src/components/application_manager/include/application_manager/event_engine/event.h b/src/components/application_manager/include/application_manager/event_engine/event.h
index 68ee508a9b..14595cd293 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_ENGINE_EVENT_H_
#include <interfaces/HMI_API.h>
+#include <interfaces/MOBILE_API.h>
#include "smart_objects/smart_object.h"
#include "application_manager/smart_object_keys.h"
@@ -130,9 +131,9 @@ int32_t Event::smart_object_function_id() const {
}
int32_t Event::smart_object_correlation_id() const {
- return response_so_.getElement(strings::params)
- .getElement(strings::correlation_id)
- .asInt();
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::correlation_id)
+ .asInt());
}
int32_t Event::smart_object_type() const {
@@ -141,6 +142,104 @@ int32_t Event::smart_object_type() const {
.asInt();
}
+class MobileEvent {
+ public:
+ // Typedef for possible Event ID's from mobile_apis functionID enum
+ typedef mobile_apis::FunctionID::eType MobileEventID;
+
+ /*
+ * @brief Constructor with parameters
+ *
+ * @param id Event ID. Please see mobile_apis::FunctionID for possible ID's
+ */
+ explicit MobileEvent(const MobileEventID& id);
+
+ /*
+ * @brief Destructor
+ */
+ virtual ~MobileEvent();
+
+ /*
+ * @brief Sends synchronously event to all subscribers.
+ *
+ */
+ void raise(EventDispatcher& event_dispatcher);
+
+ /*
+ * @brief Provides event ID
+ */
+ inline const MobileEventID& id() const;
+
+ /*
+ * @brief Sets event smart object
+ *
+ * @param so The smart_object received in Mobile response
+ */
+ void set_smart_object(const smart_objects::SmartObject& so);
+
+ /*
+ * @brief Retrieves event smart object
+ *
+ * @return The smart_object received in Mobile response
+ */
+ inline const smart_objects::SmartObject& smart_object() const;
+
+ /*
+ * @brief Retrieves smart object request ID
+ */
+ inline int32_t smart_object_function_id() const;
+
+ /*
+ * @brief Retrieves smart object correlation ID
+ */
+ inline int32_t smart_object_correlation_id() const;
+
+ /*
+ * @brief Retrieves smart_object response type
+ */
+ inline int32_t smart_object_type() const;
+
+ protected:
+ private:
+ MobileEventID id_;
+ smart_objects::SmartObject response_so_;
+
+ /*
+ * @brief Default constructor
+ *
+ * Unimplemented to avoid misusing
+ */
+ MobileEvent();
+
+ DISALLOW_COPY_AND_ASSIGN(MobileEvent);
+};
+
+const MobileEvent::MobileEventID& MobileEvent::id() const {
+ return id_;
+}
+
+const smart_objects::SmartObject& MobileEvent::smart_object() const {
+ return response_so_;
+}
+
+int32_t MobileEvent::smart_object_function_id() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::function_id)
+ .asInt());
+}
+
+int32_t MobileEvent::smart_object_correlation_id() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::correlation_id)
+ .asInt());
+}
+
+int32_t MobileEvent::smart_object_type() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::message_type)
+ .asInt());
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
index 813dda0295..0656372f47 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
@@ -77,6 +77,42 @@ class EventDispatcher {
*/
virtual void remove_observer(EventObserver& observer) = 0;
+ // Mobile Events
+
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ virtual void raise_mobile_event(const MobileEvent& event) = 0;
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ virtual void add_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) = 0;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_mobile_observer(
+ const MobileEvent::MobileEventID& event_id, EventObserver& observer) = 0;
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_mobile_observer(EventObserver& observer) = 0;
+
/*
* @brief Destructor
*/
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
index ed923369ac..75e77e603c 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
@@ -52,6 +52,8 @@ class EventDispatcherImpl : public EventDispatcher {
typedef std::vector<EventObserver*> ObserverVector;
typedef std::map<int32_t, ObserverVector> ObserversMap;
typedef std::map<Event::EventID, ObserversMap> EventObserverMap;
+ typedef std::map<MobileEvent::MobileEventID, ObserversMap>
+ MobileEventObserverMap;
/*
* @brief Destructor
*/
@@ -66,6 +68,9 @@ class EventDispatcherImpl : public EventDispatcher {
EventObserverMap get_observers() const {
return observers_event_;
}
+ MobileEventObserverMap get_mobile_observers() const {
+ return mobile_observers_event_;
+ }
ObserverVector get_observers_list() const {
return observers_;
}
@@ -105,6 +110,41 @@ class EventDispatcherImpl : public EventDispatcher {
*/
void remove_observer(EventObserver& observer) OVERRIDE;
+ // Mobile requests
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ void raise_mobile_event(const MobileEvent& event) OVERRIDE;
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ void add_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_mobile_observer(EventObserver& observer) OVERRIDE;
+
private:
/*
* @brief removes observer
@@ -113,14 +153,25 @@ class EventDispatcherImpl : public EventDispatcher {
*/
void remove_observer_from_vector(EventObserver& observer);
+ /*
+ * @brief removes observer
+ * when occurs unsubscribe from event
+ * @param observer to be removed
+ */
+ void remove_mobile_observer_from_vector(EventObserver& observer);
+
DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl);
private:
// Members section
sync_primitives::Lock state_lock_;
+ sync_primitives::Lock mobile_state_lock_;
sync_primitives::RecursiveLock observer_lock_;
+ sync_primitives::RecursiveLock mobile_observer_lock_;
EventObserverMap observers_event_;
+ MobileEventObserverMap mobile_observers_event_;
ObserverVector observers_;
+ ObserverVector mobile_observers_;
};
} // namespace event_engine
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
index 593f1df657..7a7fe7c2ec 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
@@ -72,6 +72,8 @@ class EventObserver {
*/
virtual void on_event(const Event& event) = 0;
+ virtual void on_event(const MobileEvent& event);
+
protected:
/*
* @brief Subscribe to an event
@@ -94,7 +96,38 @@ class EventObserver {
* @brief Unsubscribes the observer from all events
*
*/
- void unsubscribe_from_all_events();
+ DEPRECATED void unsubscribe_from_all_events();
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ */
+ void unsubscribe_from_all_hmi_events();
+
+ // Mobile Events
+
+ /*
+ * @brief Subscribe to an event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param mobile_correlation_id The event mobile correlation ID.
+ * If param is omitted, it means subscription for mobile notification
+ */
+ void subscribe_on_event(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id = 0);
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ */
+ void unsubscribe_from_event(const MobileEvent::MobileEventID& event_id);
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ */
+ void unsubscribe_from_all_mobile_events();
private:
ObserverID id_;
diff --git a/src/components/application_manager/include/application_manager/helpers/application_helper.h b/src/components/application_manager/include/application_manager/helpers/application_helper.h
index 145bef659e..18267c9e7f 100644
--- a/src/components/application_manager/include/application_manager/helpers/application_helper.h
+++ b/src/components/application_manager/include/application_manager/helpers/application_helper.h
@@ -57,6 +57,18 @@ ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor,
return app;
}
+template <class UnaryPredicate>
+ApplicationSharedPtr FindPendingApp(
+ DataAccessor<AppsWaitRegistrationSet> accessor, UnaryPredicate finder) {
+ AppsWaitRegistrationSet::iterator it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ if (accessor.GetData().end() == it) {
+ return ApplicationSharedPtr();
+ }
+ ApplicationSharedPtr app = *it;
+ return app;
+}
+
/**
* Helper function for lookup through applications list and returning all
* applications satisfying predicate logic
diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces.h b/src/components/application_manager/include/application_manager/hmi_interfaces.h
index 59ec32694a..5f172b415d 100644
--- a/src/components/application_manager/include/application_manager/hmi_interfaces.h
+++ b/src/components/application_manager/include/application_manager/hmi_interfaces.h
@@ -60,7 +60,8 @@ class HmiInterfaces {
HMI_INTERFACE_Navigation,
HMI_INTERFACE_VehicleInfo,
HMI_INTERFACE_SDL,
- HMI_INTERFACE_RC
+ HMI_INTERFACE_RC,
+ HMI_INTERFACE_AppService
};
/**
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index 07d9c8dc23..774376b249 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -207,7 +207,7 @@ class HmiState {
}
protected:
- std::shared_ptr<Application> app_;
+ uint32_t hmi_app_id_;
StateID state_id_;
const ApplicationManager& app_mngr_;
HmiStatePtr parent_;
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 609b240301..ac84bcfaa5 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -786,6 +786,14 @@ class MessageHelper {
static hmi_apis::Common_Language::eType CommonLanguageFromString(
const std::string& language);
+ /**
+ * @brief CommonLightNameFromString convert string to LightName enum value
+ * @param lightName string to convert
+ * @return value LightName enum value
+ */
+ static hmi_apis::Common_LightName::eType CommonLightNameFromString(
+ const std::string& lightName);
+
static smart_objects::SmartObjectSPtr
GetOnAppInterfaceUnregisteredNotificationToMobile(
int32_t connection_key,
@@ -878,6 +886,12 @@ class MessageHelper {
static smart_objects::SmartObjectSPtr CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id);
+ static smart_objects::SmartObject CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services);
+
+ static void BroadcastCapabilityUpdate(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h b/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h
new file mode 100644
index 0000000000..11a7d353f6
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h
@@ -0,0 +1,48 @@
+/*
+ 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_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
+
+namespace application_manager {
+namespace plugin_manager {
+
+namespace plugin_names {
+extern const char* vehicle_info_rpc_plugin;
+extern const char* app_service_rpc_plugin;
+extern const char* rc_rpc_plugin;
+extern const char* sdl_rpc_plugin;
+}
+
+} // namespace plugin_manager
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
diff --git a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
index 8c904bf513..3168b80b5a 100644
--- a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
@@ -48,6 +48,7 @@ class PolicyEventObserver
application_manager::event_engine::EventDispatcher& event_dispatcher);
void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler);
void on_event(const application_manager::event_engine::Event& event);
+ void on_event(const application_manager::event_engine::MobileEvent& event);
void subscribe_on_event(
const application_manager::event_engine::Event::EventID& event_id,
int32_t hmi_correlation_id = 0);
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..a33bb640ad 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
@@ -187,6 +187,8 @@ class PolicyHandler : public PolicyHandlerInterface,
void GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) OVERRIDE;
virtual std::string GetLockScreenIconUrl() const OVERRIDE;
+ virtual std::string GetIconUrl(
+ const std::string& policy_app_id) const OVERRIDE;
uint32_t NextRetryTimeout() OVERRIDE;
/**
@@ -398,6 +400,88 @@ 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
+ */
+ bool 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;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+ /**
+ * @brief Check app service parameters from an app against policies
+ * @param policy_app_id Unique application id
+ * @param requested_service_name Service name published by app service
+ * provider
+ * @param requested_service_type Service type published by app service
+ * provider
+ * @param requested_handled_rpcs Vector of requested function ids an app
+ * service wants to handle from consumers
+ */
+ bool CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const OVERRIDE;
+
virtual void OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
@@ -406,6 +490,9 @@ class PolicyHandler : public PolicyHandlerInterface,
#ifdef EXTERNAL_PROPRIETARY_MODE
void OnCertificateDecrypted(bool is_succeeded) OVERRIDE;
#endif // EXTERNAL_PROPRIETARY_MODE
+ void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token);
+
virtual bool CanUpdate() OVERRIDE;
virtual void OnDeviceConsentChanged(const std::string& device_id,
diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
index f4924111b3..4a104812a4 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
@@ -48,6 +48,7 @@ class PolicyEventObserver
application_manager::event_engine::EventDispatcher& event_dispatcher);
void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler);
void on_event(const application_manager::event_engine::Event& event);
+ void on_event(const application_manager::event_engine::MobileEvent& event);
void subscribe_on_event(
const application_manager::event_engine::Event::EventID& event_id,
int32_t hmi_correlation_id = 0);
diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
index 07d234f036..68e7511b43 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
@@ -48,6 +48,9 @@ class PolicyHandlerObserver {
return false;
}
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {}
+
virtual void OnPTUFinished(const bool ptu_result) {}
virtual ~PolicyHandlerObserver() {}
diff --git a/src/components/application_manager/include/application_manager/rpc_handler_impl.h b/src/components/application_manager/include/application_manager/rpc_handler_impl.h
index cc93e4213c..e1dc9e6c5d 100644
--- a/src/components/application_manager/include/application_manager/rpc_handler_impl.h
+++ b/src/components/application_manager/include/application_manager/rpc_handler_impl.h
@@ -154,11 +154,18 @@ class RPCHandlerImpl : public RPCHandler,
ns_smart_device_link::ns_smart_objects::SmartObject& output,
utils::SemanticVersion& message_version);
+ bool ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) OVERRIDE;
+
private:
void ProcessMessageFromMobile(const std::shared_ptr<Message> message);
void ProcessMessageFromHMI(const std::shared_ptr<Message> message);
bool ConvertMessageToSO(const Message& message,
- smart_objects::SmartObject& output);
+ smart_objects::SmartObject& output,
+ const bool allow_unknown_parameters = false,
+ const bool validate_params = true);
std::shared_ptr<Message> ConvertRawMsgToMessage(
const ::protocol_handler::RawMessagePtr message);
hmi_apis::HMI_API& hmi_so_factory();
diff --git a/src/components/application_manager/include/application_manager/rpc_passing_handler.h b/src/components/application_manager/include/application_manager/rpc_passing_handler.h
new file mode 100644
index 0000000000..45fe4cad2f
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/rpc_passing_handler.h
@@ -0,0 +1,123 @@
+/*
+ * 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_RPC_PASSING_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_PASSING_HANDLER_H_
+
+#include <deque>
+#include "application_manager/application.h"
+#include "application_manager/commands/command.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/timer.h"
+
+namespace application_manager {
+
+struct ServiceInfo {
+ std::string service_id;
+ uint32_t connection_key;
+};
+
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
+
+class AppServiceManager;
+
+class RPCPassingHandler {
+ public:
+ RPCPassingHandler(AppServiceManager& asm_ref, ApplicationManager& am_ref);
+
+ /**
+ * @brief Class destructor
+ */
+ ~RPCPassingHandler();
+
+ /**
+ * @brief Check if function id is in the handled_rpcs list of an active app
+ * service
+ * @param function_id RPC function id
+ * @return true if function id exists in handled_rpcs list of an active app
+ * service
+ */
+ bool CanHandleFunctionID(int32_t function_id);
+
+ /**
+ * @brief Check if app services or core is being used to handle the RPC
+ * @param correlation_id correlation id of RPC response
+ * @return true if an app service was used to handle the RPC
+ */
+ bool IsPassThroughMessage(uint32_t correlation_id,
+ commands::Command::CommandSource source,
+ int32_t message_type);
+ /**
+ * @brief Check if passthrough is allowed by policies for a given message
+ * @param rpc_message RPC message SmartObject
+ * @return true if the request is allowed to be passed through, false
+ * otherwise
+ */
+ bool IsPassthroughAllowed(smart_objects::SmartObject rpc_message);
+
+ /**
+ * @brief Function to handle sending and receiving RPC Passing
+ * requests/responses
+ * @param rpc_message RPC message SmartObject
+ * @return true if the request was handled, false otherwise
+ */
+ bool RPCPassThrough(smart_objects::SmartObject rpc_message);
+
+ private:
+ bool PerformNextRequest(uint32_t correlation_id);
+ void OnPassThroughRequestTimeout();
+ void AddRequestTimer(uint32_t correlation_id);
+ void RemoveRequestTimer(uint32_t correlation_id);
+ void ClearCompletedTimers();
+ void ForwardRequestToMobile(uint32_t correlation_id);
+ void ForwardRequestToCore(uint32_t correlation_id);
+ void ForwardResponseToMobile(uint32_t correlation_id,
+ smart_objects::SmartObject response_message);
+ void PopulateRPCRequestQueue(smart_objects::SmartObject request_message);
+ bool ExtractRPCParams(const smart_objects::SmartObject& s_map,
+ const ApplicationSharedPtr app,
+ const std::string& function_id_str);
+
+ AppServiceManager& app_service_manager_;
+ ApplicationManager& app_manager_;
+ sync_primitives::RecursiveLock rpc_request_queue_lock_;
+ std::map<uint32_t,
+ std::pair<smart_objects::SmartObject, std::deque<ServiceInfo> > >
+ rpc_request_queue;
+ sync_primitives::RecursiveLock timeout_queue_lock_;
+ std::vector<std::pair<TimerSPtr, uint32_t> > timeout_queue_;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_PASSING_HANDLER_H_
diff --git a/src/components/application_manager/include/application_manager/rpc_service_impl.h b/src/components/application_manager/include/application_manager/rpc_service_impl.h
index 1eaeb46255..98aad1a90e 100644
--- a/src/components/application_manager/include/application_manager/rpc_service_impl.h
+++ b/src/components/application_manager/include/application_manager/rpc_service_impl.h
@@ -108,7 +108,9 @@ class RPCServiceImpl : public RPCService,
bool ManageMobileCommand(const commands::MessageSharedPtr message,
commands::Command::CommandSource source) OVERRIDE;
- bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE;
+ bool ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source =
+ commands::Command::SOURCE_HMI) OVERRIDE;
// CALLED ON messages_to_hmi_ thread!
void Handle(const impl::MessageToHmi message) OVERRIDE;
@@ -119,6 +121,9 @@ class RPCServiceImpl : public RPCService,
bool final_message = false) OVERRIDE;
void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE;
+ bool IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source);
+
void set_protocol_handler(
protocol_handler::ProtocolHandler* handler) OVERRIDE;
void set_hmi_message_handler(
@@ -126,9 +131,13 @@ class RPCServiceImpl : public RPCService,
private:
bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
- Message& output);
+ Message& output,
+ const bool allow_unknown_parameters = false);
hmi_apis::HMI_API& hmi_so_factory();
mobile_apis::MOBILE_API& mobile_so_factory();
+ void CheckSourceForUnsupportedRequest(
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source);
ApplicationManager& app_manager_;
request_controller::RequestController& request_ctrl_;
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..67c849c8fc 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
@@ -60,6 +60,7 @@ extern const char* app_launch_last_session;
extern const char* policy_app_id;
extern const char* hmi_app_id;
extern const char* device_id;
+extern const char* subscribe;
extern const char* subscribed_for_way_points;
extern const char* url;
extern const char* urlScheme;
@@ -76,7 +77,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;
@@ -178,6 +179,7 @@ extern const char* navigation_capability;
extern const char* phone_capability;
extern const char* video_streaming_capability;
extern const char* rc_capability;
+extern const char* app_services_capabilities;
extern const char* day_color_scheme;
extern const char* night_color_scheme;
extern const char* primary_color;
@@ -188,10 +190,19 @@ extern const char* green;
extern const char* blue;
extern const char* display_layout;
extern const char* icon_resumed;
+extern const char* nicknames;
+extern const char* enabled;
+extern const char* 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;
+extern const char* endpoint;
// PutFile
extern const char* sync_file_name;
extern const char* file_name;
+extern const char* file_path;
extern const char* file_type;
extern const char* file_size;
extern const char* crc32_check_sum;
@@ -253,6 +264,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 +305,31 @@ 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* 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;
+extern const char* app_service_id;
+extern const char* service_data;
+extern const char* request_service_active;
+extern const char* app_services;
+extern const char* update_reason;
+extern const char* updated_app_service_record;
+extern const char* service_records;
+extern const char* activate;
+extern const char* set_as_default;
+extern const char* origin_app;
+
// resuming
extern const char* application_commands;
extern const char* application_submenus;
@@ -359,6 +396,8 @@ extern const char* const keyboard_layout_supported;
extern const char* const keypress_mode_supported;
extern const char* const limited_characters_list_supported;
extern const char* const auto_complete_text_supported;
+extern const char* const send_location_enabled;
+extern const char* const get_way_points_enabled;
extern const char* const entity_type;
extern const char* const entity_id;
extern const char* const status;
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index 99113d6d00..8270e9b807 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -144,6 +144,7 @@ class StateControllerImpl : public event_engine::EventObserver,
// EventObserver interface
void on_event(const event_engine::Event& event);
+ void on_event(const event_engine::MobileEvent& event);
/**
* @brief Sets default application state and apply currently active HMI states
diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
index add440ad80..05565861f6 100644
--- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
+++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
@@ -39,7 +39,7 @@
#include "utils/lock.h"
#include "utils/macro.h"
#include "utils/system_time_handler.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/event_engine/event_observer.h"
namespace application_manager {
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..1e23aac8ee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
@@ -0,0 +1,84 @@
+# 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
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/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
+ sdl_rpc_plugin
+)
+
+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_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
new file mode 100644
index 0000000000..9be93f5c9e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
@@ -0,0 +1,131 @@
+/*
+ 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H
+
+#include <application_manager/application_manager.h>
+#include "application_manager/app_extension.h"
+
+#include <set>
+#include <string>
+
+namespace app_service_rpc_plugin {
+class AppServiceRpcPlugin;
+
+namespace app_mngr = application_manager;
+
+typedef int AppExtensionUID;
+typedef mobile_apis::VehicleDataType::eType VehicleDataType;
+/**
+ * @brief Defines set of app service types
+ */
+typedef std::set<std::string> AppServiceSubscriptions;
+
+class AppServiceAppExtension : public app_mngr::AppExtension {
+ public:
+ /**
+ * @brief AppServiceAppExtension constructor
+ * @param plugin app service plugin
+ * @param app application that contains this plugin
+ */
+ AppServiceAppExtension(AppServiceRpcPlugin& plugin,
+ app_mngr::Application& app);
+ virtual ~AppServiceAppExtension();
+
+ /**
+ * @brief subscribeToAppService add vehicle_data to list of subscriptions of
+ * application extension
+ * @param vehicle_data data to subscribe
+ * @return true in case if subscription is successful
+ */
+ bool SubscribeToAppService(const std::string app_service_type);
+
+ /**
+ * @brief unsubscribeFromAppService remove vehicle_data from list of
+ * subscriptions of application extension
+ * @param vehicle_data data to unsubscribe
+ * @return true in case if unsubscription is successful
+ */
+ bool UnsubscribeFromAppService(const std::string app_service_type);
+ /**
+ * @brief unsubscribeFromAppService unsubscribe from all app service types
+ */
+ void UnsubscribeFromAppService();
+
+ /**
+ * @brief isSubscribedToAppService checks if extension is subscribed to
+ * app service type
+ * @param app_service_type data type to check subscription
+ * @return true if extension is subscribed this app_service_type, otherwise
+ * return false
+ */
+ bool IsSubscribedToAppService(const std::string app_service_type) const;
+
+ /**
+ * @brief Subscriptions get list of subscriptions for application extension
+ * @return list of subscriptions for application extension
+ */
+ AppServiceSubscriptions Subscriptions();
+
+ /**
+ * @brief SaveResumptionData saves vehicle info data
+ * @param resumption_data plase to store resumption data
+ */
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
+
+ /**
+ * @brief ProcessResumption load resumtion data back to plugin during
+ * resumption
+ * @param resumption_data resumption data
+ */
+ void ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ /**
+ * @brief ExtractVIExtension utility function to extract application extension
+ * from application
+ * @param app : applicaiton that contains vehicle info app_extension
+ * @return application extension extracted from application
+ */
+ static AppServiceAppExtension& ExtractASExtension(
+ application_manager::Application& app);
+
+ private:
+ AppServiceSubscriptions subscribed_data_;
+ AppServiceRpcPlugin& plugin_;
+ app_mngr::Application& app_;
+};
+}
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_APP_EXTENSION_H
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..c9cb98cdfb
--- /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,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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_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;
+
+ private:
+ void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app);
+
+ 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_app_service_activation_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h
new file mode 100644
index 0000000000..c98979da0f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.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_APP_SERVICE_ACTIVATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_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 ASAppServiceActivationRequest command class
+ **/
+class ASAppServiceActivationRequest
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASAppServiceActivationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASAppServiceActivationRequest(
+ 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 ASAppServiceActivationRequest class destructor
+ **/
+ virtual ~ASAppServiceActivationRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationRequest);
+};
+
+} // 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_APP_SERVICE_ACTIVATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h
new file mode 100644
index 0000000000..68b77cb7e3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_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_APP_SERVICE_ACTIVATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_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 ASAppServiceActivationResponse command class
+ **/
+class ASAppServiceActivationResponse
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASAppServiceActivationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASAppServiceActivationResponse(
+ 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 ASAppServiceActivationResponse class destructor
+ **/
+ virtual ~ASAppServiceActivationResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationResponse);
+};
+
+} // 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_APP_SERVICE_ACTIVATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h
new file mode 100644
index 0000000000..2286d4c67c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.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_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetActiveServiceConsentRequest command class
+ **/
+class ASGetActiveServiceConsentRequest
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASGetActiveServiceConsentRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetActiveServiceConsentRequest(
+ 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 ASGetActiveServiceConsentRequest class destructor
+ **/
+ virtual ~ASGetActiveServiceConsentRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentRequest);
+};
+
+} // 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_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h
new file mode 100644
index 0000000000..f69152208c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_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_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetActiveServiceConsentResponse command class
+ **/
+class ASGetActiveServiceConsentResponse
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASGetActiveServiceConsentResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetActiveServiceConsentResponse(
+ 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 ASGetActiveServiceConsentResponse class destructor
+ **/
+ virtual ~ASGetActiveServiceConsentResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentResponse);
+};
+
+} // 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_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h
new file mode 100644
index 0000000000..7b175fc0d4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h
@@ -0,0 +1,98 @@
+/*
+ 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_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataRequestFromHMI command class
+ **/
+class ASGetAppServiceDataRequestFromHMI
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataRequestFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataRequestFromHMI(
+ 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 ASGetAppServiceDataRequestFromHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataRequestFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief onTimeOut from request controller
+ */
+ virtual void onTimeOut();
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestFromHMI);
+};
+
+} // 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_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h
new file mode 100644
index 0000000000..c4b3026176
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h
@@ -0,0 +1,79 @@
+/*
+ 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_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataRequestToHMI command class
+ **/
+class ASGetAppServiceDataRequestToHMI
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataRequestToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataRequestToHMI(
+ 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 ASGetAppServiceDataRequestToHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataRequestToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestToHMI);
+};
+
+} // 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_GET_APP_SERVICE_DATA_TO_HMI_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h
new file mode 100644
index 0000000000..b46626a56b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h
@@ -0,0 +1,79 @@
+/*
+ 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_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataResponseFromHMI command class
+ **/
+class ASGetAppServiceDataResponseFromHMI
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataResponseFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataResponseFromHMI(
+ 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 ASGetAppServiceDataResponseFromHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataResponseFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseFromHMI);
+};
+
+} // 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_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h
new file mode 100644
index 0000000000..e48a9d1429
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h
@@ -0,0 +1,79 @@
+/*
+ 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_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataResponseToHMI command class
+ **/
+class ASGetAppServiceDataResponseToHMI
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataResponseToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataResponseToHMI(
+ 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 ASGetAppServiceDataResponseToHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataResponseToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseToHMI);
+};
+
+} // 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_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h
new file mode 100644
index 0000000000..79ea0922a8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.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_GET_APP_SERVICE_RECORDS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_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 ASGetAppServiceRecordsRequest command class
+ **/
+class ASGetAppServiceRecordsRequest
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceRecordsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceRecordsRequest(
+ 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 ASGetAppServiceRecordsRequest class destructor
+ **/
+ virtual ~ASGetAppServiceRecordsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsRequest);
+};
+
+} // 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_GET_APP_SERVICE_RECORDS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h
new file mode 100644
index 0000000000..6db24132af
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_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_GET_APP_SERVICE_RECORDS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_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 ASGetAppServiceRecordsResponse command class
+ **/
+class ASGetAppServiceRecordsResponse
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceRecordsResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceRecordsResponse(
+ 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 ASGetAppServiceRecordsResponse class destructor
+ **/
+ virtual ~ASGetAppServiceRecordsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsResponse);
+};
+
+} // 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_GET_APP_SERVICE_RECORDS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h
new file mode 100644
index 0000000000..36acf116f4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h
@@ -0,0 +1,99 @@
+/*
+ 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_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 ASPerformAppServiceInteractionRequestFromHMI command class
+ **/
+class ASPerformAppServiceInteractionRequestFromHMI
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionRequestFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionRequestFromHMI(
+ 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 ASPerformAppServiceInteractionRequestFromHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionRequestFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE;
+
+ /**
+ * @brief onTimeOut from request controller
+ */
+ virtual void onTimeOut();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h
new file mode 100644
index 0000000000..0b67dd5624
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionRequestToHMI command class
+ **/
+class ASPerformAppServiceInteractionRequestToHMI
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionRequestToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionRequestToHMI(
+ 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 ASPerformAppServiceInteractionRequestToHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionRequestToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestToHMI);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h
new file mode 100644
index 0000000000..f807348833
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionResponseFromHMI command class
+ **/
+class ASPerformAppServiceInteractionResponseFromHMI
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionResponseFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionResponseFromHMI(
+ 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 ASPerformAppServiceInteractionResponseFromHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionResponseFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseFromHMI);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h
new file mode 100644
index 0000000000..7ce05bdba1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_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 ASPerformAppServiceInteractionResponseToHMI command class
+ **/
+class ASPerformAppServiceInteractionResponseToHMI
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionResponseToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionResponseToHMI(
+ 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 ASPerformAppServiceInteractionResponseToHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionResponseToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseToHMI);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_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..4433444602
--- /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,79 @@
+/*
+ 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:
+ 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..519d57c609
--- /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,79 @@
+/*
+ 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:
+ 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..30af13038a
--- /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,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_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:
+ 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..5a23e35df0
--- /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,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_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:
+ 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/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h
new file mode 100644
index 0000000000..7c80ec5e03
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h
@@ -0,0 +1,89 @@
+/*
+ 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_GET_APP_SERVICE_DATA_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_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 GetAppServiceDataRequest command class
+ **/
+class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief GetAppServiceDataRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataRequest(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 GetAppServiceDataRequest class destructor
+ **/
+ virtual ~GetAppServiceDataRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ virtual void on_event(const app_mngr::event_engine::MobileEvent& event);
+
+ private:
+ void HandleSubscribe();
+
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest);
+};
+
+} // 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_GET_APP_SERVICE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h
new file mode 100644
index 0000000000..279cf15055
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h
@@ -0,0 +1,79 @@
+/*
+ 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_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
+
+#include "application_manager/commands/command_request_to_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataRequestToMobile command class
+ **/
+class GetAppServiceDataRequestToMobile
+ : public app_mngr::commands::CommandRequestToMobile {
+ public:
+ /**
+ * @brief GetAppServiceDataRequestToMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataRequestToMobile(
+ 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 GetAppServiceDataRequestToMobile class destructor
+ **/
+ virtual ~GetAppServiceDataRequestToMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequestToMobile);
+};
+
+} // 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_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h
new file mode 100644
index 0000000000..f5758e1c39
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h
@@ -0,0 +1,78 @@
+/*
+ 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_GET_APP_SERVICE_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataResponse command class
+ **/
+class GetAppServiceDataResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief GetAppServiceDataResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataResponse(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 GetAppServiceDataResponse class destructor
+ **/
+ virtual ~GetAppServiceDataResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponse);
+};
+
+} // 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_GET_APP_SERVICE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h
new file mode 100644
index 0000000000..7e2b26d8fb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.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_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_from_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataResponseFromMobile command class
+ **/
+class GetAppServiceDataResponseFromMobile
+ : public app_mngr::commands::CommandResponseFromMobile {
+ public:
+ /**
+ * @brief GetAppServiceDataResponseFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataResponseFromMobile(
+ 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 GetAppServiceDataResponseFromMobile class destructor
+ **/
+ virtual ~GetAppServiceDataResponseFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponseFromMobile);
+};
+
+} // 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_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_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..719f5ebf5b
--- /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,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_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:
+ 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..c41fabf7b1
--- /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,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_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:
+ 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/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h
new file mode 100644
index 0000000000..854ed3c6aa
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h
@@ -0,0 +1,89 @@
+/*
+ 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_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 PerformAppServiceInteractionRequest command class
+ **/
+class PerformAppServiceInteractionRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionRequest(
+ 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 PerformAppServiceInteractionRequest class destructor
+ **/
+ virtual ~PerformAppServiceInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ virtual void on_event(const app_mngr::event_engine::MobileEvent& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequest);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h
new file mode 100644
index 0000000000..5c38e6a71e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_to_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionRequestToMobile command class
+ **/
+class PerformAppServiceInteractionRequestToMobile
+ : public app_mngr::commands::CommandRequestToMobile {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionRequestToMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionRequestToMobile(
+ 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 PerformAppServiceInteractionRequestToMobile class destructor
+ **/
+ virtual ~PerformAppServiceInteractionRequestToMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequestToMobile);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h
new file mode 100644
index 0000000000..b4c422fac6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_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 PerformAppServiceInteractionResponse command class
+ **/
+class PerformAppServiceInteractionResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionResponse(
+ 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 PerformAppServiceInteractionResponse class destructor
+ **/
+ virtual ~PerformAppServiceInteractionResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponse);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h
new file mode 100644
index 0000000000..4530cb2dfd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_from_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionResponseFromMobile command class
+ **/
+class PerformAppServiceInteractionResponseFromMobile
+ : public app_mngr::commands::CommandResponseFromMobile {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionResponseFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionResponseFromMobile(
+ 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 PerformAppServiceInteractionResponseFromMobile class destructor
+ **/
+ virtual ~PerformAppServiceInteractionResponseFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponseFromMobile);
+};
+
+} // 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_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_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..d70f279658
--- /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,78 @@
+/*
+ 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:
+ 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..9275f9e468
--- /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,79 @@
+/*
+ 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:
+ 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_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
new file mode 100644
index 0000000000..6d8b0c08cc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
@@ -0,0 +1,122 @@
+/*
+ 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_app_extension.h"
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+
+const AppExtensionUID AppServiceAppExtensionUID = 455;
+
+AppServiceAppExtension::AppServiceAppExtension(
+ AppServiceRpcPlugin& plugin, application_manager::Application& app)
+ : app_mngr::AppExtension(AppServiceAppExtensionUID)
+ , plugin_(plugin)
+ , app_(app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+AppServiceAppExtension::~AppServiceAppExtension() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool AppServiceAppExtension::SubscribeToAppService(
+ const std::string app_service_type) {
+ LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type);
+ return subscribed_data_.insert(app_service_type).second;
+}
+
+bool AppServiceAppExtension::UnsubscribeFromAppService(
+ const std::string app_service_type) {
+ LOG4CXX_DEBUG(logger_, app_service_type);
+ auto it = subscribed_data_.find(app_service_type);
+ if (it != subscribed_data_.end()) {
+ subscribed_data_.erase(it);
+ return true;
+ }
+ return false;
+}
+
+void AppServiceAppExtension::UnsubscribeFromAppService() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ subscribed_data_.clear();
+}
+
+bool AppServiceAppExtension::IsSubscribedToAppService(
+ const std::string app_service_type) const {
+ LOG4CXX_DEBUG(logger_,
+ "isSubscribedToAppService for type: " << app_service_type);
+ return subscribed_data_.find(app_service_type) != subscribed_data_.end();
+}
+
+AppServiceSubscriptions AppServiceAppExtension::Subscriptions() {
+ return subscribed_data_;
+}
+
+void AppServiceAppExtension::SaveResumptionData(
+ smart_objects::SmartObject& resumption_data) {
+ const char* app_service_info = "appService";
+ resumption_data[app_service_info] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ int i = 0;
+ for (const auto& subscription : subscribed_data_) {
+ resumption_data[app_service_info][i] = subscription;
+ i++;
+ }
+}
+
+void AppServiceAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ const char* app_service_info = "appService";
+ if (resumption_data.keyExists(app_service_info)) {
+ const smart_objects::SmartObject& subscriptions_app_services =
+ resumption_data[app_service_info];
+ for (size_t i = 0; i < subscriptions_app_services.length(); ++i) {
+ std::string service_type = resumption_data[i].asString();
+ SubscribeToAppService(service_type);
+ }
+ }
+}
+
+AppServiceAppExtension& AppServiceAppExtension::ExtractASExtension(
+ application_manager::Application& app) {
+ auto ext_ptr = app.QueryInterface(AppServiceAppExtensionUID);
+ DCHECK(ext_ptr);
+ DCHECK(dynamic_cast<AppServiceAppExtension*>(ext_ptr.get()));
+ auto vi_app_extension =
+ std::static_pointer_cast<AppServiceAppExtension>(ext_ptr);
+ DCHECK(vi_app_extension);
+ return *vi_app_extension;
+}
+}
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..f0a0698bb7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#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 ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_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 {
+ LOG4CXX_DEBUG(logger_,
+ "AppServiceCommandFactory::IsAbleToProcess" << function_id
+ << " " << source);
+ return (commands::Command::SOURCE_HMI == source ||
+ commands::Command::SOURCE_SDL_TO_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..7cfbdd22d0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -0,0 +1,191 @@
+/*
+ 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_app_service_activation_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.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";
+ } else if (hmi_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 AppServiceHmiCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const {
+ LOG4CXX_DEBUG(logger_,
+ "HMI App Service Plugin IsAbleToProcess: " << function_id);
+ 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_);
+
+ LOG4CXX_DEBUG(logger_,
+ "buildCommandCreator: " << function_id << " " << source);
+
+ 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>();
+ case hmi_apis::FunctionID::AppService_GetAppServiceData:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASGetAppServiceDataRequestFromHMI>()
+ : factory.GetCreator<
+ commands::ASGetAppServiceDataResponseFromHMI>();
+ } else if (app_mngr::commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASGetAppServiceDataRequestToHMI>()
+ : factory.GetCreator<
+ commands::ASGetAppServiceDataResponseToHMI>();
+ }
+ break;
+ case hmi_apis::FunctionID::AppService_GetAppServiceRecords:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASGetAppServiceRecordsRequest>()
+ : factory
+ .GetCreator<commands::ASGetAppServiceRecordsResponse>();
+ case hmi_apis::FunctionID::AppService_AppServiceActivation:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASAppServiceActivationRequest>()
+ : factory
+ .GetCreator<commands::ASAppServiceActivationResponse>();
+ case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionRequestFromHMI>()
+ : factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionResponseFromHMI>();
+ } else if (app_mngr::commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASPerformAppServiceInteractionRequestToHMI>()
+ : factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionResponseToHMI>();
+ }
+ break;
+ case hmi_apis::FunctionID::AppService_GetActiveServiceConsent:
+ return hmi_apis::messageType::request == message_type
+ ? factory
+ .GetCreator<commands::ASGetActiveServiceConsentRequest>()
+ : factory.GetCreator<
+ commands::ASGetActiveServiceConsentResponse>();
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported HMI 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..4b4da5e3e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -0,0 +1,159 @@
+/*
+ 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/get_app_service_data_request.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.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/perform_app_service_interaction_request.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_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>();
+ case mobile_apis::FunctionID::GetAppServiceDataID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::GetAppServiceDataRequest>()
+ : factory.GetCreator<
+ commands::GetAppServiceDataResponseFromMobile>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::GetAppServiceDataRequestToMobile>()
+ : factory.GetCreator<commands::GetAppServiceDataResponse>();
+ }
+ break;
+ case mobile_apis::FunctionID::PerformAppServiceInteractionID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::PerformAppServiceInteractionRequest>()
+ : factory.GetCreator<
+ commands::
+ PerformAppServiceInteractionResponseFromMobile>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::
+ PerformAppServiceInteractionRequestToMobile>()
+ : factory.GetCreator<
+ commands::PerformAppServiceInteractionResponse>();
+ }
+ break;
+ 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..b96e5c199d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -0,0 +1,98 @@
+/*
+ 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"
+#include "application_manager/plugin_manager/plugin_keys.h"
+
+namespace app_service_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace strings = application_manager::strings;
+namespace plugins = application_manager::plugin_manager;
+
+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 plugins::plugin_names::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) {
+ if (plugins::ApplicationEvent::kApplicationRegistered == event) {
+ application->AddExtension(
+ std::make_shared<AppServiceAppExtension>(*this, *application));
+ } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
+ DeleteSubscriptions(application);
+ }
+}
+
+void AppServiceRpcPlugin::DeleteSubscriptions(
+ application_manager::ApplicationSharedPtr app) {
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ auto subscriptions = ext.Subscriptions();
+ for (auto& service_type : subscriptions) {
+ ext.UnsubscribeFromAppService(service_type);
+ }
+}
+
+} // 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_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
new file mode 100644
index 0000000000..fd7312ca98
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
@@ -0,0 +1,89 @@
+/*
+ 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_app_service_activation_request.h"
+
+#include "application_manager/app_service_manager.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASAppServiceActivationRequest::ASAppServiceActivationRequest(
+ 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) {}
+
+ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {}
+
+void ASAppServiceActivationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppServiceManager& service_manager =
+ application_manager_.GetAppServiceManager();
+ smart_objects::SmartObject params = (*message_)[strings::msg_params];
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+ std::string service_id = params[strings::service_id].asString();
+ response_params[strings::service_id] = service_id;
+ if (params[strings::activate].asBool()) {
+ response_params[strings::activate] =
+ service_manager.ActivateAppService(service_id);
+ } else {
+ service_manager.DeactivateAppService(service_id);
+ response_params[strings::activate] = false;
+ }
+
+ if (params.keyExists(strings::set_as_default)) {
+ if (params[strings::set_as_default].asBool()) {
+ response_params[strings::set_as_default] =
+ service_manager.SetDefaultService(service_id);
+ } else {
+ service_manager.RemoveDefaultService(service_id);
+ response_params[strings::set_as_default] = false;
+ }
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_AppServiceActivation,
+ 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_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
new file mode 100644
index 0000000000..c77d3ed381
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
@@ -0,0 +1,59 @@
+/*
+ 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_app_service_activation_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASAppServiceActivationResponse::ASAppServiceActivationResponse(
+ 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) {}
+
+ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {}
+
+void ASAppServiceActivationResponse::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/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
new file mode 100644
index 0000000000..b1f3d6fdbf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
@@ -0,0 +1,59 @@
+/*
+ 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_get_active_service_consent_request.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {}
+
+void ASGetActiveServiceConsentRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
new file mode 100644
index 0000000000..038c2922ad
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {}
+
+void ASGetActiveServiceConsentResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::Event event(
+ hmi_apis::FunctionID::AppService_GetActiveServiceConsent);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
new file mode 100644
index 0000000000..a339ffb9a6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
@@ -0,0 +1,126 @@
+/*
+ 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_get_app_service_data_request_from_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI(
+ 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) {}
+
+ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {}
+
+void ASGetAppServiceDataRequestFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_type].asString();
+
+ LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type);
+
+ SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*message_),
+ true);
+}
+
+void ASGetAppServiceDataRequestFromHMI::on_event(
+ const event_engine::Event& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ bool success =
+ IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService);
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASGetAppServiceDataRequestFromHMI::on_event(
+ const event_engine::MobileEvent& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType mobile_result =
+ static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ hmi_apis::Common_Result::eType result =
+ MessageHelper::MobileToHMIResult(mobile_result);
+ bool success = IsMobileResultSuccess(mobile_result);
+
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASGetAppServiceDataRequestFromHMI::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject response_params;
+ response_params[strings::info] =
+ "The provider did not respond to the request";
+ SendErrorResponse(correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider did not respond to the request",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
new file mode 100644
index 0000000000..635cd7319a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ 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_get_app_service_data_request_to_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {}
+
+void ASGetAppServiceDataRequestToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
new file mode 100644
index 0000000000..c0b1b274fb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
@@ -0,0 +1,67 @@
+/*
+ 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_get_app_service_data_response_from_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/HMI_API.h"
+
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {}
+
+void ASGetAppServiceDataResponseFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
new file mode 100644
index 0000000000..b489ec4765
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ 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_get_app_service_data_response_to_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI(
+ 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) {}
+
+ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {}
+
+void ASGetAppServiceDataResponseToHMI::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/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
new file mode 100644
index 0000000000..fa704c1995
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
@@ -0,0 +1,90 @@
+/*
+ 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_get_app_service_records_request.h"
+
+#include "application_manager/app_service_manager.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest(
+ 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) {}
+
+ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {}
+
+void ASGetAppServiceRecordsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string type;
+ if ((*message_)[strings::msg_params].keyExists(strings::service_type)) {
+ type = (*message_)[strings::msg_params][strings::service_type].asString();
+ }
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject records =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ std::vector<smart_objects::SmartObject> service_records =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+
+ int index = 0;
+ for (auto& record : service_records) {
+ if (!type.empty() &&
+ record[strings::service_manifest][strings::service_type].asString() !=
+ type) {
+ continue;
+ }
+ records[index] = record;
+ index++;
+ }
+
+ if (!records.empty()) {
+ response_params[strings::service_records] = records;
+ }
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_GetAppServiceRecords,
+ 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_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
new file mode 100644
index 0000000000..0479aa8d31
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
@@ -0,0 +1,59 @@
+/*
+ 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_get_app_service_records_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse(
+ 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) {}
+
+ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {}
+
+void ASGetAppServiceRecordsResponse::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/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
new file mode 100644
index 0000000000..6499b08c28
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -0,0 +1,164 @@
+/*
+ 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_perform_app_service_interaction_request_from_hmi.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionRequestFromHMI::
+ ASPerformAppServiceInteractionRequestFromHMI(
+ 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) {}
+
+ASPerformAppServiceInteractionRequestFromHMI::
+ ~ASPerformAppServiceInteractionRequestFromHMI() {}
+
+void ASPerformAppServiceInteractionRequestFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ std::string hmi_origin_id =
+ application_manager_.get_settings().hmi_origin_id();
+ if (!msg_params.keyExists(strings::origin_app)) {
+ if (hmi_origin_id.empty()) {
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_DATA,
+ "No HMI origin ID to use for interaction passthrough",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+ msg_params[strings::origin_app] = hmi_origin_id;
+ }
+
+ std::string service_id = msg_params[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_ID,
+ "The requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ bool request_service_active = false;
+ if (msg_params.keyExists(strings::request_service_active)) {
+ request_service_active =
+ msg_params[strings::request_service_active].asBool();
+ msg_params.erase(strings::request_service_active);
+ }
+
+ // Only activate service if it is not already active
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
+ if (activate_service) {
+ application_manager_.GetAppServiceManager().ActivateAppService(service_id);
+ }
+
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::on_event(
+ const event_engine::Event& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ bool success =
+ IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService);
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::on_event(
+ const event_engine::MobileEvent& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType mobile_result =
+ static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ hmi_apis::Common_Result::eType result =
+ MessageHelper::MobileToHMIResult(mobile_result);
+ bool success = IsMobileResultSuccess(mobile_result);
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject response_params;
+ response_params[strings::info] =
+ "The provider did not respond to the request";
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider did not respond to the request",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
new file mode 100644
index 0000000000..22876328de
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ 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_perform_app_service_interaction_request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionRequestToHMI::
+ ASPerformAppServiceInteractionRequestToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionRequestToHMI::
+ ~ASPerformAppServiceInteractionRequestToHMI() {}
+
+void ASPerformAppServiceInteractionRequestToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
new file mode 100644
index 0000000000..a2ffa65a73
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
@@ -0,0 +1,64 @@
+/*
+ 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_perform_app_service_interaction_response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionResponseFromHMI::
+ ASPerformAppServiceInteractionResponseFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionResponseFromHMI::
+ ~ASPerformAppServiceInteractionResponseFromHMI() {}
+
+void ASPerformAppServiceInteractionResponseFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::Event event(
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
new file mode 100644
index 0000000000..5ddef55c2a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ 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_perform_app_service_interaction_response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionResponseToHMI::
+ ASPerformAppServiceInteractionResponseToHMI(
+ 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) {}
+
+ASPerformAppServiceInteractionResponseToHMI::
+ ~ASPerformAppServiceInteractionResponseToHMI() {}
+
+void ASPerformAppServiceInteractionResponseToHMI::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/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..637240666d
--- /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,76 @@
+/*
+ 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/app_service_manager.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) {}
+
+ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {}
+
+void ASPublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI");
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject manifest =
+ (*message_)[strings::msg_params][strings::app_service_manifest];
+ smart_objects::SmartObject service_record =
+ application_manager_.GetAppServiceManager().PublishAppService(manifest,
+ false);
+
+ response_params[strings::app_service_record] = service_record;
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params);
+}
+
+} // 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..c143315b8c
--- /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,60 @@
+/*
+ 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) {}
+
+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..80dd88c15f
--- /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,60 @@
+/*
+ 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"
+
+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) {}
+
+OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {}
+
+void OnASAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Sending AS data to HMI");
+ SendNotification();
+}
+
+} // 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..05266f834b
--- /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,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.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) {}
+
+OnASAppServiceDataNotificationFromHMI::
+ ~OnASAppServiceDataNotificationFromHMI() {}
+
+void OnASAppServiceDataNotificationFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+ SendNotificationToConsumers(
+ mobile_apis::FunctionID::eType::OnAppServiceDataID);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
new file mode 100644
index 0000000000..7c2e62abe2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
@@ -0,0 +1,129 @@
+/*
+ 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/get_app_service_data_request.h"
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataRequest::GetAppServiceDataRequest(
+ 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) {}
+
+GetAppServiceDataRequest::~GetAppServiceDataRequest() {}
+
+void GetAppServiceDataRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*message_),
+ true);
+}
+
+void GetAppServiceDataRequest::HandleSubscribe() {
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_type].asString();
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ if (app && (*message_)[strings::msg_params].keyExists(strings::subscribe)) {
+ bool subscribe =
+ (*message_)[strings::msg_params][strings::subscribe].asBool();
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ if (subscribe) {
+ ext.SubscribeToAppService(service_type);
+ } else {
+ ext.UnsubscribeFromAppService(service_type);
+ }
+ }
+}
+
+void GetAppServiceDataRequest::on_event(
+ const event_engine::MobileEvent& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ bool success = IsMobileResultSuccess(result);
+ if (success) {
+ HandleSubscribe();
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+void GetAppServiceDataRequest::on_event(const event_engine::Event& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+ if (success) {
+ HandleSubscribe();
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
new file mode 100644
index 0000000000..0af1a5436b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
@@ -0,0 +1,61 @@
+/*
+ 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/get_app_service_data_request_to_mobile.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile(
+ 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)
+ : CommandRequestToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {}
+
+void GetAppServiceDataRequestToMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
new file mode 100644
index 0000000000..32ad8e014d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
@@ -0,0 +1,61 @@
+/*
+ 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/get_app_service_data_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataResponse::GetAppServiceDataResponse(
+ 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) {}
+
+GetAppServiceDataResponse::~GetAppServiceDataResponse() {}
+
+void GetAppServiceDataResponse::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/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
new file mode 100644
index 0000000000..90fca04eb2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_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 {
+
+GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile(
+ 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)
+ : CommandResponseFromMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {}
+
+void GetAppServiceDataResponseFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // 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..fd3891e0e8
--- /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,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/commands/mobile/on_app_service_data_notification.h"
+
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/helpers/application_helper.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+#include "smart_objects/enum_schema_item.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) {}
+
+OnAppServiceDataNotification::~OnAppServiceDataNotification() {}
+
+void OnAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer");
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service) {
+ LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published");
+ return;
+ } else if (!service->record[strings::service_manifest]
+ [strings::allow_app_consumers].asBool()) {
+ LOG4CXX_ERROR(logger_,
+ "Service does not allow for app consumers, skipping mobile "
+ "OnAppServiceData notification");
+ return;
+ }
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type].asString();
+
+ auto subscribed_to_app_service_predicate =
+ [service_type](const ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app, false);
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type);
+ return ext.IsSubscribedToAppService(service_type);
+ };
+
+ const std::vector<ApplicationSharedPtr>& applications =
+ application_manager::FindAllApps(application_manager_.applications(),
+ subscribed_to_app_service_predicate);
+
+ std::vector<ApplicationSharedPtr>::const_iterator app_it =
+ applications.begin();
+
+ for (; applications.end() != app_it; ++app_it) {
+ const ApplicationSharedPtr app = *app_it;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ continue;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Sending OnAppServiceDataNotification to mobile connection: "
+ << app->app_id());
+ (*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] =
+ app->app_id();
+ 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..7bb62d298d
--- /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,84 @@
+/*
+ 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) {}
+
+OnAppServiceDataNotificationFromMobile::
+ ~OnAppServiceDataNotificationFromMobile() {}
+
+void OnAppServiceDataNotificationFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
+ MessageHelper::PrintSmartObject(*message_);
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type].asString();
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ bool result = policy_handler_.CheckAppServiceParameters(
+ app->policy_app_id(), std::string(), service_type, NULL);
+
+ if (!result) {
+ LOG4CXX_DEBUG(logger_,
+ "Incorrect service type received in "
+ "OnAppServiceDataNotificationFromMobile");
+ return;
+ }
+
+ SendNotificationToConsumers(
+ hmi_apis::FunctionID::eType::AppService_OnAppServiceData);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
new file mode 100644
index 0000000000..63b6e47d8e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -0,0 +1,188 @@
+/*
+ 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/perform_app_service_interaction_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest(
+ 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) {}
+
+PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {}
+
+void PerformAppServiceInteractionRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto app = application_manager_.application(connection_key());
+ if (!app) {
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ std::string service_id = msg_params[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_ID,
+ "The requested service ID does not exist");
+ return;
+ }
+
+ if (!service->record[strings::service_manifest][strings::allow_app_consumers]
+ .asBool()) {
+ SendResponse(
+ false,
+ mobile_apis::Result::REJECTED,
+ "The requested service ID does not allow mobile app consumers");
+ return;
+ }
+
+ bool request_service_active = false;
+ if (msg_params.keyExists(strings::request_service_active)) {
+ request_service_active =
+ msg_params[strings::request_service_active].asBool();
+ msg_params.erase(strings::request_service_active);
+ }
+
+ // Only activate service if it is not already active
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
+ if (activate_service) {
+ if (app->IsFullscreen()) {
+ // App is in foreground, we can just activate the service
+ application_manager_.GetAppServiceManager().ActivateAppService(
+ service_id);
+ } else {
+ // App is not in foreground, we need to prompt the user to activate the
+ // service
+ smart_objects::SmartObject request_params;
+ request_params[strings::service_id] = service_id;
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent,
+ &request_params,
+ true);
+ return;
+ }
+ }
+
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+}
+
+void PerformAppServiceInteractionRequest::on_event(
+ const event_engine::Event& event) {
+ LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event");
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+
+ switch (event.id()) {
+ case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction:
+ SendResponse(success, result, info, &msg_params);
+ break;
+ case hmi_apis::FunctionID::AppService_GetActiveServiceConsent:
+ if (msg_params[strings::activate].asBool()) {
+ // User agreed to activate service, we can now send the provider request
+ application_manager_.GetAppServiceManager().ActivateAppService(
+ (*message_)[strings::msg_params][strings::service_id].asString());
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+ } else if (mobile_apis::Result::SUCCESS == result) {
+ // Request was successful, but user denied the request to activate the
+ // service
+ SendResponse(false,
+ mobile_apis::Result::USER_DISALLOWED,
+ "Request to activate service was denied by driver");
+ } else {
+ SendResponse(success, result, info);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void PerformAppServiceInteractionRequest::on_event(
+ const event_engine::MobileEvent& event) {
+ LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event");
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+ mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ bool success = IsMobileResultSuccess(result);
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
new file mode 100644
index 0000000000..2a7b644cb3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "application_manager/application_impl.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionRequestToMobile::
+ PerformAppServiceInteractionRequestToMobile(
+ 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)
+ : CommandRequestToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionRequestToMobile::
+ ~PerformAppServiceInteractionRequestToMobile() {}
+
+void PerformAppServiceInteractionRequestToMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
new file mode 100644
index 0000000000..5e84f42c34
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
@@ -0,0 +1,60 @@
+/*
+ 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/perform_app_service_interaction_response.h"
+#include "application_manager/application_impl.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse(
+ 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) {}
+
+PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {}
+
+void PerformAppServiceInteractionResponse::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/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
new file mode 100644
index 0000000000..9912df84ce
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionResponseFromMobile::
+ PerformAppServiceInteractionResponseFromMobile(
+ 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)
+ : CommandResponseFromMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionResponseFromMobile::
+ ~PerformAppServiceInteractionResponseFromMobile() {}
+
+void PerformAppServiceInteractionResponseFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::MobileEvent event(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // 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..bb0855d42f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -0,0 +1,126 @@
+/*
+ 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/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.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) {}
+
+PublishAppServiceRequest::~PublishAppServiceRequest() {}
+
+void PublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key());
+ 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];
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ std::string requested_service_name = "";
+
+ if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists(
+ strings::service_name)) {
+ requested_service_name =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::service_name].asString();
+ }
+
+ std::string requested_service_type =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::service_type].asString();
+
+ smart_objects::SmartArray* requested_handled_rpcs = NULL;
+ if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ requested_handled_rpcs =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::handled_rpcs].asArray();
+ }
+
+ bool result =
+ policy_handler_.CheckAppServiceParameters(app->policy_app_id(),
+ requested_service_name,
+ requested_service_type,
+ requested_handled_rpcs);
+
+ if (!result) {
+ SendResponse(false,
+ mobile_apis::Result::DISALLOWED,
+ "Service disallowed by policies",
+ NULL);
+ return;
+ }
+
+ auto& ext =
+ sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES);
+
+ smart_objects::SmartObject service_record =
+ application_manager_.GetAppServiceManager().PublishAppService(
+ manifest, true, connection_key());
+ if (app->IsFullscreen()) {
+ // Service should be activated if app is in the foreground
+ application_manager_.GetAppServiceManager().ActivateAppService(
+ service_record[strings::service_id].asString());
+ }
+
+ 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..d1bfc6e154
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "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"
+
+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) {}
+
+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/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
new file mode 100644
index 0000000000..0b56ddb7e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
@@ -0,0 +1,40 @@
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+
+include_directories(
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/
+ ${COMPONENTS_DIR}/application_manager/test/include/
+ ${POLICY_MOCK_INCLUDE_PATH}/
+ ${CMAKE_SOURCE_DIR}/src
+ ${COMPONENTS_DIR}/resumption/include
+)
+
+
+set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
+
+file(GLOB SOURCES
+ ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
+ ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc
+ ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc
+ ${COMMANDS_TEST_DIR}/hmi/*
+ ${COMMANDS_TEST_DIR}/mobile/*
+ ${COMPONENTS_DIR}/application_manager/src/message.cc
+ ${COMPONENTS_DIR}/application_manager/src/event_engine/*
+)
+
+set(LIBRARIES
+ gmock
+ Utils
+ SmartObjects
+ HMI_API
+ MOBILE_API
+ connectionHandler
+ app_service_rpc_plugin
+ sdl_rpc_plugin
+ jsoncpp
+ Policy
+ Resumption
+)
+
+create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
new file mode 100644
index 0000000000..8ef87b6de9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -0,0 +1,151 @@
+/*
+ * 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/commands/command_request_test.h"
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include "gtest/gtest.h"
+
+#include "hmi/as_app_service_activation_request.h"
+#include "hmi/as_app_service_activation_response.h"
+#include "hmi/as_get_active_service_consent_request.h"
+#include "hmi/as_get_active_service_consent_response.h"
+#include "hmi/as_get_app_service_data_request_from_hmi.h"
+#include "hmi/as_get_app_service_data_request_to_hmi.h"
+#include "hmi/as_get_app_service_data_response_from_hmi.h"
+#include "hmi/as_get_app_service_data_response_to_hmi.h"
+#include "hmi/as_get_app_service_records_request.h"
+#include "hmi/as_get_app_service_records_response.h"
+#include "hmi/as_perform_app_service_interaction_request_from_hmi.h"
+#include "hmi/as_perform_app_service_interaction_request_to_hmi.h"
+#include "hmi/as_perform_app_service_interaction_response_from_hmi.h"
+#include "hmi/as_perform_app_service_interaction_response_to_hmi.h"
+#include "hmi/as_publish_app_service_request.h"
+#include "hmi/as_publish_app_service_response.h"
+#include "hmi/on_as_app_service_data_notification.h"
+#include "hmi/on_as_app_service_data_notification_from_hmi.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+
+namespace am = application_manager;
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace dummy_hmi_commands_test {
+
+namespace commands = app_service_rpc_plugin::commands;
+
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+using application_manager::commands::MessageSharedPtr;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::test::components::application_manager_test::MockApplicationManager;
+using ::test::components::application_manager_test::
+ MockApplicationManagerSettings;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
+
+template <class Command>
+class HMICommandsTest : public components::commands_test::CommandRequestTest<
+ CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ stream_retry_.first = 0;
+ stream_retry_.second = 0;
+ EXPECT_CALL(app_mngr_settings_, default_timeout())
+ .WillOnce(ReturnRef(timeout));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, start_stream_retry_amount())
+ .WillByDefault(ReturnRef(stream_retry_));
+ }
+
+ protected:
+ std::pair<uint32_t, int32_t> stream_retry_;
+};
+
+template <class Command>
+class HMICommandsTestFirst : public HMICommandsTest<Command> {
+ public:
+ using typename HMICommandsTest<Command>::CommandType;
+};
+
+/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few
+ * TYPED_TEST_CASE for HMI and mobile commands
+ */
+
+typedef Types<commands::ASAppServiceActivationRequest,
+ commands::ASAppServiceActivationResponse,
+ commands::ASGetActiveServiceConsentRequest,
+ commands::ASGetActiveServiceConsentResponse,
+ commands::ASPerformAppServiceInteractionRequestFromHMI,
+ commands::ASGetAppServiceDataRequestToHMI,
+ commands::ASGetAppServiceDataResponseFromHMI,
+ commands::ASGetAppServiceDataResponseToHMI,
+ commands::ASGetAppServiceRecordsRequest,
+ commands::ASGetAppServiceRecordsResponse,
+ commands::ASPerformAppServiceInteractionRequestFromHMI,
+ commands::ASPerformAppServiceInteractionRequestToHMI,
+ commands::ASPerformAppServiceInteractionResponseFromHMI,
+ commands::ASPerformAppServiceInteractionResponseToHMI,
+ commands::ASPublishAppServiceRequest,
+ commands::ASPublishAppServiceResponse,
+ commands::OnASAppServiceDataNotification,
+ commands::OnASAppServiceDataNotificationFromHMI>
+ HMICommandsListFirst;
+
+TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
+
+TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) {
+ std::shared_ptr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_NE(command.use_count(), 0);
+}
+
+} // namespace dummy_hmi_commands_test
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
new file mode 100644
index 0000000000..3c8a780128
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -0,0 +1,135 @@
+/*
+ * 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/commands/command_request_test.h"
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include "gtest/gtest.h"
+
+#include "mobile/get_app_service_data_request.h"
+#include "mobile/get_app_service_data_request_to_mobile.h"
+#include "mobile/get_app_service_data_response.h"
+#include "mobile/get_app_service_data_response_from_mobile.h"
+#include "mobile/on_app_service_data_notification.h"
+#include "mobile/on_app_service_data_notification_from_mobile.h"
+#include "mobile/perform_app_service_interaction_request.h"
+#include "mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "mobile/perform_app_service_interaction_response.h"
+#include "mobile/perform_app_service_interaction_response_from_mobile.h"
+#include "mobile/publish_app_service_request.h"
+#include "mobile/publish_app_service_response.h"
+
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "test/application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+
+namespace am = application_manager;
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace dummy_mobile_commands_test {
+
+namespace commands = app_service_rpc_plugin::commands;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+using am::commands::MessageSharedPtr;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::test::components::application_manager_test::MockApplicationManager;
+using ::test::components::application_manager_test::
+ MockApplicationManagerSettings;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
+
+namespace {
+const std::string kEmptyString_ = "";
+} // namespace
+
+template <class Command>
+class MobileCommandsTest : public components::commands_test::CommandRequestTest<
+ CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ EXPECT_CALL(app_mngr_settings_, default_timeout())
+ .WillOnce(ReturnRef(timeout));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, app_icons_folder())
+ .WillByDefault(ReturnRef(kEmptyString_));
+ }
+};
+
+template <class Command>
+class MobileCommandsTestFirst : public MobileCommandsTest<Command> {
+ public:
+ using typename MobileCommandsTest<Command>::CommandType;
+};
+
+/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few
+ * TYPED_TEST_CASE for HMI and mobile commands
+ */
+
+typedef Types<commands::GetAppServiceDataRequest,
+ commands::GetAppServiceDataRequestToMobile,
+ commands::GetAppServiceDataResponse,
+ commands::GetAppServiceDataResponseFromMobile,
+ commands::OnAppServiceDataNotification,
+ commands::OnAppServiceDataNotificationFromMobile,
+ commands::PerformAppServiceInteractionRequest,
+ commands::PerformAppServiceInteractionRequestToMobile,
+ commands::PerformAppServiceInteractionResponse,
+ commands::PerformAppServiceInteractionResponseFromMobile,
+ commands::PublishAppServiceRequest,
+ commands::PublishAppServiceResponse> MobileCommandsListFirst;
+
+TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
+
+TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) {
+ std::shared_ptr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_NE(command.use_count(), 0);
+}
+
+} // namespace dummy_mobile_commands_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
new file mode 100644
index 0000000000..47358ef631
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
@@ -0,0 +1,217 @@
+/*
+ * 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/application.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_app_service_manager.h"
+#include "application_manager/commands/commands_test.h"
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "resumption/last_state_impl.h"
+
+namespace am = application_manager;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::ReturnNull;
+using ::testing::NiceMock;
+using ::testing::SaveArg;
+using ::testing::Mock;
+using am::ApplicationSet;
+using am::commands::MessageSharedPtr;
+using test::components::application_manager_test::MockApplication;
+using test::components::application_manager_test::MockApplicationManager;
+using test::components::application_manager_test::MockAppServiceManager;
+using test::components::commands_test::CommandsTest;
+using test::components::commands_test::CommandsTestMocks;
+using app_service_rpc_plugin::commands::OnAppServiceDataNotification;
+
+namespace {
+const uint32_t kAppId = 0u;
+const uint32_t kConnectionKey = 1u;
+const std::string kPolicyAppId = "Test";
+const int kModuleId = 153u;
+}
+
+namespace app_service_plugin_test {
+using namespace app_service_rpc_plugin;
+using application_manager::ApplicationSet;
+
+class OnAppServiceDataNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnAppServiceDataNotificationTest()
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
+ , app_service_app_extension_(
+ std::make_shared<app_service_rpc_plugin::AppServiceAppExtension>(
+ app_service_plugin_, *mock_app_))
+ , apps_lock_(std::make_shared<sync_primitives::Lock>())
+ , apps_da_(apps_, apps_lock_)
+ , last_state_("app_storage_folder", "app_info_storage")
+ , app_service_manager_(app_mngr_, last_state_) {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, QueryInterface(_))
+ .WillByDefault(Return(app_service_app_extension_));
+ }
+
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ mobile_apis::FunctionID::OnAppServiceDataID;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kConnectionKey;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::app_id] = kAppId;
+
+ return message;
+ }
+
+ protected:
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<AppServiceAppExtension> app_service_app_extension_;
+ app_service_rpc_plugin::AppServiceRpcPlugin app_service_plugin_;
+ application_manager::ApplicationSet apps_;
+ const std::shared_ptr<sync_primitives::Lock> apps_lock_;
+ DataAccessor<application_manager::ApplicationSet> apps_da_;
+ resumption::LastStateImpl last_state_;
+ MockAppServiceManager app_service_manager_;
+};
+
+TEST_F(OnAppServiceDataNotificationTest, Run_SendMessageToMobile_Notification) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ app_service_app_extension_->SubscribeToAppService("MEDIA");
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ am::AppService service;
+ service.connection_key = 1;
+ service.mobile_service = true;
+ service
+ .record[am::strings::service_manifest][am::strings::allow_app_consumers] =
+ true;
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_))
+ .WillOnce(Return(&service));
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&mobile_message));
+ // Act
+ command->Run();
+
+ // Assertions
+ ASSERT_TRUE(mobile_message.get());
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+TEST_F(OnAppServiceDataNotificationTest, Run_NoService) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ app_service_app_extension_->SubscribeToAppService("MEDIA");
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_)).WillOnce(ReturnNull());
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0);
+ command->Run();
+
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+TEST_F(OnAppServiceDataNotificationTest, Run_NoSubscribedApps) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ am::AppService service;
+ service.connection_key = 1;
+ service.mobile_service = true;
+ service
+ .record[am::strings::service_manifest][am::strings::allow_app_consumers] =
+ true;
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_))
+ .WillOnce(Return(&service));
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0);
+ command->Run();
+
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
index ecfc1dcda4..d49f3e9e36 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
@@ -124,7 +124,8 @@ RCCommandFactory::RCCommandFactory(const RCCommandParams& params)
CommandSharedPtr RCCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
hmi_apis::messageType::eType message_type =
static_cast<hmi_apis::messageType::eType>(
(*message)[strings::params][strings::message_type].asInt());
@@ -153,7 +154,8 @@ bool RCCommandFactory::IsAbleToProcess(
const application_manager::commands::Command::CommandSource message_source)
const {
using app_mngr::commands::Command;
- if (Command::SOURCE_HMI == message_source) {
+ if (Command::SOURCE_HMI == message_source ||
+ Command::SOURCE_SDL_TO_HMI == message_source) {
return get_hmi_creator_factory(
static_cast<hmi_apis::FunctionID::eType>(function_id),
hmi_apis::messageType::INVALID_ENUM).CanBeCreated();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
index fd6b4e86ac..3bc1106573 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
@@ -29,7 +29,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
+#include "application_manager/plugin_manager/plugin_keys.h"
#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "rc_rpc_plugin/rc_command_factory.h"
#include "rc_rpc_plugin/rc_app_extension.h"
@@ -77,7 +77,7 @@ bool RCRPCPlugin::IsAbleToProcess(
}
std::string RCRPCPlugin::PluginName() {
- return "RC RPC Plugin";
+ return plugins::plugin_names::rc_rpc_plugin;
}
application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
index 59d038a790..e9d1063648 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
@@ -196,8 +196,8 @@ TEST_F(ButtonPressRequestTest,
SetResourceState(resource, kAppId, rc_rpc_plugin::ResourceState::BUSY));
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress)))
- .WillOnce(Return(true));
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress),
+ _)).WillOnce(Return(true));
// Act
std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command =
@@ -230,8 +230,9 @@ TEST_F(
.Times(2);
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_ButtonPress))).Times(0);
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress),
+ _)).Times(0);
MessageSharedPtr command_result;
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
index 25dad2dc04..4e74e74ef8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
@@ -199,9 +199,10 @@ TEST_F(GetInteriorVehicleDataRequestTest,
mobile_message);
// Expectations
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
// Act
command->Run();
@@ -225,9 +226,10 @@ TEST_F(GetInteriorVehicleDataRequestTest,
mobile_message);
// Expectations
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
// Act
command->Run();
@@ -253,7 +255,7 @@ TEST_F(
.WillOnce(Return(true));
EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio))
.WillOnce(Return(radio_data));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
MessageSharedPtr command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -295,9 +297,10 @@ TEST_F(
.WillByDefault(Return(true));
// Expectations
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
@@ -347,7 +350,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio))
.WillOnce(Return(radio_data));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
MessageSharedPtr command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -383,7 +386,7 @@ TEST_F(
.WillByDefault(Return(&rc_capabilities));
// Expectations
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE),
@@ -407,7 +410,7 @@ TEST_F(
ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(false));
// Expectations
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::DISALLOWED), _))
@@ -443,9 +446,10 @@ TEST_F(GetInteriorVehicleDataRequestTest,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
// Act
@@ -478,9 +482,10 @@ TEST_F(GetInteriorVehicleDataRequestTest,
.WillByDefault(Return(true));
// Expectations
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -519,9 +524,10 @@ TEST_F(GetInteriorVehicleDataRequestTest,
.WillByDefault(Return(true));
// Expectations
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -569,10 +575,11 @@ TEST_F(GetInteriorVehicleDataRequestTest,
StoreRequestToHMITime(enums_value::kRadio));
EXPECT_CALL(mock_interior_data_cache_, Contains(enums_value::kRadio))
.WillRepeatedly(Return(false));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
- .WillRepeatedly(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData),
+ _)).WillRepeatedly(Return(true));
// Act
command->Run();
}
@@ -585,7 +592,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::REJECTED), _))
.WillOnce(Return(false));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
// Act
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
index 11dd35d061..fdf02b57cb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
@@ -42,8 +42,12 @@ set (HMI_COMMANDS_SOURCE_DIR
${COMMANDS_SOURCE_DIR}/hmi
)
+set (EXTENSIONS_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/extensions
+)
collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}")
collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}")
+collect_sources(APP_EXTENSIONS "${EXTENSIONS_SOURCE_DIR}")
collect_sources(RPC_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
@@ -60,7 +64,7 @@ if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES})
+add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS})
target_link_libraries("sdl_rpc_plugin" ${LIBRARIES})
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
index 90160d9953..3a97ebdfb5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/response_from_hmi.h"
#include "utils/macro.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
new file mode 100644
index 0000000000..fd241da3c4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathRequest command class
+ **/
+class BCGetFilePathRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BCGetFilePathRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathRequest class destructor
+ **/
+ virtual ~BCGetFilePathRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_sdl_RPC_PLUGIN_INCLUDE_sdl_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
new file mode 100644
index 0000000000..2a6025cbdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathResponse command class
+ **/
+class BCGetFilePathResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BCGetFilePathResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathResponse class destructor
+ **/
+ virtual ~BCGetFilePathResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h
new file mode 100644
index 0000000000..17f8a5b3c8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+
+#include "application_manager/commands/notification_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASSystemCapabilityUpdatedNotification command class
+ **/
+class OnBCSystemCapabilityUpdatedNotification
+ : public app_mngr::commands::NotificationToHMI {
+ public:
+ /**
+ * @brief OnASSystemCapabilityUpdatedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnBCSystemCapabilityUpdatedNotification(
+ 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 OnASSystemCapabilityUpdatedNotification class destructor
+ **/
+ virtual ~OnBCSystemCapabilityUpdatedNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotification);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
index 0beba8dc6b..7cd8410d8e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_TIME_READY_NOTIFICATION_H_
#include "application_manager/commands/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h
new file mode 100644
index 0000000000..3d74a80dc2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_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_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_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 GetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ GetCloudAppPropertiesRequest(
+ 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 ~GetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesRequest);
+}; // GetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h
new file mode 100644
index 0000000000..f716c7dcb5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_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_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_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 GetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ GetCloudAppPropertiesResponse(
+ 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 ~GetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesResponse);
+
+}; // GetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
new file mode 100644
index 0000000000..d4182ea004
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetFileRequest command class
+ **/
+class GetFileRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief GetFileRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetFileRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetFileRequest class destructor
+ **/
+ virtual ~GetFileRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ bool GetFilePath(std::string& file_path, bool& forward_to_hmi);
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ private:
+ std::string file_name_;
+ mobile_apis::FileType::eType file_type_;
+ uint32_t length_;
+ uint32_t offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(GetFileRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
new file mode 100644
index 0000000000..bc191d224c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetFileResponse command class
+ **/
+class GetFileResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief GetFileResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetFileResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetFileResponse class destructor
+ **/
+ virtual ~GetFileResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetFileResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h
new file mode 100644
index 0000000000..1f7e8468db
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.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_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+
+#include "application_manager/commands/command_notification_impl.h"
+#include "policy/policy_table/enums.h"
+#include <vector>
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+namespace mobile {
+
+/**
+ * @brief OnSystemCapabilityUpdatedNotification class
+ **/
+class OnSystemCapabilityUpdatedNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ typedef std::vector<uint8_t> BinaryMessage;
+ /**
+ * @brief OnSystemCapabilityUpdatedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnSystemCapabilityUpdatedNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief OnSystemCapabilityUpdatedNotification class destructor
+ **/
+ ~OnSystemCapabilityUpdatedNotification() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnSystemCapabilityUpdatedNotification);
+};
+
+} // namespace mobile
+} // namespace commands
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
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..91ee8ea813 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);
/*
@@ -141,11 +144,14 @@ class RegisterAppInterfaceRequest
/*
* @brief Check new application parameters (name, tts, vr) for
* coincidence with already known parameters of registered applications
+ * @param out_duplicate_apps In the case other apps was found with duplicate
+ * names, this field will be filled with a list of said apps
*
* return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms,
* otherwise appropriate error code returns
- */
- mobile_apis::Result::eType CheckCoincidence();
+ */
+ mobile_apis::Result::eType CheckCoincidence(
+ std::vector<app_mngr::ApplicationSharedPtr>& out_duplicate_apps);
/*
* @brief Predicate for using with CheckCoincidence method to compare with VR
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/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
new file mode 100644
index 0000000000..fb82cf37c2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
@@ -0,0 +1,83 @@
+/*
+ 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_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
+#include <application_manager/application_manager.h>
+#include <set>
+#include <string>
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+class SDLRPCPlugin;
+
+namespace app_mngr_ = application_manager;
+
+typedef mobile_apis::SystemCapabilityType::eType SystemCapabilityType;
+typedef std::set<mobile_apis::SystemCapabilityType::eType>
+ SystemCapabilitySubscriptions;
+
+class SystemCapabilityAppExtension : public app_mngr_::AppExtension {
+ public:
+ SystemCapabilityAppExtension(SDLRPCPlugin& plugin,
+ app_mngr_::Application& app);
+ virtual ~SystemCapabilityAppExtension();
+
+ bool SubscribeTo(const SystemCapabilityType system_capability_type);
+
+ bool UnsubscribeFrom(const SystemCapabilityType system_capability_type);
+
+ void UnsubscribeFromAll();
+
+ bool IsSubscribedTo(const SystemCapabilityType system_capability_type) const;
+
+ SystemCapabilitySubscriptions Subscriptions();
+
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
+
+ void ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID;
+
+ static SystemCapabilityAppExtension& ExtractExtension(
+ app_mngr_::Application& app);
+
+ private:
+ SystemCapabilitySubscriptions subscribed_data_;
+ SDLRPCPlugin& plugin_;
+ app_mngr_::Application& app_;
+};
+}
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
index 6ae3a0b6bc..b57fcbec12 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
@@ -36,29 +36,32 @@
#include "application_manager/command_factory.h"
namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
+
+class SystemCapabilityAppExtension;
+
class SDLRPCPlugin : public plugins::RPCPlugin {
// RPCPlugin interface
public:
- bool Init(application_manager::ApplicationManager& app_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
+ bool Init(app_mngr::ApplicationManager& app_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 application_manager::commands::Command::CommandSource
- message_source) OVERRIDE;
+ const app_mngr::commands::Command::CommandSource message_source) OVERRIDE;
std::string PluginName() OVERRIDE;
- application_manager::CommandFactory& GetCommandFactory() OVERRIDE;
- void OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent event) OVERRIDE;
- void OnApplicationEvent(
- application_manager::plugin_manager::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) OVERRIDE;
+ app_mngr::CommandFactory& GetCommandFactory() OVERRIDE;
+ void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE;
+ void OnApplicationEvent(plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
private:
+ void ClearSubscriptions(app_mngr::ApplicationSharedPtr app);
+
std::unique_ptr<application_manager::CommandFactory> command_factory_;
};
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
new file mode 100644
index 0000000000..b735cd9bdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathRequest::BCGetFilePathRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathRequest::~BCGetFilePathRequest() {}
+
+void BCGetFilePathRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
new file mode 100644
index 0000000000..b86ab6a2b8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathResponse::BCGetFilePathResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathResponse::~BCGetFilePathResponse() {}
+
+void BCGetFilePathResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_GetFilePath);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
new file mode 100644
index 0000000000..0677c97db8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -0,0 +1,167 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/HMI_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnBCSystemCapabilityUpdatedNotification::
+ OnBCSystemCapabilityUpdatedNotification(
+ 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) {}
+
+OnBCSystemCapabilityUpdatedNotification::
+ ~OnBCSystemCapabilityUpdatedNotification() {}
+
+void OnBCSystemCapabilityUpdatedNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "Sending BasicCommunication.OnSystemCapabilityUpdated "
+ "Notification to HMI");
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+
+ hmi_apis::Common_SystemCapabilityType::eType system_capability_type =
+ static_cast<hmi_apis::Common_SystemCapabilityType::eType>(
+ msg_params[strings::system_capability]
+ [strings::system_capability_type].asInt());
+ switch (system_capability_type) {
+ case hmi_apis::Common_SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
+ if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
+ msg_params[strings::system_capability][strings::navigation_capability] =
+ nav_capability;
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::PHONE_CALL: {
+ if (hmi_capabilities_.phone_capability()) {
+ msg_params[strings::system_capability][strings::phone_capability] =
+ *hmi_capabilities_.phone_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::REMOTE_CONTROL: {
+ if (!hmi_capabilities_.is_rc_cooperating()) {
+ return;
+ }
+ if (hmi_capabilities_.rc_capability()) {
+ msg_params[strings::system_capability][strings::rc_capability] =
+ *hmi_capabilities_.rc_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::VIDEO_STREAMING:
+ if (hmi_capabilities_.video_streaming_capability()) {
+ msg_params[strings::system_capability]
+ [strings::video_streaming_capability] =
+ *hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
+ }
+ break;
+ case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ auto app_service_caps =
+ MessageHelper::CreateAppServiceCapabilities(all_services);
+
+ smart_objects::SmartArray* app_services =
+ app_service_caps[strings::app_services].asArray();
+ smart_objects::SmartObject& updated_capabilities =
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities][strings::app_services];
+ for (size_t i = 0; i < updated_capabilities.length(); i++) {
+ std::string service_id =
+ updated_capabilities[i][strings::updated_app_service_record]
+ [strings::service_id].asString();
+ auto matching_service_predicate = [&service_id](
+ const smart_objects::SmartObject& app_service_capability) {
+ return service_id ==
+ app_service_capability[strings::updated_app_service_record]
+ [strings::service_id].asString();
+ };
+
+ auto it = std::find_if(app_services->begin(),
+ app_services->end(),
+ matching_service_predicate);
+ if (it != app_services->end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Replacing updated record with service_id "
+ << service_id);
+ app_services->erase(it);
+ }
+ app_services->push_back(updated_capabilities[i]);
+ }
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities] = app_service_caps;
+ break;
+ }
+ default:
+ return;
+ }
+ SendNotification();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
index 681390fbf4..b6d44a4511 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
@@ -106,6 +106,10 @@ void OnExitApplicationNotification::Run() {
application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
return;
}
+ case Common_ApplicationExitReason::CLOSE_CLOUD_CONNECTION: {
+ application_manager_.DisconnectCloudApp(app_impl);
+ break;
+ }
default: {
LOG4CXX_WARN(logger_, "Unhandled reason");
return;
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/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..34ed30c243
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
@@ -0,0 +1,98 @@
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
+ 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) {}
+
+GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {}
+
+void GetCloudAppPropertiesRequest::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;
+ }
+
+ std::string policy_app_id =
+ (*message_)[strings::msg_params][strings::app_id].asString();
+
+ bool enabled = true;
+ std::string endpoint;
+ std::string auth_token;
+ std::string certificate;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+
+ bool result = policy_handler_.GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+
+ if (!result) {
+ SendResponse(false,
+ mobile_apis::Result::DATA_NOT_AVAILABLE,
+ "Cloud app does not exist on module");
+ return;
+ }
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types);
+
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array);
+ size_t i = 0;
+ for (std::string nickname : nicknames) {
+ nicknames_array[i] = nickname;
+ ++i;
+ }
+ properties[strings::nicknames] = nicknames_array;
+ properties[strings::app_id] = policy_app_id;
+ properties[strings::enabled] = enabled;
+
+ if (!auth_token.empty()) {
+ properties[strings::auth_token] = auth_token;
+ }
+ if (!cloud_transport_type.empty()) {
+ properties[strings::cloud_transport_type] = cloud_transport_type;
+ }
+ if (!hybrid_app_preference.empty()) {
+ properties[strings::hybrid_app_preference] = hybrid_app_preference;
+ }
+ if (!endpoint.empty()) {
+ properties[strings::endpoint] = endpoint;
+ }
+
+ response_params[strings::properties] = properties;
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+}
+
+void GetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
new file mode 100644
index 0000000000..813a9e7006
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_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/get_cloud_app_properties_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse(
+ 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) {}
+
+GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {}
+
+void GetCloudAppPropertiesResponse::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/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
new file mode 100644
index 0000000000..a582670426
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
@@ -0,0 +1,356 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/message_helper.h"
+#include "utils/file_system.h"
+#include <boost/crc.hpp>
+
+namespace {
+/**
+* Calculates CRC32 checksum
+* @param binary_data - input data for which CRC32 should be calculated
+* @return calculated CRC32 checksum
+*/
+uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) {
+ const std::size_t file_size = binary_data.size();
+ boost::crc_32_type result;
+ result.process_bytes(&binary_data[0], file_size);
+ return result.checksum();
+}
+
+} // namespace
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileRequest::GetFileRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , file_name_("")
+ , file_type_(mobile_apis::FileType::INVALID_ENUM)
+ , length_(0)
+ , offset_(0) {}
+
+GetFileRequest::~GetFileRequest() {}
+
+bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
+ std::string path = application_manager_.get_settings().app_storage_folder();
+ auto connect_key = connection_key();
+ forward_to_hmi = false;
+
+ if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) {
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::app_service_id].asString();
+ LOG4CXX_DEBUG(logger_,
+ "Finding storage directory for service id: " << service_id);
+
+ AppService* app_service_info =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (app_service_info) {
+ if (app_service_info->mobile_service) {
+ connect_key = app_service_info->connection_key;
+ } else {
+ forward_to_hmi = true;
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Using current storage directory");
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(connect_key);
+ file_path = path + "/" + app->folder_name();
+ return true;
+}
+
+void GetFileRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Received GetFile request");
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ file_name_ = (*message_)[strings::msg_params][strings::file_name].asString();
+
+ if (!file_system::IsFileNameValid(file_name_)) {
+ LOG4CXX_ERROR(logger_,
+ "File name " << file_name_ << " contains forbidden symbols.");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "File name contains forbidden symbols",
+ &response_params);
+ return;
+ }
+
+ // Initialize other params with default values. If exists overwrite the values
+ LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values");
+
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ file_type_ = static_cast<mobile_apis::FileType::eType>(
+ (*message_)[strings::msg_params][strings::file_type].asInt());
+ }
+
+ // Check if file exists on system (may have to use app service id to get the
+ // correct app folder)
+ LOG4CXX_DEBUG(logger_, "Check if file exists on system");
+ std::string file_path;
+ bool forward_to_hmi;
+
+ if (GetFilePath(file_path, forward_to_hmi)) {
+ if (forward_to_hmi) {
+ LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath,
+ &(*message_)[strings::msg_params],
+ true);
+ return;
+ }
+ } else {
+ LOG4CXX_ERROR(logger_, "Could not get file path");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Could not get file path",
+ &response_params);
+ return;
+ }
+
+ const std::string full_path = file_path + "/" + file_name_;
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ // Handle offset
+ LOG4CXX_DEBUG(logger_, "Handle offset and length parameters");
+ const uint64_t file_size = file_system::FileSize(full_path);
+
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(logger_,
+ "Offset " << offset_ << " greater than file size "
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+
+ // Load data from file as binary data
+ LOG4CXX_DEBUG(logger_, "Load binary data from file");
+ std::vector<uint8_t> bin_data;
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Unable to read from file",
+ &response_params);
+ return;
+ }
+
+ // Construct response message
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ response_params[strings::offset] = offset_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ response_params[strings::length] = length_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] = file_type_;
+ }
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ SendResponse(true,
+ mobile_apis::Result::SUCCESS,
+ "File uploaded",
+ &response_params,
+ bin_data);
+}
+
+void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) {
+ return;
+ }
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+
+ if (!success) {
+ auto msg_params = event_message[strings::msg_params];
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(false, result, info, &msg_params);
+ return;
+ }
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::vector<uint8_t> bin_data;
+
+ if (event_message[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] =
+ event_message[strings::msg_params][strings::file_type];
+ }
+
+ if (event_message[strings::msg_params].keyExists(strings::file_path)) {
+ std::string full_path =
+ event_message[strings::msg_params][strings::file_path].asString();
+
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ const uint64_t file_size = file_system::FileSize(full_path);
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(logger_,
+ "Offset " << offset_ << " greater than file size "
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Failed to read from file",
+ &response_params);
+ return;
+ }
+
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ } else {
+ LOG4CXX_ERROR(logger_, "HMI did not return a file path: ");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "HMI did not return a file path",
+ &response_params);
+ return;
+ }
+
+ SendResponse(true, result, "File uploaded", &response_params, bin_data);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
new file mode 100644
index 0000000000..2ea8dde02a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileResponse::GetFileResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetFileResponse::~GetFileResponse() {}
+
+void GetFileResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Sending GetFile response");
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
index a6c627aad2..2a25928b97 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
@@ -32,6 +32,11 @@
#include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message_helper.h"
+#include <set>
+
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -80,10 +85,20 @@ void GetSystemCapabilityRequest::Run() {
switch (response_type) {
case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
if (hmi_capabilities.navigation_capability()) {
+ has_nav_capability = true;
+ auto nav_capability = *hmi_capabilities.navigation_capability();
+ }
+
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
response_params[strings::system_capability]
- [strings::navigation_capability] =
- *hmi_capabilities.navigation_capability();
+ [strings::navigation_capability] = nav_capability;
} else {
SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
return;
@@ -128,10 +143,34 @@ void GetSystemCapabilityRequest::Run() {
return;
}
break;
+ case mobile_apis::SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ response_params
+ [strings::system_capability][strings::app_services_capabilities] =
+ MessageHelper::CreateAppServiceCapabilities(all_services);
+ break;
+ }
default: // Return unsupported resource
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
+
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ strings::subscribe)) {
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
+ .asBool() == true) {
+ LOG4CXX_DEBUG(logger_,
+ "Subscribe to system capability: " << response_type);
+ ext.SubscribeTo(response_type);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Unsubscribe from system capability: " << response_type);
+ ext.UnsubscribeFrom(response_type);
+ }
+ }
+
SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
new file mode 100644
index 0000000000..a8544ae643
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -0,0 +1,177 @@
+#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/helpers/application_helper.h"
+#include "application_manager/message_helper.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+namespace mobile {
+
+OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification(
+ 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)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnSystemCapabilityUpdatedNotification::
+ ~OnSystemCapabilityUpdatedNotification() {}
+
+void OnSystemCapabilityUpdatedNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ mobile_apis::SystemCapabilityType::eType system_capability_type = static_cast<
+ mobile_apis::SystemCapabilityType::eType>(
+ msg_params[strings::system_capability][strings::system_capability_type]
+ .asInt());
+
+ switch (system_capability_type) {
+ case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
+ if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
+ msg_params[strings::system_capability][strings::navigation_capability] =
+ nav_capability;
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::PHONE_CALL: {
+ if (hmi_capabilities_.phone_capability()) {
+ msg_params[strings::system_capability][strings::phone_capability] =
+ *hmi_capabilities_.phone_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: {
+ if (!hmi_capabilities_.is_rc_cooperating()) {
+ return;
+ }
+ if (hmi_capabilities_.rc_capability()) {
+ msg_params[strings::system_capability][strings::rc_capability] =
+ *hmi_capabilities_.rc_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::VIDEO_STREAMING:
+ if (hmi_capabilities_.video_streaming_capability()) {
+ msg_params[strings::system_capability]
+ [strings::video_streaming_capability] =
+ *hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
+ }
+ break;
+ case mobile_apis::SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ auto app_service_caps =
+ MessageHelper::CreateAppServiceCapabilities(all_services);
+
+ smart_objects::SmartArray* app_services =
+ app_service_caps[strings::app_services].asArray();
+ smart_objects::SmartObject& updated_capabilities =
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities][strings::app_services];
+ for (size_t i = 0; i < updated_capabilities.length(); i++) {
+ std::string service_id =
+ updated_capabilities[i][strings::updated_app_service_record]
+ [strings::service_id].asString();
+ auto matching_service_predicate = [&service_id](
+ const smart_objects::SmartObject& app_service_capability) {
+ return service_id ==
+ app_service_capability[strings::updated_app_service_record]
+ [strings::service_id].asString();
+ };
+
+ auto it = std::find_if(app_services->begin(),
+ app_services->end(),
+ matching_service_predicate);
+ if (it != app_services->end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Replacing updated record with service_id "
+ << service_id);
+ app_services->erase(it);
+ }
+ app_services->push_back(updated_capabilities[i]);
+ }
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities] = app_service_caps;
+ break;
+ }
+ default:
+ return;
+ }
+
+ const char* capability_type_string;
+ ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
+ mobile_apis::SystemCapabilityType::eType>::
+ EnumToCString(system_capability_type, &capability_type_string);
+
+ auto subscribed_to_capability_predicate =
+ [&system_capability_type](const ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app, false);
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ return ext.IsSubscribedTo(system_capability_type);
+ };
+
+ const std::vector<ApplicationSharedPtr>& applications = FindAllApps(
+ application_manager_.applications(), subscribed_to_capability_predicate);
+
+ LOG4CXX_DEBUG(logger_,
+ "Number of Notifications to be sent: " << applications.size());
+
+ std::vector<ApplicationSharedPtr>::const_iterator app_it =
+ applications.begin();
+
+ for (; applications.end() != app_it; ++app_it) {
+ const ApplicationSharedPtr app = *app_it;
+ if (system_capability_type ==
+ mobile_apis::SystemCapabilityType::REMOTE_CONTROL &&
+ !app->is_remote_control_supported()) {
+ LOG4CXX_WARN(
+ logger_,
+ "App with connection key: "
+ << app->app_id()
+ << " was subcribed to REMOTE_CONTROL system capabilities, but "
+ "does not have RC permissions. Unsubscribing");
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.UnsubscribeFrom(system_capability_type);
+ continue;
+ }
+ LOG4CXX_INFO(logger_,
+ "Sending OnSystemCapabilityUpdated " << capability_type_string
+ << " application id "
+ << app->app_id());
+ (*message_)[strings::params][strings::connection_key] = app->app_id();
+ SendNotification();
+ }
+}
+
+} // namespace mobile
+} // namespace commands
+} // namespace application_manager
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..924705f82b 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
@@ -281,17 +281,51 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- mobile_apis::Result::eType coincidence_result = CheckCoincidence();
+ std::vector<ApplicationSharedPtr> duplicate_apps;
+ mobile_apis::Result::eType coincidence_result =
+ CheckCoincidence(duplicate_apps);
+
+ if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result &&
+ duplicate_apps.size() == 1) {
+ ApplicationSharedPtr duplicate_app = duplicate_apps.front();
+ bool error_response = true;
+ if (duplicate_app->is_cloud_app()) {
+ if (duplicate_app->hybrid_app_preference() ==
+ mobile_apis::HybridAppPreference::MOBILE) {
+ // Unregister cloud application and allow mobile application to register
+ // in it's place
+ application_manager_.UnregisterApplication(
+ duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED);
+ error_response = false;
+ }
+ } else {
+ ApplicationSharedPtr cloud_app =
+ application_manager_.pending_application_by_policy_id(policy_app_id);
+ // If the duplicate name was not because of a mobile/cloud app pair, go
+ // through the normal process for handling duplicate names
+ if (cloud_app.use_count() == 0 || !cloud_app->is_cloud_app()) {
+ usage_statistics::AppCounter count_of_rejections_duplicate_name(
+ GetPolicyHandler().GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_DUPLICATE_NAME);
+ ++count_of_rejections_duplicate_name;
+ } else if (cloud_app->hybrid_app_preference() ==
+ mobile_apis::HybridAppPreference::CLOUD) {
+ // Unregister mobile application and allow cloud application to
+ // register in it's place
+ application_manager_.UnregisterApplication(
+ duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED);
+ error_response = false;
+ }
+ }
- if (mobile_apis::Result::SUCCESS != coincidence_result) {
- LOG4CXX_ERROR(logger_, "Coincidence check failed.");
- if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) {
- usage_statistics::AppCounter count_of_rejections_duplicate_name(
- GetPolicyHandler().GetStatisticManager(),
- policy_app_id,
- usage_statistics::REJECTIONS_DUPLICATE_NAME);
- ++count_of_rejections_duplicate_name;
+ if (error_response) {
+ LOG4CXX_ERROR(logger_, "Coincidence check failed.");
+ SendResponse(false, coincidence_result);
+ return;
}
+ } else if (mobile_apis::Result::SUCCESS != coincidence_result) {
+ LOG4CXX_ERROR(logger_, "Coincidence check failed.");
SendResponse(false, coincidence_result);
return;
}
@@ -346,19 +380,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 +472,8 @@ void RegisterAppInterfaceRequest::Run() {
FillDeviceInfo(&device_info);
}
+ const std::string& device_mac = application->mac_address();
+
GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication);
@@ -458,6 +481,9 @@ void RegisterAppInterfaceRequest::Run() {
GetLockScreenIconUrlNotification(connection_key(), application);
rpc_service_.ManageMobileCommand(so, SOURCE_SDL);
application_manager_.SendDriverDistractionState(application);
+ // Create onSystemRequest to mobile to obtain cloud app icons
+ application_manager_.SendGetIconUrlNotifications(connection_key(),
+ application);
}
smart_objects::SmartObjectSPtr
@@ -816,8 +842,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 +850,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 +903,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 +927,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,105 +945,19 @@ 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));
}
-mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
+mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence(
+ std::vector<ApplicationSharedPtr>& out_duplicate_apps) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -1035,7 +973,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
const custom_str::CustomString& cur_name = (*it)->name();
if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
- return mobile_apis::Result::DUPLICATE_NAME;
+ out_duplicate_apps.push_back(*it);
+ continue;
}
const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
@@ -1046,7 +985,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
- return mobile_apis::Result::DUPLICATE_NAME;
+ out_duplicate_apps.push_back(*it);
+ continue;
}
}
@@ -1058,12 +998,16 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
- return mobile_apis::Result::DUPLICATE_NAME;
+ out_duplicate_apps.push_back(*it);
+ continue;
}
} // end vr check
} // application for end
+ if (!out_duplicate_apps.empty()) {
+ return mobile_apis::Result::DUPLICATE_NAME;
+ }
return mobile_apis::Result::SUCCESS;
} // method end
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..5173be56d6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
@@ -0,0 +1,43 @@
+#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;
+ }
+
+ 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/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index cea00a9d5e..ca9182469a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -511,7 +511,8 @@ void SystemRequest::Run() {
return;
}
- if (!file_system::IsFileNameValid(file_name)) {
+ if (!file_system::IsFileNameValid(file_name) &&
+ mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
LOG4CXX_ERROR(logger_, err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
@@ -533,8 +534,22 @@ void SystemRequest::Run() {
std::string binary_data_folder;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
- binary_data_folder =
- application_manager_.get_settings().system_files_path();
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ binary_data_folder =
+ application_manager_.get_settings().app_icons_folder();
+ // Use the URL file name to identify the policy id.
+ // Save the icon file with the policy id as the name.
+ file_name = application_manager_.PolicyIDByIconUrl(file_name);
+ if (file_name.empty()) {
+ const std::string err_msg = "Invalid file name";
+ SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
+ } else {
+ binary_data_folder =
+ application_manager_.get_settings().system_files_path();
+ }
} else {
binary_data_folder =
application_manager_.get_settings().app_storage_folder();
@@ -581,6 +596,12 @@ void SystemRequest::Run() {
LOG4CXX_DEBUG(logger_, "Binary data ok.");
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ application_manager_.SetIconFileFromSystemRequest(file_name);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ return;
+ }
+
if (mobile_apis::RequestType::HTTP == request_type &&
(*message_)[strings::msg_params].keyExists(strings::file_name)) {
const std::string& file =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
index 40bb1ddfc9..4b40b7a9ce 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -71,9 +71,20 @@ void UnsubscribeWayPointsRequest::Run() {
return;
}
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- SendHMIRequest(
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
+ std::set<uint32_t> subscribed_apps =
+ application_manager_.GetAppsSubscribedForWayPoints();
+
+ if (subscribed_apps.size() > 1) {
+ // More than 1 subscribed app, don't send HMI unsubscribe request
+ application_manager_.UnsubscribeAppFromWayPoints(app);
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL);
+ return;
+ } else {
+ // Only subscribed app, send HMI unsubscribe request
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
+ }
}
void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
new file mode 100644
index 0000000000..130585a927
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
@@ -0,0 +1,98 @@
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+
+namespace sdl_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension")
+
+namespace app_mngr_ = application_manager;
+const app_mngr_::AppExtensionUID
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200;
+
+SystemCapabilityAppExtension::SystemCapabilityAppExtension(
+ sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app)
+ : app_mngr_::AppExtension(
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID)
+ , plugin_(plugin)
+ , app_(app) {}
+
+SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {}
+
+bool SystemCapabilityAppExtension::SubscribeTo(
+ const SystemCapabilityType system_capability_type) {
+ LOG4CXX_INFO(logger_,
+ "Subscribing to System Capability " << system_capability_type);
+ return subscribed_data_.insert(system_capability_type).second;
+}
+
+bool SystemCapabilityAppExtension::UnsubscribeFrom(
+ const SystemCapabilityType system_capability_type) {
+ LOG4CXX_INFO(logger_,
+ "Unsubscribing from System Capability "
+ << system_capability_type);
+ auto it = subscribed_data_.find(system_capability_type);
+ if (it != subscribed_data_.end()) {
+ subscribed_data_.erase(it);
+ return true;
+ }
+ return false;
+}
+
+void SystemCapabilityAppExtension::UnsubscribeFromAll() {
+ LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities");
+ subscribed_data_.clear();
+}
+
+bool SystemCapabilityAppExtension::IsSubscribedTo(
+ const SystemCapabilityType system_capability_type) const {
+ LOG4CXX_DEBUG(logger_, system_capability_type);
+ return subscribed_data_.find(system_capability_type) !=
+ subscribed_data_.end();
+}
+
+SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() {
+ return subscribed_data_;
+}
+
+void SystemCapabilityAppExtension::SaveResumptionData(
+ ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const char* application_system_capability = "systemCapability";
+
+ resumption_data[application_system_capability] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ int i = 0;
+ for (const auto& subscription : subscribed_data_) {
+ resumption_data[application_system_capability][i] = subscription;
+ i++;
+ }
+}
+
+void SystemCapabilityAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const char* application_system_capability = "systemCapability";
+ if (resumption_data.keyExists(application_system_capability)) {
+ const smart_objects::SmartObject& subscriptions =
+ resumption_data[application_system_capability];
+ for (size_t i = 0; i < subscriptions.length(); ++i) {
+ SystemCapabilityType capability_type =
+ static_cast<SystemCapabilityType>((resumption_data[i]).asInt());
+ SubscribeTo(capability_type);
+ }
+ }
+}
+
+SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension(
+ app_mngr_::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto ext_ptr = app.QueryInterface(
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID);
+ DCHECK(ext_ptr);
+ DCHECK(dynamic_cast<SystemCapabilityAppExtension*>(ext_ptr.get()));
+ auto app_extension =
+ std::static_pointer_cast<SystemCapabilityAppExtension>(ext_ptr);
+ DCHECK(app_extension);
+ return *app_extension;
+}
+} \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index 7065c7cf7d..fb809e8834 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -240,10 +240,16 @@
#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
+
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
+CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory")
+
HMICommandFactory::HMICommandFactory(
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -840,6 +846,15 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UISendHapticDataRequest>()
: factory.GetCreator<commands::UISendHapticDataResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_GetFilePath: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::BCGetFilePathRequest>()
+ : factory.GetCreator<commands::BCGetFilePathResponse>();
+ }
+ case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: {
+ return factory
+ .GetCreator<commands::OnBCSystemCapabilityUpdatedNotification>();
+ }
default: { return factory.GetCreator<InvalidCommand>(); }
}
}
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..554d004360 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
@@ -73,6 +73,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h"
#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h"
@@ -124,6 +125,12 @@
#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 "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
#include "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -231,6 +238,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::PutFileRequest>()
: factory.GetCreator<commands::PutFileResponse>();
}
+ case mobile_apis::FunctionID::GetFileID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetFileRequest>()
+ : factory.GetCreator<commands::GetFileResponse>();
+ }
case mobile_apis::FunctionID::DeleteFileID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteFileRequest>()
@@ -337,6 +349,18 @@ 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::GetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::GetCloudAppPropertiesResponse>();
+ }
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}
@@ -380,6 +404,10 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
case mobile_apis::FunctionID::OnTouchEventID: {
return factory.GetCreator<commands::mobile::OnTouchEventNotification>();
}
+ case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID: {
+ return factory.GetCreator<
+ commands::mobile::OnSystemCapabilityUpdatedNotification>();
+ }
case mobile_apis::FunctionID::OnSystemRequestID: {
return factory
.GetCreator<commands::mobile::OnSystemRequestNotification>();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
index efdcde7526..d745cd8f44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
@@ -55,7 +55,8 @@ SDLCommandFactory::SDLCommandFactory(
app_mngr::CommandSharedPtr SDLCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
return hmi_command_factory_->CreateCommand(message, source);
} else {
return mobile_command_factory_->CreateCommand(message, source);
@@ -70,7 +71,8 @@ bool SDLCommandFactory::IsAbleToProcess(
bool is_mobile_command_factory_able_to_process =
mobile_command_factory_->IsAbleToProcess(FunctionID, source);
- return app_mngr::commands::Command::SOURCE_HMI == source
+ return (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source)
? is_hmi_command_factory_able_to_process
: is_mobile_command_factory_able_to_process;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
index 22b818f5e0..c448b41ff1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
@@ -30,17 +30,21 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/plugin_manager/plugin_keys.h"
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
#include "sdl_rpc_plugin/sdl_command_factory.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
-bool SDLRPCPlugin::Init(
- application_manager::ApplicationManager& app_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) {
+CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin")
+
+bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler) {
command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
app_manager, rpc_service, hmi_capabilities, policy_handler));
return true;
@@ -48,25 +52,35 @@ bool SDLRPCPlugin::Init(
bool SDLRPCPlugin::IsAbleToProcess(
const int32_t function_id,
- const application_manager::commands::Command::CommandSource
- message_source) {
+ const app_mngr::commands::Command::CommandSource message_source) {
return command_factory_->IsAbleToProcess(function_id, message_source);
}
std::string SDLRPCPlugin::PluginName() {
- return "SDL RPC Plugin";
+ return plugins::plugin_names::sdl_rpc_plugin;
}
-application_manager::CommandFactory& SDLRPCPlugin::GetCommandFactory() {
+app_mngr::CommandFactory& SDLRPCPlugin::GetCommandFactory() {
return *command_factory_;
}
-void SDLRPCPlugin::OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent event) {}
+void SDLRPCPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
void SDLRPCPlugin::OnApplicationEvent(
- application_manager::plugin_manager::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) {}
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) {
+ if (plugins::ApplicationEvent::kApplicationRegistered == event) {
+ application->AddExtension(
+ std::make_shared<SystemCapabilityAppExtension>(*this, *application));
+ } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
+ ClearSubscriptions(application);
+ }
+}
+
+void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) {
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.UnsubscribeFromAll();
+}
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index a6497ca6e1..874d27b4b0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -223,6 +223,8 @@
#include "hmi/on_tts_reset_timeout_notification.h"
#include "hmi/dial_number_request.h"
#include "hmi/dial_number_response.h"
+#include "hmi/bc_get_file_path_request.h"
+#include "hmi/bc_get_file_path_response.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
@@ -496,7 +498,9 @@ typedef Types<commands::hmi::OnButtonEventNotification,
typedef Types<commands::AllowAllAppsRequest,
commands::AllowAllAppsResponse,
commands::AllowAppRequest,
- commands::AllowAppResponse> HMICommandsListFifth;
+ commands::AllowAppResponse,
+ commands::BCGetFilePathRequest,
+ commands::BCGetFilePathResponse> HMICommandsListFifth;
TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond);
@@ -507,30 +511,30 @@ TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth);
TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
} // namespace dummy_hmi_commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
index 2191900750..20a05d8601 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
@@ -110,7 +110,7 @@ TEST_F(GetUrlsTest, RUN_SUCCESS) {
TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) {
EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
request_command_->Run();
@@ -127,7 +127,7 @@ TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) {
.WillOnce(SetArgReferee<1>(endpoints_));
EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
request_command_->Run();
@@ -160,7 +160,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kAppIdForSending))
.WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
request_command_->Run();
@@ -197,7 +197,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) {
EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
.WillOnce(Return(kInvalidAppId_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0);
@@ -226,7 +226,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kAppIdForSending))
.WillOnce(Return(invalid_mock_app));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
request_command_->Run();
@@ -261,7 +261,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) {
EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
.WillOnce(Return(true));
request_command_->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index fe82b16f3f..ca322ea425 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -945,7 +945,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(GetMessage(temp_message));
command->Run();
@@ -973,7 +973,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, SetUnregisterAllApplicationsReason(_)).Times(0);
EXPECT_CALL(app_mngr_, HeadUnitReset(_)).Times(0);
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
index 030db2f424..c7fbdb663b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
@@ -99,7 +99,7 @@ class RCIsReadyRequestTest
EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _))
.WillOnce(Return(capabilities));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
index 0b1f2df491..25abefb010 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
@@ -86,7 +86,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) {
ResponseFromHMIPtr command(CreateCommand<ResponseFromHMI>());
MessageSharedPtr result_msg;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(true)));
const hmi_apis::FunctionID::eType posted_function_id =
@@ -115,7 +115,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_CantManageCommand_Covering) {
MessageSharedPtr result_msg;
ON_CALL(app_mngr_, GetNextHMICorrelationID()).WillByDefault(Return(1u));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(false)));
const hmi_apis::FunctionID::eType posted_function_id =
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..917de81fb3 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 {
@@ -137,6 +140,8 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) {
std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
+ EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID))
+ .WillOnce(Return(ApplicationSharedPtr()));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
@@ -148,7 +153,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] =
@@ -163,9 +168,9 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) {
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp), _))
.WillOnce(Return(true));
command->Run();
@@ -189,6 +194,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 +256,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 +343,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 +435,55 @@ 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));
+
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(app_mngr_, application(kAppID))
+ .WillOnce(Return(ApplicationSharedPtr()));
+#endif
+ 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);
@@ -434,7 +491,7 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) {
std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
ON_CALL(mock_event_dispatcher_, remove_observer(_, _));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
index 5c42d265c7..a69f6c71fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
@@ -81,7 +81,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) {
const bool success = false;
const uint32_t correlation_id = 1u;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull()));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull(), _));
command->SendResponse(success,
correlation_id,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
index 4a86fa9458..4f415975ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
@@ -310,7 +310,7 @@ TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) {
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(correlation_id));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(CheckMsgType(am::MessageType::kRequest)))
+ ManageHMICommand(CheckMsgType(am::MessageType::kRequest), _))
.WillOnce(Return(false));
command->CreateHMIRequest(hmi_apis::FunctionID::INVALID_ENUM,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
index fe0d8a8470..70fc80bbd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
@@ -125,9 +125,9 @@ class UIIsReadyRequestTest
.WillOnce(Return(get_capabilities));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*get_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
index 5aa00e0264..259fd0b92b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
@@ -98,7 +98,7 @@ class VRIsReadyRequestTest
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _))
.WillOnce(Return(language));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language, _));
smart_objects::SmartObjectSPtr support_language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
@@ -106,14 +106,14 @@ class VRIsReadyRequestTest
mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _))
.WillOnce(Return(support_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language, _));
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _))
.WillOnce(Return(capabilities));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index 7c99b5f2b8..0023368b5a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -190,11 +190,11 @@ class AddCommandRequestTest
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -207,7 +207,7 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(cmd_to_delete)))
+ ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _))
.WillOnce(Return(true));
SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
@@ -276,7 +276,7 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_WARNINGS) {
commands_map, lock_ptr_)));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -492,13 +492,13 @@ TEST_F(AddCommandRequestTest,
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -522,7 +522,7 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -547,7 +547,7 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, help_prompt_manager())
@@ -578,7 +578,7 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, help_prompt_manager())
@@ -659,7 +659,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -690,13 +690,13 @@ TEST_F(AddCommandRequestTest,
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
@@ -734,13 +734,13 @@ TEST_F(
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
@@ -779,13 +779,13 @@ TEST_F(
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
@@ -824,13 +824,13 @@ TEST_F(
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
std::shared_ptr<AddCommandRequest> request_ptr =
@@ -873,13 +873,13 @@ TEST_F(
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
std::shared_ptr<AddCommandRequest> request_ptr =
@@ -921,7 +921,7 @@ TEST_F(
commands_map, lock_ptr_)));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -958,7 +958,7 @@ TEST_F(
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -996,13 +996,13 @@ TEST_F(AddCommandRequestTest,
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
@@ -1020,9 +1020,9 @@ TEST_F(AddCommandRequestTest,
event_ui.set_smart_object(*msg_ui);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
event_vr.set_smart_object(*msg_);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
request_ptr->on_event(event_ui);
@@ -1044,13 +1044,13 @@ TEST_F(AddCommandRequestTest,
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
@@ -1063,9 +1063,9 @@ TEST_F(AddCommandRequestTest,
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
event_ui.set_smart_object(*msg_);
request_ptr->on_event(event_ui);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
@@ -1119,13 +1119,13 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
.WillOnce(Return(so_ptr_.get()));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
index e32cc2b335..a66d0d557f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
@@ -169,11 +169,11 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
void ExpectManageHmiCommandTTSAndUI() {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert), _))
.WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
}
sync_primitives::Lock lock_;
@@ -452,7 +452,7 @@ TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) {
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)));
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _));
command->on_event(event);
}
@@ -477,10 +477,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
- .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
+ _)).WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -509,10 +508,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
- .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
+ _)).WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -556,9 +554,9 @@ TEST_F(AlertRequestTest,
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -605,9 +603,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSUnsupportedResourceUiAlertSuccess_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -643,10 +641,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
- .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
+ _)).WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -654,9 +651,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::INVALID_ENUM;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -693,10 +690,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
- .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
+ _)).WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -704,9 +700,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::INVALID_ENUM;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -743,9 +739,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index c42be48e57..3abda89234 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -232,7 +232,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
.WillByDefault(
Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
.WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
req_vr->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index 43c30809e5..c209c4fea2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -252,7 +252,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
EXPECT_CALL(*app_, UpdateHash());
}
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
DeleteInteractionChoiceSetRequestPtr command =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
index f1c44f86ac..ff9e29c872 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
@@ -224,9 +224,9 @@ TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) {
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _))
.WillOnce(Return(true));
command_->Run();
}
@@ -273,9 +273,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_));
@@ -284,9 +284,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
EXPECT_CALL(*app_, help_prompt_manager())
.WillOnce(ReturnRef(*mock_help_prompt_manager_));
EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*app_, RemoveSubMenu(_));
@@ -330,7 +330,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
@@ -357,7 +357,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
index 5d6c6dc89e..ffa1b833be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
@@ -131,9 +131,11 @@ TEST_F(DialNumberRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_DialNumber)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_DialNumber),
+ _));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
index 8589cbb6be..9c20143c39 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -62,6 +62,8 @@
#include "mobile/end_audio_pass_thru_request.h"
#include "mobile/end_audio_pass_thru_response.h"
#include "mobile/generic_response.h"
+#include "mobile/get_file_request.h"
+#include "mobile/get_file_response.h"
#include "mobile/get_way_points_request.h"
#include "mobile/get_way_points_response.h"
#include "mobile/list_files_request.h"
@@ -78,6 +80,7 @@
#include "mobile/on_keyboard_input_notification.h"
#include "mobile/on_language_change_notification.h"
#include "mobile/on_permissions_change_notification.h"
+#include "mobile/on_system_capability_updated_notification.h"
#include "mobile/on_system_request_notification.h"
#include "mobile/on_tbt_client_state_notification.h"
#include "mobile/on_touch_event_notification.h"
@@ -220,6 +223,8 @@ typedef Types<commands::AddCommandRequest,
commands::EndAudioPassThruRequest,
commands::EndAudioPassThruResponse,
commands::GenericResponse,
+ commands::GetFileRequest,
+ commands::GetFileResponse,
commands::GetWayPointsRequest,
commands::GetWayPointsResponse,
commands::ListFilesRequest,
@@ -236,12 +241,13 @@ typedef Types<commands::AddCommandRequest,
commands::mobile::OnKeyBoardInputNotification,
commands::OnLanguageChangeNotification,
commands::OnPermissionsChangeNotification,
- commands::mobile::OnSystemRequestNotification,
- commands::OnTBTClientStateNotification,
- commands::mobile::OnTouchEventNotification>
+ commands::mobile::OnSystemCapabilityUpdatedNotification>
MobileCommandsListFirst;
-typedef Types<commands::OnWayPointChangeNotification,
+typedef Types<commands::mobile::OnSystemRequestNotification,
+ commands::OnTBTClientStateNotification,
+ commands::mobile::OnTouchEventNotification,
+ commands::OnWayPointChangeNotification,
commands::PerformAudioPassThruRequest,
commands::PerformAudioPassThruResponse,
commands::PerformInteractionRequest,
@@ -277,12 +283,12 @@ typedef Types<commands::OnWayPointChangeNotification,
commands::SubscribeWayPointsRequest,
commands::SubscribeWayPointsResponse,
commands::SystemResponse,
- commands::UnregisterAppInterfaceRequest,
- commands::UnregisterAppInterfaceResponse,
- commands::UnsubscribeButtonRequest,
- commands::UnsubscribeButtonResponse> MobileCommandsListSecond;
+ commands::UnregisterAppInterfaceRequest> MobileCommandsListSecond;
-typedef Types<commands::UnsubscribeWayPointsRequest,
+typedef Types<commands::UnregisterAppInterfaceResponse,
+ commands::UnsubscribeButtonRequest,
+ commands::UnsubscribeButtonResponse,
+ commands::UnsubscribeWayPointsRequest,
commands::UnsubscribeWayPointsResponse,
commands::UpdateTurnListRequest,
commands::UpdateTurnListResponse> MobileCommandsListThird;
@@ -294,18 +300,18 @@ TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird);
TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) {
std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
} // namespace dummy_mobile_commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
index 09a3336a10..f450d4b671 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
@@ -205,7 +205,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) {
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
CallOnEvent caller(*command_sptr_, event);
caller();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
index f51f1aa655..acda9b9fc7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -239,7 +239,7 @@ TEST_F(PerformAudioPassThruRequestTest,
MessageSharedPtr response_to_mobile;
uint32_t app_id = kConnectionKey;
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(false));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillRepeatedly(Return(true));
EXPECT_CALL(
mock_rpc_service_,
@@ -342,7 +342,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -355,7 +355,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun run_caller(*command_sptr_);
@@ -431,7 +431,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -444,7 +444,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun caller(*command_sptr_);
@@ -505,7 +505,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -518,7 +518,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun caller(*command_sptr_);
@@ -551,7 +551,7 @@ TEST_F(
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Perform audio path thru request sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -564,7 +564,7 @@ TEST_F(
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Start recording notification sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&start_record_result_msg), Return(true)));
}
@@ -613,7 +613,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// Start recording notification sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
// Start microphone recording cals
uint32_t app_id = kConnectionKey;
@@ -676,7 +676,7 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::function_id] = kFunctionId;
msg_params_[am::strings::correlation_id] = kCorrelationId;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
uint32_t app_id = kConnectionKey;
EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true));
@@ -703,7 +703,7 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::function_id] = kFunctionId;
uint32_t app_id = kConnectionKey;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true));
EXPECT_CALL(
@@ -751,7 +751,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command_sptr_->onTimeOut();
}
@@ -783,7 +783,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -796,7 +796,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -807,7 +807,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// For setting is_active_tts_speak -> true
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.Times(2)
.WillRepeatedly(Return(false));
CallRun caller(*command_sptr_);
@@ -819,9 +819,9 @@ TEST_F(PerformAudioPassThruRequestTest,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL));
command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(false));
command_sptr_->onTimeOut();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
index df4f69f0d0..415b559f82 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
@@ -315,10 +315,11 @@ TEST_F(PutFileRequestTest, Run_SendOnPutFileNotification_SUCCESS) {
EXPECT_CALL(app_mngr_,
SaveBinary(binary_data_, kStorageFolder, kFileName, kZeroOffset))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnPutFile)))
- .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_OnPutFile),
+ _)).WillOnce(Return(true));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::SUCCESS);
PutFileRequestPtr command(CreateCommand<PutFileRequest>(msg_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
index 7dab16fe35..868d353a85 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
@@ -207,27 +207,36 @@ class RegisterAppInterfaceRequestTest
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(response_result_code), _));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
- .Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _)).Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
- .Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _)).Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .Times(0);
EXPECT_CALL(app_mngr_,
OnApplicationSwitched(
@@ -297,13 +306,15 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
@@ -399,25 +410,27 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration)))
- .WillOnce(Return(true));
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration),
+ _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_ChangeRegistration)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration),
+ _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration)))
- .WillOnce(Return(true));
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration),
+ _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index 0e3cd685fa..38585319e4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -170,7 +170,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command_->Run();
}
@@ -238,12 +238,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
.WillOnce(Return(so_help_prompt.get()));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
@@ -275,9 +276,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
command_->Run();
@@ -321,12 +322,13 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*ui_msg)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties);
ui_event.set_smart_object(*ui_msg);
@@ -363,9 +365,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
smart_objects::SmartObjectSPtr vr_help =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -413,12 +415,13 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
ResetGlobalPropertiesRequestPtr command =
@@ -478,12 +481,13 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
@@ -542,12 +546,13 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
index 6c7127e48c..19f799448a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
@@ -102,7 +102,7 @@ TEST_F(SendHapticDataRequestTest, Run_SUCCESS) {
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData)))
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData), _))
.WillOnce(Return(true));
SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
index 4f44293fc9..4cab3db2a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
@@ -137,15 +137,16 @@ class SendLocationRequestTest
void FinishSetup() {
EXPECT_CALL(*mock_app_, hmi_app_id()).WillOnce(Return(kAppID));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Navigation_SendLocation)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Navigation_SendLocation), _));
}
void FinishSetupCancelled(mobile_apis::Result::eType result) {
EXPECT_CALL(*mock_app_, hmi_app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(result), _));
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
index cd6af1512d..10ca925739 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
@@ -201,7 +201,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(CheckMshCorrId(kCorrelationKey)))
+ ManageHMICommand(CheckMshCorrId(kCorrelationKey), _))
.WillOnce(Return(true));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
index 03aa5d85a1..94dbbc8b44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
@@ -322,12 +322,13 @@ TEST_F(SetGlobalPropertiesRequestTest,
(*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
+ _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
(*msg_vr)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
index a69d3d741b..04a7da60cf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
@@ -179,7 +179,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->Run();
}
@@ -217,7 +217,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
index 4725af4671..4540980b9e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
@@ -125,7 +125,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
static_cast<int32_t>(field_name);
msg_params[am::hmi_request::show_strings][0][am::hmi_request::field_text] =
text_field_;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
@@ -143,7 +143,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
}
@@ -196,7 +196,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
}
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
@@ -272,7 +272,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
EXPECT_CALL(
mock_message_helper_,
SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -296,7 +296,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
smart_objects::SmartObject(smart_objects::SmartType_Array);
EXPECT_CALL(*mock_app_, UnsubscribeFromSoftButtons(kFunctionID));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -321,7 +321,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _))
.Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
@@ -348,7 +348,7 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -375,7 +375,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WARNINGS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -398,7 +398,7 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
.WillOnce(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -421,7 +421,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -447,7 +447,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
msg_params[am::strings::app_id] = kAppId;
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -473,7 +473,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WARNINGS) {
msg_params[am::strings::app_id] = kAppId;
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -497,7 +497,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -520,7 +520,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -836,7 +836,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -859,7 +859,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) {
msg_params[am::strings::app_id] = kAppId;
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -880,7 +880,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
@@ -895,7 +895,7 @@ TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) {
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
@@ -910,7 +910,7 @@ TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
index be14aebc8f..14e670a387 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
@@ -268,7 +268,7 @@ TEST_F(SliderRequestTest, Run_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider), _));
CommandPtr command(CreateCommand<SliderRequest>(msg_));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
index 9eb23eeee3..5dcbd7e6b9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
@@ -295,7 +295,7 @@ TEST_F(SpeakRequestTest, Run_MsgWithEmptyString_Success) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _));
command->Run();
}
@@ -315,7 +315,7 @@ TEST_F(SpeakRequestTest, Run_MsgCorrect_Success) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index caca56e297..df3e778ee6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -182,7 +182,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
MessageSharedPtr hmi_result_msg;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
MessageSharedPtr mobile_result_msg;
@@ -230,7 +230,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
MessageSharedPtr hmi_result_msg;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
MessageSharedPtr mobile_result_msg;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
index 9e6bc8f505..298661dc74 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
@@ -160,7 +160,7 @@ TEST_F(SystemRequestTest,
.WillOnce(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObjectSPtr result;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
@@ -201,7 +201,7 @@ TEST_F(
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
ASSERT_TRUE(command->Init());
@@ -222,7 +222,7 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) {
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
ASSERT_TRUE(command->Init());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
index a848fff2b2..22893b771c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -139,9 +139,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
@@ -182,9 +184,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) {
EXPECT_CALL(*mock_app,
UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
index f345d719c6..05e15a78af 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -122,9 +122,16 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
.WillOnce(Return(true));
+ const std::set<uint32_t> subscribed_apps{kConnectionKey};
+
+ EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
+ .WillOnce(Return(subscribed_apps));
+
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints)));
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints),
+ _));
command_->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
index 32959174da..0c6e0a07b1 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
@@ -53,7 +53,8 @@ VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {}
app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
return hmi_command_factory_->CreateCommand(message, source);
} else {
return mob_command_factory_->CreateCommand(message, source);
@@ -63,7 +64,8 @@ app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand(
bool VehicleInfoCommandFactory::IsAbleToProcess(
const int32_t function_id,
const commands::Command::CommandSource source) const {
- return commands::Command::SOURCE_HMI == source
+ return (commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source)
? hmi_command_factory_->IsAbleToProcess(function_id, source)
: mob_command_factory_->IsAbleToProcess(function_id, source);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index d0bcc36ab4..c9e9839929 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -33,6 +33,7 @@
#include "vehicle_info_plugin/vehicle_info_plugin.h"
#include "vehicle_info_plugin/vehicle_info_command_factory.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/message_helper.h"
#include "application_manager/message_helper.h"
@@ -41,6 +42,7 @@ namespace vehicle_info_plugin {
CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
namespace strings = application_manager::strings;
+namespace plugins = application_manager::plugin_manager;
VehicleInfoPlugin::VehicleInfoPlugin() : application_manager_(nullptr) {}
@@ -61,7 +63,7 @@ bool VehicleInfoPlugin::IsAbleToProcess(
}
std::string VehicleInfoPlugin::PluginName() {
- return "Vehicle Info Plugin";
+ return plugins::plugin_names::vehicle_info_rpc_plugin;
}
app_mngr::CommandFactory& VehicleInfoPlugin::GetCommandFactory() {
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
index d4477d5d5f..679d9d0e58 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
@@ -101,7 +101,7 @@ class VIIsReadyRequestTest
mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _))
.WillOnce(Return(ivi_type));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
index 9cdf60b1ea..b27a306a5c 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
@@ -141,9 +141,11 @@ TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) {
EXPECT_CALL(app_mngr_settings_, supported_diag_modes())
.WillOnce(ReturnRef(supported_diag_modes));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage),
+ _));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
index 4473a36c63..981d649a94 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
@@ -98,9 +98,10 @@ TEST_F(GetDTCsRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs), _));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
index a88d362968..cb78e44904 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -200,9 +200,11 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetVehicleData),
+ _));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 323334de2d..165c7694b1 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -149,9 +149,10 @@ TEST_F(UnsubscribeVehicleRequestTest,
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData)))
- .WillOnce(Return(true));
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData),
+ _)).WillOnce(Return(true));
vehicle_info_plugin::VehicleInfoAppExtension* vi_app_extension =
dynamic_cast<vehicle_info_plugin::VehicleInfoAppExtension*>(
vi_app_extension_ptr_.get());
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
index 393b01c952..22d2790183 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
@@ -33,7 +33,7 @@
#include <unistd.h>
#include "application_manager/app_launch/app_launch_data_db.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/app_launch/app_launch_sql_queries.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/message_helper.h"
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..1711180980
--- /dev/null
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -0,0 +1,555 @@
+/*
+ * 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/app_service_manager.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 "encryption/hashing.h"
+#include "resumption/last_state.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/logger.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceManager")
+
+namespace application_manager {
+
+const char* kAppServiceSection = "AppServices";
+const char* kDefaults = "defaults";
+
+AppServiceManager::AppServiceManager(ApplicationManager& app_manager,
+ resumption::LastState& last_state)
+ : app_manager_(app_manager)
+ , last_state_(last_state)
+ , rpc_passing_handler_(*this, app_manager_) {}
+
+AppServiceManager::~AppServiceManager() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+smart_objects::SmartObject AppServiceManager::PublishAppService(
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string str_to_hash = "";
+ std::string service_id = "";
+
+ published_services_lock_.Acquire();
+ do {
+ str_to_hash = manifest[strings::service_type].asString() +
+ std::to_string(std::rand());
+ service_id = encryption::MakeHash(str_to_hash);
+ } while (published_services_.find(service_id) != published_services_.end());
+
+ AppService app_service;
+ app_service.connection_key = connection_key;
+ app_service.mobile_service = mobile_service;
+
+ 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] = false;
+ app_service.record = service_record;
+
+ std::string service_type = manifest[strings::service_type].asString();
+
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (default_app_id.empty() && !mobile_service) {
+ auto embedded_services = app_manager_.get_settings().embedded_services();
+ for (auto it = embedded_services.begin(); it != embedded_services.end();
+ ++it) {
+ if (*it == service_type) {
+ Json::Value& dictionary = last_state_.get_dictionary();
+ dictionary[kAppServiceSection][kDefaults][service_type] =
+ kEmbeddedService;
+ default_app_id = kEmbeddedService;
+ }
+ }
+ }
+ app_service.default_service =
+ !default_app_id.empty() && GetPolicyAppID(app_service) == default_app_id;
+
+ auto ret = published_services_.insert(
+ std::pair<std::string, AppService>(service_id, app_service));
+ smart_objects::SmartObject& published_record = ret.first->second.record;
+ published_services_lock_.Release();
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+ AppServiceUpdated(
+ service_record, mobile_apis::ServiceUpdateReason::PUBLISHED, msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ // Activate the new service if it is the default for its service type, or if
+ // no service is active of its service type
+ AppService* active_service = ActiveServiceForType(service_type);
+ if (!active_service || app_service.default_service) {
+ ActivateAppService(service_id);
+ }
+
+ return published_record;
+}
+
+bool AppServiceManager::UnpublishAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Unpublishing app service: " << service_id);
+
+ SetServicePublished(service_id, false);
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ auto& record = it->second.record;
+ if (record[strings::service_active].asBool()) {
+ record[strings::service_active] = false;
+
+ // Activate embedded service, if available
+ auto embedded_service = EmbeddedServiceForType(
+ record[strings::service_manifest][strings::service_type].asString());
+ if (embedded_service) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ msg_params);
+ }
+ }
+ AppServiceUpdated(
+ record, mobile_apis::ServiceUpdateReason::REMOVED, msg_params);
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ published_services_.erase(it);
+
+ return true;
+}
+
+void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Unpublishing all app services: " << connection_key);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.connection_key == connection_key) {
+ UnpublishAppService(it->first);
+ }
+ }
+}
+
+void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.begin();
+ // Activate all services published by the app
+ for (; it != published_services_.end(); ++it) {
+ if (it->second.connection_key == app->app_id()) {
+ ActivateAppService(it->first);
+ }
+ }
+}
+
+std::vector<smart_objects::SmartObject>
+AppServiceManager::GetAllServiceRecords() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<smart_objects::SmartObject> services;
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ services.push_back(it->second.record);
+ }
+ return services;
+}
+
+void AppServiceManager::GetProviderByType(const std::string& service_type,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto active_service = ActiveServiceForType(service_type);
+ if (!active_service) {
+ LOG4CXX_ERROR(logger_,
+ "There is no active service for the given service type: "
+ << service_type);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Found provider for service type: " << service_type);
+ GetProviderFromService(*active_service, mobile_consumer, app, hmi_service);
+}
+
+void AppServiceManager::GetProviderByID(const std::string& service_id,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Found provider with service ID: " << service_id);
+ GetProviderFromService(it->second, mobile_consumer, app, hmi_service);
+}
+
+void AppServiceManager::GetProviderFromService(const AppService& service,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (mobile_consumer &&
+ !service.record[strings::service_manifest][strings::allow_app_consumers]
+ .asBool()) {
+ LOG4CXX_ERROR(logger_, "Service does not support app consumers");
+ return;
+ }
+ bool mobile_service = service.mobile_service;
+ if (mobile_service) {
+ app = app_manager_.application(service.connection_key);
+ hmi_service = false;
+ return;
+ }
+ hmi_service = true;
+}
+
+bool AppServiceManager::SetDefaultService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+ AppService& service = it->second;
+
+ std::string service_type =
+ service.record[strings::service_manifest][strings::service_type]
+ .asString();
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (!default_app_id.empty()) {
+ auto default_service =
+ FindServiceByPolicyAppID(default_app_id, service_type);
+ if (default_service) {
+ default_service->default_service = false;
+ }
+ }
+ service.default_service = true;
+
+ Json::Value& dictionary = last_state_.get_dictionary();
+ dictionary[kAppServiceSection][kDefaults][service_type] =
+ GetPolicyAppID(service);
+ return true;
+}
+
+bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+
+ AppService& service = it->second;
+ if (!service.default_service) {
+ LOG4CXX_ERROR(logger_, "Service was not default " << service_id);
+ return false;
+ }
+ service.default_service = false;
+
+ std::string service_type =
+ service.record[strings::service_manifest][strings::service_type]
+ .asString();
+ Json::Value& dictionary = last_state_.get_dictionary();
+ dictionary[kAppServiceSection][kDefaults].removeMember(service_type);
+ return true;
+}
+
+bool AppServiceManager::ActivateAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+
+ smart_objects::SmartObject& service = it->second.record;
+ if (service[strings::service_active].asBool()) {
+ LOG4CXX_DEBUG(logger_, "Service was already active " << service_id);
+ return true;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ const std::string service_type =
+ service[strings::service_manifest][strings::service_type].asString();
+ auto active_service = ActiveServiceForType(service_type);
+ if (active_service) {
+ active_service->record[strings::service_active] = false;
+ AppServiceUpdated(active_service->record,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ msg_params);
+ }
+ service[strings::service_active] = true;
+ AppServiceUpdated(
+ service, mobile_apis::ServiceUpdateReason::ACTIVATED, msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ if (service_type == navi_service_type) {
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::NAVIGATION;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ }
+ return true;
+}
+
+bool AppServiceManager::DeactivateAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+ smart_objects::SmartObject& service = it->second.record;
+ smart_objects::SmartObject msg_params;
+ bool send_update = false;
+
+ if (service[strings::service_active].asBool()) {
+ service[strings::service_active] = false;
+ AppServiceUpdated(
+ service, mobile_apis::ServiceUpdateReason::DEACTIVATED, msg_params);
+
+ // Activate embedded service, if available
+ const std::string service_type =
+ service[strings::service_manifest][strings::service_type].asString();
+ auto embedded_service = EmbeddedServiceForType(service_type);
+ if (embedded_service &&
+ embedded_service->record[strings::service_id].asString() !=
+ service[strings::service_id].asString()) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ msg_params);
+ }
+ send_update = true;
+ }
+
+ if (send_update) {
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ }
+ return true;
+}
+
+AppService* AppServiceManager::ActiveServiceForType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type &&
+ it->second.record[strings::service_published].asBool() &&
+ it->second.record[strings::service_active].asBool()) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::EmbeddedServiceForType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type &&
+ !it->second.mobile_service) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByPolicyAppID(
+ const std::string policy_app_id, const std::string type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() != type) {
+ continue;
+ }
+
+ if (policy_app_id == GetPolicyAppID(it->second)) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByID(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return NULL;
+ }
+ return &(it->second);
+}
+
+std::string AppServiceManager::DefaultServiceByType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Json::Value& dictionary = last_state_.get_dictionary();
+ if (dictionary[kAppServiceSection][kDefaults].isMember(service_type)) {
+ return dictionary[kAppServiceSection][kDefaults][service_type].asString();
+ }
+ return std::string();
+}
+
+void AppServiceManager::SetServicePublished(const std::string service_id,
+ const bool service_published) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return;
+ }
+ it->second.record[strings::service_published] = service_published;
+}
+
+std::string AppServiceManager::GetPolicyAppID(AppService service) {
+ if (service.mobile_service) {
+ auto app = app_manager_.application(service.connection_key);
+ return app ? app->policy_app_id() : std::string();
+ }
+ return kEmbeddedService;
+}
+
+bool AppServiceManager::UpdateNavigationCapabilities(
+ smart_objects::SmartObject& out_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ auto service = ActiveServiceForType(navi_service_type);
+ if (!service) {
+ return false;
+ }
+
+ if (!out_params.keyExists(strings::send_location_enabled)) {
+ out_params[strings::send_location_enabled] = false;
+ }
+ if (!out_params.keyExists(strings::get_way_points_enabled)) {
+ out_params[strings::get_way_points_enabled] = false;
+ }
+
+ if (!service->record[strings::service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ return true;
+ }
+
+ smart_objects::SmartObject& handled_rpcs =
+ service->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
+ if (handled_rpcs[i].asInt() == mobile_apis::FunctionID::SendLocationID) {
+ out_params[strings::send_location_enabled] = true;
+ } else if (handled_rpcs[i].asInt() ==
+ mobile_apis::FunctionID::GetWayPointsID) {
+ out_params[strings::get_way_points_enabled] = true;
+ }
+ }
+ return true;
+}
+
+void AppServiceManager::AppServiceUpdated(
+ const smart_objects::SmartObject& service_record,
+ const mobile_apis::ServiceUpdateReason::eType update_reason,
+ smart_objects::SmartObject& msg_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject& services =
+ msg_params[strings::system_capability][strings::app_services_capabilities]
+ [strings::app_services];
+ smart_objects::SmartObject service(smart_objects::SmartType_Map);
+ service[strings::update_reason] = update_reason;
+ service[strings::updated_app_service_record] = service_record;
+ services[-1] = service;
+}
+
+std::vector<AppService> AppServiceManager::GetActiveServices() {
+ std::vector<AppService> active_services;
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_active].asBool()) {
+ active_services.push_back(it->second);
+ }
+ }
+ return active_services;
+}
+
+RPCPassingHandler& AppServiceManager::GetRPCPassingHandler() {
+ return rpc_passing_handler_;
+}
+
+} // 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..3d17da51ce 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,54 @@ const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
return extensions_;
}
+const std::string& ApplicationImpl::cloud_app_endpoint() const {
+ return endpoint_;
+}
+
+const std::string& ApplicationImpl::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();
+}
+
+void ApplicationImpl::set_cloud_app_endpoint(const std::string& endpoint) {
+ endpoint_ = endpoint;
+}
+
+void ApplicationImpl::set_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..b0a0514e77 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -73,6 +73,7 @@
#include "policy/usage_statistics/counter.h"
#include "utils/custom_string.h"
#include <time.h>
+#include <boost/filesystem.hpp>
namespace {
int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
@@ -98,7 +99,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)};
}
/**
@@ -130,6 +133,7 @@ bool policy_app_id_comparator(const std::string& policy_app_id,
return app->policy_app_id() == policy_app_id;
}
+uint32_t ApplicationManagerImpl::mobile_corelation_id_ = 0;
uint32_t ApplicationManagerImpl::corelation_id_ = 0;
const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX;
@@ -166,6 +170,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>(
@@ -236,6 +242,13 @@ DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
return accessor;
}
+DataAccessor<AppsWaitRegistrationSet>
+ApplicationManagerImpl::pending_applications() const {
+ DataAccessor<AppsWaitRegistrationSet> accessor(
+ apps_to_register_, apps_to_register_list_lock_ptr_);
+ return accessor;
+}
+
ApplicationSharedPtr ApplicationManagerImpl::application(
uint32_t app_id) const {
AppIdPredicate finder(app_id);
@@ -257,6 +270,20 @@ ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id(
return FindApp(accessor, finder);
}
+ApplicationSharedPtr ApplicationManagerImpl::application_by_name(
+ const std::string& app_name) const {
+ AppNamePredicate finder(app_name);
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, finder);
+}
+
+ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id(
+ const std::string& policy_app_id) const {
+ PolicyAppIdPredicate finder(policy_app_id);
+ DataAccessor<AppsWaitRegistrationSet> accessor = pending_applications();
+ return FindPendingApp(accessor, finder);
+}
+
bool ActiveAppPredicate(const ApplicationSharedPtr app) {
return app ? app->IsFullscreen() : false;
}
@@ -379,21 +406,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 +551,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
app_name,
GetPolicyHandler().GetStatisticManager(),
*this));
+
if (!application) {
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
@@ -608,13 +621,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_auth_token((*it)->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);
@@ -650,6 +698,10 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
apps_size_ = applications_.size();
applications_list_lock_ptr_->Release();
+ // Update cloud app information, in case any pending apps are unable to be
+ // registered due to a mobile app taking precedence
+ RefreshCloudAppInformation();
+
// It is possible that secondary transport of this app has been already
// established. Make sure that the information is reflected to application
// instance.
@@ -674,6 +726,8 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
// remove from resumption if app was activated by user
resume_controller().OnAppActivated(app);
+ // Activate any app services published by the app
+ GetAppServiceManager().OnAppActivated(app);
const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
const AudioStreamingState::eType audio_state =
app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
@@ -779,6 +833,412 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
*this));
rpc_service_->ManageHMICommand(mixing_audio_supported_request);
resume_controller().ResetLaunchTime();
+
+ RefreshCloudAppInformation();
+}
+
+std::string ApplicationManagerImpl::PolicyIDByIconUrl(const std::string url) {
+ sync_primitives::AutoLock lock(app_icon_map_lock_ptr_);
+ for (auto& x : app_icon_map_) {
+ auto policy_id = x.first;
+ std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id);
+ if (icon_url == url) {
+ LOG4CXX_DEBUG(logger_, "Matched icon url: " << url);
+ x.second.pending_request = false;
+ return policy_id;
+ }
+ }
+ return std::string("");
+}
+
+void ApplicationManagerImpl::SetIconFileFromSystemRequest(
+ const std::string policy_id) {
+ app_icon_map_lock_ptr_.Acquire();
+ auto app_icon_it = app_icon_map_.find(policy_id);
+ if (app_icon_it != app_icon_map_.end()) {
+ app_icon_map_.erase(app_icon_it);
+ }
+ app_icon_map_lock_ptr_.Release();
+
+ // Find pending application and set icon path
+ auto app = pending_application_by_policy_id(policy_id);
+ if (!app) {
+ return;
+ }
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_id);
+ if (file_system::FileExists(full_icon_path)) {
+ LOG4CXX_DEBUG(logger_, "Set Icon Path: " << full_icon_path);
+ AppFile file;
+ file.is_persistent = true;
+ file.is_download_complete = true;
+ file.file_name = full_icon_path;
+
+ std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id);
+ std::string extension = boost::filesystem::extension(icon_url);
+ if (extension == "bmp" || extension == "BMP") {
+ file.file_type = mobile_apis::FileType::GRAPHIC_BMP;
+ } else if (extension == "JPEG" || extension == "jpeg" ||
+ extension == "JPG" || extension == "jpg") {
+ file.file_type = mobile_apis::FileType::GRAPHIC_JPEG;
+ } else {
+ file.file_type = mobile_apis::FileType::GRAPHIC_PNG;
+ }
+
+ app->AddFile(file);
+ app->set_app_icon_path(full_icon_path);
+ }
+ SendUpdateAppList();
+}
+
+void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
+ std::string endpoint;
+ std::string certificate;
+ std::string auth_token;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+ bool enabled = true;
+ std::string policy_app_id = app->policy_app_id();
+ GetPolicyHandler().GetCloudAppParameters(policy_app_id,
+ enabled,
+ endpoint,
+ certificate,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference);
+ 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());
+
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ endpoint,
+ certificate,
+ enabled,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference};
+ // Create device in pending state
+ LOG4CXX_DEBUG(logger_, "Re-adding the cloud app device");
+ connection_handler().AddCloudAppDevice(policy_app_id, properties);
+}
+
+void ApplicationManagerImpl::RefreshCloudAppInformation() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_stopping()) {
+ return;
+ }
+ 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_str;
+ bool enabled = true;
+
+ // Store old device map and clear the current map
+ pending_device_map_lock_ptr_->Acquire();
+ app_icon_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_str);
+
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference =
+ mobile_apis::HybridAppPreference::INVALID_ENUM;
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ StringToEnum(hybrid_app_preference_str, &hybrid_app_preference);
+
+ auto policy_id = *enabled_it;
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+ GetPolicyHandler().GetInitialAppData(policy_id, &nicknames, &app_hmi_types);
+
+ if (nicknames.empty()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ continue;
+ } else if (mobile_apis::HybridAppPreference::MOBILE ==
+ hybrid_app_preference) {
+ auto nickname_it = nicknames.begin();
+ for (; nickname_it != nicknames.end(); ++nickname_it) {
+ auto app = application_by_name(*nickname_it);
+ if (app.use_count() != 0) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Mobile app already registered for cloud app: " << *nickname_it);
+ continue;
+ }
+ }
+ }
+
+ pending_device_map_.insert(
+ std::pair<std::string, std::string>(endpoint, policy_id));
+ // 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);
+ }
+
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ endpoint,
+ certificate,
+ enabled,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference_str};
+
+ // If the device was disconnected, this will reinitialize the device
+ connection_handler().AddCloudAppDevice(policy_id, properties);
+
+ // Look for app icon url data and add to app_icon_url_map
+ std::string url = GetPolicyHandler().GetIconUrl(policy_id);
+
+ if (url.empty()) {
+ LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ continue;
+ }
+
+ auto app_icon_it = app_icon_map_.find(policy_id);
+ if (app_icon_it != app_icon_map_.end()) {
+ LOG4CXX_DEBUG(logger_, "Cloud App Already Exists in Icon Map");
+ continue;
+ }
+
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_id);
+ if (!file_system::FileExists(full_icon_path)) {
+ AppIconInfo icon_info(endpoint, false);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Inserting cloud app into icon map: " << app_icon_map_.size());
+ app_icon_map_.insert(
+ std::pair<std::string, AppIconInfo>(policy_id, icon_info));
+ }
+ }
+ app_icon_map_lock_ptr_.Release();
+ 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()) {
+ pending_device_map_lock_ptr_->Release();
+ 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.empty()) {
+ 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 (!hybrid_app_preference_str.empty() && !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_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::SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info) {
+ 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()) {
+ pending_device_map_lock_ptr_->Release();
+ return;
+ }
+ pending_device_map_lock_ptr_->Release();
+
+ const std::string policy_app_id = it->second;
+ auto app = application_by_policy_id(policy_app_id);
+
+ if (!app) {
+ return;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Unregister application and move into apps_to_register");
+
+ UnregisterApplication(
+ app->app_id(), mobile_apis::Result::INVALID_ENUM, true, true);
+ app->MarkUnregistered();
+
+ {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ apps_to_register_.insert(app);
+ }
+}
+
+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::GetNextMobileCorrelationID() {
+ if (mobile_corelation_id_ < max_corelation_id_) {
+ mobile_corelation_id_++;
+ } else {
+ mobile_corelation_id_ = 0;
+ }
+
+ return mobile_corelation_id_;
}
uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
@@ -1003,6 +1463,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
so_to_send[jhs::S_MSG_PARAMS] = *msg_params;
rpc_service_->ManageHMICommand(update_list);
+ RefreshCloudAppInformation();
}
void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
@@ -1779,6 +2240,9 @@ 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, last_state));
return true;
}
@@ -1806,7 +2270,9 @@ bool ApplicationManagerImpl::Stop() {
}
bool ApplicationManagerImpl::ConvertSOtoMessage(
- const smart_objects::SmartObject& message, Message& output) {
+ const smart_objects::SmartObject& message,
+ Message& output,
+ const bool allow_unknown_parameters) {
LOG4CXX_AUTO_TRACE(logger_);
if (smart_objects::SmartType_Null == message.getType() ||
@@ -1831,16 +2297,16 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
switch (protocol_type) {
case 0: {
if (protocol_version == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
output.set_protocol_version(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
} else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv2::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -1852,7 +2318,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
break;
}
case 1: {
- if (!formatters::FormatterJsonRpc::ToString(message, output_string)) {
+ if (!formatters::FormatterJsonRpc::ToString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -2151,6 +2618,17 @@ void ApplicationManagerImpl::updateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
+void ApplicationManagerImpl::IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Increasing Request Timeout by "
+ << get_settings().rpc_pass_through_timeout());
+ uint32_t new_timeout_value = get_settings().default_timeout() +
+ get_settings().rpc_pass_through_timeout();
+ request_ctrl_.updateRequestTimeout(
+ connection_key, mobile_correlation_id, new_timeout_value);
+}
+
uint32_t ApplicationManagerImpl::application_id(const int32_t correlation_id) {
// ykazakov: there is no erase for const iterator for QNX
std::map<const int32_t, const uint32_t>::iterator it =
@@ -2350,6 +2828,21 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
it = accessor.GetData().begin();
}
}
+
+ bool send_pending_update_app_list = false;
+ {
+ sync_primitives::AutoLock auto_lock(apps_to_register_list_lock_ptr_);
+ if (!apps_to_register_.empty()) {
+ send_pending_update_app_list = true;
+ apps_to_register_.clear();
+ }
+ }
+
+ // Only send update app list if pending apps were removed.
+ if (send_pending_update_app_list) {
+ SendUpdateAppList();
+ }
+
if (is_ignition_off) {
resume_controller().OnIgnitionOff();
}
@@ -2387,6 +2880,8 @@ void ApplicationManagerImpl::UnregisterApplication(
<< is_unexpected_disconnect);
size_t subscribed_for_way_points_app_count = 0;
+ GetAppServiceManager().UnpublishServices(app_id);
+
// SDL sends UnsubscribeWayPoints only for last application
{
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
@@ -2449,6 +2944,7 @@ void ApplicationManagerImpl::UnregisterApplication(
if (app_id == (*it_app)->app_id()) {
app_to_remove = *it_app;
applications_.erase(it_app++);
+ break;
} else {
++it_app;
}
@@ -2472,14 +2968,23 @@ void ApplicationManagerImpl::UnregisterApplication(
(hmi_capabilities_->get_hmi_language_handler())
.OnUnregisterApplication(app_id);
- AppV4DevicePredicate finder(handle);
- ApplicationSharedPtr app = FindApp(applications(), finder);
- if (!app) {
- LOG4CXX_DEBUG(
- logger_, "There is no more SDL4 apps with device handle: " << handle);
- RemoveAppsWaitingForRegistration(handle);
- SendUpdateAppList();
+ if (connection_handler().GetDeviceID(app_to_remove->mac_address(),
+ &handle)) {
+ AppV4DevicePredicate finder(handle);
+ ApplicationSharedPtr app = FindApp(applications(), finder);
+ if (!app) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "There is no more SDL4 apps with device handle: " << handle);
+
+ RemoveAppsWaitingForRegistration(handle);
+ RefreshCloudAppInformation();
+ SendUpdateAppList();
+ } else if (app_to_remove->is_cloud_app()) {
+ RefreshCloudAppInformation();
+ SendUpdateAppList();
+ }
}
}
@@ -3363,6 +3868,15 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
if (!ptu_result) {
return;
}
+
+ RefreshCloudAppInformation();
+
+ auto app_id = policy_handler_->GetAppIdForSending();
+ auto app = application(app_id);
+ if (app) {
+ SendGetIconUrlNotifications(app->app_id(), app);
+ }
+
auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) {
plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated);
};
@@ -3405,6 +3919,58 @@ void ApplicationManagerImpl::SendDriverDistractionState(
}
}
+void ApplicationManagerImpl::SendGetIconUrlNotifications(
+ const uint32_t connection_key, ApplicationSharedPtr application) {
+ 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();
+ sync_primitives::AutoLock lock(app_icon_map_lock_ptr_);
+ for (; enabled_it != enabled_end; ++enabled_it) {
+ auto app_icon_it = app_icon_map_.find(*enabled_it);
+ if (app_icon_it == app_icon_map_.end()) {
+ LOG4CXX_WARN(logger_, "Could not find cloud app in icon map");
+ continue;
+ }
+
+ std::string endpoint = app_icon_it->second.endpoint;
+ bool pending_request = app_icon_it->second.pending_request;
+
+ if (pending_request) {
+ LOG4CXX_DEBUG(logger_, "Cloud app has already sent request");
+ continue;
+ }
+
+ std::string url = GetPolicyHandler().GetIconUrl(*enabled_it);
+
+ if (url.empty()) {
+ LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ continue;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Creating Get Icon Request");
+
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemRequestID;
+ (*message)[strings::params][strings::connection_key] = connection_key;
+ (*message)[strings::params][strings::message_type] =
+ mobile_apis::messageType::notification;
+ (*message)[strings::params][strings::protocol_version] =
+ application->protocol_version();
+ (*message)[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::ICON_URL;
+ (*message)[strings::msg_params][strings::url] = url;
+
+ app_icon_it->second.pending_request = true;
+
+ rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL);
+ }
+}
+
protocol_handler::MajorProtocolVersion
ApplicationManagerImpl::SupportedSDLVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
@@ -3642,6 +4208,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/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
index 4e9a2556de..f9b084323a 100644
--- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
@@ -75,6 +75,30 @@ void CommandNotificationFromMobileImpl::SendNotification() {
rpc_service_.SendMessageToMobile(message_);
}
+void CommandNotificationFromMobileImpl::SendNotificationToMobile() {
+ auto app = application_manager_.application(connection_key());
+ (*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
+ (*message_)[strings::params][strings::protocol_version] =
+ app->protocol_version();
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+void CommandNotificationFromMobileImpl::SendNotificationToHMI(
+ const hmi_apis::FunctionID::eType& hmi_function_id) {
+ (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ (*message_)[strings::params][strings::function_id] = hmi_function_id;
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+void CommandNotificationFromMobileImpl::SendNotificationToConsumers(
+ const hmi_apis::FunctionID::eType& hmi_function_id) {
+ SendNotificationToMobile();
+ SendNotificationToHMI(hmi_function_id);
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 68e8cfe6b4..f67fde22a0 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -36,11 +36,15 @@
#include "utils/macro.h"
#include "application_manager/commands/command_request_impl.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
#include "smart_objects/smart_object.h"
+#include "smart_objects/enum_schema_item.h"
+
namespace application_manager {
namespace commands {
@@ -233,7 +237,8 @@ void CommandRequestImpl::Run() {}
void CommandRequestImpl::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
+ unsubscribe_from_all_mobile_events();
{
// FIXME (dchmerev@luxoft.com): atomic_xchg fits better
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -257,11 +262,14 @@ void CommandRequestImpl::onTimeOut() {
void CommandRequestImpl::on_event(const event_engine::Event& event) {}
+void CommandRequestImpl::on_event(const event_engine::MobileEvent& event) {}
+
void CommandRequestImpl::SendResponse(
const bool success,
const mobile_apis::Result::eType& result_code,
const char* info,
- const smart_objects::SmartObject* response_params) {
+ const smart_objects::SmartObject* response_params,
+ const std::vector<uint8_t> binary_data) {
LOG4CXX_AUTO_TRACE(logger_);
{
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -286,7 +294,9 @@ void CommandRequestImpl::SendResponse(
CommandImpl::protocol_version_;
response[strings::params][strings::connection_key] = connection_key();
response[strings::params][strings::function_id] = function_id();
-
+ if (!binary_data.empty()) {
+ response[strings::params][strings::binary_data] = binary_data;
+ }
if (response_params) {
response[strings::msg_params] = *response_params;
}
@@ -414,6 +424,94 @@ void CommandRequestImpl::UpdateHash() {
application->UpdateHash();
}
+void CommandRequestImpl::SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool hmi_destination = false;
+ ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ mobile_apis::Result::eType error_code =
+ mobile_apis::Result::DATA_NOT_AVAILABLE;
+
+ if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
+ std::string service_type =
+ (*msg)[strings::msg_params][strings::service_type].asString();
+ application_manager_.GetAppServiceManager().GetProviderByType(
+ service_type, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = mobile_apis::Result::DATA_NOT_AVAILABLE;
+ } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
+ std::string service_id =
+ (*msg)[strings::msg_params][strings::service_id].asString();
+ application_manager_.GetAppServiceManager().GetProviderByID(
+ service_id, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = mobile_apis::Result::INVALID_ID;
+ }
+
+ if (hmi_destination) {
+ LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
+ return;
+ }
+
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SendResponse(false, error_code, error_msg.c_str());
+ return;
+ }
+
+ if (connection_key() == app->app_id()) {
+ SendResponse(false,
+ mobile_apis::Result::IGNORED,
+ "Consumer app is same as producer app");
+ return;
+ }
+
+ smart_objects::SmartObjectSPtr new_msg =
+ std::make_shared<smart_objects::SmartObject>();
+ smart_objects::SmartObject& request = *new_msg;
+
+ request[strings::params] = (*msg)[strings::params];
+ request[strings::msg_params] = (*msg)[strings::msg_params];
+ request[strings::params][strings::connection_key] = app->app_id();
+
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendMobileRequest(mobile_function_id, new_msg, use_events);
+}
+
+void CommandRequestImpl::SendMobileRequest(
+ const mobile_apis::FunctionID::eType& function_id,
+ smart_objects::SmartObjectSPtr msg,
+ bool use_events) {
+ smart_objects::SmartObject& request = *msg;
+
+ const uint32_t mobile_correlation_id =
+ application_manager_.GetNextMobileCorrelationID();
+
+ request[strings::params][strings::correlation_id] = mobile_correlation_id;
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "SendMobileRequest subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
+ subscribe_on_event(function_id, mobile_correlation_id);
+ }
+
+ if (!rpc_service_.ManageMobileCommand(msg, SOURCE_SDL)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ }
+}
+
uint32_t CommandRequestImpl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject* msg_params,
@@ -439,12 +537,12 @@ uint32_t CommandRequestImpl::SendHMIRequest(
if (use_events) {
LOG4CXX_DEBUG(logger_,
- "subscribe_on_event " << function_id << " "
- << hmi_correlation_id);
+ "SendHMIRequest subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
subscribe_on_event(function_id, hmi_correlation_id);
}
if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
- if (!rpc_service_.ManageHMICommand(result)) {
+ if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
}
@@ -474,7 +572,7 @@ void CommandRequestImpl::CreateHMINotification(
notify[strings::params][strings::function_id] = function_id;
notify[strings::msg_params] = msg_params;
- if (!rpc_service_.ManageHMICommand(result)) {
+ if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
}
}
@@ -811,6 +909,19 @@ bool CommandRequestImpl::HasDisallowedParams() const {
(!removed_parameters_permissions_.undefined_params.empty()));
}
+bool CommandRequestImpl::IsMobileResultSuccess(
+ mobile_apis::Result::eType result_code) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ return Compare<mobile_apis::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::WRONG_LANGUAGE,
+ mobile_apis::Result::RETRY,
+ mobile_apis::Result::SAVED);
+}
+
bool CommandRequestImpl::PrepareResultForMobileResponse(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
diff --git a/src/components/application_manager/src/commands/command_request_to_mobile.cc b/src/components/application_manager/src/commands/command_request_to_mobile.cc
new file mode 100644
index 0000000000..e1ed06e887
--- /dev/null
+++ b/src/components/application_manager/src/commands/command_request_to_mobile.cc
@@ -0,0 +1,72 @@
+/*
+ Copyright (c) 2014, 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/commands/command_request_to_mobile.h"
+#include "application_manager/rpc_service.h"
+
+namespace application_manager {
+
+namespace commands {
+
+CommandRequestToMobile::CommandRequestToMobile(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CommandRequestToMobile::~CommandRequestToMobile() {}
+
+bool CommandRequestToMobile::Init() {
+ return true;
+}
+
+bool CommandRequestToMobile::CleanUp() {
+ return true;
+}
+
+void CommandRequestToMobile::Run() {
+ SendRequest();
+}
+
+void CommandRequestToMobile::SendRequest() {
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_response_from_mobile.cc b/src/components/application_manager/src/commands/command_response_from_mobile.cc
new file mode 100644
index 0000000000..dfed65b134
--- /dev/null
+++ b/src/components/application_manager/src/commands/command_response_from_mobile.cc
@@ -0,0 +1,71 @@
+/*
+ Copyright (c) 2013, 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/commands/command_response_from_mobile.h"
+#include "application_manager/rpc_service.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+CommandResponseFromMobile::CommandResponseFromMobile(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : CommandImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+CommandResponseFromMobile::~CommandResponseFromMobile() {}
+
+bool CommandResponseFromMobile::Init() {
+ return true;
+}
+
+bool CommandResponseFromMobile::CleanUp() {
+ return true;
+}
+
+void CommandResponseFromMobile::Run() {}
+
+void CommandResponseFromMobile::SendResponse() {
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc
index 75e49b180e..b6bb8d4e3c 100644
--- a/src/components/application_manager/src/commands/notification_from_hmi.cc
+++ b/src/components/application_manager/src/commands/notification_from_hmi.cc
@@ -73,6 +73,20 @@ void NotificationFromHMI::SendNotificationToMobile(
rpc_service_.ManageMobileCommand(message, SOURCE_SDL);
}
+void NotificationFromHMI::SendNotificationToMobile(
+ const MessageSharedPtr& message,
+ const mobile_apis::FunctionID::eType& mobile_function_id) {
+ (*message)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ (*message)[strings::params][strings::function_id] = mobile_function_id;
+ rpc_service_.ManageMobileCommand(message, SOURCE_SDL);
+}
+
+void NotificationFromHMI::SendNotificationToHMI(MessageSharedPtr& message) {
+ (*message)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ rpc_service_.SendMessageToHMI(message);
+}
+
void NotificationFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const {
@@ -106,6 +120,12 @@ void NotificationFromHMI::CreateHMIRequest(
}
}
+void NotificationFromHMI::SendNotificationToConsumers(
+ const mobile_apis::FunctionID::eType& mobile_function_id) {
+ SendNotificationToHMI(message_);
+ SendNotificationToMobile(message_, mobile_function_id);
+}
+
} // namespace commands
} // namespace application_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..873d9a844f 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -31,8 +31,16 @@
*/
#include "application_manager/commands/request_from_hmi.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
+#include "application_manager/request_info.h"
#include "application_manager/rpc_service.h"
+#include "utils/helpers.h"
+
+#include "smart_objects/enum_schema_item.h"
+
+#include "smart_objects/enum_schema_item.h"
namespace application_manager {
@@ -67,28 +75,37 @@ void RequestFromHMI::Run() {}
void RequestFromHMI::on_event(const event_engine::Event& event) {}
+void RequestFromHMI::on_event(const event_engine::MobileEvent& event) {}
+
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,
+ commands::Command::CommandSource source) {
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
FillCommonParametersOfSO(*message, correlation_id, function_id);
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
- (*message)[strings::params][hmi_response::code] = 0;
+ (*message)[strings::params][hmi_response::code] = result_code;
(*message)[strings::msg_params][strings::success] = success;
(*message)[strings::msg_params][strings::result_code] = result_code;
- rpc_service_.ManageHMICommand(message);
+ if (response_params) {
+ (*message)[strings::msg_params] = *response_params;
+ }
+
+ rpc_service_.ManageHMICommand(message, source);
}
void RequestFromHMI::SendErrorResponse(
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
const hmi_apis::Common_Result::eType result_code,
- const std::string error_message) {
+ const std::string error_message,
+ commands::Command::CommandSource source) {
smart_objects::SmartObjectSPtr message =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -98,7 +115,7 @@ void RequestFromHMI::SendErrorResponse(
(*message)[strings::params][hmi_response::code] = result_code;
(*message)[strings::params][strings::error_msg] = error_message;
- rpc_service_.ManageHMICommand(message);
+ rpc_service_.ManageHMICommand(message, source);
}
void RequestFromHMI::FillCommonParametersOfSO(
@@ -111,5 +128,191 @@ void RequestFromHMI::FillCommonParametersOfSO(
(message)[strings::params][strings::correlation_id] = correlation_id;
}
+bool RequestFromHMI::IsMobileResultSuccess(
+ mobile_apis::Result::eType result_code) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ return Compare<mobile_apis::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::WRONG_LANGUAGE,
+ mobile_apis::Result::RETRY,
+ mobile_apis::Result::SAVED);
+}
+
+bool RequestFromHMI::IsHMIResultSuccess(
+ hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ result_code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED)) {
+ return true;
+ }
+
+ const HmiInterfaces::InterfaceState state =
+ application_manager_.hmi_interfaces().GetInterfaceState(interface);
+ if ((hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code) &&
+ (HmiInterfaces::STATE_NOT_AVAILABLE != state)) {
+ return true;
+ }
+ return false;
+}
+
+void RequestFromHMI::SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool hmi_destination = false;
+ ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ hmi_apis::Common_Result::eType error_code =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+
+ if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
+ std::string service_type =
+ (*msg)[strings::msg_params][strings::service_type].asString();
+ application_manager_.GetAppServiceManager().GetProviderByType(
+ service_type, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+ } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
+ std::string service_id =
+ (*msg)[strings::msg_params][strings::service_id].asString();
+ application_manager_.GetAppServiceManager().GetProviderByID(
+ service_id, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = hmi_apis::Common_Result::INVALID_ID;
+ }
+
+ if (hmi_destination) {
+ LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectoinKey,
+ correlation_id());
+ SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
+ return;
+ }
+
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SendErrorResponse(correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()),
+ error_code,
+ error_msg,
+ commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Sending Request to Mobile Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectoinKey,
+ correlation_id());
+ SendMobileRequest(
+ mobile_function_id, app, &(*msg)[strings::msg_params], use_events);
+}
+
+void RequestFromHMI::SendMobileRequest(
+ const mobile_apis::FunctionID::eType& function_id,
+ const ApplicationSharedPtr app,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events) {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+
+ const uint32_t mobile_correlation_id =
+ application_manager_.GetNextMobileCorrelationID();
+
+ smart_objects::SmartObject& request = *result;
+
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ request[strings::params][strings::function_id] = function_id;
+ request[strings::params][strings::correlation_id] = mobile_correlation_id;
+ request[strings::params][strings::protocol_version] = app->protocol_version();
+ request[strings::params][strings::protocol_type] =
+ CommandImpl::mobile_protocol_type_;
+
+ request[strings::params][strings::connection_key] = app->app_id();
+
+ if (msg_params) {
+ request[strings::msg_params] = *msg_params;
+ }
+
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "RequestFromHMI subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
+ subscribe_on_event(function_id, mobile_correlation_id);
+ }
+ if (!rpc_service_.ManageMobileCommand(
+ result, commands::Command::CommandSource::SOURCE_SDL)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ }
+}
+
+void RequestFromHMI::SendHMIRequest(
+ const hmi_apis::FunctionID::eType& function_id,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events) {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+
+ const uint32_t hmi_correlation_id =
+ application_manager_.GetNextHMICorrelationID();
+
+ smart_objects::SmartObject& request = *result;
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ request[strings::params][strings::function_id] = function_id;
+ request[strings::params][strings::correlation_id] = hmi_correlation_id;
+ request[strings::params][strings::protocol_type] =
+ CommandImpl::hmi_protocol_type_;
+
+ if (msg_params) {
+ request[strings::msg_params] = *msg_params;
+ }
+
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "RequestFromHMI subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
+ subscribe_on_event(function_id, hmi_correlation_id);
+ }
+ if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
+ if (!rpc_service_.ManageHMICommand(
+ result, commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Interface is not available");
+ }
+}
+
+bool RequestFromHMI::ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ HmiInterfaces::InterfaceID interface =
+ hmi_interfaces.GetInterfaceFromFunction(function_id);
+ DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM);
+ const HmiInterfaces::InterfaceState state =
+ hmi_interfaces.GetInterfaceState(interface);
+ if (HmiInterfaces::STATE_NOT_AVAILABLE == state) {
+ return false;
+ }
+ return true;
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event.cc b/src/components/application_manager/src/event_engine/event.cc
index cc180ca950..ecdeb41a2e 100644
--- a/src/components/application_manager/src/event_engine/event.cc
+++ b/src/components/application_manager/src/event_engine/event.cc
@@ -48,5 +48,17 @@ void Event::set_smart_object(const smart_objects::SmartObject& so) {
response_so_ = so;
}
+MobileEvent::MobileEvent(const MobileEventID& id) : id_(id), response_so_() {}
+
+MobileEvent::~MobileEvent() {}
+
+void MobileEvent::raise(EventDispatcher& event_dispatcher) {
+ event_dispatcher.raise_mobile_event(*this);
+}
+
+void MobileEvent::set_smart_object(const smart_objects::SmartObject& so) {
+ response_so_ = so;
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
index f1e5bf9735..3f3cfae1d3 100644
--- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
+++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
@@ -122,5 +122,77 @@ void EventDispatcherImpl::remove_observer_from_vector(EventObserver& observer) {
observers_.end());
}
+// Mobile Events
+
+void EventDispatcherImpl::raise_mobile_event(const MobileEvent& event) {
+ AutoLock observer_lock(mobile_observer_lock_);
+ {
+ AutoLock state_lock(mobile_state_lock_);
+
+ // check if event is notification
+ if (mobile_apis::messageType::notification == event.smart_object_type()) {
+ const uint32_t notification_correlation_id = 0;
+ mobile_observers_ =
+ mobile_observers_event_[event.id()][notification_correlation_id];
+ }
+
+ if (mobile_apis::messageType::response == event.smart_object_type()) {
+ mobile_observers_ = mobile_observers_event_
+ [event.id()][event.smart_object_correlation_id()];
+ }
+ }
+
+ // Call observers
+ while (!mobile_observers_.empty()) {
+ EventObserver* temp = *mobile_observers_.begin();
+ mobile_observers_.erase(mobile_observers_.begin());
+ AutoUnlock unlock_observer(observer_lock);
+ temp->on_event(event);
+ }
+}
+
+void EventDispatcherImpl::add_mobile_observer(
+ const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) {
+ AutoLock auto_lock(mobile_state_lock_);
+ mobile_observers_event_[event_id][mobile_correlation_id].push_back(&observer);
+}
+
+void EventDispatcherImpl::remove_mobile_observer(
+ const MobileEvent::MobileEventID& event_id, EventObserver& observer) {
+ remove_mobile_observer_from_vector(observer);
+ AutoLock auto_lock(mobile_state_lock_);
+ ObserversMap::iterator it = mobile_observers_event_[event_id].begin();
+
+ for (; mobile_observers_event_[event_id].end() != it; ++it) {
+ ObserverVector& obs_vec = it->second;
+ const ObserverVector::iterator obs_vec_it = obs_vec.end();
+ obs_vec.erase(
+ std::remove_if(
+ obs_vec.begin(), obs_vec_it, IdCheckFunctor(observer.id())),
+ obs_vec_it);
+ }
+}
+
+void EventDispatcherImpl::remove_mobile_observer(EventObserver& observer) {
+ remove_mobile_observer_from_vector(observer);
+ MobileEventObserverMap::iterator event_map = mobile_observers_event_.begin();
+
+ for (; mobile_observers_event_.end() != event_map; ++event_map) {
+ remove_mobile_observer(event_map->first, observer);
+ }
+}
+
+void EventDispatcherImpl::remove_mobile_observer_from_vector(
+ EventObserver& observer) {
+ AutoLock auto_lock(mobile_observer_lock_);
+
+ mobile_observers_.erase(
+ std::remove_if(
+ observers_.begin(), observers_.end(), IdCheckFunctor(observer.id())),
+ observers_.end());
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc
index f89f6649b1..fc252d3125 100644
--- a/src/components/application_manager/src/event_engine/event_observer.cc
+++ b/src/components/application_manager/src/event_engine/event_observer.cc
@@ -44,7 +44,8 @@ EventObserver::EventObserver(EventDispatcher& event_dispatcher)
}
EventObserver::~EventObserver() {
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
+ unsubscribe_from_all_mobile_events();
}
void EventObserver::subscribe_on_event(const Event::EventID& event_id,
@@ -60,5 +61,25 @@ void EventObserver::unsubscribe_from_all_events() {
event_dispatcher_.remove_observer(*this);
}
+void EventObserver::unsubscribe_from_all_hmi_events() {
+ event_dispatcher_.remove_observer(*this);
+}
+
+void EventObserver::subscribe_on_event(
+ const MobileEvent::MobileEventID& event_id, int32_t mobile_correlation_id) {
+ event_dispatcher_.add_mobile_observer(event_id, mobile_correlation_id, *this);
+}
+
+void EventObserver::unsubscribe_from_event(
+ const MobileEvent::MobileEventID& event_id) {
+ event_dispatcher_.remove_mobile_observer(event_id, *this);
+}
+
+void EventObserver::unsubscribe_from_all_mobile_events() {
+ event_dispatcher_.remove_mobile_observer(*this);
+}
+
+void EventObserver::on_event(const event_engine::MobileEvent& event) {}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index f67590543d..060eaf011c 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -34,7 +34,7 @@
#include "utils/logger.h"
#include "application_manager/hmi_capabilities_impl.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "smart_objects/smart_object.h"
#include "application_manager/message_helper.h"
#include "application_manager/smart_object_keys.h"
@@ -46,6 +46,8 @@
namespace application_manager {
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities")
+
namespace {
std::map<std::string, hmi_apis::Common_VrCapabilities::eType>
vr_enum_capabilities;
@@ -1170,6 +1172,20 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
smart_objects::SmartObject rc_capability_so;
formatters::CFormatterJsonBase::jsonValueToObj(rc_capability,
rc_capability_so);
+ if (rc_capability_so.keyExists("lightControlCapabilities")) {
+ if (rc_capability_so["lightControlCapabilities"].keyExists(
+ "supportedLights")) {
+ auto& lights = rc_capability_so["lightControlCapabilities"]
+ ["supportedLights"];
+ auto it = lights.asArray()->begin();
+ for (; it != lights.asArray()->end(); ++it) {
+ smart_objects::SmartObject& light_name_so = (*it)["name"];
+ auto light_name = MessageHelper::CommonLightNameFromString(
+ light_name_so.asString());
+ light_name_so = light_name;
+ }
+ }
+ }
set_rc_capability(rc_capability_so);
if (!rc_capability_so.empty()) {
set_rc_supported(true);
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 452b5ab79d..9aff403e09 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -103,6 +103,8 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnEventChanged] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_GetFilePath] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
@@ -227,6 +229,14 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_RC;
convert_map[RC_OnInteriorVehicleData] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[RC_OnRemoteControlSettings] = HmiInterfaces::HMI_INTERFACE_RC;
+ convert_map[AppService_PublishAppService] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_GetAppServiceData] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_PerformAppServiceInteraction] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_GetActiveServiceConsent] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
return convert_map;
}
@@ -250,6 +260,8 @@ HmiInterfacesImpl::HmiInterfacesImpl() {
HmiInterfaces::STATE_NOT_RESPONSE;
interfaces_states_[HmiInterfaces::HMI_INTERFACE_RC] =
HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_AppService] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
}
HmiInterfaces::InterfaceState HmiInterfacesImpl::GetInterfaceState(
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc
index 6e89b2419c..647df242df 100644
--- a/src/components/application_manager/src/hmi_language_handler.cc
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -284,7 +284,7 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
LOG4CXX_DEBUG(logger_,
"No registered apps found. HMILanguageHandler unsubscribed "
"from all events.");
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
}
@@ -304,7 +304,7 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) {
if (0 == apps_.size()) {
LOG4CXX_DEBUG(logger_,
"HMILanguageHandler unsubscribed from all events.");
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
}
SendOnLanguageChangeToMobile(app.first);
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 7be9668543..e220988f0e 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -45,7 +45,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState")
HmiState::HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr,
StateID state_id)
- : app_(app)
+ : hmi_app_id_(app->hmi_app_id())
, state_id_(state_id)
, app_mngr_(app_mngr)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
@@ -57,7 +57,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
HmiState::HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
- : app_(app)
+ : hmi_app_id_(app->hmi_app_id())
, state_id_(STATE_ID_REGULAR)
, app_mngr_(app_mngr)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
@@ -73,19 +73,27 @@ void HmiState::set_parent(HmiStatePtr parent) {
}
bool HmiState::is_navi_app() const {
- return app_->is_navi();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_navi() : false;
}
bool HmiState::is_media_app() const {
- return app_->is_media_application();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_media_application() : false;
}
bool HmiState::is_voice_communication_app() const {
- return app_->is_voice_communication_supported();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_voice_communication_supported() : false;
}
bool HmiState::is_mobile_projection_app() const {
- return app_->mobile_projection_enabled();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->mobile_projection_enabled() : false;
}
mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
@@ -123,7 +131,9 @@ VideoStreamingHmiState::VideoStreamingHmiState(
mobile_apis::VideoStreamingState::eType
VideoStreamingHmiState::video_streaming_state() const {
- if (app_->IsVideoApplication()) {
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ if (app && app->IsVideoApplication()) {
return parent()->video_streaming_state();
}
@@ -201,7 +211,7 @@ AudioSource::AudioSource(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE)
, keep_context_(app->keep_context()) {
- app_->set_keep_context(false);
+ app->set_keep_context(false);
}
mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
@@ -260,7 +270,15 @@ std::ostream& operator<<(std::ostream& os, const HmiState::StateID src) {
}
std::ostream& operator<<(std::ostream& os, const HmiState& src) {
- os << "HMIState(app id:" << src.app_->app_id() << ", state:" << src.state_id()
+ const ApplicationSharedPtr app =
+ src.app_mngr_.application_by_hmi_app(src.hmi_app_id_);
+ os << "HMIState(app id:";
+ if (app) {
+ os << app->app_id();
+ } else {
+ os << "(none)";
+ }
+ os << ", hmi app id:" << src.hmi_app_id_ << ", state:" << src.state_id()
<< ", hmi_level:" << src.hmi_level()
<< ", audio:" << src.audio_streaming_state()
<< ", video:" << src.video_streaming_state()
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..0e44a53c6f 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,
@@ -288,6 +290,17 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
return hmi_apis::Common_Language::INVALID_ENUM;
}
+hmi_apis::Common_LightName::eType MessageHelper::CommonLightNameFromString(
+ const std::string& lightName) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ hmi_apis::Common_LightName::eType value;
+ if (EnumConversionHelper<hmi_apis::Common_LightName::eType>::StringToEnum(
+ lightName, &value)) {
+ return value;
+ }
+ return hmi_apis::Common_LightName::INVALID_ENUM;
+}
+
std::string MessageHelper::GetDeviceMacAddressForHandle(
const transport_manager::DeviceHandle device_handle,
const ApplicationManager& app_mngr) {
@@ -325,6 +338,51 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::message_type] = MessageType::kNotification;
+ message[strings::msg_params] = msg_params;
+
+ // Construct and send mobile notification
+ message[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::CommandSource::SOURCE_SDL);
+
+ // Construct and send HMI notification
+ message[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
+ smart_objects::SmartObjectSPtr hmi_notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageHMICommand(hmi_notification);
+}
+
+smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services) {
+ smart_objects::SmartObject app_service_capabilities(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject app_services(smart_objects::SmartType_Array);
+
+ std::vector<smart_objects::SmartObject> service_records = all_services;
+
+ int i = 0;
+ for (auto& record : service_records) {
+ smart_objects::SmartObject app_service_capability(
+ smart_objects::SmartType_Map);
+ app_service_capability[strings::updated_app_service_record] = record;
+ app_services[i] = app_service_capability;
+ i++;
+ }
+
+ app_service_capabilities[strings::app_services] = app_services;
+ return app_service_capabilities;
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification(
const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1540,15 +1598,20 @@ 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 +1627,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 +1693,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/plugin_manager/plugin_keys.cc b/src/components/application_manager/src/plugin_manager/plugin_keys.cc
new file mode 100644
index 0000000000..9eabc67c09
--- /dev/null
+++ b/src/components/application_manager/src/plugin_manager/plugin_keys.cc
@@ -0,0 +1,14 @@
+#include "application_manager/plugin_manager/plugin_keys.h"
+
+namespace application_manager {
+namespace plugin_manager {
+
+namespace plugin_names {
+const char* vehicle_info_rpc_plugin = "Vehicle Info RPC Plugin";
+const char* app_service_rpc_plugin = "App Service RPC Plugin";
+const char* rc_rpc_plugin = "RC RPC Plugin";
+const char* sdl_rpc_plugin = "SDL RPC Plugin";
+}
+
+} // namespace plugin_manager
+} // namespace application_manager \ No newline at end of file
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index f397814005..ea8935c8c5 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -55,6 +55,8 @@ void PolicyEventObserver::set_policy_handler(
policy_handler_ = policy_handler;
}
+void PolicyEventObserver::on_event(const event_engine::MobileEvent& event) {}
+
void PolicyEventObserver::on_event(const event_engine::Event& event) {
sync_primitives::AutoLock auto_lock(policy_handler_lock_);
if (!policy_handler_) {
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 1b64c5d7b4..aeb5a8bd01 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"
@@ -90,7 +91,8 @@ RequestTypeMap TypeToString = {
{mobile_apis::RequestType::EMERGENCY, "EMERGENCY"},
{mobile_apis::RequestType::MEDIA, "MEDIA"},
{mobile_apis::RequestType::FOTA, "FOTA"},
- {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"}};
+ {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"},
+ {mobile_apis::RequestType::ICON_URL, "ICON_URL"}};
const std::string RequestTypeToString(mobile_apis::RequestType::eType type) {
RequestTypeMap::const_iterator it = TypeToString.find(type);
@@ -1575,6 +1577,11 @@ std::string PolicyHandler::GetLockScreenIconUrl() const {
return policy_manager_->GetLockScreenIconUrl();
}
+std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK(std::string(""));
+ return policy_manager_->GetIconUrl(policy_app_id);
+}
+
uint32_t PolicyHandler::NextRetryTimeout() {
POLICY_LIB_CHECK(0);
LOG4CXX_AUTO_TRACE(logger_);
@@ -1770,6 +1777,17 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
}
#endif // EXTERNAL_PROPRIETARY_MODE
+void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(listeners_lock_);
+ HandlersCollection::const_iterator it = listeners_.begin();
+ for (; it != listeners_.end(); ++it) {
+ PolicyHandlerObserver* observer = *it;
+ observer->OnAuthTokenUpdated(policy_app_id, auth_token);
+ }
+}
+
void PolicyHandler::OnPTUFinished(const bool ptu_result) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
@@ -1845,6 +1863,205 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
+void PolicyHandler::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetEnabledCloudApps(enabled_apps);
+}
+
+bool 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(false);
+ return 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;
+ }
+ if (!message[strings::msg_params].keyExists(strings::properties)) {
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain app properties "
+ << strings::msg_params);
+ return;
+ }
+
+ const smart_objects::SmartObject& properties =
+ message[strings::msg_params][strings::properties];
+ if (!properties.keyExists(strings::app_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Message does not contain mandatory parameter "
+ << strings::app_id);
+ return;
+ }
+ std::string policy_app_id(properties[strings::app_id].asString());
+
+ policy_manager_->InitCloudApp(policy_app_id);
+
+ bool auth_token_update = false;
+ if (properties.keyExists(strings::enabled)) {
+ bool enabled = properties[strings::enabled].asBool();
+ policy_manager_->SetCloudAppEnabled(policy_app_id, enabled);
+ auth_token_update = enabled;
+ application_manager_.RefreshCloudAppInformation();
+ }
+ if (properties.keyExists(strings::auth_token)) {
+ std::string auth_token = properties[strings::auth_token].asString();
+ policy_manager_->SetAppAuthToken(policy_app_id, auth_token);
+ auth_token_update = true;
+ }
+ if (properties.keyExists(strings::cloud_transport_type)) {
+ policy_manager_->SetAppCloudTransportType(
+ policy_app_id, properties[strings::cloud_transport_type].asString());
+ }
+ if (properties.keyExists(strings::endpoint)) {
+ policy_manager_->SetAppEndpoint(policy_app_id,
+ properties[strings::endpoint].asString());
+ }
+ if (properties.keyExists(strings::nicknames)) {
+ StringArray nicknames;
+ const smart_objects::SmartObject& nicknames_array =
+ properties[strings::nicknames];
+ for (size_t i = 0; i < nicknames_array.length(); ++i) {
+ nicknames.push_back(nicknames_array[i].asString());
+ }
+ policy_manager_->SetAppNicknames(policy_app_id, nicknames);
+ }
+ if (properties.keyExists(strings::hybrid_app_preference)) {
+ std::string hybrid_app_preference;
+
+ mobile_apis::HybridAppPreference::eType value =
+ static_cast<mobile_apis::HybridAppPreference::eType>(
+ properties[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);
+ }
+
+ if (auth_token_update) {
+ bool enabled;
+ std::string end, cert, ctt, hap;
+ std::string auth_token;
+
+ policy_manager_->GetCloudAppParameters(
+ policy_app_id, enabled, end, cert, auth_token, ctt, hap);
+ OnAuthTokenUpdated(policy_app_id, auth_token);
+ }
+}
+
+void PolicyHandler::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetAppServiceParameters(policy_app_id,
+ app_service_parameters);
+}
+
+bool PolicyHandler::CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const {
+ std::string service_name = std::string();
+ std::string service_type = std::string();
+ std::vector<int32_t> handled_rpcs = {};
+
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ this->GetAppServiceParameters(policy_app_id, &app_service_parameters);
+
+ if (app_service_parameters.find(requested_service_type) ==
+ app_service_parameters.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed service type: " << requested_service_type);
+ return false;
+ }
+
+ auto service_names =
+ *(app_service_parameters[requested_service_type].service_names);
+ if (!service_names.is_initialized()) {
+ LOG4CXX_DEBUG(logger_,
+ "Pt Service Name is Null, All service names accepted");
+ } else if (!requested_service_name.empty()) {
+ auto find_name_result =
+ std::find(service_names.begin(),
+ service_names.end(),
+ rpc::String<0, 255>(requested_service_name));
+ if (find_name_result == service_names.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed service name: " << requested_service_name);
+ return false;
+ }
+ }
+
+ if (requested_handled_rpcs) {
+ auto temp_rpcs =
+ app_service_parameters[requested_service_type].handled_rpcs;
+ for (auto handled_it = temp_rpcs.begin(); handled_it != temp_rpcs.end();
+ ++handled_it) {
+ handled_rpcs.push_back(handled_it->function_id);
+ }
+
+ for (auto requested_it = requested_handled_rpcs->begin();
+ requested_it != requested_handled_rpcs->end();
+ ++requested_it) {
+ auto find_result = std::find(
+ handled_rpcs.begin(), handled_rpcs.end(), requested_it->asInt());
+ if (find_result == handled_rpcs.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed by handled rpc: " << requested_it->asInt());
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool PolicyHandler::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK(false);
+ return policy_manager_->UnknownRPCPassthroughAllowed(policy_app_id);
+}
+
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/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index c8e9032dfa..584fb4e697 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "application_manager/resumption/resumption_data_json.h"
#include "smart_objects/smart_object.h"
#include "json/json.h"
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 939b3d1ce6..28b3779dad 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -32,12 +32,16 @@
#include "application_manager/rpc_handler_impl.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+
namespace application_manager {
namespace rpc_handler {
CREATE_LOGGERPTR_LOCAL(logger_, "RPCHandlerImpl")
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+namespace plugin_names = application_manager::plugin_manager::plugin_names;
RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager)
: app_manager_(app_manager)
@@ -63,17 +67,76 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
#endif // TELEMETRY_MONITOR
smart_objects::SmartObjectSPtr so_from_mobile =
std::make_shared<smart_objects::SmartObject>();
-
+ bool allow_unknown_parameters = false;
DCHECK_OR_RETURN_VOID(so_from_mobile);
if (!so_from_mobile) {
LOG4CXX_ERROR(logger_, "Null pointer");
return;
}
- if (!ConvertMessageToSO(*message, *so_from_mobile)) {
+ if (message->type() == application_manager::MessageType::kRequest &&
+ message->correlation_id() < 0) {
+ LOG4CXX_ERROR(logger_, "Request correlation id < 0. Returning INVALID_ID");
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(message->connection_key(),
+ message->function_id(),
+ 0,
+ mobile_apis::Result::INVALID_ID));
+ // CreateNegativeResponse() takes a uint32_t for correlation_id, therefore a
+ // negative number cannot be passed to that function or else it will be
+ // improperly cast. correlation_id is reassigned below to its original
+ // value.
+ (*response)[strings::params][strings::correlation_id] =
+ message->correlation_id();
+ (*response)[strings::msg_params][strings::info] =
+ "Invalid Correlation ID for RPC Request";
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+ return;
+ }
+
+ bool rpc_passing = app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .CanHandleFunctionID(message->function_id());
+ if (app_manager_.GetRPCService().IsAppServiceRPC(
+ message->function_id(), commands::Command::SOURCE_MOBILE) ||
+ rpc_passing) {
+ LOG4CXX_DEBUG(logger_,
+ "Allowing unknown parameters for request function "
+ << message->function_id());
+ allow_unknown_parameters = true;
+ }
+
+ if (!ConvertMessageToSO(
+ *message, *so_from_mobile, allow_unknown_parameters, !rpc_passing)) {
LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
return;
}
+
+ if (rpc_passing) {
+ uint32_t correlation_id =
+ (*so_from_mobile)[strings::params][strings::correlation_id].asUInt();
+ int32_t message_type =
+ (*so_from_mobile)[strings::params][strings::message_type].asInt();
+ RPCPassingHandler& handler =
+ app_manager_.GetAppServiceManager().GetRPCPassingHandler();
+ // Check permissions for requests, otherwise attempt passthrough
+ if ((application_manager::MessageType::kRequest != message_type ||
+ handler.IsPassthroughAllowed(*so_from_mobile)) &&
+ handler.RPCPassThrough(*so_from_mobile)) {
+ // RPC was forwarded. Skip handling by Core
+ return;
+ } else if (!handler.IsPassThroughMessage(correlation_id,
+ commands::Command::SOURCE_MOBILE,
+ message_type)) {
+ // Since PassThrough failed, refiltering the message
+ if (!ConvertMessageToSO(*message, *so_from_mobile)) {
+ LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
+ return;
+ }
+ }
+ }
+
#ifdef TELEMETRY_MONITOR
metric->message = so_from_mobile;
#endif // TELEMETRY_MONITOR
@@ -95,13 +158,28 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr smart_object =
std::make_shared<smart_objects::SmartObject>();
-
+ bool allow_unknown_parameters = false;
if (!smart_object) {
LOG4CXX_ERROR(logger_, "Null pointer");
return;
}
- if (!ConvertMessageToSO(*message, *smart_object)) {
+ smart_objects::SmartObject converted_result;
+ formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ message->json_message(), converted_result);
+
+ if (app_manager_.GetRPCService().IsAppServiceRPC(
+ converted_result[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt(),
+ commands::Command::SOURCE_HMI)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Allowing unknown parameters for request function "
+ << converted_result[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ allow_unknown_parameters = true;
+ }
+
+ if (!ConvertMessageToSO(*message, *smart_object, allow_unknown_parameters)) {
if (application_manager::MessageType::kResponse ==
(*smart_object)[strings::params][strings::message_type].asInt()) {
(*smart_object).erase(strings::msg_params);
@@ -228,7 +306,9 @@ void RPCHandlerImpl::GetMessageVersion(
bool RPCHandlerImpl::ConvertMessageToSO(
const Message& message,
- ns_smart_device_link::ns_smart_objects::SmartObject& output) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& output,
+ const bool allow_unknown_parameters,
+ const bool validate_params) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"\t\t\tMessage to convert: protocol "
@@ -262,13 +342,14 @@ bool RPCHandlerImpl::ConvertMessageToSO(
}
if (!conversion_result ||
- !mobile_so_factory().attachSchema(output, true, msg_version) ||
- ((output.validate(&report, msg_version) !=
- smart_objects::errors::OK))) {
+ (validate_params &&
+ !ValidateRpcSO(
+ output, msg_version, report, allow_unknown_parameters))) {
LOG4CXX_WARN(logger_,
"Failed to parse string to smart object with API version "
<< msg_version.toString() << " : "
<< message.json_message());
+
std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
message.connection_key(),
@@ -280,8 +361,10 @@ bool RPCHandlerImpl::ConvertMessageToSO(
rpc::PrettyFormat(report);
app_manager_.GetRPCService().ManageMobileCommand(
response, commands::Command::SOURCE_SDL);
+
return false;
}
+
LOG4CXX_DEBUG(logger_,
"Convertion result for sdl object is true function_id "
<< output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
@@ -330,9 +413,12 @@ bool RPCHandlerImpl::ConvertMessageToSO(
rpc::ValidationReport report("RPC");
- if (output.validate(&report) != smart_objects::errors::OK) {
+ utils::SemanticVersion empty_version;
+ if (validate_params &&
+ output.validate(&report, empty_version, allow_unknown_parameters) !=
+ smart_objects::errors::OK) {
LOG4CXX_ERROR(logger_,
- "Incorrect parameter from HMI"
+ "Incorrect parameter from HMI - "
<< rpc::PrettyFormat(report));
output.erase(strings::msg_params);
@@ -391,6 +477,20 @@ bool RPCHandlerImpl::ConvertMessageToSO(
return true;
}
+bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) {
+ if (!mobile_so_factory().attachSchema(
+ message, !allow_unknown_parameters, msg_version) ||
+ message.validate(&report_out, msg_version, allow_unknown_parameters) !=
+ smart_objects::errors::OK) {
+ LOG4CXX_WARN(logger_, "Failed to parse string to smart object");
+ return false;
+ }
+ return true;
+}
+
std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
const protocol_handler::RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
new file mode 100644
index 0000000000..32eda4b9e8
--- /dev/null
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -0,0 +1,441 @@
+/*
+ * 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/app_service_manager.h"
+#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/rpc_handler.h"
+#include "application_manager/rpc_passing_handler.h"
+#include "application_manager/smart_object_keys.h"
+#include "encryption/hashing.h"
+#include "resumption/last_state.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/logger.h"
+
+#include "smart_objects/enum_schema_item.h"
+#include "utils/timer_task_impl.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "RPCPassingHandler")
+
+namespace application_manager {
+
+RPCPassingHandler::RPCPassingHandler(AppServiceManager& asm_ref,
+ ApplicationManager& am_ref)
+ : app_service_manager_(asm_ref), app_manager_(am_ref) {}
+
+RPCPassingHandler::~RPCPassingHandler() {}
+
+bool RPCPassingHandler::IsPassThroughMessage(
+ uint32_t correlation_id,
+ commands::Command::CommandSource source,
+ int32_t message_type) {
+ sync_primitives::AutoLock lock(rpc_request_queue_lock_);
+
+ if (rpc_request_queue.find(correlation_id) != rpc_request_queue.end()) {
+ if (message_type == MessageType::kResponse &&
+ source == commands::Command::CommandSource::SOURCE_SDL) {
+ // Checks if response is being sent to mobile then removes the correlation
+ // id from the map
+ rpc_request_queue.erase(correlation_id);
+ }
+ return true;
+ }
+ return false;
+}
+
+bool RPCPassingHandler::CanHandleFunctionID(int32_t function_id) {
+ auto services = app_service_manager_.GetActiveServices();
+ for (auto it = services.begin(); it != services.end(); ++it) {
+ auto handled_rpcs =
+ it->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); i++) {
+ if (handled_rpcs[i].asInt() == function_id) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool RPCPassingHandler::ExtractRPCParams(
+ const smart_objects::SmartObject& s_map,
+ const ApplicationSharedPtr app,
+ const std::string& function_id_str) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ RPCParams params;
+
+ if (smart_objects::SmartType_Map == s_map.getType()) {
+ for (auto iter = s_map.map_begin(); iter != s_map.map_end(); ++iter) {
+ LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
+ params.insert(iter->first);
+ }
+ }
+
+ CommandParametersPermissions parameters_permissions;
+
+ mobile_apis::Result::eType check_result = app_manager_.CheckPolicyPermissions(
+ app, function_id_str, params, &parameters_permissions);
+
+ // Check if RPC is allowed by policy (since we are allowing unknown params,
+ // check should pass if only undefined parameters exist)
+ if (mobile_apis::Result::DISALLOWED == check_result &&
+ !parameters_permissions.undefined_params.empty() &&
+ parameters_permissions.disallowed_params.empty() &&
+ parameters_permissions.allowed_params.empty()) {
+ return true;
+ } else if (mobile_apis::Result::SUCCESS != check_result) {
+ return false;
+ }
+
+ return true;
+}
+
+bool RPCPassingHandler::IsPassthroughAllowed(
+ smart_objects::SmartObject rpc_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ uint32_t connection_key =
+ rpc_message[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app = app_manager_.application(connection_key);
+ if (!app) {
+ return false;
+ }
+
+ mobile_api::FunctionID::eType function_id =
+ static_cast<mobile_api::FunctionID::eType>(
+ rpc_message[strings::params][strings::function_id].asInt());
+ std::string function_id_str =
+ MessageHelper::StringifiedFunctionID(function_id);
+ PolicyHandlerInterface& policy_handler = app_manager_.GetPolicyHandler();
+
+ if (function_id_str.empty()) {
+ // Unknown RPC, just do basic revoked and user consent checks
+ std::string device_mac;
+ app_manager_.connection_handler().get_session_observer().GetDataOnDeviceID(
+ app->device(), NULL, NULL, &device_mac, NULL);
+ return policy_handler.UnknownRPCPassthroughAllowed(app->policy_app_id()) &&
+ !policy_handler.IsApplicationRevoked(app->policy_app_id()) &&
+ policy::kDeviceAllowed ==
+ app_manager_.GetUserConsentForDevice(device_mac);
+ }
+
+ return ExtractRPCParams(
+ rpc_message[strings::msg_params], app, function_id_str);
+}
+
+bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ uint32_t correlation_id =
+ rpc_message[strings::params][strings::correlation_id].asUInt();
+ int32_t message_type =
+ rpc_message[strings::params][strings::message_type].asInt();
+
+ LOG4CXX_DEBUG(logger_, "RPC_PASSING: ");
+ MessageHelper::PrintSmartObject(rpc_message);
+
+ // Clear timers for timed out requests
+ ClearCompletedTimers();
+ switch (message_type) {
+ case MessageType::kRequest: {
+ LOG4CXX_DEBUG(logger_, "Handle request");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ rpc_request_queue_lock_.Release();
+ LOG4CXX_DEBUG(
+ logger_,
+ "Correlation id DOES NOT exist in map. Constructing request queue");
+ PopulateRPCRequestQueue(rpc_message);
+ } else {
+ rpc_request_queue_lock_.Release();
+ LOG4CXX_DEBUG(logger_, "Correlation id DOES exist in map. Returning");
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ rpc_message[strings::params][strings::connection_key].asUInt(),
+ rpc_message[strings::params][strings::function_id].asInt(),
+ correlation_id,
+ mobile_apis::Result::INVALID_ID));
+
+ (*response)[strings::msg_params][strings::info] =
+ "Duplicate correlation_id";
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+
+ return true;
+ }
+
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue[correlation_id].second.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "No services left in map. Using core to handle request");
+ rpc_request_queue.erase(correlation_id);
+ rpc_request_queue_lock_.Release();
+ return false;
+ } else {
+ rpc_request_queue_lock_.Release();
+ ForwardRequestToMobile(correlation_id);
+ return true;
+ }
+
+ break;
+ }
+
+ case MessageType::kResponse: {
+ LOG4CXX_DEBUG(logger_, "Handle response");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ rpc_request_queue_lock_.Release();
+ return false;
+ }
+ rpc_request_queue_lock_.Release();
+ RemoveRequestTimer(correlation_id);
+
+ mobile_apis::Result::eType result_code;
+ smart_objects::EnumConversionHelper<mobile_apis::Result::eType>::
+ StringToEnum(
+ rpc_message[strings::msg_params][strings::result_code].asString(),
+ &result_code);
+
+ if (result_code == mobile_apis::Result::UNSUPPORTED_REQUEST) {
+ LOG4CXX_DEBUG(logger_, "Service sent UNSUPPORTED_REQUEST");
+ PerformNextRequest(correlation_id);
+ return true;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Valid RPC passing response");
+ ForwardResponseToMobile(correlation_id, rpc_message);
+ return true;
+ }
+
+ break;
+ }
+ }
+
+ return false;
+}
+
+void RPCPassingHandler::PopulateRPCRequestQueue(
+ smart_objects::SmartObject request_message) {
+ uint32_t origin_connection_key =
+ request_message[strings::params][strings::connection_key].asUInt();
+ uint32_t correlation_id =
+ request_message[strings::params][strings::correlation_id].asUInt();
+ int32_t function_id =
+ request_message[strings::params][strings::function_id].asInt();
+
+ // Construct list of pass through services
+ auto entry = std::make_pair(request_message, std::deque<ServiceInfo>());
+ auto services = app_service_manager_.GetActiveServices();
+
+ for (auto services_it = services.begin(); services_it != services.end();
+ ++services_it) {
+ auto handled_rpcs =
+ services_it->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); i++) {
+ if (handled_rpcs[i].asInt() == function_id) {
+ // Add requests to queue
+ ServiceInfo service_info{
+ services_it->record[strings::service_id].asString(),
+ services_it->connection_key};
+ entry.second.push_back(service_info);
+ app_manager_.IncreaseForwardedRequestTimeout(origin_connection_key,
+ correlation_id);
+ break;
+ }
+ }
+ }
+
+ sync_primitives::AutoLock lock(rpc_request_queue_lock_);
+ rpc_request_queue[correlation_id] = entry;
+
+ LOG4CXX_DEBUG(logger_,
+ "Added " << rpc_request_queue[correlation_id].second.size()
+ << " requests to the queue");
+}
+void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) {
+ rpc_request_queue_lock_.Acquire();
+ uint32_t connection_key =
+ rpc_request_queue[correlation_id].second.front().connection_key;
+ LOG4CXX_DEBUG(logger_,
+ "Forwarding request to service with app id " << connection_key);
+
+ smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
+ message[strings::params][strings::connection_key] = connection_key;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ rpc_request_queue_lock_.Release();
+ AddRequestTimer(correlation_id);
+ app_manager_.GetRPCService().SendMessageToMobile(result);
+}
+
+void RPCPassingHandler::ForwardRequestToCore(uint32_t correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "No services left in map. using core to handle request");
+ rpc_request_queue_lock_.Acquire();
+ smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ rpc_request_queue.erase(correlation_id);
+ rpc_request_queue_lock_.Release();
+
+ // Validate rpc message before forwarding to core
+ rpc::ValidationReport report("RPC");
+ uint32_t connection_key =
+ message[strings::params][strings::connection_key].asUInt();
+ int32_t function_id = message[strings::params][strings::function_id].asInt();
+ auto app_ptr = app_manager_.application(connection_key);
+ utils::SemanticVersion msg_version(0, 0, 0);
+ if (app_ptr) {
+ msg_version = app_ptr->msg_version();
+ }
+
+ if (!app_manager_.GetRPCHandler().ValidateRpcSO(
+ message, msg_version, report, false)) {
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ function_id,
+ correlation_id,
+ mobile_apis::Result::INVALID_DATA));
+
+ (*response)[strings::msg_params][strings::info] = rpc::PrettyFormat(report);
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+ return;
+ }
+
+ app_manager_.GetRPCService().ManageMobileCommand(
+ result, commands::Command::SOURCE_MOBILE);
+}
+
+void RPCPassingHandler::ForwardResponseToMobile(
+ uint32_t correlation_id, smart_objects::SmartObject response_message) {
+ rpc_request_queue_lock_.Acquire();
+ uint32_t origin_connection_key =
+ rpc_request_queue[correlation_id]
+ .first[strings::params][strings::connection_key]
+ .asUInt();
+ rpc_request_queue_lock_.Release();
+
+ LOG4CXX_DEBUG(logger_,
+ "Forwarding response to mobile app " << origin_connection_key);
+ smart_objects::SmartObject message(response_message);
+ message[strings::params][strings::connection_key] = origin_connection_key;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_manager_.GetRPCService().SendMessageToMobile(result);
+}
+
+bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) {
+ LOG4CXX_DEBUG(logger_, "Performing next request in queue");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ LOG4CXX_ERROR(logger_, "Correlation id does NOT exist in map");
+ rpc_request_queue_lock_.Release();
+ return false;
+ }
+ rpc_request_queue[correlation_id].second.pop_front();
+ bool empty = rpc_request_queue[correlation_id].second.empty();
+ rpc_request_queue_lock_.Release();
+
+ if (empty) {
+ ForwardRequestToCore(correlation_id);
+ } else {
+ ForwardRequestToMobile(correlation_id);
+ }
+
+ return true;
+}
+
+void RPCPassingHandler::OnPassThroughRequestTimeout() {
+ timeout_queue_lock_.Acquire();
+ LOG4CXX_DEBUG(logger_, "Request Timed out");
+ auto timeout_entry = timeout_queue_.front();
+ uint32_t correlation_id = timeout_entry.second;
+ timeout_queue_lock_.Release();
+ PerformNextRequest(correlation_id);
+}
+
+void RPCPassingHandler::ClearCompletedTimers() {
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+
+ LOG4CXX_DEBUG(logger_, "Clearing Completed Timers");
+ for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) {
+ TimerSPtr timer = it->first;
+ if (timer->is_completed()) {
+ LOG4CXX_DEBUG(logger_,
+ "Removing completed timer for correlation id "
+ << it->second);
+ it = timeout_queue_.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
+void RPCPassingHandler::AddRequestTimer(uint32_t correlation_id) {
+ TimerSPtr rpc_passing_timer(std::make_shared<timer::Timer>(
+ "RPCPassingTimeoutTimer_" + std::to_string(correlation_id),
+ new timer::TimerTaskImpl<RPCPassingHandler>(
+ this, &RPCPassingHandler::OnPassThroughRequestTimeout)));
+ const uint32_t timeout_ms =
+ app_manager_.get_settings().rpc_pass_through_timeout();
+ rpc_passing_timer->Start(timeout_ms, timer::kSingleShot);
+ LOG4CXX_DEBUG(logger_,
+ "Adding and starting timer for correlation id "
+ << correlation_id);
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+ timeout_queue_.push_back(std::make_pair(rpc_passing_timer, correlation_id));
+}
+
+void RPCPassingHandler::RemoveRequestTimer(uint32_t correlation_id) {
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+
+ for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) {
+ TimerSPtr timer = it->first;
+ uint32_t cid = it->second;
+ if (cid == correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Removing timer for correlation id " << correlation_id);
+ it = timeout_queue_.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index 7a68ae5779..daa8cb2ac5 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -32,12 +32,16 @@
#include "application_manager/rpc_service_impl.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+
namespace application_manager {
namespace rpc_service {
CREATE_LOGGERPTR_LOCAL(logger_, "RPCServiceImpl")
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+namespace plugin_names = application_manager::plugin_manager::plugin_names;
RPCServiceImpl::RPCServiceImpl(
ApplicationManager& app_manager,
@@ -122,7 +126,8 @@ bool RPCServiceImpl::ManageMobileCommand(
auto plugin =
app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
- LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error());
+ LOG4CXX_WARN(logger_, "Failed to find plugin : " << plugin.error());
+ CheckSourceForUnsupportedRequest(message, source);
return false;
}
application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
@@ -154,7 +159,19 @@ bool RPCServiceImpl::ManageMobileCommand(
return true;
}
- if (message_type == mobile_apis::messageType::request) {
+ if (message_type == mobile_apis::messageType::request &&
+ source == commands::Command::CommandSource::SOURCE_SDL) {
+ if (command->Init()) {
+ command->Run();
+ command->CleanUp();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if (message_type == mobile_apis::messageType::request &&
+ source == commands::Command::CommandSource::SOURCE_MOBILE) {
// commands will be launched from requesr_ctrl
mobile_apis::HMILevel::eType app_hmi_level =
mobile_apis::HMILevel::INVALID_ENUM;
@@ -241,8 +258,8 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
}
-bool RPCServiceImpl::ManageHMICommand(
- const commands::MessageSharedPtr message) {
+bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source) {
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
@@ -258,15 +275,15 @@ bool RPCServiceImpl::ManageHMICommand(
MessageHelper::PrintSmartObject(*message);
const int32_t function_id =
(*(message.get()))[strings::params][strings::function_id].asInt();
- auto plugin = app_manager_.GetPluginManager().FindPluginToProcess(
- function_id, commands::Command::SOURCE_HMI);
+ auto plugin =
+ app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error());
return false;
}
application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
- auto command = factory.CreateCommand(message, commands::Command::SOURCE_HMI);
+ auto command = factory.CreateCommand(message, source);
if (!command) {
LOG4CXX_WARN(logger_, "Failed to create command from smart object");
@@ -374,6 +391,7 @@ void RPCServiceImpl::SendMessageToMobile(
const bool is_result_code_exists =
(*message)[strings::msg_params].keyExists(strings::result_code);
+ bool allow_unknown_parameters = false;
if (!app) {
LOG4CXX_ERROR(logger_, "No application associated with connection key");
@@ -405,7 +423,31 @@ void RPCServiceImpl::SendMessageToMobile(
// Messages to mobile are not yet prioritized so use default priority value
std::shared_ptr<Message> message_to_send(
new Message(protocol_handler::MessagePriority::kDefault));
- if (!ConvertSOtoMessage((*message), (*message_to_send))) {
+
+ int32_t function_id = (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt();
+ bool rpc_passing = app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .CanHandleFunctionID(function_id);
+ if (IsAppServiceRPC(function_id,
+ commands::Command::CommandSource::SOURCE_SDL) ||
+ rpc_passing) {
+ LOG4CXX_DEBUG(logger_,
+ "Allowing unknown parameters for response function "
+ << function_id);
+ allow_unknown_parameters = true;
+ }
+
+ if (rpc_passing &&
+ !app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .IsPassThroughMessage(
+ (*message)[jhs::S_PARAMS][jhs::S_CORRELATION_ID].asUInt(),
+ commands::Command::CommandSource::SOURCE_SDL,
+ (*message)[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE].asInt())) {
+ allow_unknown_parameters = false;
+ }
+ if (!ConvertSOtoMessage(
+ (*message), (*message_to_send), allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string");
return;
}
@@ -484,6 +526,7 @@ void RPCServiceImpl::SendMessageToHMI(
return;
}
+ bool allow_unknown_parameters = false;
// SmartObject |message| has no way to declare priority for now
std::shared_ptr<Message> message_to_send(
new Message(protocol_handler::MessagePriority::kDefault));
@@ -497,7 +540,17 @@ void RPCServiceImpl::SendMessageToHMI(
logger_,
"Attached schema to message, result if valid: " << message->isValid());
- if (!ConvertSOtoMessage(*message, *message_to_send)) {
+ if (IsAppServiceRPC((*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt(),
+ commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
+ LOG4CXX_DEBUG(logger_,
+ "Allowing unknown parameters for response function "
+ << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+
+ allow_unknown_parameters = true;
+ }
+
+ if (!ConvertSOtoMessage(
+ *message, *message_to_send, allow_unknown_parameters)) {
LOG4CXX_WARN(logger_,
"Cannot send message to HMI: failed to create string");
return;
@@ -506,6 +559,42 @@ void RPCServiceImpl::SendMessageToHMI(
messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send));
}
+bool RPCServiceImpl::IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source) {
+ // General RPCs related to App Services
+ if ((source == commands::Command::CommandSource::SOURCE_MOBILE) ||
+ (source ==
+ commands::Command::CommandSource::SOURCE_SDL)) { // MOBILE COMMANDS
+ switch (function_id) {
+ case mobile_apis::FunctionID::GetSystemCapabilityID:
+ case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID:
+ return true;
+ break;
+ }
+ } else if ((source == commands::Command::CommandSource::SOURCE_HMI) ||
+ (source == commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI)) { // HMI COMMANDS
+ switch (function_id) {
+ case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated:
+ return true;
+ break;
+ }
+ }
+
+ // RPCs handled by app services plugin
+ auto plugin =
+ app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
+ if (!plugin) {
+ return false;
+ }
+ if ((*plugin).PluginName() != plugin_names::app_service_rpc_plugin) {
+ return false;
+ }
+ application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
+
+ return factory.IsAbleToProcess(function_id, source);
+}
+
void RPCServiceImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* handler) {
protocol_handler_ = handler;
@@ -518,7 +607,8 @@ void RPCServiceImpl::set_hmi_message_handler(
bool RPCServiceImpl::ConvertSOtoMessage(
const ns_smart_device_link::ns_smart_objects::SmartObject& message,
- Message& output) {
+ Message& output,
+ const bool allow_unknown_parameters) {
LOG4CXX_AUTO_TRACE(logger_);
if (smart_objects::SmartType_Null == message.getType() ||
@@ -543,16 +633,16 @@ bool RPCServiceImpl::ConvertSOtoMessage(
switch (protocol_type) {
case 0: {
if (protocol_version == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
output.set_protocol_version(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
} else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv2::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -564,7 +654,8 @@ bool RPCServiceImpl::ConvertSOtoMessage(
break;
}
case 1: {
- if (!formatters::FormatterJsonRpc::ToString(message, output_string)) {
+ if (!formatters::FormatterJsonRpc::ToString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -577,7 +668,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
return false;
}
- LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string);
+ LOG4CXX_DEBUG(logger_, "Conversion result: " << output_string);
output.set_connection_key(message.getElement(jhs::S_PARAMS)
.getElement(strings::connection_key)
@@ -624,6 +715,43 @@ mobile_apis::MOBILE_API& RPCServiceImpl::mobile_so_factory() {
return mobile_so_factory_;
}
+void RPCServiceImpl::CheckSourceForUnsupportedRequest(
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source) {
+ int32_t message_type =
+ (*(message.get()))[strings::params][strings::message_type].asInt();
+ uint32_t correlation_id =
+ (*message)[strings::params].keyExists(strings::correlation_id)
+ ? (*message)[strings::params][strings::correlation_id].asUInt()
+ : 0;
+ const uint32_t connection_key = static_cast<uint32_t>(
+ (*message)[strings::params][strings::connection_key].asUInt());
+ mobile_apis::FunctionID::eType function_id =
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+ if ((source == commands::Command::CommandSource::SOURCE_MOBILE &&
+ kRequest == message_type) ||
+ (source == commands::Command::CommandSource::SOURCE_SDL &&
+ kResponse == message_type)) {
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateNegativeResponse(connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ 0);
+
+ // Since we are dealing with an unknown RPC, there is no schema attached
+ // to the message, so we have to convert the result to string directly
+ std::string result_code;
+ smart_objects::EnumConversionHelper<mobile_apis::Result::eType>::
+ EnumToString(mobile_apis::Result::UNSUPPORTED_REQUEST, &result_code);
+ (*response)[strings::msg_params][strings::result_code] = result_code;
+ (*response)[strings::msg_params][strings::info] =
+ "Module does not recognize this function id";
+
+ SendMessageToMobile(response);
+ }
+}
+
} // namespace rpc_service
} // namespace application_manager
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index ff9ebb6208..a1dedd1d64 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -27,6 +27,7 @@ const char* app_launch_last_session = "app_launch_last_session";
const char* policy_app_id = "policyAppID";
const char* hmi_app_id = "hmiAppID";
const char* device_id = "deviceID";
+const char* subscribe = "subscribe";
const char* subscribed_for_way_points = "subscribed_for_way_points";
const char* url = "url";
const char* urlScheme = "urlScheme";
@@ -43,7 +44,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";
@@ -145,6 +146,7 @@ const char* navigation_capability = "navigationCapability";
const char* phone_capability = "phoneCapability";
const char* video_streaming_capability = "videoStreamingCapability";
const char* rc_capability = "remoteControlCapability";
+const char* app_services_capabilities = "appServicesCapabilities";
const char* day_color_scheme = "dayColorScheme";
const char* night_color_scheme = "nightColorScheme";
const char* primary_color = "primaryColor";
@@ -155,10 +157,19 @@ const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
+const char* nicknames = "nicknames";
+const char* enabled = "enabled";
+const char* auth_token = "authToken";
+const char* cloud_transport_type = "cloudTransportType";
+const char* hybrid_app_preference = "hybridAppPreference";
+const char* is_cloud_application = "isCloudApplication";
+const char* cloud_connection_status = "cloudConnectionStatus";
+const char* endpoint = "endpoint";
// PutFile
const char* sync_file_name = "syncFileName";
const char* file_name = "fileName";
+const char* file_path = "filePath";
const char* file_type = "fileType";
const char* file_size = "fileSize";
const char* crc32_check_sum = "crc";
@@ -220,6 +231,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 +272,31 @@ 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* 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";
+const char* app_service_id = "appServiceId";
+const char* service_data = "serviceData";
+const char* request_service_active = "requestServiceActive";
+const char* app_services = "appServices";
+const char* update_reason = "updateReason";
+const char* updated_app_service_record = "updatedAppServiceRecord";
+const char* service_records = "serviceRecords";
+const char* activate = "activate";
+const char* set_as_default = "setAsDefault";
+const char* origin_app = "originApp";
+
// resuming
const char* application_commands = "applicationCommands";
const char* application_submenus = "applicationSubMenus";
@@ -319,6 +356,8 @@ const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
const char* const auto_complete_text_supported = "autoCompleteTextSupported";
+const char* const send_location_enabled = "sendLocationEnabled";
+const char* const get_way_points_enabled = "getWayPointsEnabled";
const char* const entity_type = "entityType";
const char* const entity_id = "entityID";
const char* const status = "status";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 3d44709657..f4852c532c 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);
@@ -622,6 +624,7 @@ void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
"Resolving HMI level conflicts for app " << app->app_id());
ForEachApplication(HmiLevelConflictResolver(app, state, this));
}
+void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {}
void StateControllerImpl::on_event(const event_engine::Event& event) {
using smart_objects::SmartObject;
diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
index 27f0972c01..f5d08a8ebf 100644
--- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc
+++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
@@ -41,6 +41,8 @@
namespace application_manager {
+CREATE_LOGGERPTR_GLOBAL(logger_, "SystemTimeHandler")
+
SystemTimeHandlerImpl::SystemTimeHandlerImpl(
ApplicationManager& application_manager)
: event_engine::EventObserver(application_manager.event_dispatcher())
@@ -56,7 +58,7 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl(
SystemTimeHandlerImpl::~SystemTimeHandlerImpl() {
LOG4CXX_AUTO_TRACE(logger_);
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
void SystemTimeHandlerImpl::DoSystemTimeQuery() {
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index 02cf58485a..4851a6b37e 100755
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -63,6 +63,7 @@ set(testSources
${AM_TEST_DIR}/application_state_test.cc
${AM_TEST_DIR}/usage_statistics_test.cc
${AM_TEST_DIR}/policy_handler_test.cc
+ ${AM_TEST_DIR}/app_service_manager_test.cc
${AM_TEST_DIR}/application_manager_impl_test.cc
${AM_TEST_DIR}/application_helper_test.cc
${AM_TEST_DIR}/command_holder_test.cc
diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc
new file mode 100644
index 0000000000..960e8e31f6
--- /dev/null
+++ b/src/components/application_manager/test/app_service_manager_test.cc
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2017, 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 <gmock/gmock.h>
+
+#include "application_manager/commands/command.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "resumption/mock_last_state.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using testing::_;
+using ::testing::DoAll;
+using ::testing::Mock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+namespace am = application_manager;
+
+const char* kAppServiceSection = "AppServices";
+const char* kDefaults = "defaults";
+const std::string kServiceType = "MEDIA";
+const std::string kServiceName = "service_name";
+const std::string kServiceId = "service_id";
+const std::string kPolicyAppId = "p_app_id";
+const uint32_t kConnectionKey = 43629;
+const uint32_t kHMIConnectionKey = 0;
+
+MATCHER_P(CapabilityUpdateMatcher, reason, "") {
+ smart_objects::SmartObject& services_updated =
+ arg[am::strings::system_capability]
+ [am::strings::app_services_capabilities][am::strings::app_services];
+ if (smart_objects::SmartType_Array != services_updated.getType()) {
+ return false;
+ }
+ for (size_t i = 0; i < services_updated.length(); i++) {
+ smart_objects::SmartObject& service_cap = services_updated[i];
+ if (reason == service_cap[am::strings::update_reason].asInt()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+class AppServiceManagerTest : public testing::Test {
+ public:
+ AppServiceManagerTest()
+ : mock_app_ptr_(new MockApplication)
+ , app_service_manager_(mock_app_manager_, mock_last_state_)
+ , mock_message_helper_(
+ application_manager::MockMessageHelper::message_helper_mock()) {
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
+ }
+ ~AppServiceManagerTest() {
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
+ }
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_message_helper_, BroadcastCapabilityUpdate(_, _))
+ .WillByDefault(Return());
+ ON_CALL(mock_settings_, embedded_services())
+ .WillByDefault(ReturnRef(embedded_services_));
+ ON_CALL(mock_app_manager_, get_settings())
+ .WillByDefault(ReturnRef(mock_settings_));
+ ON_CALL(*mock_app_ptr_, policy_app_id())
+ .WillByDefault(Return(kPolicyAppId));
+ ON_CALL(mock_last_state_, get_dictionary()).WillByDefault(ReturnRef(dict_));
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
+ ON_CALL(mock_app_manager_, application(kConnectionKey))
+ .WillByDefault(Return(app_ptr));
+ }
+
+ protected:
+ smart_objects::SmartObject GenerateMediaManifest(
+ bool allow_app_consumers, std::string app_service_name = kServiceName) {
+ smart_objects::SmartObject manifest(smart_objects::SmartType_Map);
+ manifest[am::strings::service_type] = "MEDIA";
+ manifest[am::strings::service_name] = app_service_name;
+ manifest[am::strings::allow_app_consumers] = allow_app_consumers;
+ manifest[am::strings::media_service_manifest] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return manifest;
+ }
+
+ smart_objects::SmartObject PublishService(
+ uint32_t connection_key = kConnectionKey, bool first_run = true) {
+ smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+
+ Json::Value empty_json;
+ EXPECT_CALL(mock_last_state_, get_dictionary())
+ .WillOnce(ReturnRef(empty_json));
+
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _)).WillOnce(Return());
+ if (first_run) {
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _)).WillOnce(Return());
+ }
+ bool mobile_service = connection_key != kHMIConnectionKey;
+ return app_service_manager_.PublishAppService(
+ manifest, mobile_service, connection_key);
+ }
+
+ void CheckCapabilityUpdate(smart_objects::SmartObject& msg_params,
+ size_t length,
+ std::string service_id,
+ mobile_apis::ServiceUpdateReason::eType reason,
+ bool published,
+ bool active) {
+ smart_objects::SmartObject& services_updated = msg_params
+ [am::strings::system_capability][am::strings::app_services_capabilities]
+ [am::strings::app_services];
+ ASSERT_EQ(smart_objects::SmartType_Array, services_updated.getType());
+ EXPECT_EQ(length, services_updated.length());
+ for (size_t i = 0; i < services_updated.length(); i++) {
+ smart_objects::SmartObject& service_cap = services_updated[i];
+ if (service_id ==
+ service_cap[am::strings::updated_app_service_record]
+ [am::strings::service_id].asString()) {
+ CheckCapability(service_cap, service_id, reason, published, active);
+ return;
+ }
+ }
+ FAIL() << "Unable to find service in capability update with service_id: "
+ << service_id;
+ }
+
+ void CheckCapability(smart_objects::SmartObject& app_service_capability,
+ std::string service_id,
+ mobile_apis::ServiceUpdateReason::eType reason,
+ bool published,
+ bool active) {
+ EXPECT_EQ(reason,
+ app_service_capability[am::strings::update_reason].asInt());
+ smart_objects::SmartObject& updated_record =
+ app_service_capability[am::strings::updated_app_service_record];
+ EXPECT_EQ(service_id, updated_record[am::strings::service_id].asString());
+ EXPECT_EQ(published,
+ updated_record[am::strings::service_published].asBool());
+ EXPECT_EQ(active, updated_record[am::strings::service_active].asBool());
+ }
+
+ Json::Value dict_;
+ std::vector<std::string> embedded_services_;
+ std::shared_ptr<MockApplication> mock_app_ptr_;
+ MockApplicationManager mock_app_manager_;
+ resumption_test::MockLastState mock_last_state_;
+ MockApplicationManagerSettings mock_settings_;
+ application_manager::AppServiceManager app_service_manager_;
+ application_manager::MockMessageHelper* mock_message_helper_;
+};
+
+TEST_F(AppServiceManagerTest, PublishAppService_Mobile_SUCCESS) {
+ smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+
+ Json::Value empty_json;
+ EXPECT_CALL(mock_last_state_, get_dictionary())
+ .WillOnce(ReturnRef(empty_json));
+
+ smart_objects::SmartObject syscap_update_published;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_published), Return()));
+
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+
+ auto record =
+ app_service_manager_.PublishAppService(manifest, true, kConnectionKey);
+
+ // Check final record
+ std::string service_id = record[am::strings::service_id].asString();
+ EXPECT_EQ(manifest, record[am::strings::service_manifest]);
+ EXPECT_TRUE(record[am::strings::service_published].asBool());
+ EXPECT_TRUE(record[am::strings::service_active].asBool());
+
+ // Check first capability update
+ CheckCapabilityUpdate(syscap_update_published,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::PUBLISHED,
+ true,
+ false);
+
+ // Check second capability update
+ CheckCapabilityUpdate(syscap_update_activated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, PublishAppService_HMI_SUCCESS) {
+ smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+
+ Json::Value empty_json;
+ EXPECT_CALL(mock_last_state_, get_dictionary())
+ .WillOnce(ReturnRef(empty_json));
+
+ smart_objects::SmartObject syscap_update_published;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_published), Return()));
+
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+
+ auto record = app_service_manager_.PublishAppService(manifest, false);
+
+ // Check final record
+ std::string service_id = record[am::strings::service_id].asString();
+ EXPECT_EQ(manifest, record[am::strings::service_manifest]);
+ EXPECT_TRUE(record[am::strings::service_published].asBool());
+ EXPECT_TRUE(record[am::strings::service_active].asBool());
+
+ // Check first capability update
+ CheckCapabilityUpdate(syscap_update_published,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::PUBLISHED,
+ true,
+ false);
+
+ // Check second capability update
+ CheckCapabilityUpdate(syscap_update_activated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, UnpublishAppService_SUCCESS) {
+ auto record = PublishService();
+
+ smart_objects::SmartObject syscap_update_unpublished;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::REMOVED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_unpublished), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.UnpublishAppService(service_id));
+
+ // Check removed capability update
+ CheckCapabilityUpdate(syscap_update_unpublished,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::REMOVED,
+ false,
+ false);
+}
+
+TEST_F(AppServiceManagerTest, ActivateAppService_AlreadyActivated) {
+ auto record = PublishService();
+
+ // No capability update
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _)).Times(0);
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.ActivateAppService(service_id));
+}
+
+TEST_F(AppServiceManagerTest, ActivateAppService_TwoApps_SUCCESS) {
+ // Register two services with the same service type, the first is activated
+ // automatically
+ auto record = PublishService();
+ auto record2 = PublishService(kConnectionKey + 1, false);
+
+ // No capability update
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _)).WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+ std::string service_id2 = record2[am::strings::service_id].asString();
+
+ // Activate the second service
+ EXPECT_TRUE(app_service_manager_.ActivateAppService(service_id2));
+
+ // Check that the first service is deactivated
+ CheckCapabilityUpdate(syscap_update_activated,
+ 2,
+ service_id,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ true,
+ false);
+
+ // Check that the second service is activated
+ CheckCapabilityUpdate(syscap_update_activated,
+ 2,
+ service_id2,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, DeactivateAppService_SUCCESS) {
+ auto record = PublishService();
+
+ smart_objects::SmartObject syscap_update_deactivated;
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::DEACTIVATED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_deactivated), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.DeactivateAppService(service_id));
+
+ // Check deactivated capability update
+ CheckCapabilityUpdate(syscap_update_deactivated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ true,
+ false);
+}
+
+TEST_F(AppServiceManagerTest, ActiveServiceForType_SUCCESS) {
+ auto record = PublishService();
+
+ auto service = app_service_manager_.ActiveServiceForType(kServiceType);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_EQ(kConnectionKey, service->connection_key);
+ EXPECT_TRUE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, EmbeddedServiceForType_SUCCESS) {
+ auto record = PublishService(kHMIConnectionKey);
+
+ auto service = app_service_manager_.EmbeddedServiceForType(kServiceType);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_FALSE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, FindServiceByID_SUCCESS) {
+ auto record = PublishService();
+
+ std::string service_id = record[am::strings::service_id].asString();
+ auto service = app_service_manager_.FindServiceByID(service_id);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_EQ(kConnectionKey, service->connection_key);
+ EXPECT_TRUE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, GetAllServiceRecords_OneService_SUCCESS) {
+ auto record = PublishService();
+
+ auto records = app_service_manager_.GetAllServiceRecords();
+
+ ASSERT_EQ(1u, records.size());
+ EXPECT_EQ(record, records[0]);
+}
+
+TEST_F(AppServiceManagerTest, GetActiveServices_OneService_SUCCESS) {
+ auto record = PublishService();
+
+ auto services = app_service_manager_.GetActiveServices();
+
+ ASSERT_EQ(1u, services.size());
+ EXPECT_EQ(record, services[0].record);
+ EXPECT_EQ(kConnectionKey, services[0].connection_key);
+ EXPECT_TRUE(services[0].mobile_service);
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test \ No newline at end of file
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 301ed227b8..437f567538 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -118,6 +118,13 @@ class ApplicationImplTest : public ::testing::Test {
AddSet hmi_action);
void CheckCurrentHMIState();
+ // 'directory_name' has to be declared prior to 'app_impl' so that when
+ // deleting ApplicationImplTest class, 'directory_name' will be removed
+ // after 'app_impl' runs its destructor.
+ // (ApplicationImpl's destructor calls CleanupFiles(), which will call
+ // application_manager_.get_settings().app_storage_folder() and will
+ // access 'directory_name'.)
+ const std::string directory_name = "./test_storage";
MockApplicationManagerSettings mock_application_manager_settings_;
MockApplicationManager mock_application_manager_;
std::shared_ptr<ApplicationImpl> app_impl;
@@ -126,7 +133,6 @@ class ApplicationImplTest : public ::testing::Test {
std::string mac_address;
connection_handler::DeviceHandle device_handle;
custom_str::CustomString app_name;
- const std::string directory_name = "./test_storage";
HmiState::StateID state_id;
HmiStatePtr testHmiState;
HMILevel::eType test_lvl;
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..e4951880de 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -29,38 +29,43 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <bson_object.h>
#include <stdint.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
-#include <bson_object.h>
-#include "gtest/gtest.h"
#include "application_manager/application.h"
#include "application_manager/application_impl.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_resumption_data.h"
-#include "application_manager/mock_rpc_service.h"
+#include "application_manager/mock_app_service_manager.h"
#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/test/include/application_manager/mock_message_helper.h"
#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "hmi_message_handler/mock_hmi_message_handler.h"
#include "media_manager/mock_media_manager.h"
#include "policy/mock_policy_settings.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "protocol/bson_object_keys.h"
-#include "protocol_handler/mock_session_observer.h"
#include "protocol_handler/mock_protocol_handler.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "resumption/mock_last_state.h"
#include "utils/custom_string.h"
#include "utils/file_system.h"
#include "utils/lock.h"
-#include "utils/push_log.h"
#include "encryption/hashing.h"
+#ifdef ENABLE_LOG
+#include "utils/push_log.h"
+#endif
namespace test {
namespace components {
@@ -72,15 +77,16 @@ namespace con_test = connection_handler_test;
using testing::_;
using ::testing::An;
-using ::testing::Matcher;
using ::testing::ByRef;
using ::testing::DoAll;
+using ::testing::Matcher;
using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
using ::testing::SaveArg;
using ::testing::SetArgPointee;
+using ::testing::SetArgReferee;
using namespace application_manager;
@@ -96,6 +102,17 @@ 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 kEndpoint2 = "https://fakesdlcloudapptesting.com:8080";
+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;
+const std::string kHybridAppPreferenceStr = "CLOUD";
+const bool kEnabled = true;
} // namespace
class ApplicationManagerImplTest : public ::testing::Test {
@@ -106,6 +123,10 @@ class ApplicationManagerImplTest : public ::testing::Test {
std::make_shared<NiceMock<resumption_test::MockResumptionData> >(
mock_app_mngr_))
, mock_rpc_service_(new MockRPCService)
+ , mock_policy_handler_(
+ new test::components::policy_test::MockPolicyHandlerInterface)
+ , mock_app_service_manager_(
+ new MockAppServiceManager(mock_app_mngr_, mock_last_state_))
, mock_message_helper_(
application_manager::MockMessageHelper::message_helper_mock())
@@ -122,14 +143,21 @@ 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_);
+ ON_CALL(*mock_app_service_manager_, UnpublishServices(_))
+ .WillByDefault(Return());
+ ON_CALL(*mock_app_service_manager_, OnAppActivated(_))
+ .WillByDefault(Return());
+ app_manager_impl_->SetAppServiceManager(mock_app_service_manager_);
+ Json::Value empty;
+ ON_CALL(mock_last_state_, get_dictionary()).WillByDefault(ReturnRef(empty));
}
void CreateAppManager() {
@@ -196,16 +224,22 @@ class ApplicationManagerImplTest : public ::testing::Test {
connection_handler::DeviceHandle secondary_device_handle,
std::string secondary_transport_device_string);
+ void AddCloudAppToPendingDeviceMap();
+
uint32_t app_id_;
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_;
+ resumption_test::MockLastState mock_last_state_;
NiceMock<con_test::MockConnectionHandler> mock_connection_handler_;
NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_;
NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_;
+ test::components::policy_test::MockPolicyHandlerInterface*
+ mock_policy_handler_;
application_manager_test::MockApplicationManager mock_app_mngr_;
std::unique_ptr<am::ApplicationManagerImpl> app_manager_impl_;
+ MockAppServiceManager* mock_app_service_manager_;
application_manager::MockMessageHelper* mock_message_helper_;
std::shared_ptr<MockApplication> mock_app_ptr_;
@@ -1413,6 +1447,219 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_TRUE(file_system::RemoveDirectory(kDirectoryName, true));
}
-} // application_manager_test
+void ApplicationManagerImplTest::AddCloudAppToPendingDeviceMap() {
+ app_manager_impl_->SetMockPolicyHandler(mock_policy_handler_);
+ std::vector<std::string> enabled_apps{"1234"};
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledCloudApps(_))
+ .WillOnce(SetArgReferee<0>(enabled_apps));
+ EXPECT_CALL(*mock_policy_handler_, GetCloudAppParameters(_, _, _, _, _, _, _))
+ .WillOnce(DoAll(SetArgReferee<1>(kEnabled),
+ SetArgReferee<2>(kEndpoint2),
+ SetArgReferee<3>(kCertificate),
+ SetArgReferee<4>(kAuthToken),
+ SetArgReferee<5>(kTransportType),
+ SetArgReferee<6>(kHybridAppPreferenceStr),
+ Return(true)));
+
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl(_)).WillOnce(Return(""));
+
+ app_manager_impl_->RefreshCloudAppInformation();
+}
+
+TEST_F(ApplicationManagerImplTest, CreatePendingApplication) {
+ // Add to pending device map. Calls refresh cloud app
+ AddCloudAppToPendingDeviceMap();
+
+ // CreatePendingApplication
+ transport_manager::DeviceInfo device_info(
+ 1, "mac", kEndpoint2, "CLOUD_WEBSOCKET");
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+ std::vector<std::string> enabled_apps{"1234"};
+
+ EXPECT_CALL(*mock_policy_handler_, GetStatisticManager())
+ .WillOnce(Return(std::shared_ptr<usage_statistics::StatisticsManager>(
+ new usage_statistics_test::MockStatisticsManager())));
+ EXPECT_CALL(*mock_policy_handler_, GetCloudAppParameters(_, _, _, _, _, _, _))
+ .WillOnce(DoAll(SetArgReferee<1>(kEnabled),
+ SetArgReferee<2>(kEndpoint2),
+ SetArgReferee<3>(kCertificate),
+ SetArgReferee<4>(kAuthToken),
+ SetArgReferee<5>(kTransportType),
+ SetArgReferee<6>(kHybridAppPreferenceStr),
+ Return(true)));
+ // Expect Update app list
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ app_manager_impl_->CreatePendingApplication(1, device_info, 1);
+ AppsWaitRegistrationSet app_list =
+ app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+TEST_F(ApplicationManagerImplTest, SetPendingState) {
+ AddCloudAppToPendingDeviceMap();
+ AddMockApplication();
+ AppsWaitRegistrationSet app_list =
+ app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(0u, app_list.size());
+ EXPECT_CALL(*mock_app_ptr_, policy_app_id()).WillRepeatedly(Return("1234"));
+ EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(123));
+ std::string mac = "MAC_ADDRESS";
+ EXPECT_CALL(*mock_app_ptr_, mac_address()).WillRepeatedly(ReturnRef(mac));
+ transport_manager::DeviceInfo device_info(
+ 1, "mac", kEndpoint2, "CLOUD_WEBSOCKET");
+
+ std::vector<std::string> enabled_apps{"1234"};
+
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledCloudApps(_))
+ .WillOnce(SetArgReferee<0>(enabled_apps));
+ EXPECT_CALL(*mock_policy_handler_, GetCloudAppParameters(_, _, _, _, _, _, _))
+ .WillOnce(DoAll(SetArgReferee<1>(kEnabled),
+ SetArgReferee<2>(kEndpoint2),
+ SetArgReferee<3>(kCertificate),
+ SetArgReferee<4>(kAuthToken),
+ SetArgReferee<5>(kTransportType),
+ SetArgReferee<6>(kHybridAppPreferenceStr),
+ Return(true)));
+
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl(_)).WillOnce(Return(""));
+
+ plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager =
+ new plugin_manager::MockRPCPluginManager;
+ std::unique_ptr<plugin_manager::RPCPluginManager> mock_rpc_plugin_manager_ptr(
+ mock_rpc_plugin_manager);
+ app_manager_impl_->SetPluginManager(mock_rpc_plugin_manager_ptr);
+
+ EXPECT_CALL(mock_connection_handler_, GetDeviceID(_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
+ app_manager_impl_->SetPendingApplicationState(1, device_info);
+ app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+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, 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->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());
+}
+
+} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/command_holder_test.cc b/src/components/application_manager/test/command_holder_test.cc
index 56e24b8d29..9496e37924 100644
--- a/src/components/application_manager/test/command_holder_test.cc
+++ b/src/components/application_manager/test/command_holder_test.cc
@@ -84,7 +84,7 @@ TEST_F(CommandHolderImplTest, HoldOne_ExpectReleaseOne) {
mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _));
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -99,7 +99,8 @@ TEST_F(CommandHolderImplTest, HoldMany_ExpectReleaseSame) {
} while (iterations < 5);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(iterations);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _))
+ .Times(iterations);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -112,7 +113,7 @@ TEST_F(CommandHolderImplTest, Hold_Drop_ExpectNoReleased) {
// Act
cmd_holder.Clear(mock_app_ptr_);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _)).Times(0);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -127,7 +128,7 @@ TEST_F(CommandHolderImplTest, Hold_ReleaseAnotherId_ExpectNoReleased) {
std::shared_ptr<MockApplication> another_app =
std::make_shared<MockApplication>();
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _)).Times(0);
cmd_holder.Resume(another_app, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -146,7 +147,8 @@ TEST_F(CommandHolderImplTest, Hold_DropAnotherId_ExpectReleased) {
std::make_shared<MockApplication>();
cmd_holder.Clear(another_app);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(iterations);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _))
+ .Times(iterations);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -160,7 +162,7 @@ TEST_F(CommandHolderImplTest, Hold_Mobile_and_HMI_commands_ExpectReleased) {
mock_app_ptr_, am::CommandHolder::CommandType::kMobileCommand, cmd_ptr_);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _));
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
EXPECT_CALL(
diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt
index 33258e60db..556f3a5032 100644
--- a/src/components/application_manager/test/commands/CMakeLists.txt
+++ b/src/components/application_manager/test/commands/CMakeLists.txt
@@ -59,6 +59,7 @@ set(LIBRARIES
ApplicationManager
jsoncpp
Policy
+ Resumption
)
create_test("commands_test" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc
index 222f16ef46..53e8534c2b 100644
--- a/src/components/application_manager/test/commands/command_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_impl_test.cc
@@ -85,11 +85,12 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> {
using CommandImpl::ReplaceMobileWithHMIAppId;
using CommandImpl::ReplaceHMIWithMobileAppId;
- UnwrappedCommandImpl(const MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ UnwrappedCommandImpl(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
: CommandImpl(message,
application_manager,
rpc_service,
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index c70dd14852..6d80a11440 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -51,6 +51,9 @@
#include "application_manager/mock_hmi_interface.h"
#include "interfaces/MOBILE_API.h"
+#include "application_manager/mock_app_service_manager.h"
+#include "resumption/last_state_impl.h"
+
namespace test {
namespace components {
namespace commands_test {
@@ -64,6 +67,7 @@ using ::testing::_;
using ::testing::Return;
using ::testing::SaveArg;
using ::testing::DoAll;
+using ::testing::SetArgReferee;
using am::commands::MessageSharedPtr;
using am::CommandParametersPermissions;
@@ -74,6 +78,7 @@ using am::ApplicationManager;
using am::ApplicationSet;
using am::RPCParams;
using am::MockHmiInterfaces;
+using test::components::application_manager_test::MockAppServiceManager;
typedef am::commands::CommandRequestImpl::RequestState RequestState;
@@ -258,7 +263,7 @@ TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) {
MessageSharedPtr result;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
command->CreateHMINotification(kInvalidFunctionId, *msg_params);
@@ -280,7 +285,7 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Return `true` prevents call of `SendResponse` method;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_EQ(kCorrelationId,
command->SendHMIRequest(kInvalidFunctionId, NULL, false));
@@ -298,7 +303,7 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Return `true` prevents call of `SendResponse` method;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(event_dispatcher_, add_observer(_, _, _));
EXPECT_EQ(kCorrelationId,
@@ -585,6 +590,87 @@ TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) {
command.reset();
}
+TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) {
+ resumption::LastStateImpl last_state("app_storage_folder",
+ "app_info_storage");
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByType("MEDIA", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_type] = "MEDIA";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
+TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) {
+ resumption::LastStateImpl last_state("app_storage_folder",
+ "app_info_storage");
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
+TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) {
+ resumption::LastStateImpl last_state("app_storage_folder",
+ "app_info_storage");
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(true)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
} // namespace command_request_impl
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc
index f921eb1dde..dc6635b049 100644
--- a/src/components/application_manager/test/help_prompt_manager_test.cc
+++ b/src/components/application_manager/test/help_prompt_manager_test.cc
@@ -136,10 +136,12 @@ class HelpPromptManagerTest : public ::testing::Test {
typedef CommandsTest<CommandsTestMocks::kIsNice>::MockAppManager
MockAppManager;
MockAppManager app_mngr_;
+ // put this before ApplicationImplTest instance, so that app_mngr_settings_
+ // will still exist during app_impl_'s destructor.
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
std::shared_ptr<ApplicationImplTest> app_impl_;
MockHmiInterfaces mock_hmi_interfaces_;
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
- NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
std::shared_ptr<application_manager_test::MockApplication> mock_app_;
sync_primitives::Lock app_lock_;
MockRPCService mock_rpc_service_;
@@ -175,11 +177,6 @@ void HelpPromptManagerTest::SetUp() {
mock_help_prompt_manager_ =
std::shared_ptr<MockHelpPromptManager>(new MockHelpPromptManager());
- HmiStatePtr state = std::make_shared<HmiState>(
- static_cast<std::shared_ptr<Application> >(mock_app_),
- app_mngr_,
- HmiState::STATE_ID_REGULAR);
-
std::string path = file_system::CreateDirectory("storage");
file_system::CreateFile(path + "/" + "certificate");
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index ae95fca35f..d67dfebaa5 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -583,7 +583,7 @@ void HMICapabilitiesTest::SetCooperating() {
smart_objects::SmartObjectSPtr test_so;
EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
CreateModuleInfoSO(_, _)).WillRepeatedly(Return(test_so));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillRepeatedly(Return(true));
}
diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
index 1980ffa100..8dd29ce244 100644
--- a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
+++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
@@ -105,7 +105,7 @@ class CommandRequestTest : public CommandsTest<kIsNice> {
MessageSharedPtr CatchHMICommandResult(CallableT delegate,
bool call_return = true) {
MessageSharedPtr result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(this->mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return)));
delegate();
return result_msg;
diff --git a/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
new file mode 100644
index 0000000000..f77b5685da
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
@@ -0,0 +1,95 @@
+/*
+ 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_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
+
+#include <gmock/gmock.h>
+#include "application_manager/app_service_manager.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/commands/command_impl.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockAppServiceManager : public application_manager::AppServiceManager {
+ public:
+ MockAppServiceManager(application_manager::ApplicationManager& app_manager,
+ resumption::LastState& last_state)
+ : application_manager::AppServiceManager(app_manager, last_state) {}
+ MOCK_METHOD3(
+ PublishAppService,
+ smart_objects::SmartObject(const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key));
+ MOCK_METHOD1(UnpublishAppService, bool(const std::string service_id));
+ MOCK_METHOD1(UnpublishServices, void(const uint32_t connection_key));
+ MOCK_METHOD1(OnAppActivated,
+ void(application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(SetDefaultService, bool(const std::string service_id));
+ MOCK_METHOD1(RemoveDefaultService, bool(const std::string service_id));
+ MOCK_METHOD1(ActivateAppService, bool(const std::string service_id));
+ MOCK_METHOD1(DeactivateAppService, bool(const std::string service_id));
+ MOCK_METHOD0(GetAllServiceRecords, std::vector<smart_objects::SmartObject>());
+ MOCK_METHOD0(GetActiveServices,
+ std::vector<application_manager::AppService>());
+ MOCK_METHOD4(GetProviderByType,
+ void(const std::string& service_type,
+ const bool mobile_consumer,
+ application_manager::ApplicationSharedPtr& app,
+ bool& hmi_service));
+ MOCK_METHOD4(GetProviderByID,
+ void(const std::string& service_id,
+ const bool mobile_consumer,
+ application_manager::ApplicationSharedPtr& app,
+ bool& hmi_service));
+ MOCK_METHOD1(
+ ActiveServiceForType,
+ application_manager::AppService*(const std::string service_type));
+ MOCK_METHOD1(
+ EmbeddedServiceForType,
+ application_manager::AppService*(const std::string service_type));
+ MOCK_METHOD1(FindServiceByID,
+ application_manager::AppService*(const std::string service_id));
+ MOCK_METHOD2(SetServicePublished,
+ void(const std::string service_id,
+ const bool service_published));
+ MOCK_METHOD1(UpdateNavigationCapabilities,
+ bool(smart_objects::SmartObject& out_params));
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
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..36d20f227d 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(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_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/include/application_manager/mock_event_dispatcher.h b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
index 916f4a69f0..c5aedba029 100644
--- a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
+++ b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
@@ -59,6 +59,26 @@ class MockEventDispatcher
MOCK_METHOD1(
remove_observer,
void(::application_manager::event_engine::EventObserver& observer));
+
+ MOCK_METHOD1(
+ raise_mobile_event,
+ void(const ::application_manager::event_engine::MobileEvent& event));
+ MOCK_METHOD3(
+ add_mobile_observer,
+ void(
+ const ::application_manager::event_engine::MobileEvent::MobileEventID&
+ event_id,
+ int32_t mobile_correlation_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD2(
+ remove_mobile_observer,
+ void(
+ const ::application_manager::event_engine::MobileEvent::MobileEventID&
+ event_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD1(
+ remove_mobile_observer,
+ void(::application_manager::event_engine::EventObserver& observer));
};
} // namespace event_engine_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 84a3b6bc87..ac39c39f22 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -164,6 +164,8 @@ class MockMessageHelper {
ApplicationManager& app_mngr));
MOCK_METHOD1(CommonLanguageFromString,
hmi_apis::Common_Language::eType(const std::string& language));
+ MOCK_METHOD1(CommonLightNameFromString,
+ hmi_apis::Common_LightName::eType(const std::string& lightName));
MOCK_METHOD1(CommonLanguageToString,
std::string(hmi_apis::Common_Language::eType));
MOCK_METHOD2(CreateModuleInfoSO,
@@ -308,6 +310,12 @@ class MockMessageHelper {
void(mobile_apis::ButtonName::eType button,
ApplicationSharedPtr application,
ApplicationManager& app_mngr));
+ MOCK_METHOD1(CreateAppServiceCapabilities,
+ smart_objects::SmartObject(
+ std::vector<smart_objects::SmartObject>& all_services));
+ MOCK_METHOD2(BroadcastCapabilityUpdate,
+ void(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt
index d115ad8b40..99031849f6 100755
--- a/src/components/application_manager/test/message_helper/CMakeLists.txt
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt
@@ -40,6 +40,7 @@ set(LIBRARIES
ApplicationManager
MessageHelper
jsoncpp
+ Policy
connectionHandler
MediaManager
Resumption
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index 15a09c33cc..92be221ec9 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -42,13 +42,16 @@
#include "utils/custom_string.h"
#include "utils/lock.h"
#include "policy/mock_policy_settings.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/commands/command_impl.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_rpc_service.h"
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/state_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base_json_inl.h"
+
#ifdef EXTERNAL_PROPRIETARY_MODE
#include "policy/policy_external/include/policy/policy_types.h"
#endif
@@ -964,7 +967,7 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
const uint32_t correlation_id = 0u;
@@ -1004,7 +1007,7 @@ TEST_F(MessageHelperTest,
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
const uint32_t correlation_id = 0u;
@@ -1050,7 +1053,7 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
smart_objects::SmartObjectSPtr result;
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
int32_t app_id = 123;
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index f091e183dc..518761c315 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -277,6 +277,12 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
language);
}
+hmi_apis::Common_LightName::eType MessageHelper::CommonLightNameFromString(
+ const std::string& lightName) {
+ return MockMessageHelper::message_helper_mock()->CommonLightNameFromString(
+ lightName);
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
uint32_t function_id, ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->CreateModuleInfoSO(
@@ -572,4 +578,15 @@ void MessageHelper::SendUnsubscribeButtonNotification(
->SendUnsubscribeButtonNotification(button, application, app_mngr);
}
+smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services) {
+ return MockMessageHelper::message_helper_mock()->CreateAppServiceCapabilities(
+ all_services);
+}
+
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->BroadcastCapabilityUpdate(
+ msg_params, app_mngr);
+}
} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index a1471eff36..af21a705bf 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -81,15 +81,13 @@ using namespace application_manager;
using namespace policy;
using namespace utils::custom_string;
using testing::_;
+using ::testing::DoAll;
using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::SetArgReferee;
using ::testing::SetArgPointee;
-using ::testing::DoAll;
using ::testing::SetArgReferee;
-using ::testing::Mock;
typedef NiceMock<application_manager_test::MockRPCService> MockRPCService;
@@ -380,6 +378,70 @@ TEST_F(PolicyHandlerTest, ClearUserConsent) {
policy_handler_.ClearUserConsent();
}
+TEST_F(PolicyHandlerTest, AppServiceUpdate_CheckAppService) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ // Check
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ ChangePolicyManagerToMock();
+ std::string file_name("sdl_pt_update.json");
+ std::ifstream ifile(file_name);
+ Json::Reader reader;
+ std::string json;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ json = root.toStyledString();
+ }
+ ifile.close();
+ BinaryMessage msg(json.begin(), json.end());
+ // Checks
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg)).WillOnce(Return(true));
+ policy_handler_.ReceiveMessageFromSDK("", msg);
+
+ policy_table::AppServiceParameters app_service_params =
+ policy_table::AppServiceParameters();
+ std::string kServiceType = "MEDIA";
+ std::string as_app_id = "1010101010";
+ std::string service_name1 = "SDL Music";
+ std::string service_name2 = "SDL App";
+ (app_service_params)[kServiceType] = policy_table::AppServiceInfo();
+ (app_service_params)[kServiceType].service_names->push_back(service_name2);
+ (app_service_params)[kServiceType].service_names->push_back(service_name1);
+ (app_service_params)[kServiceType].service_names->mark_initialized();
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = 41;
+ (app_service_params)[kServiceType].handled_rpcs.push_back(handled_rpc);
+ EXPECT_CALL(*mock_policy_manager_, GetAppServiceParameters(_, _))
+ .WillRepeatedly(SetArgPointee<1>(app_service_params));
+
+ ns_smart_device_link::ns_smart_objects::SmartArray requested_handled_rpcs;
+ ns_smart_device_link::ns_smart_objects::SmartObject rpc_id(41);
+ requested_handled_rpcs.push_back(rpc_id);
+
+ ns_smart_device_link::ns_smart_objects::SmartArray fake_handled_rpcs;
+ ns_smart_device_link::ns_smart_objects::SmartObject fake_rpc_id(40);
+ fake_handled_rpcs.push_back(fake_rpc_id);
+
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name1, kServiceType, &requested_handled_rpcs));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, &requested_handled_rpcs));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, NULL));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, "", kServiceType, NULL));
+
+ EXPECT_FALSE(
+ policy_handler_.CheckAppServiceParameters(as_app_id, "", "", NULL));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, "NAVIGATION", &requested_handled_rpcs));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, "MUSIC", kServiceType, &requested_handled_rpcs));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, &fake_handled_rpcs));
+}
+
TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK) {
// Arrange
EnablePolicy();
@@ -2536,6 +2598,104 @@ TEST_F(PolicyHandlerTest, RemoteAppsUrl_SUCCESS) {
EXPECT_EQ(url, policy_handler_.RemoteAppsUrl());
}
+TEST_F(PolicyHandlerTest, OnSetCloudAppProperties_AllProperties_SUCCESS) {
+ EnablePolicyAndPolicyManagerMock();
+
+ bool enabled = true;
+ std::string app_name = "anAppName";
+ std::string auth_token = "anAuthToken";
+ std::string cloud_transport_type = "aTransportType";
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference =
+ mobile_apis::HybridAppPreference::CLOUD;
+ std::string hybrid_app_preference_str = "CLOUD";
+ std::string endpoint = "anEndpoint";
+
+ StringArray nicknames_vec;
+ nicknames_vec.push_back(app_name);
+
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ smart_objects::SmartObject nicknames(smart_objects::SmartType_Array);
+
+ properties[strings::app_id] = kPolicyAppId_;
+ nicknames[0] = app_name;
+ properties[strings::nicknames] = nicknames;
+ properties[strings::enabled] = enabled;
+ properties[strings::auth_token] = auth_token;
+ properties[strings::cloud_transport_type] = cloud_transport_type;
+ properties[strings::hybrid_app_preference] = hybrid_app_preference;
+ properties[strings::endpoint] = endpoint;
+ message[strings::msg_params][strings::properties] = properties;
+
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+
+ EXPECT_CALL(*mock_policy_manager_, InitCloudApp(kPolicyAppId_));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetCloudAppEnabled(kPolicyAppId_, enabled));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppNicknames(kPolicyAppId_, nicknames_vec));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppAuthToken(kPolicyAppId_, auth_token));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppCloudTransportType(kPolicyAppId_, cloud_transport_type));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetHybridAppPreference(kPolicyAppId_, hybrid_app_preference_str));
+ EXPECT_CALL(*mock_policy_manager_, SetAppEndpoint(kPolicyAppId_, endpoint));
+ EXPECT_CALL(*mock_policy_manager_,
+ GetCloudAppParameters(kPolicyAppId_, _, _, _, _, _, _))
+ .WillOnce(DoAll(SetArgReferee<4>(auth_token), Return(true)));
+ EXPECT_CALL(app_manager_, RefreshCloudAppInformation());
+ EXPECT_CALL(policy_handler_observer,
+ OnAuthTokenUpdated(kPolicyAppId_, auth_token));
+
+ policy_handler_.OnSetCloudAppProperties(message);
+}
+
+TEST_F(PolicyHandlerTest, GetCloudAppParameters_AllProperties_SUCCESS) {
+ EnablePolicyAndPolicyManagerMock();
+
+ bool enabled = true;
+ std::string certificate = "aCertificate";
+ std::string auth_token = "anAuthToken";
+ std::string cloud_transport_type = "aTransportType";
+ std::string hybrid_app_preference_str = "CLOUD";
+ std::string endpoint = "anEndpoint";
+
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+
+ EXPECT_CALL(*mock_policy_manager_,
+ GetCloudAppParameters(kPolicyAppId_, _, _, _, _, _, _))
+ .WillOnce(DoAll(SetArgReferee<1>(enabled),
+ SetArgReferee<2>(endpoint),
+ SetArgReferee<3>(certificate),
+ SetArgReferee<4>(auth_token),
+ SetArgReferee<5>(cloud_transport_type),
+ SetArgReferee<6>(hybrid_app_preference_str),
+ Return(true)));
+
+ bool enabled_out;
+ std::string endpoint_out;
+ std::string cert_out;
+ std::string auth_token_out;
+ std::string ctt_out;
+ std::string hap_out;
+ EXPECT_TRUE(policy_handler_.GetCloudAppParameters(kPolicyAppId_,
+ enabled_out,
+ endpoint_out,
+ cert_out,
+ auth_token_out,
+ ctt_out,
+ hap_out));
+ EXPECT_EQ(enabled, enabled_out);
+ EXPECT_EQ(endpoint, endpoint_out);
+ EXPECT_EQ(certificate, cert_out);
+ EXPECT_EQ(auth_token, auth_token_out);
+ EXPECT_EQ(cloud_transport_type, ctt_out);
+ EXPECT_EQ(hybrid_app_preference_str, hap_out);
+}
+
} // namespace policy_handler_test
} // namespace components
} // namespace 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..aea3f7700b 100644
--- a/src/components/application_manager/test/sdl_pt_update.json
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "watchdog_timer_ms" : 20000
+ "watchdog_timer_ms" : 20000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1600,6 +1606,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1618,6 +1625,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1644,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1653,6 +1662,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index 1d4cead52b..9574f8d00f 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -170,34 +170,42 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSharedPtr simple_app_;
NiceMock<application_manager_test::MockApplication>* simple_app_ptr_;
uint32_t simple_app_id_ = 1721;
+ uint32_t simple_hmi_app_id_ = 22770; // random number
am::ApplicationSharedPtr navi_app_;
NiceMock<application_manager_test::MockApplication>* navi_app_ptr_;
uint32_t navi_app_id_ = 1762;
+ uint32_t navi_hmi_app_id_ = 17559;
am::ApplicationSharedPtr media_app_;
NiceMock<application_manager_test::MockApplication>* media_app_ptr_;
uint32_t media_app_id_ = 1801;
+ uint32_t media_hmi_app_id_ = 12751;
am::ApplicationSharedPtr vc_app_;
NiceMock<application_manager_test::MockApplication>* vc_app_ptr_;
uint32_t vc_app_id_ = 1825;
+ uint32_t vc_hmi_app_id_ = 14986;
am::ApplicationSharedPtr media_navi_app_;
NiceMock<application_manager_test::MockApplication>* media_navi_app_ptr_;
uint32_t media_navi_app_id_ = 1855;
+ uint32_t media_navi_hmi_app_id_ = 16194;
am::ApplicationSharedPtr media_vc_app_;
NiceMock<application_manager_test::MockApplication>* media_vc_app_ptr_;
uint32_t media_vc_app_id_ = 1881;
+ uint32_t media_vc_hmi_app_id_ = 12798;
am::ApplicationSharedPtr navi_vc_app_;
NiceMock<application_manager_test::MockApplication>* navi_vc_app_ptr_;
uint32_t navi_vc_app_id_ = 1894;
+ uint32_t navi_vc_hmi_app_id_ = 10807;
am::ApplicationSharedPtr media_navi_vc_app_;
NiceMock<application_manager_test::MockApplication>* media_navi_vc_app_ptr_;
uint32_t media_navi_vc_app_id_ = 1922;
+ uint32_t media_navi_vc_hmi_app_id_ = 21419;
std::vector<am::HmiStatePtr> valid_states_for_audio_app_;
std::vector<am::HmiStatePtr> valid_states_for_not_audio_app_;
@@ -661,6 +669,7 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSharedPtr ConfigureApp(
NiceMock<application_manager_test::MockApplication>** app_mock,
uint32_t app_id,
+ uint32_t hmi_app_id,
bool media,
bool navi,
bool vc) {
@@ -670,6 +679,7 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSharedPtr app(*app_mock);
ON_CALL(**app_mock, app_id()).WillByDefault(Return(app_id));
+ ON_CALL(**app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id));
ON_CALL(**app_mock, is_media_application()).WillByDefault(Return(media));
ON_CALL(**app_mock, is_navi()).WillByDefault(Return(navi));
ON_CALL(**app_mock, is_voice_communication_supported())
@@ -871,21 +881,50 @@ class StateControllerImplTest : public ::testing::Test {
}
void ConfigureApps() {
- simple_app_ = ConfigureApp(
- &simple_app_ptr_, simple_app_id_, NOT_MEDIA, NOT_NAVI, NOT_VC);
- media_app_ =
- ConfigureApp(&media_app_ptr_, media_app_id_, MEDIA, NOT_NAVI, NOT_VC);
- navi_app_ =
- ConfigureApp(&navi_app_ptr_, navi_app_id_, NOT_MEDIA, NAVI, NOT_VC);
- vc_app_ = ConfigureApp(&vc_app_ptr_, vc_app_id_, NOT_MEDIA, NOT_NAVI, VC);
- media_navi_app_ = ConfigureApp(
- &media_navi_app_ptr_, media_navi_app_id_, MEDIA, NAVI, NOT_VC);
- media_vc_app_ =
- ConfigureApp(&media_vc_app_ptr_, media_vc_app_id_, MEDIA, NOT_NAVI, VC);
- navi_vc_app_ =
- ConfigureApp(&navi_vc_app_ptr_, navi_vc_app_id_, NOT_MEDIA, NAVI, VC);
- media_navi_vc_app_ = ConfigureApp(
- &media_navi_vc_app_ptr_, media_navi_vc_app_id_, MEDIA, NAVI, VC);
+ simple_app_ = ConfigureApp(&simple_app_ptr_,
+ simple_app_id_,
+ simple_hmi_app_id_,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC);
+ media_app_ = ConfigureApp(&media_app_ptr_,
+ media_app_id_,
+ media_hmi_app_id_,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC);
+ navi_app_ = ConfigureApp(&navi_app_ptr_,
+ navi_app_id_,
+ navi_hmi_app_id_,
+ NOT_MEDIA,
+ NAVI,
+ NOT_VC);
+ vc_app_ = ConfigureApp(
+ &vc_app_ptr_, vc_app_id_, vc_hmi_app_id_, NOT_MEDIA, NOT_NAVI, VC);
+ media_navi_app_ = ConfigureApp(&media_navi_app_ptr_,
+ media_navi_app_id_,
+ media_navi_hmi_app_id_,
+ MEDIA,
+ NAVI,
+ NOT_VC);
+ media_vc_app_ = ConfigureApp(&media_vc_app_ptr_,
+ media_vc_app_id_,
+ media_vc_hmi_app_id_,
+ MEDIA,
+ NOT_NAVI,
+ VC);
+ navi_vc_app_ = ConfigureApp(&navi_vc_app_ptr_,
+ navi_vc_app_id_,
+ navi_vc_hmi_app_id_,
+ NOT_MEDIA,
+ NAVI,
+ VC);
+ media_navi_vc_app_ = ConfigureApp(&media_navi_vc_app_ptr_,
+ media_navi_vc_app_id_,
+ media_navi_vc_hmi_app_id_,
+ MEDIA,
+ NAVI,
+ VC);
applications_list_.push_back(simple_app_);
applications_list_.push_back(media_app_);
applications_list_.push_back(navi_app_);
@@ -914,6 +953,15 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_EQ(navi_vc_app_->app_id(), navi_vc_app_id_);
ASSERT_EQ(media_navi_vc_app_->app_id(), media_navi_vc_app_id_);
+ ASSERT_EQ(simple_app_->hmi_app_id(), simple_hmi_app_id_);
+ ASSERT_EQ(media_app_->hmi_app_id(), media_hmi_app_id_);
+ ASSERT_EQ(navi_app_->hmi_app_id(), navi_hmi_app_id_);
+ ASSERT_EQ(vc_app_->hmi_app_id(), vc_hmi_app_id_);
+ ASSERT_EQ(media_navi_app_->hmi_app_id(), media_navi_hmi_app_id_);
+ ASSERT_EQ(media_vc_app_->hmi_app_id(), media_vc_hmi_app_id_);
+ ASSERT_EQ(navi_vc_app_->hmi_app_id(), navi_vc_hmi_app_id_);
+ ASSERT_EQ(media_navi_vc_app_->hmi_app_id(), media_navi_vc_hmi_app_id_);
+
ASSERT_FALSE(simple_app_->IsAudioApplication());
ASSERT_TRUE(media_app_->IsAudioApplication());
ASSERT_TRUE(navi_app_->IsAudioApplication());
@@ -992,7 +1040,7 @@ class StateControllerImplTest : public ::testing::Test {
.WillByDefault(Return(bc_activate_app_request));
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request))
+ ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request, _))
.WillByDefault(Return(true));
}
@@ -1040,6 +1088,8 @@ class StateControllerImplTest : public ::testing::Test {
application_set_.insert(app);
ON_CALL(app_manager_mock_, application(app->app_id()))
.WillByDefault(Return(app));
+ ON_CALL(app_manager_mock_, application_by_hmi_app(app->hmi_app_id()))
+ .WillByDefault(Return(app));
}
am::HmiStatePtr NoneNotAudibleState() {
@@ -1475,9 +1525,9 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
- app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&app_in_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
@@ -1549,11 +1599,11 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_full_mock;
am::ApplicationSharedPtr app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&app_in_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1796, 30093, MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
@@ -1575,11 +1625,11 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NAVI, NOT_VC);
+ ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NAVI, VC);
+ ConfigureApp(&app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
@@ -1600,12 +1650,12 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NOT_NAVI, VC);
+ ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, VC);
NiceMock<application_manager_test::MockApplication>*
app_moved_to_limited_mock;
- am::ApplicationSharedPtr app_moved_to_limited =
- ConfigureApp(&app_moved_to_limited_mock, 1796, NOT_MEDIA, NOT_NAVI, VC);
+ am::ApplicationSharedPtr app_moved_to_limited = ConfigureApp(
+ &app_moved_to_limited_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
@@ -1749,8 +1799,8 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
am::ApplicationSharedPtr limited_app = media_app_;
NiceMock<application_manager_test::MockApplication>* limited_app_mock =
@@ -1758,7 +1808,7 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -1786,16 +1836,16 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -1823,16 +1873,16 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
@@ -1941,7 +1991,7 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
SetBCActivateAppRequestToHMI(hmi_level, corr_id);
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request))
+ ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request, _))
.WillByDefault(Return(true));
EXPECT_CALL(app_manager_mock_, application_id(corr_id))
@@ -2845,14 +2895,7 @@ TEST_F(StateControllerImplTest,
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- const HmiStatePtr state =
- createHmiState(mobile_apis::HMILevel::HMI_FULL,
- mobile_apis::AudioStreamingState::AUDIBLE,
- mobile_apis::VideoStreamingState::NOT_STREAMABLE,
- mobile_apis::SystemContext::SYSCTXT_MAIN);
-
EXPECT_CALL(*simple_app_ptr_, keep_context()).WillOnce(Return(true));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
@@ -2884,12 +2927,6 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- const HmiStatePtr state =
- createHmiState(mobile_apis::HMILevel::HMI_LIMITED,
- mobile_apis::AudioStreamingState::AUDIBLE,
- mobile_apis::VideoStreamingState::NOT_STREAMABLE,
- mobile_apis::SystemContext::SYSCTXT_MAIN);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt
index 4ed382039a..4b545c65ae 100644
--- a/src/components/config_profile/CMakeLists.txt
+++ b/src/components/config_profile/CMakeLists.txt
@@ -35,6 +35,7 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 57e925cd43..ba43ec9695 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;
@@ -516,6 +526,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::vector<std::string>& audio_service_transports() const OVERRIDE;
const std::vector<std::string>& video_service_transports() const OVERRIDE;
+ uint32_t rpc_pass_through_timeout() const OVERRIDE;
+ const std::vector<std::string>& embedded_services() const OVERRIDE;
+ const std::string hmi_origin_id() const OVERRIDE;
/**
* @brief Reads a string value from the profile
*
@@ -960,6 +973,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_;
@@ -1051,6 +1066,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
int low_voltage_signal_offset_;
int wake_up_signal_offset_;
int ignition_off_signal_offset_;
+ uint32_t rpc_pass_through_timeout_;
+
+ std::vector<std::string> embedded_services_;
+
+ std::string hmi_origin_id_;
DISALLOW_COPY_AND_ASSIGN(Profile);
};
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 57984324aa..e5a32f4560 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";
@@ -95,6 +96,7 @@ const char* kTransportRequiredForResumptionSection =
"TransportRequiredForResumption";
const char* kLowBandwidthTransportResumptionLevelSection =
"LowBandwidthTransportResumptionLevel";
+const char* kAppServicesSection = "AppServices";
const char* kSDLVersionKey = "SDLVersion";
const char* kHmiCapabilitiesKey = "HMICapabilities";
@@ -154,6 +156,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";
@@ -235,6 +239,7 @@ const char* kSecondaryTransportForUSBKey = "SecondaryTransportForUSB";
const char* kSecondaryTransportForWiFiKey = "SecondaryTransportForWiFi";
const char* kAudioServiceTransportsKey = "AudioServiceTransports";
const char* kVideoServiceTransportsKey = "VideoServiceTransports";
+const char* kRpcPassThroughTimeoutKey = "RpcPassThroughTimeout";
const char* kDefaultTransportRequiredForResumptionKey =
"DefaultTransportRequiredForResumption";
@@ -281,6 +286,8 @@ const char* kProjectionLowBandwidthResumptionLevelKey =
"ProjectionLowBandwidthResumptionLevel";
const char* kMediaLowBandwidthResumptionLevelKey =
"MediaLowBandwidthResumptionLevel";
+const char* kHMIOriginIDKey = "HMIOriginID";
+const char* kEmbeddedServicesKey = "EmbeddedServices";
#ifdef WEB_HMI
const char* kDefaultLinkToWebHMI = "HMI/index.html";
@@ -318,6 +325,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;
@@ -386,6 +395,8 @@ const std::string kAllowedSymbols =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-";
const bool kDefaultMultipleTransportsEnabled = false;
const char* kDefaultLowBandwidthResumptionLevel = "NONE";
+const uint32_t kDefaultRpcPassThroughTimeout = 10000;
+const char* kDefaultHMIOriginId = "HMI_ID";
} // namespace
namespace profile {
@@ -452,6 +463,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)
@@ -499,7 +512,8 @@ Profile::Profile()
, error_description_()
, low_voltage_signal_offset_(kDefaultLowVoltageSignalOffset)
, wake_up_signal_offset_(kDefaultWakeUpSignalOffset)
- , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset) {
+ , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset)
+ , rpc_pass_through_timeout_(kDefaultRpcPassThroughTimeout) {
// SDL version
ReadStringValue(
&sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
@@ -784,6 +798,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_;
}
@@ -1063,6 +1085,10 @@ const bool Profile::multiple_transports_enabled() const {
return multiple_transports_enabled_;
}
+uint32_t Profile::rpc_pass_through_timeout() const {
+ return rpc_pass_through_timeout_;
+}
+
const std::vector<std::string>& Profile::secondary_transports_for_bluetooth()
const {
return secondary_transports_for_bluetooth_;
@@ -1099,6 +1125,14 @@ bool Profile::IsFileNamePortable(const std::string& file_name) const {
return true;
}
+const std::vector<std::string>& Profile::embedded_services() const {
+ return embedded_services_;
+}
+
+const std::string Profile::hmi_origin_id() const {
+ return hmi_origin_id_;
+}
+
void Profile::UpdateValues() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1769,6 +1803,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);
@@ -2202,6 +2254,15 @@ void Profile::UpdateValues() {
kMultipleTransportsEnabledKey,
kMultipleTransportsSection);
+ ReadUIntValue(&rpc_pass_through_timeout_,
+ kDefaultRpcPassThroughTimeout,
+ kAppServicesSection,
+ kRpcPassThroughTimeoutKey);
+
+ LOG_UPDATED_VALUE(rpc_pass_through_timeout_,
+ kRpcPassThroughTimeoutKey,
+ kAppServicesSection);
+
{ // Secondary Transports and ServicesMap
struct KeyPair {
std::vector<std::string>* ini_vector;
@@ -2245,6 +2306,44 @@ void Profile::UpdateValues() {
entry++;
}
}
+
+ ReadStringValue(&hmi_origin_id_,
+ kDefaultHMIOriginId,
+ kAppServicesSection,
+ kHMIOriginIDKey);
+
+ LOG_UPDATED_VALUE(hmi_origin_id_, kHMIOriginIDKey, kAppServicesSection);
+
+ { // App Services map
+ struct KeyPair {
+ std::vector<std::string>* ini_vector;
+ const char* ini_section_name;
+ const char* ini_key_name;
+ } keys[] = {
+ {&embedded_services_, kAppServicesSection, kEmbeddedServicesKey},
+ {NULL, NULL, NULL}};
+ struct KeyPair* entry = keys;
+
+ while (entry->ini_vector != NULL) {
+ bool exist = false;
+ std::vector<std::string> profile_entry = ReadStringContainer(
+ entry->ini_section_name, entry->ini_key_name, &exist, true);
+ if (exist) {
+ *entry->ini_vector = profile_entry;
+
+ const std::string list_with_comma = std::accumulate(
+ profile_entry.begin(),
+ profile_entry.end(),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ LOG_UPDATED_VALUE(
+ list_with_comma, entry->ini_key_name, entry->ini_section_name);
+ }
+ entry++;
+ }
+ }
}
bool Profile::ReadValue(bool* value,
diff --git a/src/components/connection_handler/CMakeLists.txt b/src/components/connection_handler/CMakeLists.txt
index fd2aa876cd..8018ea3707 100644
--- a/src/components/connection_handler/CMakeLists.txt
+++ b/src/components/connection_handler/CMakeLists.txt
@@ -36,6 +36,7 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${ENCRYPTION_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
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..06eb4f232d 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
@@ -81,7 +81,7 @@ class ConnectionHandlerImpl
ConnectionHandlerImpl(const ConnectionHandlerSettings& settings,
transport_manager::TransportManager& tm);
/**
- * \brief Destructor
+ * @brief Destructor
*/
~ConnectionHandlerImpl();
@@ -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,13 @@ class ConnectionHandlerImpl
void ConnectToAllDevices() OVERRIDE;
+ void AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) OVERRIDE;
+
+ void RemoveCloudAppDevice(const DeviceHandle device_id) OVERRIDE;
+
void StartTransportManager() OVERRIDE;
void OnDeviceListUpdated(
@@ -162,6 +179,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.
*
@@ -352,6 +379,15 @@ class ConnectionHandlerImpl
const protocol_handler::ServiceType& service_type) const OVERRIDE;
/**
+ * @brief Get cloud app id by connection id
+ * @param connection_id unique connection id
+ * @return the policy app id of the cloud app if the connection is tied to a
+ * cloud app, an empty string otherwise.
+ */
+ std::string GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const OVERRIDE;
+
+ /**
* \brief Get device handle by mac address
* \param mac_address uniq address
* \param device_handle
@@ -629,6 +665,12 @@ class ConnectionHandlerImpl
std::map<uint32_t, protocol_handler::SessionContext>
start_service_context_map_;
+ // Map app id -> (cloud_app_endpoint, connection_uid)
+ mutable sync_primitives::Lock cloud_app_id_map_lock_;
+ std::map<std::string,
+ std::pair<std::string, transport_manager::ConnectionUID> >
+ cloud_app_id_map_;
+
/**
* @brief connection object as it's being closed
*/
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 478127c42a..c412c9c637 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,69 @@ 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.");
+
+ std::string endpoint = device_info.mac_address();
+ cloud_app_id_map_lock_.Acquire();
+ for (auto it = cloud_app_id_map_.begin(); it != cloud_app_id_map_.end();
+ ++it) {
+ if (endpoint == it->second.first) {
+ it->second.second = connection_id;
+ break;
+ }
+ }
+ cloud_app_id_map_lock_.Release();
+
+ 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);
+ } else {
+ connection_handler_observer_->SetPendingApplicationState(connection_id,
+ device_info);
+ }
+}
+
+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 +320,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(
@@ -823,6 +888,8 @@ ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle(
return std::string("IAP_USB_DEVICE_MODE");
} else if (connection_type == "CARPLAY_WIRELESS_IOS") {
return std::string("IAP_CARPLAY");
+ } else if (connection_type == "CLOUD_WEBSOCKET") {
+ return std::string("WEBSOCKET");
#ifdef BUILD_TESTS
} else if (connection_type == "BTMAC") {
return std::string("BTMAC");
@@ -1057,6 +1124,18 @@ const uint8_t ConnectionHandlerImpl::GetSessionIdFromSecondaryTransport(
return 0;
}
+std::string ConnectionHandlerImpl::GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const {
+ sync_primitives::AutoLock auto_lock(cloud_app_id_map_lock_);
+ for (auto it = cloud_app_id_map_.begin(); it != cloud_app_id_map_.end();
+ ++it) {
+ if (connection_id == it->second.second) {
+ return it->first;
+ }
+ }
+ return std::string();
+}
+
struct CompareMAC {
explicit CompareMAC(const std::string& mac) : mac_(mac) {}
bool operator()(const DeviceMap::value_type& device) {
@@ -1245,6 +1324,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 +1351,21 @@ void ConnectionHandlerImpl::ConnectToAllDevices() {
}
}
+void ConnectionHandlerImpl::AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) {
+ cloud_app_id_map_lock_.Acquire();
+ cloud_app_id_map_[policy_app_id] =
+ std::make_pair(cloud_properties.endpoint, 0);
+ cloud_app_id_map_lock_.Release();
+ transport_manager_.AddCloudDevice(cloud_properties);
+}
+
+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/formatters/CMakeLists.txt b/src/components/formatters/CMakeLists.txt
index ffd6f333e5..86483929e9 100644
--- a/src/components/formatters/CMakeLists.txt
+++ b/src/components/formatters/CMakeLists.txt
@@ -38,6 +38,7 @@ include_directories (
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/smart_objects/include
${COMPONENTS_DIR}/utils/include
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
index d2fdf87957..cd3e50212a 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
@@ -126,11 +126,14 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
*
* @param obj input SmartObject
* @param outStr resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise
*/
static bool toString(
const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
- std::string& outStr);
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -151,12 +154,15 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
* @param schema Smart schema which describes 'fake' smart object to be
*formatted
* @param outStr Resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return formatting error code
*/
static tMetaFormatterErrorCode MetaFormatToString(
const ns_smart_device_link::ns_smart_objects::SmartObject& object,
const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
- std::string& outStr);
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
};
// ----------------------------------------------------------------------------
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
index e248954552..f86e4e51cb 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
@@ -73,11 +73,14 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
*
* @param obj input SmartObject
* @param outStr resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise
*/
static bool toString(
const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
- std::string& outStr);
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -128,12 +131,15 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
* @param schema Smart schema which describes 'fake' smart object to be
*formatted
* @param outStr Resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return formatting error code
*/
static tMetaFormatterErrorCode MetaFormatToString(
const ns_smart_device_link::ns_smart_objects::SmartObject& object,
const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
- std::string& outStr);
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
};
template <typename FunctionId, typename MessageType>
diff --git a/src/components/formatters/include/formatters/CSmartFactory.h b/src/components/formatters/include/formatters/CSmartFactory.h
index a48eab2a6b..f3c3fbe207 100644
--- a/src/components/formatters/include/formatters/CSmartFactory.h
+++ b/src/components/formatters/include/formatters/CSmartFactory.h
@@ -148,14 +148,14 @@ class CSmartFactory {
*
* @param object SmartObject to attach schema for.
*
- * @param RemoveFakeParameters contains true if need
+ * @param remove_unknown_parameters contains true if need
* to remove fake parameters from smart object otherwise contains false.
*
* @return True if operation was successful or false otherwise.
*/
bool attachSchema(
ns_smart_device_link::ns_smart_objects::SmartObject& object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
@@ -276,7 +276,7 @@ CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CSmartFactory(
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
ns_smart_device_link::ns_smart_objects::SmartObject& object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {
if (false == object.keyExists(strings::S_PARAMS))
return false;
@@ -305,7 +305,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
object.setSchema(schemaIterator->second);
schemaIterator->second.applySchema(
- object, RemoveFakeParameters, MessageVersion);
+ object, remove_unknown_parameters, MessageVersion);
return true;
}
diff --git a/src/components/formatters/include/formatters/formatter_json_rpc.h b/src/components/formatters/include/formatters/formatter_json_rpc.h
index 842e176976..3503767988 100644
--- a/src/components/formatters/include/formatters/formatter_json_rpc.h
+++ b/src/components/formatters/include/formatters/formatter_json_rpc.h
@@ -105,11 +105,13 @@ class FormatterJsonRpc : public CFormatterJsonBase {
*
* @param obj Input SmartObject.
* @param out_str Resulting JSON string.
- *
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise.
*/
static bool ToString(const ns_smart_objects::SmartObject& obj,
- std::string& out_str);
+ std::string& out_str,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
index 121fd43131..a5c3d1a103 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
@@ -85,7 +85,8 @@ const std::string CFormatterJsonSDLRPCv1::getMessageType(
// ----------------------------------------------------------------------------
bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
bool result = false;
try {
Json::Value root(Json::objectValue);
@@ -93,7 +94,8 @@ bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
smart_objects_ns::SmartObject formattedObj(obj);
formattedObj.getSchema().unapplySchema(
- formattedObj); // converts enums(as int32_t) to strings
+ formattedObj,
+ remove_unknown_parameters); // converts enums(as int32_t) to strings
objToJsonValue(formattedObj.getElement(strings::S_MSG_PARAMS), params);
@@ -125,7 +127,8 @@ CFormatterJsonSDLRPCv1::tMetaFormatterErrorCode
CFormatterJsonSDLRPCv1::MetaFormatToString(
const smart_objects_ns::SmartObject& object,
const smart_objects_ns::CSmartSchema& schema,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
meta_formatter_error_code::tMetaFormatterErrorCode result_code =
meta_formatter_error_code::kErrorOk;
@@ -156,7 +159,8 @@ CFormatterJsonSDLRPCv1::MetaFormatToString(
result_code |= meta_formatter_error_code::kErrorSchemaIsNotFunction;
}
- CFormatterJsonSDLRPCv1::toString(tmp_object, outStr);
+ CFormatterJsonSDLRPCv1::toString(
+ tmp_object, outStr, remove_unknown_parameters);
return result_code;
}
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
index ffbb644cc6..a582b52462 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
@@ -41,14 +41,16 @@ namespace formatters {
// ----------------------------------------------------------------------------
bool CFormatterJsonSDLRPCv2::toString(const smart_objects_ns::SmartObject& obj,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
bool result = true;
try {
Json::Value root(Json::objectValue);
smart_objects_ns::SmartObject formattedObj(obj);
formattedObj.getSchema().unapplySchema(
- formattedObj); // converts enums(as int32_t) to strings
+ formattedObj,
+ remove_unknown_parameters); // converts enums(as int32_t) to strings
objToJsonValue(formattedObj.getElement(strings::S_MSG_PARAMS), root);
@@ -68,7 +70,8 @@ CFormatterJsonSDLRPCv2::tMetaFormatterErrorCode
CFormatterJsonSDLRPCv2::MetaFormatToString(
const smart_objects_ns::SmartObject& object,
const smart_objects_ns::CSmartSchema& schema,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
meta_formatter_error_code::tMetaFormatterErrorCode result_code =
meta_formatter_error_code::kErrorOk;
@@ -99,7 +102,8 @@ CFormatterJsonSDLRPCv2::MetaFormatToString(
result_code |= meta_formatter_error_code::kErrorSchemaIsNotFunction;
}
- CFormatterJsonSDLRPCv2::toString(tmp_object, outStr);
+ CFormatterJsonSDLRPCv2::toString(
+ tmp_object, outStr, remove_unknown_parameters);
return result_code;
}
diff --git a/src/components/formatters/src/formatter_json_rpc.cc b/src/components/formatters/src/formatter_json_rpc.cc
index d50d04d0e9..07d45d5855 100644
--- a/src/components/formatters/src/formatter_json_rpc.cc
+++ b/src/components/formatters/src/formatter_json_rpc.cc
@@ -57,7 +57,8 @@ const char* FormatterJsonRpc::kData = "data";
const char* FormatterJsonRpc::kMessage = "message";
bool FormatterJsonRpc::ToString(const ns_smart_objects::SmartObject& obj,
- std::string& out_str) {
+ std::string& out_str,
+ const bool remove_unknown_parameters) {
bool result = true;
try {
Json::Value root(Json::objectValue);
@@ -66,7 +67,8 @@ bool FormatterJsonRpc::ToString(const ns_smart_objects::SmartObject& obj,
ns_smart_objects::SmartObject formatted_object(obj);
Json::Value msg_params_json(Json::objectValue);
- formatted_object.getSchema().unapplySchema(formatted_object);
+ formatted_object.getSchema().unapplySchema(formatted_object,
+ remove_unknown_parameters);
bool is_message_params = formatted_object.keyExists(strings::S_MSG_PARAMS);
bool empty_message_params = true;
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index d400cca335..8e45d4ecd9 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -138,6 +138,8 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("BasicCommunication.OnEventChanged");
MessageBrokerController::subscribeTo("RC.OnInteriorVehicleData");
MessageBrokerController::subscribeTo("RC.OnRemoteControlSettings");
+ MessageBrokerController::subscribeTo(
+ "SystemCapability.OnSystemCapabilityUpdated");
LOG4CXX_INFO(logger_, "Subscribed to notifications.");
}
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index e6e5c89f45..e8f646c1e5 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"
+
namespace resumption {
class LastState;
}
@@ -89,6 +90,7 @@ class RPCHandler;
}
class Application;
+class AppServiceManager;
class StateControllerImpl;
struct CommandParametersPermissions;
using policy::RPCParams;
@@ -152,6 +154,8 @@ class ApplicationManager {
connection_handler::ConnectionHandler* handler) = 0;
virtual DataAccessor<ApplicationSet> applications() const = 0;
+ virtual DataAccessor<AppsWaitRegistrationSet> pending_applications()
+ const = 0;
virtual ApplicationSharedPtr application(uint32_t app_id) const = 0;
virtual ApplicationSharedPtr active_application() const = 0;
@@ -167,6 +171,12 @@ class ApplicationManager {
virtual ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const = 0;
+ virtual ApplicationSharedPtr application_by_name(
+ const std::string& app_name) const = 0;
+
+ virtual ApplicationSharedPtr pending_application_by_policy_id(
+ const std::string& policy_app_id) const = 0;
+
virtual AppSharedPtrs applications_by_button(uint32_t button) = 0;
virtual AppSharedPtrs applications_with_navi() = 0;
@@ -188,6 +198,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;
@@ -283,6 +295,9 @@ class ApplicationManager {
*/
virtual void SendDriverDistractionState(ApplicationSharedPtr application) = 0;
+ virtual void SendGetIconUrlNotifications(
+ const uint32_t connection_key, ApplicationSharedPtr application) = 0;
+
/**
* @brief Checks if Application is subscribed for way points
* @param Application pointer
@@ -394,6 +409,7 @@ class ApplicationManager {
virtual bool is_stopping() const = 0;
virtual bool is_audio_pass_thru_active() const = 0;
+ virtual uint32_t GetNextMobileCorrelationID() = 0;
virtual uint32_t GetNextHMICorrelationID() = 0;
virtual uint32_t GenerateNewHMIAppID() = 0;
@@ -427,6 +443,22 @@ class ApplicationManager {
virtual void OnHMIStartedCooperation() = 0;
+ virtual void DisconnectCloudApp(ApplicationSharedPtr app) = 0;
+
+ virtual void RefreshCloudAppInformation() = 0;
+
+ virtual std::string PolicyIDByIconUrl(const std::string url) = 0;
+
+ virtual void SetIconFileFromSystemRequest(const std::string policy_id) = 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
@@ -546,6 +578,9 @@ class ApplicationManager {
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) = 0;
+ virtual void IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) = 0;
+
virtual StateController& state_controller() = 0;
virtual void SetUnregisterAllApplicationsReason(
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 8fdca4125f..b206e56125 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -85,6 +85,9 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& audio_stream_file() const = 0;
virtual bool use_full_app_id() const = 0;
+ virtual uint32_t rpc_pass_through_timeout() 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;
@@ -107,6 +110,8 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const uint32_t& app_icons_amount_to_remove() const = 0;
virtual const uint32_t& list_files_response_size() const = 0;
virtual const std::string& plugins_folder() const = 0;
+ virtual const std::vector<std::string>& embedded_services() const = 0;
+ virtual const std::string hmi_origin_id() const = 0;
};
} // namespace application_manager
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..c7caae1d28 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -105,6 +105,7 @@ class PolicyHandlerInterface {
virtual void GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) = 0;
virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
virtual uint32_t NextRetryTimeout() = 0;
/**
@@ -437,6 +438,91 @@ 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 bool 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;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check app service parameters from an app against policies
+ * @param policy_app_id Unique application id
+ * @param requested_service_name Service name published by app service
+ * provider
+ * @param requested_service_type Service type published by app service
+ * provider
+ * @param requested_handled_rpcs Vector of requested function ids an app
+ * service wants to handle from consumers
+ */
+ virtual bool CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
diff --git a/src/components/include/application_manager/policies/policy_handler_observer.h b/src/components/include/application_manager/policies/policy_handler_observer.h
index 1c32102184..c13846dff2 100644
--- a/src/components/include/application_manager/policies/policy_handler_observer.h
+++ b/src/components/include/application_manager/policies/policy_handler_observer.h
@@ -48,6 +48,9 @@ class PolicyHandlerObserver {
return false;
}
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {}
+
virtual void OnPTUFinished(const bool ptu_result) {}
virtual ~PolicyHandlerObserver() {}
diff --git a/src/components/include/application_manager/rpc_handler.h b/src/components/include/application_manager/rpc_handler.h
index 9b6428f32d..2ada9e7901 100644
--- a/src/components/include/application_manager/rpc_handler.h
+++ b/src/components/include/application_manager/rpc_handler.h
@@ -52,6 +52,11 @@ class RPCHandler
#endif // TELEMETRY_MONITOR
{
public:
+ virtual bool ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) = 0;
+
virtual ~RPCHandler() {}
};
diff --git a/src/components/include/application_manager/rpc_service.h b/src/components/include/application_manager/rpc_service.h
index 79b4007f71..e0127eac80 100644
--- a/src/components/include/application_manager/rpc_service.h
+++ b/src/components/include/application_manager/rpc_service.h
@@ -58,7 +58,9 @@ class RPCService {
* @param message pointer to received message
* @return true if command is executed, otherwise return false
*/
- virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0;
+ virtual bool ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource
+ source = commands::Command::SOURCE_HMI) = 0;
/**
* @brief SendMessageToMobile Put message to the queue to be sent to mobile.
@@ -75,6 +77,17 @@ class RPCService {
virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0;
/**
+ * @brief Check if RPC with function_id can be handled by app services(related
+ * to app services or handled by app services plugin)
+ * @param function_id RPC function id
+ * @param source RPC command source
+ * @param rpc_passing Reference to bool. Set to true to enable rpc pasing
+ * @return true if App Services can handle RPC
+ */
+ virtual bool IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source) = 0;
+
+ /**
* @brief set_protocol_handler
* @param handler
* set protocol handler
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index a50760b547..ea9cc6c039 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,13 @@ class ConnectionHandler {
virtual void ConnectToAllDevices() = 0;
+ virtual void AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) = 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
@@ -112,6 +129,15 @@ class ConnectionHandler {
virtual uint32_t GetConnectionSessionsCount(uint32_t connection_key) = 0;
/**
+ * @brief Get cloud app id by connection id
+ * @param connection_id unique connection id
+ * @return the policy app id of the cloud app if the connection is tied to a
+ * cloud app, an empty string otherwise.
+ */
+ virtual std::string GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const = 0;
+
+ /**
* Gets device id by mac address
* @param mac_address
* @return true if successfully
diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h
index 154a2a8e34..b9d6a18926 100644
--- a/src/components/include/connection_handler/connection_handler_observer.h
+++ b/src/components/include/connection_handler/connection_handler_observer.h
@@ -161,6 +161,17 @@ 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;
+
+ virtual void SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info) = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
index c446c87d1b..8299d019f5 100644
--- a/src/components/include/policy/policy_external/policy/policy_listener.h
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -115,6 +115,16 @@ class PolicyListener {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
/**
+ * @brief OnAuthTokenUpdated the callback which signals if an app's auth token
+ * field has been updated during a PTU
+ *
+ * @param policy_app_id the policy app id tied to the updated field.
+ * @param auth_token the value of the updated field.
+ */
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
* @brief OnPTUFinishedd the callback which signals PTU has finished
*
* @param ptu_result the result from the PTU - true if successful,
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..a2eb2db0c9 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -109,12 +109,21 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resource where lock screen icon could be
*obtained.
*/
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the initial
+ *registration
+ *
+ * @return url which point to the resource where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
virtual void RequestPTUpdate() = 0;
@@ -523,6 +532,108 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Gets meta information
* @return meta information
*/
diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h
index 3f6f555bcc..56e674e81b 100644
--- a/src/components/include/policy/policy_regular/policy/policy_listener.h
+++ b/src/components/include/policy/policy_regular/policy/policy_listener.h
@@ -113,6 +113,16 @@ class PolicyListener {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
/**
+ * @brief OnAuthTokenUpdated the callback which signals if an app's auth token
+ * field has been updated during a PTU
+ *
+ * @param policy_app_id the policy app id tied to the updated field.
+ * @param auth_token the value of the updated field.
+ */
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
* Gets devices ids by policy application id
* @param policy_app_id
* @return list devices ids
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..18fb3e1c2b 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -87,12 +87,21 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resource where lock screen icon could be
*obtained.
*/
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the initial
+ *registration
+ *
+ * @return url which point to the resource where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Gets all URLs for sending PTS to from PT itself.
* @param service_type Service specifies user of URL
* @param out_end_points output vector of urls
@@ -503,6 +512,109 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 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/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h
index 56bd5cebd6..f81de4cc81 100644
--- a/src/components/include/protocol/bson_object_keys.h
+++ b/src/components/include/protocol/bson_object_keys.h
@@ -48,6 +48,7 @@ extern const char* video_service_transports;
extern const char* tcp_ip_address;
extern const char* tcp_port;
extern const char* reason;
+extern const char* auth_token;
} // namespace strings
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..679e6ccfb3 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -39,21 +39,24 @@
#include "gmock/gmock.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/app_launch/app_launch_ctrl.h"
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager_settings.h"
+#include "application_manager/command_factory.h"
#include "application_manager/commands/command.h"
+#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/hmi_capabilities.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message.h"
-#include "resumption/last_state.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/app_launch/app_launch_ctrl.h"
-#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/plugin_manager/rpc_plugin_manager.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_handler.h"
+#include "application_manager/rpc_service.h"
#include "application_manager/state_controller.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "resumption/last_state.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/plugin_manager/rpc_plugin_manager.h"
-#include "application_manager/command_factory.h"
namespace test {
namespace components {
@@ -74,6 +77,9 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(connection_handler::ConnectionHandler* handler));
MOCK_CONST_METHOD0(applications,
DataAccessor<application_manager::ApplicationSet>());
+ MOCK_CONST_METHOD0(
+ pending_applications,
+ DataAccessor<application_manager::AppsWaitRegistrationSet>());
MOCK_CONST_METHOD1(
application, application_manager::ApplicationSharedPtr(uint32_t app_id));
MOCK_CONST_METHOD0(active_application,
@@ -91,12 +97,20 @@ 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));
MOCK_CONST_METHOD1(application_by_policy_id,
application_manager::ApplicationSharedPtr(
const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ application_by_name,
+ application_manager::ApplicationSharedPtr(const std::string& app_name));
+ MOCK_CONST_METHOD1(pending_application_by_policy_id,
+ application_manager::ApplicationSharedPtr(
+ const std::string& policy_app_id));
MOCK_METHOD1(
applications_by_button,
std::vector<application_manager::ApplicationSharedPtr>(uint32_t button));
@@ -124,6 +138,9 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(const std::shared_ptr<application_manager::Application> app));
MOCK_METHOD1(SendDriverDistractionState,
void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD2(SendGetIconUrlNotifications,
+ void(const uint32_t connection_key,
+ application_manager::ApplicationSharedPtr application));
MOCK_METHOD2(RemoveHMIFakeParameters,
void(application_manager::commands::MessageSharedPtr& message,
const hmi_apis::FunctionID::eType& function_id));
@@ -160,12 +177,21 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(is_stopping, bool());
MOCK_CONST_METHOD0(is_audio_pass_thru_active, bool());
MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
+ MOCK_METHOD0(GetNextMobileCorrelationID, uint32_t());
MOCK_METHOD0(GenerateNewHMIAppID, uint32_t());
MOCK_METHOD1(EndNaviServices, void(uint32_t app_id));
MOCK_METHOD1(BeginAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_METHOD1(DisconnectCloudApp,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD0(RefreshCloudAppInformation, void());
+ MOCK_CONST_METHOD1(GetCloudAppConnectionStatus,
+ hmi_apis::Common_CloudConnectionStatus::eType(
+ application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(PolicyIDByIconUrl, std::string(const std::string url));
+ MOCK_METHOD1(SetIconFileFromSystemRequest, void(const std::string policy_id));
MOCK_CONST_METHOD0(IsHMICooperating, bool());
MOCK_METHOD2(IviInfoUpdated,
void(mobile_apis::VehicleDataType::eType vehicle_info,
@@ -211,6 +237,8 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value));
+ MOCK_METHOD2(IncreaseForwardedRequestTimeout,
+ void(uint32_t connection_key, uint32_t mobile_correlation_id));
MOCK_METHOD0(state_controller, application_manager::StateController&());
MOCK_METHOD1(SetUnregisterAllApplicationsReason,
void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
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..a4ec7c0317 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&());
@@ -125,6 +127,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_time_scale, const uint32_t&());
MOCK_CONST_METHOD0(app_time_scale_max_requests, const uint32_t&());
MOCK_CONST_METHOD0(pending_requests_amount, const uint32_t&());
+ MOCK_CONST_METHOD0(rpc_pass_through_timeout, uint32_t());
// app_launch::AppLaunchSettings
MOCK_CONST_METHOD0(app_launch_wait_time, const uint16_t());
@@ -134,6 +137,10 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(max_number_of_ios_device, const uint16_t());
MOCK_CONST_METHOD0(wait_time_between_apps, const uint16_t());
MOCK_CONST_METHOD0(enable_app_launch_ios, const bool());
+
+ // AppServices
+ MOCK_CONST_METHOD0(embedded_services, const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(hmi_origin_id, const std::string());
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/mock_rpc_service.h b/src/components/include/test/application_manager/mock_rpc_service.h
index 4eddbbe257..aacb48a5ab 100644
--- a/src/components/include/test/application_manager/mock_rpc_service.h
+++ b/src/components/include/test/application_manager/mock_rpc_service.h
@@ -10,9 +10,10 @@ namespace application_manager_test {
class MockRPCService : public application_manager::rpc_service::RPCService {
public:
- MOCK_METHOD1(
+ MOCK_METHOD2(
ManageHMICommand,
- bool(const application_manager::commands::MessageSharedPtr message));
+ bool(const application_manager::commands::MessageSharedPtr message,
+ application_manager::commands::Command::CommandSource source));
MOCK_METHOD2(
ManageMobileCommand,
bool(const application_manager::commands::MessageSharedPtr message,
@@ -26,6 +27,10 @@ class MockRPCService : public application_manager::rpc_service::RPCService {
void(protocol_handler::ProtocolHandler* handler));
MOCK_METHOD1(set_hmi_message_handler,
void(hmi_message_handler::HMIMessageHandler* handler));
+ MOCK_METHOD2(
+ IsAppServiceRPC,
+ bool(int32_t function_id,
+ application_manager::commands::Command::CommandSource source));
};
}
}
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..3521d84a84 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
@@ -102,6 +102,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const uint32_t service_type,
policy::EndpointUrls& end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
@@ -213,6 +214,31 @@ 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,
+ bool(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));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD4(CheckAppServiceParameters,
+ bool(const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
index e8ed0e90e2..bd8c83d897 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
@@ -49,6 +49,9 @@ class MockPolicyHandlerObserver : public ::policy::PolicyHandlerObserver {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, std::vector<std::string> >));
MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
};
} // namespace application_manager_test
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..8cc439c78a 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -60,12 +60,23 @@ 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_METHOD2(
+ AddCloudAppDevice,
+ void(const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&));
+ 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));
+ MOCK_CONST_METHOD1(
+ GetCloudAppID,
+ std::string(const transport_manager::ConnectionUID connection_id));
MOCK_METHOD2(GetDeviceID,
bool(const std::string& mac_address,
DeviceHandle* device_handle));
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..552be4bee0 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,14 @@ 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));
+ MOCK_METHOD2(SetPendingApplicationState,
+ void(const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info));
};
} // 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..6f754ad2c9 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,40 @@ 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,
+ bool(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(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD2(SetDeviceConsent,
@@ -97,6 +131,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(GetUpdateUrls,
void(const uint32_t service_type, EndpointUrls& out_end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
policy_table::NumberOfNotificationsType(const std::string& priority));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
index 1f570d8699..720a81862a 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -81,6 +81,9 @@ class MockPolicyListener : public ::policy::PolicyListener {
uint32_t timeout_exceed));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
void(const policy::AppPermissions&, const std::string&));
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..8fc8a9c358 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
@@ -180,10 +180,45 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(OnAppRegisteredOnMobile,
void(const std::string& application_id));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_CONST_METHOD1(
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,
+ bool(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(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
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..dacdaf202f 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,12 +63,45 @@ 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,
+ bool(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(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ 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>(
const std::vector<std::string>& msg_codes,
const std::string& language));
-
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
policy_table::NumberOfNotificationsType(const std::string& priority));
@@ -81,6 +114,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD2(GetUpdateUrls,
void(const uint32_t service_type, EndpointUrls& out_end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD2(Init,
bool(const std::string& file_name,
const PolicySettings* settings));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
index 3b0c1a925e..045d4f4e4f 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
@@ -75,6 +75,9 @@ class MockPolicyListener : public ::policy::PolicyListener {
MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
void(const policy::AppPermissions&, const std::string&));
MOCK_METHOD3(OnUpdateHMILevel,
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..b6fdc2c2c9 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,40 @@ 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,
+ bool(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(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
@@ -204,6 +238,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
MOCK_CONST_METHOD2(RetrySequenceUrl,
AppIdURL(const struct RetrySequenceURL&,
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..2ef79f930c 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_METHOD1(
+ AddCloudDevice,
+ void(const transport_manager::transport_adapter::CloudAppProperties&));
+ 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..eaa1fa9955 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -64,12 +64,22 @@ 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
UNKNOWN
};
+struct CloudAppProperties {
+ std::string endpoint;
+ std::string certificate;
+ bool enabled;
+ std::string auth_token;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+};
+
typedef std::map<DeviceType, std::string> DeviceTypes;
/**
@@ -88,6 +98,7 @@ typedef std::list<TransportAdapterListener*> TransportAdapterListenerList;
*/
typedef std::map<std::string, std::string> TransportConfig;
+typedef std::map<std::string, CloudAppProperties> CloudAppTransportConfig;
/**
* @brief TransportConfig keys
*/
@@ -196,6 +207,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 +348,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..eabb4f7028 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -75,6 +75,12 @@ class TransportManager {
**/
virtual int SearchDevices() = 0;
+ virtual void AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) = 0;
+
+ virtual void RemoveCloudDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -85,6 +91,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/CMakeLists.txt b/src/components/interfaces/CMakeLists.txt
index 3cf1082e90..ae5adc6d2a 100644
--- a/src/components/interfaces/CMakeLists.txt
+++ b/src/components/interfaces/CMakeLists.txt
@@ -35,6 +35,7 @@ include_directories (
${COMPONENTS_DIR}/utils/include
${COMPONENTS_DIR}/formatters/include
${COMPONENTS_DIR}/smart_objects/include
+ ${BOOST_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
)
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 97df559ef5..1861e49893 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -34,7 +34,7 @@
<interfaces name="SmartDeviceLink HMI API">
-<interface name="Common" version="2.0.0" date="2018-09-05">
+<interface name="Common" version="2.1.0" date="2019-03-18">
<enum name="Result">
<element name="SUCCESS" value="0"/>
@@ -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" />
@@ -474,6 +487,9 @@
<element name="UNSUPPORTED_HMI_RESOURCE">
<description>By getting this value, SDL unregisters the named application</description>
</element>
+ <element name="CLOSE_CLOUD_CONNECTION">
+ <description>By getting this value, SDL puts the named app to NONE HMILevel. Used by the HMI to close a cloud app connection.</description>
+ </element>
</enum>
<enum name="TextFieldName">
@@ -1094,6 +1110,7 @@
<element name="VEHICLEDATA_FUELRANGE" />
<element name="VEHICLEDATA_ENGINEOILLIFE" />
<element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" />
+ <element name="VEHICLEDATA_CLOUDAPPVEHICLEID" />
</enum>
<enum name="WiperStatus">
@@ -1254,6 +1271,7 @@
<element name="MEDIA" />
<element name="FOTA" />
<element name="OEM_SPECIFIC"/>
+ <element name="ICON_URL"/>
</enum>
<enum name="ECallConfirmationStatus">
@@ -2618,16 +2636,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 +3361,450 @@
<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"/>
+ <element name="NAVIGATION"/>
+ </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="queuePlaybackProgress" 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">
+ <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">
+ <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">
+ <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="weatherIcon" type="Common.Image" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherServiceData">
+ <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="NavigationServiceManifest">
+ <param name="acceptsWayPoints" type="Boolean" mandatory="false">
+ <description> Informs the subscriber if this service can actually accept way points. </description>
+ </param>
+ </struct>
+
+ <enum name="NavigationAction">
+ <element name="TURN">
+ <description> Using this action plus a supplied direction can give the type of turn. </description>
+ </element>
+ <element name="EXIT"/>
+ <element name="STAY"/>
+ <element name="MERGE"/>
+ <element name="FERRY"/>
+ <element name="CAR_SHUTTLE_TRAIN"/>
+ <element name="WAYPOINT"/>
+ </enum>
+
+ <enum name="NavigationJunction">
+ <element name="REGULAR">
+ <description> A junction that represents a standard intersection with a single road crossing another. </description>
+ </element>
+ <element name="BIFURCATION">
+ <description> A junction where the road splits off into two paths; a fork in the road. </description>
+ </element>
+ <element name="MULTI_CARRIAGEWAY">
+ <description> A junction that has multiple intersections and paths. </description>
+ </element>
+ <element name="ROUNDABOUT">
+ <description> A junction where traffic moves in a single direction around a central, non-traversable point to reach one of the connecting roads. </description>
+ </element>
+ <element name="TRAVERSABLE_ROUNDABOUT">
+ <description> Similar to a roundabout, however the center of the roundabout is fully traversable. Also known as a mini-roundabout. </description>
+ </element>
+ <element name="JUGHANDLE">
+ <description> A junction where lefts diverge to the right, then curve to the left, converting a left turn to a crossing maneuver. </description>
+ </element>
+ <element name="ALL_WAY_YIELD">
+ <description> Multiple way intersection that allows traffic to flow based on priority; most commonly right of way and first in, first out. </description>
+ </element>
+ <element name="TURN_AROUND">
+ <description> A junction designated for traffic turn arounds. </description>
+ </element>
+ </enum>
+
+ <enum name="Direction">
+ <element name="LEFT"/>
+ <element name="RIGHT"/>
+ </enum>
+
+ <struct name="NavigationInstruction">
+ <param name="locationDetails" type="Common.LocationDetails" mandatory="true"/>
+
+ <param name="action" type="Common.NavigationAction" mandatory="true"/>
+
+ <param name="eta" type="Common.DateTime" mandatory="false"/>
+
+ <param name="bearing" type="Integer" minvalue="0" maxvalue="359" mandatory="false">
+ <description> The angle at which this instruction takes place. For example, 0 would mean straight, less than 45 is bearing right, greater than 135 is sharp right, between 45 and 135 is a regular right, and 180 is a U-Turn, etc. </description>
+ </param>
+
+ <param name="junctionType" type="Common.NavigationJunction" mandatory="false"/>
+
+ <param name="drivingSide" type="Common.Direction" mandatory="false">
+ <description> Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this will determine which direction the turn should take place. </description>
+ </param>
+
+ <param name="details" type="String" mandatory="false">
+ <description> This is a string representation of this instruction, used to display instructions to the users. This is not intended to be read aloud to the users, see the param prompt in NavigationServiceData for that. </description>
+ </param>
+
+ <param name="image" type="Common.Image" mandatory="false">
+ <description> An image representation of this instruction. </description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceData">
+ <description> This data is related to what a navigation service would provide.</description>
+
+ <param name="timeStamp" type="Common.DateTime" mandatory="true">
+ <description> This is the timestamp of when the data was generated. This is to ensure any time or distance given in the data can accurately be adjusted if necessary. </description>
+ </param>
+
+ <param name="origin" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destination" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destinationETA" type="Common.DateTime" mandatory="false"/>
+
+ <param name="instructions" type="Common.NavigationInstruction" array="true" mandatory="false">
+ <description> This array should be ordered with all remaining instructions. The start of this array should always contain the next instruction.</description>
+ </param>
+
+ <param name="nextInstructionETA" type="Common.DateTime" mandatory="false"/>
+ <param name="nextInstructionDistance" type="Float" mandatory="false">
+ <description>The distance to this instruction from current location. This should only be updated ever .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and the next instruction. </description>
+ </param>
+ <param name="nextInstructionDistanceScale" type="Float" mandatory="false">
+ <description>Distance till next maneuver (starting from) from previous maneuver.</description>
+ </param>
+
+ <param name="prompt" type="String" mandatory="false">
+ <description>This is a prompt message that should be conveyed to the user through either display or voice (TTS). This param will change often as it should represent the following: approaching instruction, post instruction, alerts that affect the current navigation session, etc.</description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceManifest">
+ <description> This manifest contains all the information necessary for the service to be published, activated, and consumers able to interact with it </description>
+
+ <param name="serviceName" type="String" mandatory="false">
+ <description> Unique name of this service </description>
+ </param>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description> The type of service that is to be offered by this app </description>
+ </param>
+
+ <param name="serviceIcon" type="Common.Image" mandatory="false">
+ <description> 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="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"/>
+ <param name="navigationServiceManifest" type="Common.NavigationServiceManifest" 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 (e.g. if the service type is MEDIA, the mediaServiceData param should be included).</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+ <param name="serviceID" type="String" mandatory="true"/>
+
+ <param name="mediaServiceData" type="Common.MediaServiceData" mandatory="false"/>
+ <param name="weatherServiceData" type="Common.WeatherServiceData" mandatory="false"/>
+ <param name="navigationServiceData" type="Common.NavigationServiceData" mandatory="false"/>
+ </struct>
+
+ <enum name="ServiceUpdateReason">
+ <element name="PUBLISHED">
+ <description> The service has just been published with the module and once activated to the primary service of its type, it will be ready for possible consumption.</description>
+ </element>
+ <element name="REMOVED">
+ <description> The service has just been unpublished with the module and is no longer accessible</description>
+ </element>
+ <element name="ACTIVATED">
+ <description> The service is activated as the primary service of this type. All requests dealing with this service type will be handled by this service.</description>
+ </element>
+ <element name="DEACTIVATED">
+ <description> The service has been deactivated as the primary service of its type</description>
+ </element>
+ <element name="MANIFEST_UPDATE">
+ <description> The service has updated its manifest. This could imply updated capabilities. Note: Currently unimplemented </description>
+ </element>
+ </enum>
+
+ <struct name="AppServiceCapability">
+ <param name="updateReason" type="Common.ServiceUpdateReason" mandatory="false">
+ <description> Only included in OnSystemCapabilityUpdated. Update reason for service record.</description>
+ </param>
+ <param name="updatedAppServiceRecord" type="Common.AppServiceRecord" mandatory="true">
+ <description>Service record for a specific app service provider</description>
+ </param>
+ </struct>
+
+ <struct name="AppServicesCapabilities">
+ <description>Capabilities of app services including what service types are supported and the current state of services.</description>
+ <param name="appServices" type="Common.AppServiceCapability" array="true" mandatory="false">
+ <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
+ </param>
+ </struct>
+
+ <!-- End App Services -->
+
+ <enum name="SystemCapabilityType">
+ <description>Enumerations of all available system capability types</description>
+ <element name="NAVIGATION"/>
+ <element name="PHONE_CALL"/>
+ <element name="VIDEO_STREAMING"/>
+ <element name="REMOTE_CONTROL"/>
+ <element name="APP_SERVICES" />
+ </enum>
+
+ <struct name="SystemCapability">
+ <description>The systemCapabilityType identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
+ <param name="systemCapabilityType" type="Common.SystemCapabilityType" mandatory="true">
+ <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included.</description>
+ </param>
+ <param name="navigationCapability" type="Common.NavigationCapability" mandatory="false">
+ <description>Describes extended capabilities for onboard navigation system </description>
+ </param>
+ <param name="phoneCapability" type="Common.PhoneCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="videoStreamingCapability" type="Common.VideoStreamingCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="appServicesCapabilities" type="Common.AppServicesCapabilities" mandatory="false">
+ <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
+ </param>
+ </struct>
</interface>
@@ -3428,7 +3892,7 @@
</function>
</interface>
-<interface name="BasicCommunication" version="2.0.0" date="2018-09-05">
+<interface name="BasicCommunication" version="2.1.0" date="2019-03-18">
<function name="GetSystemTime" messagetype="request">
<description>Request from SDL to HMI to obtain current UTC time.</description>
</function>
@@ -3730,6 +4194,29 @@
</param>
</function>
+ <function name="GetFilePath" messagetype="request">
+ <description>This request is sent to retrieve a file path from the HMI.</description>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File name that should be retrieved.</description>
+ </param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ <param name="appServiceId" type="String" mandatory="false">
+ <description> ID of the service that should have uploaded the requested file.</description>
+ </param>
+ </function>
+
+ <function name="GetFilePath" messagetype="response">
+ <description> HMI handles the request internally and returns the file path with the response.</description>
+ <param name="filePath" type="String" mandatory="false">
+ <description>Path to file in hmi</description>
+ </param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ </function>
+
<!-- Policies -->
<function name="GetSystemInfo" messagetype="request">
<description>Request from SDL to HMI to obtain information about head unit system.</description>
@@ -3771,6 +4258,12 @@
<description>Must be 'true' - when the event is started on HMI. Must be 'false' when the event is ended on HMI</description>
</param>
</function>
+ <function name="OnSystemCapabilityUpdated" messagetype="notification">
+ <description>A notification to inform the HMI that a specific system capability has changed.</description>
+ <param name="systemCapability" type="Common.SystemCapability" mandatory="true">
+ <description>The system capability that has been updated</description>
+ </param>
+ </function>
</interface>
<interface name="VR" version="1.1.0" date="2017-04-27">
@@ -4794,7 +5287,7 @@
</interface>
-<interface name="VehicleInfo" version="2.0.0" date="2018-09-05">
+<interface name="VehicleInfo" version="2.1.0" date="2019-03-18">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response should provide information about presence of any of vehicle information modules (ECU, GPS, etc) and their readiness to cooperate with SDL.</description>
</function>
@@ -4950,6 +5443,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 +5464,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 +5536,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 +5557,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="UnsubscribeVehicleData" messagetype="request">
<description>
@@ -5132,6 +5635,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 +5656,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 +5728,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 +5749,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 +5825,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 +5845,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 +5921,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 +5941,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 +6015,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 +6035,8 @@
<param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
</interface>
@@ -5719,7 +6253,7 @@
<description>The module data to retrieve from the vehicle for that type</description>
</param>
<param name="subscribe" type="Boolean" mandatory="false">
- <description>If subscribe is true, the head unit will send onInteriorVehicleData notifications for the module type</description>
+ <description>If subscribe is true, the head unit will send OnInteriorVehicleData notifications for the module type</description>
</param>
</function>
@@ -5728,7 +6262,7 @@
</param>
<param name="isSubscribed" type="Boolean" mandatory="false" >
<description>Is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleDescription.
+ if "true" - the "moduleType" from request is successfully subscribed and the head unit will send OnInteriorVehicleData notifications for the moduleDescription.
if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.</description>
</param>
</function>
@@ -5780,4 +6314,124 @@
</function>
</interface>
+
+<interface name="AppService" version="1.0.0" date="2019-03-18">
+ <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>
+
+ <function name="GetAppServiceData" messagetype="request">
+ <description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+
+ <param name="subscribe" type="Boolean" mandatory="false">
+ <description> If true, the consumer is requesting to subscribe to all future updates from the service publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed if it was previously subscribed.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceData" messagetype="response">
+ <description> This response includes the data that was requested from the specific service</description>
+ <param name="serviceData" type="Common.AppServiceData" mandatory="false"/>
+ </function>
+
+ <function name="PerformAppServiceInteraction" messagetype="request">
+ <param name="serviceUri" type="String" mandatory="true">
+ <description>Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this URI is correct.</description>
+ </param>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The service ID that the app consumer wishes to send this URI.</description>
+ </param>
+
+ <param name="originApp" type="String" mandatory="false">
+ <description>This string is the appID of the app requesting the app service provider take the specific action. This will automatically be set by SDL Core in requests originating from the HMI</description>
+ </param>
+
+ <param name="requestServiceActive" type="Boolean" mandatory="false">
+ <description>This flag signals the requesting consumer would like this service to become the active primary service of the destination's type.</description>
+ </param>
+ </function>
+
+ <function name="PerformAppServiceInteraction" messagetype="response">
+ <param name="serviceSpecificResult" type="String" mandatory="false">
+ <description>The service can provide specific result strings to the consumer through this param.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceRecords" messagetype="request">
+ <param name="serviceType" type="String" mandatory="false">
+ <description>If included, only service records of supplied type will be returned in response. If not included, all service records for all types will be returned. See Common.AppServiceType.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceRecords" messagetype="response">
+ <param name="serviceRecords" type="Common.AppServiceRecord" array="true" mandatory="false">
+ <description>All app service records of requested type.</description>
+ </param>
+ </function>
+
+ <function name="AppServiceActivation" messagetype="request">
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service that should have an activation event take place on</description>
+ </param>
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>True if the service is to be activated. False if the app is to be deactivated</description>
+ </param>
+ <param name="setAsDefault" type="Boolean" mandatory="false">
+ <description>True if the service is to be the default service of this type. False if the app is not to be the default</description>
+ </param>
+ </function>
+
+ <function name="AppServiceActivation" messagetype="response">
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service that was requested to have an activation event take place</description>
+ </param>
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>True if the service was activated. False if the app was deactivated or unable to be activated</description>
+ </param>
+ <param name="setAsDefault" type="Boolean" mandatory="false">
+ <description>True if the service was set to the default service of this type. False if the app was not to be the default</description>
+ </param>
+ </function>
+
+ <function name="GetActiveServiceConsent" messagetype="request">
+ <description>
+ SDL->HMI. HMI is expected to prompt the user for permission for the app service to take over as the active service.
+ </description>
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service to be activated</description>
+ </param>
+ </function>
+
+ <function name="GetActiveServiceConsent" messagetype="response">
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>
+ "true" - If the driver grants permission for the app service to take over as the active service.
+ "false" - If the driver denies permission for the app service to take over as the active service.
+ </description>
+ </param>
+ </function>
+</interface>
</interfaces>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 76fc6ef2d1..990f86ee5a 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="2019-03-18">
<enum name="Result" internal_scope="base" since="1.0">
<element name="SUCCESS">
<description>The request succeeded</description>
@@ -542,7 +542,37 @@
<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>
+
+ <struct name="CloudAppProperties" since="5.1">
+ <param name="nicknames" type="String" minlength="0" maxlength="100" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>An array of app names a cloud app is allowed to register with. If included in a SetCloudAppProperties request, this value will overwrite the existing "nicknames" field in the app policies section of the policy table.</description>
+ </param>
+ <param name="appID" type="String" maxlength="100" mandatory="true"/>
+ <param name="enabled" type="Boolean" mandatory="false">
+ <description>If true, cloud app will be included in HMI RPC UpdateAppList</description>
+ </param>
+ <param name="authToken" type="String" maxlength="65535" 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>
+ <param name="endpoint" type="String" maxlength="65535" mandatory="false">
+ <description>Specifies the endpoint which Core will attempt to connect to when this app is selected</description>
+ </param>
+ </struct>
<enum name="ButtonName" since="1.0">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
@@ -868,7 +898,7 @@
</enum>
<enum name="TBTState" since="2.0">
- <description>Enumeration that describes possible states of turn-by-turn client or AppLink app.</description>
+ <description>Enumeration that describes possible states of turn-by-turn client or SmartDeviceLink app.</description>
<element name="ROUTE_UPDATE_REQUEST" />
<element name="ROUTE_ACCEPTED" />
<element name="ROUTE_REFUSED" />
@@ -2411,6 +2441,7 @@
<element name="MEDIA" />
<element name="FOTA" />
<element name="OEM_SPECIFIC" since="5.0" />
+ <element name="ICON_URL" since="5.1" />
</enum>
<enum name="AppHMIType" since="2.0">
@@ -2554,7 +2585,7 @@
</enum>
<enum name="FunctionID" internal_scope="base" since="1.0">
- <description>Enumeration linking function names with function IDs in AppLink protocol. Assumes enumeration starts at value 0.</description>
+ <description>Enumeration linking function names with function IDs in SmartDeviceLink protocol. Assumes enumeration starts at value 0.</description>
<element name="RESERVED" value="0" since="1.0" />
<!--
Base Request / Response RPCs
@@ -2608,6 +2639,12 @@
<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="GetCloudAppPropertiesID" value="51" hexvalue="33" since="5.1" />
+ <element name="PublishAppServiceID" value="52" hexvalue="34" since="5.1" />
+ <element name="GetAppServiceDataID" value="53" hexvalue="35" since="5.1" />
+ <element name="GetFileID" value="54" hexvalue="36" since="5.1" />
+ <element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" />
<!--
Base Notifications
@@ -2632,6 +2669,8 @@
<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" />
+ <element name="OnSystemCapabilityUpdatedID" value="32787" hexvalue="8013" since="5.1" />
<!--
Ford Specific Request / Response RPCs
@@ -2789,6 +2828,7 @@
<element name="PHONE_CALL"/>
<element name="VIDEO_STREAMING"/>
<element name="REMOTE_CONTROL"/>
+ <element name="APP_SERVICES" since="5.1"/>
</enum>
<struct name="NavigationCapability" since="4.5">
@@ -3602,24 +3642,6 @@
</struct>
<!-- End of RC -->
- <struct name="SystemCapability" since="4.5">
- <description>The systemCapabilityType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
- <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
- <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other para included.</description>
- </param>
- <param name="navigationCapability" type="NavigationCapability" mandatory="false">
- <description>Describes extended capabilities for onboard navigation system </description>
- </param>
- <param name="phoneCapability" type="PhoneCapability" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- </struct>
<enum name="MetadataType" since="4.5">
<element name="mediaTitle">
@@ -3699,7 +3721,428 @@
<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" platform="documentation" since="5.1">
+ <element name="MEDIA"/>
+ <element name="WEATHER"/>
+ <element name="NAVIGATION"/>
+ </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="queuePlaybackProgress" 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="weatherIcon" type="Image" 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="NavigationServiceManifest" since="5.1">
+ <param name="acceptsWayPoints" type="Boolean" mandatory="false">
+ <description> Informs the subscriber if this service can actually accept way points. </description>
+ </param>
+ </struct>
+
+ <enum name="NavigationAction" since="5.1">
+ <element name="TURN">
+ <description> Using this action plus a supplied direction can give the type of turn. </description>
+ </element>
+ <element name="EXIT"/>
+ <element name="STAY"/>
+ <element name="MERGE"/>
+ <element name="FERRY"/>
+ <element name="CAR_SHUTTLE_TRAIN"/>
+ <element name="WAYPOINT"/>
+ </enum>
+
+ <enum name="NavigationJunction" since="5.1">
+ <element name="REGULAR">
+ <description> A junction that represents a standard intersection with a single road crossing another. </description>
+ </element>
+ <element name="BIFURCATION">
+ <description> A junction where the road splits off into two paths; a fork in the road. </description>
+ </element>
+ <element name="MULTI_CARRIAGEWAY">
+ <description> A junction that has multiple intersections and paths. </description>
+ </element>
+ <element name="ROUNDABOUT">
+ <description> A junction where traffic moves in a single direction around a central, non-traversable point to reach one of the connecting roads. </description>
+ </element>
+ <element name="TRAVERSABLE_ROUNDABOUT">
+ <description> Similar to a roundabout, however the center of the roundabout is fully traversable. Also known as a mini-roundabout. </description>
+ </element>
+ <element name="JUGHANDLE">
+ <description> A junction where lefts diverge to the right, then curve to the left, converting a left turn to a crossing maneuver. </description>
+ </element>
+ <element name="ALL_WAY_YIELD">
+ <description> Multiple way intersection that allows traffic to flow based on priority; most commonly right of way and first in, first out. </description>
+ </element>
+ <element name="TURN_AROUND">
+ <description> A junction designated for traffic turn arounds. </description>
+ </element>
+ </enum>
+
+ <enum name="Direction" since="5.1">
+ <element name="LEFT"/>
+ <element name="RIGHT"/>
+ </enum>
+
+ <struct name="NavigationInstruction" since="5.1">
+ <param name="locationDetails" type="LocationDetails" mandatory="true"/>
+
+ <param name="action" type="NavigationAction" mandatory="true"/>
+
+ <param name="eta" type="DateTime" mandatory="false"/>
+
+ <param name="bearing" type="Integer" minvalue="0" maxvalue="359" mandatory="false">
+ <description> The angle at which this instruction takes place. For example, 0 would mean straight, less than 45 is bearing right, greater than 135 is sharp right, between 45 and 135 is a regular right, and 180 is a U-Turn, etc. </description>
+ </param>
+
+ <param name="junctionType" type="NavigationJunction" mandatory="false"/>
+
+ <param name="drivingSide" type="Direction" mandatory="false">
+ <description> Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this will determine which direction the turn should take place. </description>
+ </param>
+
+ <param name="details" type="String" mandatory="false">
+ <description> This is a string representation of this instruction, used to display instructions to the users. This is not intended to be read aloud to the users, see the param prompt in NavigationServiceData for that. </description>
+ </param>
+
+ <param name="image" type="Image" mandatory="false">
+ <description> An image representation of this instruction. </description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceData" since="5.1">
+ <description> This data is related to what a navigation service would provide.</description>
+
+ <param name="timeStamp" type="DateTime" mandatory="true">
+ <description> This is the timestamp of when the data was generated. This is to ensure any time or distance given in the data can accurately be adjusted if necessary. </description>
+ </param>
+
+ <param name="origin" type="LocationDetails" mandatory="false"/>
+ <param name="destination" type="LocationDetails" mandatory="false"/>
+ <param name="destinationETA" type="DateTime" mandatory="false"/>
+
+ <param name="instructions" type="NavigationInstruction" array="true" mandatory="false">
+ <description> This array should be ordered with all remaining instructions. The start of this array should always contain the next instruction.</description>
+ </param>
+
+ <param name="nextInstructionETA" type="DateTime" mandatory="false"/>
+ <param name="nextInstructionDistance" type="Float" mandatory="false">
+ <description>The distance to this instruction from current location. This should only be updated ever .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and the next instruction. </description>
+ </param>
+ <param name="nextInstructionDistanceScale" type="Float" mandatory="false">
+ <description>Distance till next maneuver (starting from) from previous maneuver.</description>
+ </param>
+
+ <param name="prompt" type="String" mandatory="false">
+ <description>This is a prompt message that should be conveyed to the user through either display or voice (TTS). This param will change often as it should represent the following: approaching instruction, post instruction, alerts that affect the current navigation session, etc.</description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceManifest" since="5.1">
+ <description> This manifest contains all the information necessary for the service to be published, activated, and consumers able to interact with it </description>
+
+ <param name="serviceName" type="String" mandatory="false">
+ <description> Unique name of this service </description>
+ </param>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description> The type of service that is to be offered by this app </description>
+ </param>
+
+ <param name="serviceIcon" type="Image" mandatory="false">
+ <description> 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="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"/>
+ <param name="navigationServiceManifest" type="NavigationServiceManifest" 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 (e.g. if the service type is MEDIA, the mediaServiceData param should be included).</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+ <param name="serviceID" type="String" mandatory="true"/>
+
+ <param name="mediaServiceData" type="MediaServiceData" mandatory="false"/>
+ <param name="weatherServiceData" type="WeatherServiceData" mandatory="false"/>
+ <param name="navigationServiceData" type="NavigationServiceData" mandatory="false"/>
+ </struct>
+
+ <enum name="ServiceUpdateReason" since="5.1">
+ <element name="PUBLISHED">
+ <description> The service has just been published with the module and once activated to the primary service of its type, it will be ready for possible consumption.</description>
+ </element>
+ <element name="REMOVED">
+ <description> The service has just been unpublished with the module and is no longer accessible</description>
+ </element>
+ <element name="ACTIVATED">
+ <description> The service is activated as the primary service of this type. All requests dealing with this service type will be handled by this service.</description>
+ </element>
+ <element name="DEACTIVATED">
+ <description> The service has been deactivated as the primary service of its type</description>
+ </element>
+ <element name="MANIFEST_UPDATE">
+ <description> The service has updated its manifest. This could imply updated capabilities. Note: Currently unimplemented </description>
+ </element>
+ </enum>
+
+ <struct name="AppServiceCapability" since="5.1">
+ <param name="updateReason" type="ServiceUpdateReason" mandatory="false">
+ <description> Only included in OnSystemCapabilityUpdated. Update reason for service record.</description>
+ </param>
+ <param name="updatedAppServiceRecord" type="AppServiceRecord" mandatory="true">
+ <description>Service record for a specific app service provider</description>
+ </param>
+ </struct>
+
+ <struct name="AppServicesCapabilities" since="5.1">
+ <description>Capabilities of app services including what service types are supported and the current state of services.</description>
+ <param name="appServices" type="AppServiceCapability" array="true" mandatory="false">
+ <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
+ </param>
+ </struct>
+
+ <!-- End App Services -->
+
+ <struct name="SystemCapability" since="4.5">
+ <description>The systemCapabilityType identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
+ <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included.</description>
+ </param>
+ <param name="navigationCapability" type="NavigationCapability" mandatory="false">
+ <description>Describes extended capabilities for onboard navigation system </description>
+ </param>
+ <param name="phoneCapability" type="PhoneCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="appServicesCapabilities" type="AppServicesCapabilities" mandatory="false" since="5.1">
+ <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
+ </param>
+ </struct>
+
<!-- Requests/Responses -->
<function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request" since="1.0">
@@ -3976,7 +4419,7 @@
<param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0">
<description>
VR Help Items.
- If omitted on supported displays, the default AppLink VR help / What Can I Say? screen shall be used.
+ If omitted on supported displays, the default SmartDeviceLink VR help / What Can I Say? screen shall be used.
If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC shall be rejected.
If omitted and a vrHelpTitle is provided, the request will be rejected.
</description>
@@ -4939,6 +5382,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">
@@ -5054,6 +5500,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">
@@ -5147,6 +5596,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 +5712,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 +5811,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 +5931,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">
@@ -6013,7 +6474,68 @@
<description>Provides additional human readable info regarding the result.</description>
</param>
</function>
-
+
+ <function name="GetFile" functionID="GetFileID" messagetype="request" since="5.1">
+ <description>This request is sent to the module to retrieve a file</description>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File name that should be retrieved</description>
+ </param>
+ <param name="appServiceId" type="String" mandatory="false">
+ <description>ID of the service that should have uploaded the requested file.</description>
+ </param>
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ Optional length in bytes for resuming partial data chunks
+ If offset is set to 0, then length is the total length of the file to be retrieved
+ </description>
+ </param>
+ </function>
+
+ <function name="GetFile" functionID="GetFileID" messagetype="response" since="5.1">
+ <description>This response includes the data that is requested from the specific service</description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="FILE_NOT_FOUND"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <!-- Specific response data -->
+ <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+
+ <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks if offset is set to 0, then length is the total length of the file to be downloaded</description>
+ </param>
+
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>File type that is being sent in response.</description>
+ </param>
+
+ <param name="crc" type="Integer" minvalue="0" maxvalue="4294967295" mandatory="false">
+ <description>Additional CRC32 checksum to protect data integrity up to 512 Mbits</description>
+ </param>
+ </function>
+
<function name="DeleteFile" functionID="DeleteFileID" messagetype="request" since="3.0">
<description>
Used to delete a file resident on the module in the app's local cache.
@@ -6395,8 +6917,8 @@
</param>
<param name="subscribe" type="Boolean" mandatory="false" since="4.5.1">
<description>
- If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduleType.
- If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduleType.
+ If subscribe is true, the head unit will register OnInteriorVehicleData notifications for the requested moduleType.
+ If subscribe is false, the head unit will unregister OnInteriorVehicleData notifications for the requested moduleType.
If subscribe is not included, the subscription status of the app for the requested moduleType will remain unchanged.
</description>
<history>
@@ -6554,6 +7076,9 @@
<param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
<description>The type of system capability to get more information on</description>
</param>
+ <param name="subscribe" type="Boolean" mandatory="false" since="5.1">
+ <description>Flag to subscribe to updates of the supplied service capability type. If true, the requester will be subscribed. If false, the requester will not be subscribed and be removed as a subscriber if it was previously subscribed.</description>
+ </param>
</function>
<function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="response" since="4.5">
@@ -6606,7 +7131,171 @@
<element name="GENERIC_ERROR"/>
</param>
</function>
-
+
+ <function name="SetCloudAppProperties" functionID="SetCloudAppPropertiesID" messagetype="request" since="5.1">
+ <description>
+ RPC used to enable/disable a cloud application and set its cloud-related policy properties
+ </description>
+ <param name="properties" type="CloudAppProperties" mandatory="true">
+ <description> The new cloud application properties </description>
+ </param>
+ </function>
+
+ <function name="SetCloudAppProperties" functionID="SetCloudAppPropertiesID" messagetype="response" since="5.1">
+ <description>The response to SetCloudAppProperties</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="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ </param>
+ </function>
+
+ <function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="request" since="5.1">
+ <description>
+ RPC used to get the current properties of a cloud application
+ </description>
+ <param name="appID" type="String" maxlength="100" mandatory="true"></param>
+ </function>
+
+ <function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="response" since="5.1">
+ <description>The response to GetCloudAppProperties</description>
+ <param name="properties" type="CloudAppProperties" mandatory="false">
+ <description> The requested cloud application properties </description>
+ </param>
+ <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="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ </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>
+
+ <function name="GetAppServiceData" functionID="GetAppServiceDataID" messagetype="request" since="5.1">
+ <description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+
+ <param name="subscribe" type="Boolean" mandatory="false">
+ <description> If true, the consumer is requesting to subscribe to all future updates from the service publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed if it was previously subscribed.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceData" functionID="GetAppServiceDataID" messagetype="response" since="5.1">
+ <description> This response includes the data that was requested from the specific service</description>
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <!-- Specific response data -->
+ <param name="serviceData" type="AppServiceData" mandatory="false"/>
+ </function>
+
+ <function name="PerformAppServiceInteraction" functionID="PerformAppServiceInteractionID" messagetype="request" since="5.1">
+ <param name="serviceUri" type="String" mandatory="true">
+ <description>Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this URI is correct.</description>
+ </param>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The service ID that the app consumer wishes to send this URI.</description>
+ </param>
+
+ <param name="originApp" type="String" mandatory="true">
+ <description>This string is the appID of the app requesting the app service provider take the specific action.</description>
+ </param>
+
+ <param name="requestServiceActive" type="Boolean" mandatory="false">
+ <description>This flag signals the requesting consumer would like this service to become the active primary service of the destination's type.</description>
+ </param>
+ </function>
+
+ <function name="PerformAppServiceInteraction" functionID="PerformAppServiceInteractionID" messagetype="response" since="5.1">
+ <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. All results will be available for this response.</description>
+ </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="serviceSpecificResult" type="String" mandatory="false">
+ <description>The service can provide specific result strings to the consumer through this param.</description>
+ </param>
+ </function>
+
<!-- Notifications -->
<function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification" since="1.0">
@@ -6732,7 +7421,10 @@
<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">
<description>Emergency Call notification and confirmation data</description>
@@ -6896,6 +7588,19 @@
<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>
+
+ <function name="OnSystemCapabilityUpdated" functionID="OnSystemCapabilityUpdatedID" messagetype="notification" since="5.1">
+ <description>A notification to inform the connected device that a specific system capability has changed.</description>
+ <param name="systemCapability" type="SystemCapability" mandatory="true">
+ <description>The system capability that has been updated</description>
+ </param>
+ </function>
<!-- ~~~~~~~~~~~~~~~~~~ -->
<!-- Ford Specific APIs -->
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt
index 9010d15dc0..6a582b4e3b 100644
--- a/src/components/media_manager/CMakeLists.txt
+++ b/src/components/media_manager/CMakeLists.txt
@@ -50,6 +50,7 @@ include_directories(
${POLICY_PATH}/include/
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt
index c66313240f..bd05291245 100644
--- a/src/components/policy/policy_external/CMakeLists.txt
+++ b/src/components/policy/policy_external/CMakeLists.txt
@@ -43,6 +43,7 @@ include_directories (
${COMPONENTS_DIR}/config_profile/include
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${JSONCPP_INCLUDE_DIRECTORY}
)
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..2c35b2a378 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,108 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
+ /**
+ * @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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -192,6 +294,15 @@ class CacheManager : public CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
+
+ /**
* @brief Gets list of URL to send PTS to
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
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..6465c79c05 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,110 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -208,6 +312,15 @@ class CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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..8a2e5b93f5 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
@@ -209,6 +209,15 @@ class PolicyManagerImpl : public PolicyManager {
std::string GetLockScreenIconUrl() const OVERRIDE;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
+
+ /**
* @brief Handler of PTS sending out
*/
void OnUpdateStarted() OVERRIDE;
@@ -571,6 +580,108 @@ 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
+ */
+ bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ * @return bool true if allowed
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const 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. *
@@ -892,6 +1003,12 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& application_id) OVERRIDE;
/**
+ * @brief notify listener of updated auth token for a given policy id
+ * @param policy_app_id the app id that has an updated auth token
+ */
+ void SendAuthTokenUpdated(const std::string policy_app_id);
+
+ /**
* @brief Gets all allowed module types
* @param policy_app_id unique identifier of application
* @param modules list of allowed module types
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..28b0caf95b 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,
@@ -153,6 +154,7 @@ enum RequestType {
RT_MEDIA,
RT_FOTA,
RT_OEM_SPECIFIC,
+ RT_ICON_URL,
RT_EMPTY // Added to allow empty Request Types handling
};
@@ -181,6 +183,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 +442,36 @@ enum FunctionID {
SendHapticDataID = 49,
/**
+ * @brief SetCloudAppPropertiesID.
+ */
+ SetCloudAppPropertiesID = 50,
+
+ /**
+ * @brief GetCloudAppPropertiesID.
+ */
+ GetCloudAppPropertiesID = 51,
+
+ /**
+ * @brief PublishAppServiceID.
+ */
+ PublishAppServiceID = 52,
+
+ /**
+ * @brief GetAppServiceDataID.
+ */
+ GetAppServiceDataID = 53,
+
+ /**
+ * @brief GetFileID
+ */
+ GetFileID = 54,
+
+ /**
+ * @brief PerformAppServiceInteractionID.
+ */
+ PerformAppServiceInteractionID = 55,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
@@ -524,6 +562,16 @@ enum FunctionID {
OnRCStatusID = 32785,
/**
+ * @brief OnAppServiceDataID.
+ */
+ OnAppServiceDataID = 32786,
+
+ /**
+ * @brief OnSystemCapabilityUpdatedID
+ */
+ OnSystemCapabilityUpdatedID = 32787,
+
+ /**
* @brief EncodedSyncPDataID.
*/
EncodedSyncPDataID = 65536,
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..994fd86579 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
@@ -52,6 +52,8 @@ struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
+struct AppServiceHandledRpc;
+struct AppServiceInfo;
} // namespace policy_table_interface_base
} // namespace rpc
@@ -104,6 +106,13 @@ typedef Array<Enum<RequestType>, 0, 255> RequestsTypeArray;
typedef Strings RequestSubTypes;
+typedef String<0, 255> AppServiceType;
+typedef String<0, 255> AppServiceName;
+typedef Array<AppServiceName, 0, 255> AppServiceNames;
+typedef Array<AppServiceHandledRpc, 0, 255> AppServiceHandledRpcs;
+typedef Map<AppServiceInfo, 0, 255> AppServiceParameters;
+typedef Integer<int32_t, 0, INT32_MAX> FunctionIDInt;
+
typedef Map<Strings, 0, 255> RemoteRpcs;
typedef Map<RemoteRpcs, 0, 255> AccessModules;
typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
@@ -111,6 +120,45 @@ typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
typedef AppHMIType AppHmiType;
typedef std::vector<AppHMIType> AppHmiTypes;
+struct AppServiceHandledRpc : CompositeType {
+ public:
+ FunctionIDInt function_id;
+
+ public:
+ AppServiceHandledRpc();
+ ~AppServiceHandledRpc();
+ AppServiceHandledRpc(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
+struct AppServiceInfo : CompositeType {
+ public:
+ Optional<AppServiceNames> service_names;
+ AppServiceHandledRpcs handled_rpcs;
+
+ public:
+ AppServiceInfo();
+ ~AppServiceInfo();
+ AppServiceInfo(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
struct RequestTypes : public RequestsTypeArray {
RequestTypes();
explicit RequestTypes(Json::Value* value);
@@ -177,6 +225,18 @@ 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;
+ Optional<String<0, 65535> > icon_url;
+
+ // App Service Params
+ Optional<AppServiceParameters> app_service_parameters;
+ Optional<Boolean> allow_unknown_rpc_passthrough;
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..46c8f40a01 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,21 @@
<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" />
+ <param name="icon_url" type="String" minlength="0" maxlength="65535"
mandatory="false" />
+ <param name="service_name" type="String" mandatory="false" />
+ <param name="service_type" type="String" mandatory="false" />
+ <param name="handled_rpcs" array="true" mandatory="false" />
+ <param name="allow_unknown_rpc_passthrough" type="Boolean" mandatory="false" />
</struct>
<typedef name="HmiLevels" type="HmiLevel" array="true"
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
index dd9e0204e7..5382ff2d6b 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
@@ -66,6 +66,9 @@ extern const std::string kSelectNicknames;
extern const std::string kSelectAppTypes;
extern const std::string kSelectRequestTypes;
extern const std::string kSelectRequestSubTypes;
+extern const std::string kSelectAppServiceTypes;
+extern const std::string kSelectAppServiceNames;
+extern const std::string kSelectAppServiceHandledRpcs;
extern const std::string kSelectSecondsBetweenRetries;
extern const std::string kSelectIgnitionCycles;
extern const std::string kSelectKilometers;
@@ -80,6 +83,9 @@ extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
extern const std::string kInsertRequestSubType;
+extern const std::string kInsertAppServiceTypes;
+extern const std::string kInsertAppServiceNames;
+extern const std::string kInsertAppServiceHandledRpcs;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
extern const std::string kInsertMessageString;
@@ -101,6 +107,9 @@ extern const std::string kDeleteAppGroup;
extern const std::string kDeleteApplication;
extern const std::string kDeleteRequestType;
extern const std::string kDeleteRequestSubType;
+extern const std::string kDeleteAppServiceTypes;
+extern const std::string kDeleteAppServiceNames;
+extern const std::string kDeleteAppServiceHandledRpcs;
extern const std::string kDeleteDevice;
extern const std::string kIncrementIgnitionCycles;
extern const std::string kResetIgnitionCycles;
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
index 13816eb6c5..581340ba02 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
@@ -134,6 +134,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool GatherRequestSubType(
const std::string& app_id,
policy_table::RequestSubTypes* request_subtypes) const;
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
bool GatherNickName(const std::string& app_id,
policy_table::Strings* nicknames) const;
@@ -172,6 +175,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool SaveRequestSubType(
const std::string& app_id,
const policy_table::RequestSubTypes& request_subtypes);
+ bool SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters);
public:
virtual std::string GetLockScreenIconUrl() const;
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index c2c2e91257..4a738aa6ed 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1389,6 +1389,173 @@ 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);
+ }
+ }
+}
+
+bool 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;
+ return true;
+ }
+ return false;
+}
+
+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::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ 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.endpoint = endpoint;
+ }
+}
+
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ 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.nicknames) = nicknames;
+ }
+}
+
+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;
+ }
+}
+
+void CacheManager::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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;
+ if (app_policy.app_service_parameters.is_initialized()) {
+ *app_service_parameters = *(app_policy.app_service_parameters);
+ }
+ }
+}
+
+bool CacheManager::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) 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) {
+ const auto app_policy = (*policy_iter).second;
+ if (app_policy.allow_unknown_rpc_passthrough.is_initialized()) {
+ return *(app_policy.allow_unknown_rpc_passthrough);
+ }
+ }
+ return false;
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
@@ -1491,6 +1658,21 @@ std::string CacheManager::GetLockScreenIconUrl() const {
return std::string("");
}
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ CACHE_MANAGER_CHECK(std::string());
+ std::string url;
+ 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;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
+ }
+ return url;
+}
+
rpc::policy_table_interface_base::NumberOfNotificationsType
CacheManager::GetNotificationsNumber(const std::string& priority) {
CACHE_MANAGER_CHECK(0);
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..742435098e 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -271,6 +271,11 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
return cache_->GetLockScreenIconUrl();
}
+std::string PolicyManagerImpl::GetIconUrl(
+ const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
+}
+
/**
* @brief FilterInvalidFunctions filter functions that are absent in schema
* @param rpcs list of functions to filter
@@ -497,6 +502,12 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
} else {
LOG4CXX_INFO(logger_, "app_hmi_types empty");
}
+
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
}
// If there was a user request for policy table update, it should be started
@@ -725,6 +736,75 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
+bool 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 {
+ return 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::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
+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::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ cache_->GetAppServiceParameters(policy_app_id, app_service_parameters);
+}
+
+bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
@@ -2033,6 +2113,11 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name,
const bool ret = cache_->Init(file_name, settings);
if (ret) {
RefreshRetrySequence();
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
}
return ret;
}
@@ -2141,6 +2226,15 @@ void PolicyManagerImpl::SendAppPermissionsChanged(
listener()->OnPermissionsUpdated(application_id, notification_data);
}
+void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) {
+ bool enabled = false;
+ std::string end, cert, ctt, hap;
+ std::string auth_token;
+ cache_->GetCloudAppParameters(
+ policy_app_id, enabled, end, cert, auth_token, ctt, hap);
+ listener_->OnAuthTokenUpdated(policy_app_id, auth_token);
+}
+
void PolicyManagerImpl::OnPrimaryGroupsChanged(
const std::string& application_id) {
const std::vector<std::string> devices =
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..bb25623b35 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;
@@ -621,6 +629,8 @@ bool IsValidEnum(RequestType val) {
return true;
case RT_OEM_SPECIFIC:
return true;
+ case RT_ICON_URL:
+ return true;
case RT_EMPTY:
return true;
default:
@@ -672,6 +682,8 @@ const char* EnumToJsonString(RequestType val) {
return "FOTA";
case RT_OEM_SPECIFIC:
return "OEM_SPECIFIC";
+ case RT_ICON_URL:
+ return "ICON_URL";
case RT_EMPTY:
return "EMPTY";
default:
@@ -764,6 +776,10 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) {
*result = RT_OEM_SPECIFIC;
return true;
}
+ if ("ICON_URL" == literal) {
+ *result = RT_ICON_URL;
+ return true;
+ }
if ("EMPTY" == literal) {
*result = RT_EMPTY;
return true;
@@ -840,6 +856,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 +1129,36 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("SetCloudAppProperties" == literal) {
+ *result = SetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("GetCloudAppProperties" == literal) {
+ *result = GetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("PublishAppService" == literal) {
+ *result = PublishAppServiceID;
+ return true;
+ }
+
+ if ("GetFile" == literal) {
+ *result = GetFileID;
+ return true;
+ }
+
+ if ("GetAppServiceData" == literal) {
+ *result = GetAppServiceDataID;
+ return true;
+ }
+
+ if ("PerformAppServiceInteraction" == literal) {
+ *result = PerformAppServiceInteractionID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
@@ -1171,6 +1249,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("OnAppServiceData" == literal) {
+ *result = OnAppServiceDataID;
+ return true;
+ }
+
+ if ("OnSystemCapabilityUpdated" == literal) {
+ *result = OnSystemCapabilityUpdatedID;
+ return true;
+ }
+
if ("EncodedSyncPData" == literal) {
*result = EncodedSyncPDataID;
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..f95b270fdf 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -221,6 +221,110 @@ void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
apps.SetPolicyTableType(pt_type);
}
+// Handled RPC Methods
+AppServiceHandledRpc::AppServiceHandledRpc() : CompositeType(kUninitialized) {}
+
+AppServiceHandledRpc::~AppServiceHandledRpc() {}
+
+AppServiceHandledRpc::AppServiceHandledRpc(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , function_id(impl::ValueMember(value__, "function_id")) {}
+
+Json::Value AppServiceHandledRpc::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("function_id", function_id, &result__);
+ return result__;
+}
+
+bool AppServiceHandledRpc::is_valid() const {
+ if (!function_id.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceHandledRpc::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceHandledRpc::struct_empty() const {
+ if (function_id.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceHandledRpc::SetPolicyTableType(PolicyTableType pt_type) {
+ function_id.SetPolicyTableType(pt_type);
+}
+
+void AppServiceHandledRpc::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!function_id.is_valid()) {
+ function_id.ReportErrors(&report__->ReportSubobject("function_id"));
+ }
+}
+
+// AppServiceInfo methods
+AppServiceInfo::AppServiceInfo() : CompositeType(kUninitialized) {}
+
+AppServiceInfo::~AppServiceInfo() {}
+
+AppServiceInfo::AppServiceInfo(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , service_names(impl::ValueMember(value__, "service_names"))
+ , handled_rpcs(impl::ValueMember(value__, "handled_rpcs")) {}
+
+Json::Value AppServiceInfo::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("service_names", service_names, &result__);
+ impl::WriteJsonField("parameters", handled_rpcs, &result__);
+ return result__;
+}
+
+bool AppServiceInfo::is_valid() const {
+ if (!service_names.is_valid()) {
+ return false;
+ }
+ if (!handled_rpcs.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceInfo::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceInfo::struct_empty() const {
+ if (service_names.is_initialized()) {
+ return false;
+ }
+ if (handled_rpcs.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceInfo::SetPolicyTableType(PolicyTableType pt_type) {
+ service_names.SetPolicyTableType(pt_type);
+ handled_rpcs.SetPolicyTableType(pt_type);
+}
+
+void AppServiceInfo::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!service_names.is_valid()) {
+ service_names.ReportErrors(&report__->ReportSubobject("service_names"));
+ }
+ if (!handled_rpcs.is_valid()) {
+ handled_rpcs.ReportErrors(&report__->ReportSubobject("handled_rpcs"));
+ }
+}
+
// ApplicationParams methods
ApplicationParams::ApplicationParams() : PolicyBase() {}
@@ -241,7 +345,17 @@ 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"))
+ , 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"))
+ , icon_url(impl::ValueMember(value__, "icon_url"))
+ , app_service_parameters(impl::ValueMember(value__, "app_services"))
+ , allow_unknown_rpc_passthrough(
+ impl::ValueMember(value__, "allow_unknown_rpc_passthrough")) {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -253,6 +367,18 @@ 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__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
+ impl::WriteJsonField("app_services", app_service_parameters, &result__);
+ impl::WriteJsonField("allow_unknown_rpc_passthrough",
+ allow_unknown_rpc_passthrough,
+ &result__);
return result__;
}
@@ -277,6 +403,33 @@ 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;
+ }
+ if (!icon_url.is_valid()) {
+ return false;
+ }
+ if (!app_service_parameters.is_valid()) {
+ return false;
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -309,6 +462,33 @@ 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;
+ }
+ if (icon_url.is_initialized()) {
+ return false;
+ }
+ if (app_service_parameters.is_initialized()) {
+ return false;
+ }
+ if (allow_unknown_rpc_passthrough.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -357,6 +537,36 @@ 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"));
+ }
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
+ if (!app_service_parameters.is_valid()) {
+ app_service_parameters.ReportErrors(
+ &report__->ReportSubobject("app_services"));
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ allow_unknown_rpc_passthrough.ReportErrors(
+ &report__->ReportSubobject("allow_unknown_rpc_passthrough"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -367,6 +577,14 @@ 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);
+ icon_url.SetPolicyTableType(pt_type);
+ app_service_parameters.SetPolicyTableType(pt_type);
+ allow_unknown_rpc_passthrough.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc
index 9b227615d8..fad8509711 100644
--- a/src/components/policy/policy_external/src/policy_table/validation.cc
+++ b/src/components/policy/policy_external/src/policy_table/validation.cc
@@ -194,6 +194,14 @@ bool ApplicationParams::ValidateModuleTypes() const {
return true;
}
+bool AppServiceHandledRpc::Validate() const {
+ return true;
+}
+
+bool AppServiceInfo::Validate() const {
+ return true;
+}
+
bool ApplicationParams::Validate() const {
if (is_initialized()) {
if (preconsented_groups.is_initialized()) {
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..2c24bbc522 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,11 @@ 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`, `icon_url`, `allow_unknown_rpc_passthrough`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -232,8 +236,10 @@ 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`, `icon_url`, `allow_unknown_rpc_passthrough` "
+ "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..b19feddee6 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
@@ -675,6 +675,21 @@ bool SQLPTExtRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// First, all predefined apps (e.g. default, pre_DataConsent) should be saved,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -729,6 +744,10 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
if (!SaveRequestSubType(app.first, *app.second.RequestSubType)) {
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
// Stop saving other params, since predefined permissions already set
return true;
}
@@ -752,6 +771,31 @@ 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);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(14, *app.second.icon_url)
+ : app_query.Bind(14);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(15, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(15);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -786,6 +830,11 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
+
return true;
}
@@ -873,7 +922,24 @@ 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);
+ *params.icon_url = query.GetString(13);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(14);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -906,6 +972,10 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
+ return false;
+ }
GatherPreconsentedGroup(gather_app_id, &*params.preconsented_groups);
(*policies).apps[app_id] = params;
}
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..f4cac214a5 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,14 @@ 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), "
+ " `icon_url` VARCHAR(65535), "
+ " `allow_unknown_rpc_passthrough` BOOLEAN, "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -154,11 +165,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, "
@@ -286,6 +303,30 @@ const std::string kCreateSchema =
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
+ "CREATE TABLE IF NOT EXISTS `app_service_types`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `service_type` VARCHAR(50), "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
+ " CONSTRAINT `fk_service_type_app_id` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_names`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `service_name` VARCHAR(45), "
+ " PRIMARY KEY(`service_name`,`service_type_id`), "
+ " CONSTRAINT `fk_service_name_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_handled_rpcs`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `function_id` INTEGER, "
+ " PRIMARY KEY(`function_id`,`service_type_id`), "
+ " CONSTRAINT `fk_function_id_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
" ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
@@ -430,6 +471,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 +535,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `app_type`; "
"DROP TABLE IF EXISTS `request_type`; "
"DROP TABLE IF EXISTS `request_subtype`; "
+ "DROP TABLE IF EXISTS `app_service_types`; "
+ "DROP TABLE IF EXISTS `app_service_names`; "
+ "DROP TABLE IF EXISTS `app_service_handled_rpcs`; "
"DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
"DROP TABLE IF EXISTS `nickname`; "
"DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
@@ -532,6 +579,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 +676,11 @@ 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`, `icon_url`, `allow_unknown_rpc_passthrough`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -650,6 +701,21 @@ const std::string kInsertRequestSubType =
"`request_subtype`) "
"VALUES (?, ?)";
+const std::string kInsertAppServiceTypes =
+ "INSERT INTO `app_service_types` (`id`, "
+ "`service_type`, `application_id`) "
+ "VALUES (?, ?, ?)";
+
+const std::string kInsertAppServiceNames =
+ "INSERT INTO `app_service_names` (`service_type_id`, "
+ "`service_name`) "
+ "VALUES (?, ?)";
+
+const std::string kInsertAppServiceHandledRpcs =
+ "INSERT INTO `app_service_handled_rpcs` (`service_type_id`, "
+ "`function_id`) "
+ "VALUES (?, ?)";
+
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
const std::string kInsertMessageType =
@@ -752,7 +818,11 @@ 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`, `icon_url`, "
+ " `allow_unknown_rpc_passthrough` "
+ "FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -779,6 +849,21 @@ const std::string kSelectRequestSubTypes =
"`application_id` "
"= ?";
+const std::string kSelectAppServiceTypes =
+ "SELECT `id`, `service_type` FROM `app_service_types` WHERE "
+ "`application_id` "
+ "= ?";
+
+const std::string kSelectAppServiceNames =
+ "SELECT DISTINCT `service_name` FROM `app_service_names` WHERE "
+ "`service_type_id` "
+ "= ?";
+
+const std::string kSelectAppServiceHandledRpcs =
+ "SELECT DISTINCT `function_id` FROM `app_service_handled_rpcs` WHERE "
+ "`service_type_id` "
+ "= ?";
+
const std::string kSelectSecondsBetweenRetries =
"SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
@@ -826,6 +911,13 @@ const std::string kDeleteRequestType = "DELETE FROM `request_type`";
const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`";
+const std::string kDeleteAppServiceTypes = "DELETE FROM `app_service_types`";
+
+const std::string kDeleteAppServiceNames = "DELETE FROM `app_service_names`";
+
+const std::string kDeleteAppServiceHandledRpcs =
+ "DELETE FROM `app_service_handled_rpcs`";
+
const std::string kSelectApplicationRevoked =
"SELECT `is_revoked` FROM `application` WHERE `id` = ?";
@@ -849,15 +941,22 @@ 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`, `icon_url`, "
+ "`allow_unknown_rpc_passthrough`) "
+ " 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`, "
+ "`icon_url`, "
+ " `allow_unknown_rpc_passthrough` "
+ "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..dce86f6d52 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,24 @@ 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);
+ *params.icon_url = query.GetString(10);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(11);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -793,6 +811,10 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
+ return false;
+ }
(*policies).apps[app_id] = params;
}
@@ -984,6 +1006,21 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// All predefined apps (e.g. default, pre_DataConsent) should be saved first,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -1035,6 +1072,30 @@ 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);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(11, *app.second.icon_url)
+ : app_query.Bind(11);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(12, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(12);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -1071,6 +1132,10 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
if (!SaveRequestType(app.first, *app.second.RequestType)) {
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
return true;
}
@@ -1235,6 +1300,85 @@ bool SQLPTRepresentation::SaveRequestSubType(
return true;
}
+bool SQLPTRepresentation::SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters) {
+ LOG4CXX_INFO(logger_, "Save app service parameters");
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ return false;
+ }
+ policy_table::AppServiceParameters::const_iterator it;
+ for (it = app_service_parameters.begin(); it != app_service_parameters.end();
+ ++it) {
+ // Create service type id from hashing app_id and service_type
+ std::string str_to_hash = std::string(app_id + it->first);
+ const long int id = abs(CacheManager::GenerateHash(str_to_hash));
+ query.Bind(0, static_cast<int64_t>(id));
+ query.Bind(1, it->first);
+ query.Bind(2, app_id);
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
+ return false;
+ }
+
+ // Insert app names array into db
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
+ return false;
+ }
+
+ auto app_service_names = it->second.service_names;
+
+ if (app_service_names.is_initialized() && app_service_names->empty()) {
+ // App service names is an empty array
+ LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ return false;
+ }
+ } else {
+ policy_table::AppServiceNames::const_iterator names_it;
+ for (names_it = app_service_names->begin();
+ names_it != app_service_names->end();
+ ++names_it) {
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1, *names_it);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ return false;
+ }
+ }
+ }
+
+ // Insert handled rpcs array into db
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert statement for app service handled rpcs");
+ return false;
+ }
+
+ auto handled_rpcs = it->second.handled_rpcs;
+ policy_table::AppServiceHandledRpcs::const_iterator rpc_it;
+ for (rpc_it = handled_rpcs.begin(); rpc_it != handled_rpcs.end();
+ ++rpc_it) {
+ handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
+ handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
+ if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
// Section Module Meta is empty for SDL specific
return true;
@@ -1661,6 +1805,63 @@ bool SQLPTRepresentation::GatherRequestSubType(
return true;
}
+bool SQLPTRepresentation::GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_INFO(logger_, "Gather app service info");
+ utils::dbms::SQLQuery service_type_query(db());
+ if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ return false;
+ }
+
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ return false;
+ }
+
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ return false;
+ }
+
+ service_type_query.Bind(0, app_id);
+ while (service_type_query.Next()) {
+ const int service_type_id = service_type_query.GetInteger(0);
+ std::string service_type = service_type_query.GetString(1);
+ (*app_service_parameters)[service_type] = policy_table::AppServiceInfo();
+
+ service_name_query.Bind(0, service_type_id);
+ while (service_name_query.Next()) {
+ LOG4CXX_DEBUG(logger_, "Loading service name");
+ (*app_service_parameters)[service_type].service_names->push_back(
+ service_name_query.GetString(0));
+ (*app_service_parameters)[service_type].service_names->mark_initialized();
+ }
+
+ handled_rpcs_query.Bind(0, service_type_id);
+ while (handled_rpcs_query.Next()) {
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = handled_rpcs_query.GetInteger(0);
+ (*app_service_parameters)[service_type].handled_rpcs.push_back(
+ handled_rpc);
+ }
+
+ if (!service_name_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ return false;
+ }
+ if (!handled_rpcs_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
@@ -2006,6 +2207,12 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
return false;
}
+ policy_table::AppServiceParameters app_service_parameters;
+ if (!GatherAppServiceParameters(kDefaultId, &app_service_parameters) ||
+ !SaveAppServiceParameters(app_id, app_service_parameters)) {
+ return false;
+ }
+
policy_table::Strings default_groups;
bool ret = (GatherAppGroup(kDefaultId, &default_groups) &&
SaveAppGroup(app_id, default_groups));
@@ -2107,7 +2314,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ LOG4CXX_WARN(logger_, "Incorrect insert statement into application full.");
return false;
}
query.Bind(0, destination);
@@ -2125,6 +2332,22 @@ 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));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
+ source_app.IsNull(16) ? query.Bind(17)
+ : query.Bind(17, source_app.GetBoolean(16));
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..acf18c5706 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
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "heart_beat_timeout_ms": 5000
+ "heart_beat_timeout_ms": 5000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1598,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1616,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1634,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1651,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_test.cc
index 6521db7c36..1916e09efc 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_test.cc
@@ -345,6 +345,37 @@ TEST_F(PolicyManagerImplTest2, GetCurrentDeviceId) {
EXPECT_EQ("", policy_manager_->GetCurrentDeviceId(app_id_2_));
}
+TEST_F(PolicyManagerImplTest2, UpdateApplication_AppServices) {
+ // Arrange
+ std::string kServiceType = "MEDIA";
+ CreateLocalPT(preloaded_pt_filename_);
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+ GetPTU("json/valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+ // Try to add existing app
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ policy_manager_->GetAppServiceParameters(app_id_2_, &app_service_parameters);
+
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+
+ ASSERT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ ASSERT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
+
+ // Check no update required
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+}
+
TEST_F(
PolicyManagerImplTest_ExternalConsent,
ExternalConsent_SetExternalConsentStatusWhileAppExists_ExpectUserConsentsUpdateForApp) {
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..c43c9dace6 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;
+ // 37 - is current total tables number created by schema
+ const int policy_tables_number = 37;
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/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt
index a5533302a5..3679b2efea 100644
--- a/src/components/policy/policy_regular/CMakeLists.txt
+++ b/src/components/policy/policy_regular/CMakeLists.txt
@@ -39,6 +39,7 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/config_profile/include
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(POLICY_TABLE_PATHS
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..840b706c8b 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,108 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
+ /**
+ * @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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -186,6 +288,15 @@ class CacheManager : public CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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..2c14fd8cba 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,109 @@ 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 bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -192,6 +295,15 @@ class CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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..911ce65a11 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
@@ -117,6 +117,15 @@ class PolicyManagerImpl : public PolicyManager {
std::string GetLockScreenIconUrl() const OVERRIDE;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
+
+ /**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
bool RequestPTUpdate() OVERRIDE;
@@ -565,6 +574,109 @@ 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
+ */
+ bool 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 a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) 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 Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ * @return bool true if allowed
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const 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. *
@@ -840,6 +952,12 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& application_id) OVERRIDE;
/**
+ * @brief notify listener of updated auth token for a given policy id
+ * @param policy_app_id the app id that has an updated auth token
+ */
+ void SendAuthTokenUpdated(const std::string policy_app_id);
+
+ /**
* @brief Gets all allowed module types
* @param policy_app_id unique identifier of application
* @param modules list of allowed module types
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..679950277d 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,36 @@ enum FunctionID {
SendHapticDataID = 49,
/**
+ * @brief SetCloudAppPropertiesID.
+ */
+ SetCloudAppPropertiesID = 50,
+
+ /**
+ * @brief GetCloudAppPropertiesID.
+ */
+ GetCloudAppPropertiesID = 51,
+
+ /**
+ * @brief PublishAppServiceID.
+ */
+ PublishAppServiceID = 52,
+
+ /**
+ * @brief GetAppServiceDataID.
+ */
+ GetAppServiceDataID = 53,
+
+ /**
+ * @brief GetFileID
+ */
+ GetFileID = 54,
+
+ /**
+ * @brief PerformAppServiceInteractionID.
+ */
+ PerformAppServiceInteractionID = 55,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
@@ -510,6 +547,16 @@ enum FunctionID {
OnRCStatusID = 32785,
/**
+ * @brief OnAppServiceDataID.
+ */
+ OnAppServiceDataID = 32786,
+
+ /**
+ * @brief OnSystemCapabilityUpdatedID
+ */
+ OnSystemCapabilityUpdatedID = 32787,
+
+ /**
* @brief EncodedSyncPDataID.
*/
EncodedSyncPDataID = 65536,
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..e41069a86c 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
@@ -50,6 +50,8 @@ struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
+struct AppServiceHandledRpc;
+struct AppServiceInfo;
} // namespace policy_table_interface_base
} // namespace rpc
@@ -98,6 +100,13 @@ typedef Array<Enum<RequestType>, 0, 255> RequestTypes;
typedef Strings RequestSubTypes;
+typedef String<0, 255> AppServiceType;
+typedef String<0, 255> AppServiceName;
+typedef Array<AppServiceName, 0, 255> AppServiceNames;
+typedef Array<AppServiceHandledRpc, 0, 255> AppServiceHandledRpcs;
+typedef Map<AppServiceInfo, 0, 255> AppServiceParameters;
+typedef Integer<int32_t, 0, INT32_MAX> FunctionIDInt;
+
typedef Map<Strings, 0, 255> RemoteRpcs;
typedef Map<RemoteRpcs, 0, 255> AccessModules;
typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
@@ -105,6 +114,45 @@ typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
typedef AppHMIType AppHmiType;
typedef std::vector<AppHMIType> AppHmiTypes;
+struct AppServiceHandledRpc : CompositeType {
+ public:
+ FunctionIDInt function_id;
+
+ public:
+ AppServiceHandledRpc();
+ ~AppServiceHandledRpc();
+ AppServiceHandledRpc(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
+struct AppServiceInfo : CompositeType {
+ public:
+ Optional<AppServiceNames> service_names;
+ AppServiceHandledRpcs handled_rpcs;
+
+ public:
+ AppServiceInfo();
+ ~AppServiceInfo();
+ AppServiceInfo(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
struct PolicyBase : CompositeType {
public:
Enum<Priority> priority;
@@ -142,8 +190,19 @@ struct ApplicationParams : PolicyBase {
Optional<RequestSubTypes> RequestSubType;
Optional<Integer<uint16_t, 0, 65225> > memory_kb;
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
- Optional<String<0, 255> > certificate;
+ Optional<String<0, 65535> > 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;
+ Optional<String<0, 65535> > icon_url;
+
+ // App Service Params
+ Optional<AppServiceParameters> app_service_parameters;
+ Optional<Boolean> allow_unknown_rpc_passthrough;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
index 191873efe0..bada9a003a 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
@@ -66,6 +66,9 @@ extern const std::string kSelectNicknames;
extern const std::string kSelectAppTypes;
extern const std::string kSelectRequestTypes;
extern const std::string kSelectRequestSubTypes;
+extern const std::string kSelectAppServiceTypes;
+extern const std::string kSelectAppServiceNames;
+extern const std::string kSelectAppServiceHandledRpcs;
extern const std::string kSelectSecondsBetweenRetries;
extern const std::string kSelectIgnitionCycles;
extern const std::string kSelectKilometers;
@@ -80,6 +83,9 @@ extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
extern const std::string kInsertRequestSubType;
+extern const std::string kInsertAppServiceTypes;
+extern const std::string kInsertAppServiceNames;
+extern const std::string kInsertAppServiceHandledRpcs;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
extern const std::string kInsertMessageString;
@@ -100,6 +106,9 @@ extern const std::string kDeleteAppGroup;
extern const std::string kDeleteApplication;
extern const std::string kDeleteRequestType;
extern const std::string kDeleteRequestSubType;
+extern const std::string kDeleteAppServiceTypes;
+extern const std::string kDeleteAppServiceNames;
+extern const std::string kDeleteAppServiceHandledRpcs;
extern const std::string kDeleteDevice;
extern const std::string kIncrementIgnitionCycles;
extern const std::string kResetIgnitionCycles;
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
index 0e9302dfac..dfa318454b 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
@@ -133,6 +133,10 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool GatherRequestSubType(
const std::string& app_id,
policy_table::RequestSubTypes* request_subtypes) const;
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
bool GatherNickName(const std::string& app_id,
policy_table::Strings* nicknames) const;
@@ -171,6 +175,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool SaveRequestSubType(
const std::string& app_id,
const policy_table::RequestSubTypes& request_subtypes);
+ bool SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters);
public:
bool UpdateRequired() const;
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index bd95fc8e7c..991c6a1363 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -682,6 +682,175 @@ 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);
+ }
+ }
+}
+
+bool 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;
+ return true;
+ }
+ return false;
+}
+
+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::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ 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.endpoint = endpoint;
+ }
+}
+
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ 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.nicknames) = nicknames;
+ }
+}
+
+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;
+ }
+}
+
+void CacheManager::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ 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;
+ if (app_policy.app_service_parameters.is_initialized()) {
+ *app_service_parameters = *(app_policy.app_service_parameters);
+ }
+ }
+}
+
+bool CacheManager::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) 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) {
+ const auto app_policy = (*policy_iter).second;
+ if (app_policy.allow_unknown_rpc_passthrough.is_initialized()) {
+ return *(app_policy.allow_unknown_rpc_passthrough);
+ }
+ }
+ return false;
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -778,6 +947,21 @@ std::string CacheManager::GetLockScreenIconUrl() const {
return std::string("");
}
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ CACHE_MANAGER_CHECK(std::string());
+ std::string url;
+ 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;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
+ }
+ return url;
+}
+
rpc::policy_table_interface_base::NumberOfNotificationsType
CacheManager::GetNotificationsNumber(const std::string& priority) {
CACHE_MANAGER_CHECK(0);
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..10e1c73e9a 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) {
@@ -368,6 +368,12 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
} else {
LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
}
+
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
}
// If there was a user request for policy table update, it should be started
@@ -443,6 +449,11 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
return cache_->GetLockScreenIconUrl();
}
+std::string PolicyManagerImpl::GetIconUrl(
+ const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
+}
+
void PolicyManagerImpl::StartPTExchange() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -544,6 +555,75 @@ const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
return cache_->GetVehicleInfo();
}
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
+bool 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 {
+ return 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::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
+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::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ cache_->GetAppServiceParameters(policy_app_id, app_service_parameters);
+}
+
+bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
const PTString& app_id,
const PTString& hmi_level,
@@ -1294,6 +1374,11 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name,
if (!certificate_data.empty()) {
listener_->OnCertificateUpdated(certificate_data);
}
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
}
return ret;
}
@@ -1409,6 +1494,15 @@ void PolicyManagerImpl::SendAppPermissionsChanged(
listener()->OnPermissionsUpdated(application_id, notification_data);
}
+void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) {
+ bool enabled = false;
+ std::string end, cert, ctt, hap;
+ std::string auth_token;
+ cache_->GetCloudAppParameters(
+ policy_app_id, enabled, end, cert, auth_token, ctt, hap);
+ listener_->OnAuthTokenUpdated(policy_app_id, auth_token);
+}
+
void PolicyManagerImpl::OnPrimaryGroupsChanged(
const std::string& application_id) {
const std::vector<std::string> devices =
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..421ccacded 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,18 @@ bool IsValidEnum(FunctionID val) {
return true;
case SendHapticDataID:
return true;
+ case SetCloudAppPropertiesID:
+ return true;
+ case GetCloudAppPropertiesID:
+ return true;
+ case PublishAppServiceID:
+ return true;
+ case GetFileID:
+ return true;
+ case GetAppServiceDataID:
+ return true;
+ case PerformAppServiceInteractionID:
+ return true;
case OnHMIStatusID:
return true;
case OnAppInterfaceUnregisteredID:
@@ -843,6 +895,8 @@ bool IsValidEnum(FunctionID val) {
return true;
case OnRCStatusID:
return true;
+ case OnAppServiceDataID:
+ return true;
case EncodedSyncPDataID:
return true;
case SyncPDataID:
@@ -851,6 +905,8 @@ bool IsValidEnum(FunctionID val) {
return true;
case OnSyncPDataID:
return true;
+ case OnSystemCapabilityUpdatedID:
+ return true;
default:
return false;
}
@@ -954,6 +1010,18 @@ const char* EnumToJsonString(FunctionID val) {
return "GetSystemCapability";
case SendHapticDataID:
return "SendHapticData";
+ case SetCloudAppPropertiesID:
+ return "SetCloudAppProperties";
+ case GetCloudAppPropertiesID:
+ return "GetCloudAppProperties";
+ case PublishAppServiceID:
+ return "PublishAppService";
+ case GetFileID:
+ return "GetFile";
+ case GetAppServiceDataID:
+ return "GetAppServiceData";
+ case PerformAppServiceInteractionID:
+ return "PerformAppServiceInteraction";
case OnHMIStatusID:
return "OnHMIStatus";
case OnAppInterfaceUnregisteredID:
@@ -990,6 +1058,8 @@ const char* EnumToJsonString(FunctionID val) {
return "OnWayPointChange";
case OnRCStatusID:
return "OnRCStatus";
+ case OnAppServiceDataID:
+ return "OnAppServiceData";
case EncodedSyncPDataID:
return "EncodedSyncPData";
case SyncPDataID:
@@ -998,6 +1068,8 @@ const char* EnumToJsonString(FunctionID val) {
return "OnEncodedSyncPData";
case OnSyncPDataID:
return "OnSyncPData";
+ case OnSystemCapabilityUpdatedID:
+ return "OnSystemCapabilityUpdated";
default:
return "";
}
@@ -1244,6 +1316,36 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("SetCloudAppProperties" == literal) {
+ *result = SetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("GetCloudAppProperties" == literal) {
+ *result = GetCloudAppPropertiesID;
+ return true;
+ }
+
+ if ("PublishAppService" == literal) {
+ *result = PublishAppServiceID;
+ return true;
+ }
+
+ if ("GetFile" == literal) {
+ *result = GetFileID;
+ return true;
+ }
+
+ if ("GetAppServiceData" == literal) {
+ *result = GetAppServiceDataID;
+ return true;
+ }
+
+ if ("PerformAppServiceInteraction" == literal) {
+ *result = PerformAppServiceInteractionID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
@@ -1334,6 +1436,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("OnAppServiceData" == literal) {
+ *result = OnAppServiceDataID;
+ return true;
+ }
+
+ if ("OnSystemCapabilityUpdated" == literal) {
+ *result = OnSystemCapabilityUpdatedID;
+ return true;
+ }
+
if ("EncodedSyncPData" == literal) {
*result = EncodedSyncPDataID;
return true;
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..bdf1329dee 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -149,6 +149,109 @@ void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
device.SetPolicyTableType(pt_type);
apps.SetPolicyTableType(pt_type);
}
+// Handled RPC Methods
+AppServiceHandledRpc::AppServiceHandledRpc() : CompositeType(kUninitialized) {}
+
+AppServiceHandledRpc::~AppServiceHandledRpc() {}
+
+AppServiceHandledRpc::AppServiceHandledRpc(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , function_id(impl::ValueMember(value__, "function_id")) {}
+
+Json::Value AppServiceHandledRpc::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("function_id", function_id, &result__);
+ return result__;
+}
+
+bool AppServiceHandledRpc::is_valid() const {
+ if (!function_id.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceHandledRpc::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceHandledRpc::struct_empty() const {
+ if (function_id.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceHandledRpc::SetPolicyTableType(PolicyTableType pt_type) {
+ function_id.SetPolicyTableType(pt_type);
+}
+
+void AppServiceHandledRpc::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!function_id.is_valid()) {
+ function_id.ReportErrors(&report__->ReportSubobject("function_id"));
+ }
+}
+
+// AppServiceInfo methods
+AppServiceInfo::AppServiceInfo() : CompositeType(kUninitialized) {}
+
+AppServiceInfo::~AppServiceInfo() {}
+
+AppServiceInfo::AppServiceInfo(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , service_names(impl::ValueMember(value__, "service_names"))
+ , handled_rpcs(impl::ValueMember(value__, "handled_rpcs")) {}
+
+Json::Value AppServiceInfo::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("service_names", service_names, &result__);
+ impl::WriteJsonField("parameters", handled_rpcs, &result__);
+ return result__;
+}
+
+bool AppServiceInfo::is_valid() const {
+ if (!service_names.is_valid()) {
+ return false;
+ }
+ if (!handled_rpcs.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceInfo::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceInfo::struct_empty() const {
+ if (service_names.is_initialized()) {
+ return false;
+ }
+ if (handled_rpcs.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceInfo::SetPolicyTableType(PolicyTableType pt_type) {
+ service_names.SetPolicyTableType(pt_type);
+ handled_rpcs.SetPolicyTableType(pt_type);
+}
+
+void AppServiceInfo::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!service_names.is_valid()) {
+ service_names.ReportErrors(&report__->ReportSubobject("service_names"));
+ }
+ if (!handled_rpcs.is_valid()) {
+ handled_rpcs.ReportErrors(&report__->ReportSubobject("handled_rpcs"));
+ }
+}
// ApplicationParams methods
ApplicationParams::ApplicationParams() : PolicyBase(), groups() {}
@@ -167,8 +270,17 @@ 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"))
- , certificate(impl::ValueMember(value__, "certificate"), "not_specified")
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , certificate(impl::ValueMember(value__, "certificate"))
+ , 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"))
+ , icon_url(impl::ValueMember(value__, "icon_url"))
+ , app_service_parameters(impl::ValueMember(value__, "app_services"))
+ , allow_unknown_rpc_passthrough(
+ impl::ValueMember(value__, "allow_unknown_rpc_passthrough")) {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -180,7 +292,19 @@ 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__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
+ impl::WriteJsonField("app_services", app_service_parameters, &result__);
+ impl::WriteJsonField("allow_unknown_rpc_passthrough",
+ allow_unknown_rpc_passthrough,
+ &result__);
return result__;
}
@@ -212,6 +336,30 @@ 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;
+ }
+ if (!icon_url.is_valid()) {
+ return false;
+ }
+ if (!app_service_parameters.is_valid()) {
+ return false;
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -250,6 +398,30 @@ 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;
+ }
+ if (icon_url.is_initialized()) {
+ return false;
+ }
+ if (app_service_parameters.is_initialized()) {
+ return false;
+ }
+ if (allow_unknown_rpc_passthrough.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -288,6 +460,33 @@ 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"));
+ }
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
+ if (!app_service_parameters.is_valid()) {
+ app_service_parameters.ReportErrors(
+ &report__->ReportSubobject("app_services"));
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ allow_unknown_rpc_passthrough.ReportErrors(
+ &report__->ReportSubobject("allow_unknown_rpc_passthrough"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -300,6 +499,13 @@ 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);
+ icon_url.SetPolicyTableType(pt_type);
+ app_service_parameters.SetPolicyTableType(pt_type);
+ allow_unknown_rpc_passthrough.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc
index 714dfaae5a..4db84e06ff 100644
--- a/src/components/policy/policy_regular/src/policy_table/validation.cc
+++ b/src/components/policy/policy_regular/src/policy_table/validation.cc
@@ -177,6 +177,14 @@ bool ApplicationParams::ValidateModuleTypes() const {
return true;
}
+bool AppServiceHandledRpc::Validate() const {
+ return true;
+}
+
+bool AppServiceInfo::Validate() const {
+ return true;
+}
+
bool ApplicationParams::Validate() const {
return ValidateModuleTypes();
}
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..a97b0ab153 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,14 @@ 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), "
+ " `icon_url` VARCHAR(65535), "
+ " `allow_unknown_rpc_passthrough` BOOLEAN, "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -141,11 +151,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, "
@@ -273,6 +289,30 @@ const std::string kCreateSchema =
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
+ "CREATE TABLE IF NOT EXISTS `app_service_types`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `service_type` VARCHAR(50), "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
+ " CONSTRAINT `fk_service_type_app_id` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_names`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `service_name` VARCHAR(45), "
+ " PRIMARY KEY(`service_name`,`service_type_id`), "
+ " CONSTRAINT `fk_service_name_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_handled_rpcs`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `function_id` INTEGER, "
+ " PRIMARY KEY(`function_id`,`service_type_id`), "
+ " CONSTRAINT `fk_function_id_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
" ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
@@ -391,6 +431,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); "
"";
@@ -450,6 +493,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `app_type`; "
"DROP TABLE IF EXISTS `request_type`; "
"DROP TABLE IF EXISTS `request_subtype`; "
+ "DROP TABLE IF EXISTS `app_service_types`; "
+ "DROP TABLE IF EXISTS `app_service_names`; "
+ "DROP TABLE IF EXISTS `app_service_handled_rpcs`; "
"DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
"DROP TABLE IF EXISTS `nickname`; "
"DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
@@ -491,6 +537,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 +625,11 @@ 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`, `icon_url`, `allow_unknown_rpc_passthrough`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -600,6 +650,21 @@ const std::string kInsertRequestSubType =
"`request_subtype`) "
"VALUES (?, ?)";
+const std::string kInsertAppServiceTypes =
+ "INSERT INTO `app_service_types` (`id`, "
+ "`service_type`, `application_id`) "
+ "VALUES (?, ?, ?)";
+
+const std::string kInsertAppServiceNames =
+ "INSERT INTO `app_service_names` (`service_type_id`, "
+ "`service_name`) "
+ "VALUES (?, ?)";
+
+const std::string kInsertAppServiceHandledRpcs =
+ "INSERT INTO `app_service_handled_rpcs` (`service_type_id`, "
+ "`function_id`) "
+ "VALUES (?, ?)";
+
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
const std::string kInsertMessageType =
@@ -688,7 +753,11 @@ 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`, `icon_url`, "
+ " `allow_unknown_rpc_passthrough` "
+ "FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -715,6 +784,21 @@ const std::string kSelectRequestSubTypes =
"`application_id` "
"= ?";
+const std::string kSelectAppServiceTypes =
+ "SELECT `id`, `service_type` FROM `app_service_types` WHERE "
+ "`application_id` "
+ "= ?";
+
+const std::string kSelectAppServiceNames =
+ "SELECT DISTINCT `service_name` FROM `app_service_names` WHERE "
+ "`service_type_id` "
+ "= ?";
+
+const std::string kSelectAppServiceHandledRpcs =
+ "SELECT DISTINCT `function_id` FROM `app_service_handled_rpcs` WHERE "
+ "`service_type_id` "
+ "= ?";
+
const std::string kSelectSecondsBetweenRetries =
"SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
@@ -762,6 +846,13 @@ const std::string kDeleteRequestType = "DELETE FROM `request_type`";
const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`";
+const std::string kDeleteAppServiceTypes = "DELETE FROM `app_service_types`";
+
+const std::string kDeleteAppServiceNames = "DELETE FROM `app_service_names`";
+
+const std::string kDeleteAppServiceHandledRpcs =
+ "DELETE FROM `app_service_handled_rpcs`";
+
const std::string kSelectApplicationRevoked =
"SELECT `is_revoked` FROM `application` WHERE `id` = ?";
@@ -785,15 +876,22 @@ 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`, `icon_url`, "
+ "`allow_unknown_rpc_passthrough`) "
+ " 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`, "
+ "`icon_url`, "
+ " `allow_unknown_rpc_passthrough` "
+ "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..c6f78d6d70 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,26 @@ 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);
+ *params.icon_url = query.GetString(10);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(11);
+
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
@@ -754,6 +768,11 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
return false;
}
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
+ return false;
+ }
+
(*policies).apps[app_id] = params;
}
return true;
@@ -930,6 +949,21 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// All predefined apps (e.g. default, pre_DataConsent) should be saved first,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -984,6 +1018,28 @@ 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);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(11, *app.second.icon_url)
+ : app_query.Bind(11);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(12, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(12);
+
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -1022,6 +1078,11 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
+
return true;
}
@@ -1181,6 +1242,85 @@ bool SQLPTRepresentation::SaveRequestSubType(
return true;
}
+bool SQLPTRepresentation::SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters) {
+ LOG4CXX_INFO(logger_, "Save app service parameters");
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ return false;
+ }
+ policy_table::AppServiceParameters::const_iterator it;
+ for (it = app_service_parameters.begin(); it != app_service_parameters.end();
+ ++it) {
+ // Create service type id from hashing app_id and service_type
+ std::string str_to_hash = std::string(app_id + it->first);
+ const long int id = abs(CacheManager::GenerateHash(str_to_hash));
+ query.Bind(0, static_cast<int64_t>(id));
+ query.Bind(1, it->first);
+ query.Bind(2, app_id);
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
+ return false;
+ }
+
+ // Insert app names array into db
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
+ return false;
+ }
+
+ auto app_service_names = it->second.service_names;
+
+ if (app_service_names.is_initialized() && app_service_names->empty()) {
+ // App service names is an empty array
+ LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ return false;
+ }
+ } else {
+ policy_table::AppServiceNames::const_iterator names_it;
+ for (names_it = app_service_names->begin();
+ names_it != app_service_names->end();
+ ++names_it) {
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1, *names_it);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ return false;
+ }
+ }
+ }
+
+ // Insert handled rpcs array into db
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert statement for app service handled rpcs");
+ return false;
+ }
+
+ auto handled_rpcs = it->second.handled_rpcs;
+ policy_table::AppServiceHandledRpcs::const_iterator rpc_it;
+ for (rpc_it = handled_rpcs.begin(); rpc_it != handled_rpcs.end();
+ ++rpc_it) {
+ handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
+ handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
+ if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
utils::dbms::SQLQuery query(db());
@@ -1619,6 +1759,64 @@ bool SQLPTRepresentation::GatherRequestSubType(
return true;
}
+bool SQLPTRepresentation::GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_INFO(logger_, "Gather app service info");
+ utils::dbms::SQLQuery service_type_query(db());
+ if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ return false;
+ }
+
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ return false;
+ }
+
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ return false;
+ }
+
+ service_type_query.Bind(0, app_id);
+ while (service_type_query.Next()) {
+ const int service_type_id = service_type_query.GetInteger(0);
+ std::string service_type = service_type_query.GetString(1);
+ LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type);
+ (*app_service_parameters)[service_type] = policy_table::AppServiceInfo();
+
+ service_name_query.Bind(0, service_type_id);
+ while (service_name_query.Next()) {
+ LOG4CXX_DEBUG(logger_, "Loading service name");
+ (*app_service_parameters)[service_type].service_names->push_back(
+ service_name_query.GetString(0));
+ (*app_service_parameters)[service_type].service_names->mark_initialized();
+ }
+
+ handled_rpcs_query.Bind(0, service_type_id);
+ while (handled_rpcs_query.Next()) {
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = handled_rpcs_query.GetInteger(0);
+ (*app_service_parameters)[service_type].handled_rpcs.push_back(
+ handled_rpc);
+ }
+
+ if (!service_name_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ return false;
+ }
+ if (!handled_rpcs_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
@@ -1969,6 +2167,12 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
return false;
}
+ policy_table::AppServiceParameters app_service_parameters;
+ if (!GatherAppServiceParameters(kDefaultId, &app_service_parameters) ||
+ !SaveAppServiceParameters(app_id, app_service_parameters)) {
+ return false;
+ }
+
return SetIsDefault(app_id, true);
}
@@ -2084,6 +2288,21 @@ 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));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
+ source_app.IsNull(16) ? query.Bind(17)
+ : query.Bind(17, source_app.GetBoolean(16));
+
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/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
index ff054b3cc4..97b1768666 100644
--- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
@@ -834,6 +834,37 @@ TEST_F(
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
}
+TEST_F(PolicyManagerImplTest2, UpdateApplication_AppServices) {
+ std::string kServiceType = "MEDIA";
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ GetPTU("valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ // Try to add existing app
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ manager->GetAppServiceParameters(app_id2, &app_service_parameters);
+
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+
+ ASSERT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ ASSERT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
+
+ // Check no update required
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+}
+
TEST_F(PolicyManagerImplTest2,
PTUpdatedAt_DaysNotExceedLimit_ExpectNoUpdateRequired) {
// Arrange
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..675d708843 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
@@ -124,6 +124,13 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
policy_table::ApplicationPoliciesSection* policies) const {
return ::SQLPTRepresentation::GatherApplicationPoliciesSection(policies);
}
+
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* policies) const {
+ return ::SQLPTRepresentation::GatherAppServiceParameters(app_id, policies);
+ }
+
virtual void GatherDeviceData(policy_table::DeviceData* data) const {
::SQLPTRepresentation::GatherDeviceData(data);
}
@@ -314,6 +321,21 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
app_policies["1234"]["keep_context"] = Json::Value(false);
app_policies["1234"]["steal_focus"] = Json::Value(false);
app_policies["1234"]["RequestType"] = Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"] = Json::Value(Json::objectValue);
+ app_policies["1234"]["app_services"]["MEDIA"] =
+ Json::Value(Json::objectValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"] =
+ Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"][0] =
+ Json::Value("SDL App");
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"][1] =
+ Json::Value("SDL Music");
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"] =
+ Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"][0] =
+ Json::Value(Json::objectValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"][0]
+ ["function_id"] = Json::Value(41);
app_policies["device"] = Json::Value(Json::objectValue);
app_policies["device"]["groups"] = Json::Value(Json::arrayValue);
@@ -426,8 +448,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 33 tables in the database, now.
+ const int32_t total_tables_number = 33;
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`";
@@ -1706,6 +1728,23 @@ TEST_F(SQLPTRepresentationTest, Save_SetPolicyTableThenSave_ExpectSavedToPT) {
GatherDeviceData(&devices);
EXPECT_EQ(3u, devices.size());
+
+ const std::string kAppId = "1234";
+ const std::string kServiceType = "MEDIA";
+ policy_table::AppServiceParameters app_service_parameters;
+ GatherAppServiceParameters(kAppId, &app_service_parameters);
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+ EXPECT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ EXPECT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
}
} // namespace policy_test
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..acf18c5706 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
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "heart_beat_timeout_ms": 5000
+ "heart_beat_timeout_ms": 5000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1598,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1616,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1634,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1651,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/protocol/src/bson_object_keys.cc b/src/components/protocol/src/bson_object_keys.cc
index 11160d7082..acafd3dbd2 100644
--- a/src/components/protocol/src/bson_object_keys.cc
+++ b/src/components/protocol/src/bson_object_keys.cc
@@ -18,6 +18,7 @@ const char* video_service_transports = "videoServiceTransports";
const char* tcp_ip_address = "tcpIpAddress";
const char* tcp_port = "tcpPort";
const char* reason = "reason";
+const char* auth_token = "authToken";
} // namespace strings
diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt
index ff8678b826..ed3aaaf24c 100644
--- a/src/components/protocol_handler/CMakeLists.txt
+++ b/src/components/protocol_handler/CMakeLists.txt
@@ -65,6 +65,7 @@ endforeach()
add_library(ProtocolHandler ${SOURCES})
+add_dependencies(ProtocolHandler libbson)
target_link_libraries(ProtocolHandler ${LIBRARIES})
if(BUILD_TESTS)
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..7c2b411dcb 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
@@ -141,7 +141,8 @@ typedef enum {
TT_NONE = -1,
TT_USB = 0,
TT_BLUETOOTH = 1,
- TT_WIFI = 2
+ TT_WIFI = 2,
+ TT_WEBSOCKET = 3
} TransportType;
struct TransportDescription {
@@ -428,6 +429,9 @@ class ProtocolHandlerImpl
void NotifySessionStarted(const SessionContext& context,
std::vector<std::string>& rejected_params) OVERRIDE;
+ void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
#ifdef BUILD_TESTS
const impl::FromMobileQueue& get_from_mobile_queue() const {
return raw_ford_messages_from_mobile_;
@@ -512,6 +516,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;
@@ -773,6 +781,10 @@ class ProtocolHandlerImpl
sync_primitives::Lock start_session_frame_map_lock_;
StartSessionFrameMap start_session_frame_map_;
+ // Map policy app id -> auth token
+ sync_primitives::Lock auth_token_map_lock_;
+ std::map<std::string, std::string> auth_token_map_;
+
bool tcp_enabled_;
std::string tcp_port_;
std::string tcp_ip_address_;
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index d03030b747..944d80d5d9 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -59,10 +59,11 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
std::string ConvertPacketDataToString(const uint8_t* data,
const size_t data_size);
-const size_t kStackSize = 65536;
+const size_t kStackSize = 131072;
-utils::SemanticVersion defaultProtocolVersion(5, 1, 0);
-utils::SemanticVersion minMultipleTransportsVersion(5, 1, 0);
+utils::SemanticVersion default_protocol_version(5, 2, 0);
+utils::SemanticVersion min_multiple_transports_version(5, 1, 0);
+utils::SemanticVersion min_cloud_app_version(5, 2, 0);
ProtocolHandlerImpl::ProtocolHandlerImpl(
const ProtocolHandlerSettings& settings,
@@ -309,16 +310,16 @@ void ProtocolHandlerImpl::SendStartSessionAck(
&params, strings::hash_id)));
// Minimum protocol version supported by both
- utils::SemanticVersion* minVersion =
+ utils::SemanticVersion* min_version =
(full_version.major_version_ < PROTOCOL_VERSION_5)
- ? &defaultProtocolVersion
+ ? &default_protocol_version
: utils::SemanticVersion::min(full_version,
- defaultProtocolVersion);
- char protocolVersionString[256];
- strncpy(protocolVersionString, (*minVersion).toString().c_str(), 255);
+ default_protocol_version);
+ char protocol_version_string[256];
+ strncpy(protocol_version_string, (*min_version).toString().c_str(), 255);
const bool protocol_ver_written = bson_object_put_string(
- &params, strings::protocol_version, protocolVersionString);
+ &params, strings::protocol_version, protocol_version_string);
UNUSED(protocol_ver_written);
LOG4CXX_DEBUG(
logger_,
@@ -327,12 +328,12 @@ void ProtocolHandlerImpl::SendStartSessionAck(
<< bson_object_get_string(&params, strings::protocol_version));
LOG4CXX_INFO(logger_,
- "Protocol Version String " << protocolVersionString);
+ "Protocol Version String " << protocol_version_string);
std::vector<std::string> secondaryTransports;
std::vector<int32_t> audioServiceTransports;
std::vector<int32_t> videoServiceTransports;
- if (*minVersion >= minMultipleTransportsVersion) {
+ if (*min_version >= min_multiple_transports_version) {
if (ParseSecondaryTransportConfiguration(connection_id,
secondaryTransports,
audioServiceTransports,
@@ -410,10 +411,23 @@ void ProtocolHandlerImpl::SendStartSessionAck(
connection_handler_.SetSecondaryTransportID(session_id,
kDisabledSecondary);
}
+
+ std::string policy_app_id =
+ connection_handler_.GetCloudAppID(connection_id);
+ if (*min_version >= min_cloud_app_version && !policy_app_id.empty()) {
+ sync_primitives::AutoLock lock(auth_token_map_lock_);
+ auto it = auth_token_map_.find(policy_app_id);
+ if (it != auth_token_map_.end()) {
+ char auth_token[65536];
+ strncpy(auth_token, it->second.c_str(), 65535);
+ auth_token[sizeof(auth_token) - 1] = '\0';
+ bson_object_put_string(&params, strings::auth_token, auth_token);
+ }
+ }
}
- uint8_t* payloadBytes = bson_object_to_bytes(&params);
- ptr->set_data(payloadBytes, bson_object_size(&params));
- free(payloadBytes);
+ uint8_t* payload_bytes = bson_object_to_bytes(&params);
+ ptr->set_data(payload_bytes, bson_object_size(&params));
+ free(payload_bytes);
} else {
set_hash_id(hash_id, *ptr);
}
@@ -1087,6 +1101,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) {
@@ -1181,6 +1199,17 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated(
}
}
+void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(auth_token_map_lock_);
+ if (auth_token.empty()) {
+ auth_token_map_.erase(policy_app_id);
+ } else {
+ auth_token_map_[policy_app_id] = auth_token;
+ }
+}
+
RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
if (!packet) {
@@ -1681,13 +1710,12 @@ void ProtocolHandlerImpl::NotifySessionStarted(
start_session_frame_map_.erase(it);
}
- const ServiceType service_type = ServiceTypeFromByte(packet->service_type());
const uint8_t protocol_version = packet->protocol_version();
if (0 == context.new_session_id_) {
LOG4CXX_WARN(logger_,
"Refused by session_observer to create service "
- << static_cast<int32_t>(service_type) << " type.");
+ << packet->service_type() << " type.");
SendStartSessionNAck(context.connection_id_,
packet->session_id(),
protocol_version,
@@ -1752,6 +1780,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
}
#ifdef ENABLE_SECURITY
+ const ServiceType service_type = ServiceTypeFromByte(packet->service_type());
// for packet is encrypted and security plugin is enable
if (context.is_protected_ && security_manager_) {
const uint32_t connection_key = session_observer_.KeyFromPair(
@@ -2245,7 +2274,10 @@ const impl::TransportTypes transportTypes = {
impl::TransportDescription(impl::TransportType::TT_USB, true, false)),
std::make_pair(
std::string("IAP_CARPLAY"),
- impl::TransportDescription(impl::TransportType::TT_WIFI, true, false))};
+ impl::TransportDescription(impl::TransportType::TT_WIFI, true, false)),
+ std::make_pair(std::string("WEBSOCKET"),
+ impl::TransportDescription(
+ impl::TransportType::TT_WEBSOCKET, false, false))};
const impl::TransportDescription
ProtocolHandlerImpl::GetTransportTypeFromConnectionType(
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index 51284dfcda..e1149fefb2 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -29,19 +29,19 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include <string>
-#include "protocol_handler/protocol_handler.h"
-#include "protocol_handler/protocol_handler_impl.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "protocol/bson_object_keys.h"
#include "protocol/common.h"
#include "protocol_handler/control_message_matcher.h"
#include "protocol_handler/mock_protocol_handler.h"
-#include "protocol_handler/mock_protocol_observer.h"
#include "protocol_handler/mock_protocol_handler_settings.h"
+#include "protocol_handler/mock_protocol_observer.h"
#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
-#include "connection_handler/connection_handler_impl.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_handler_impl.h"
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_ssl_context.h"
@@ -50,8 +50,8 @@
#include "utils/mock_system_time_handler.h"
#include "utils/semantic_version.h"
-#include "utils/test_async_waiter.h"
#include <bson_object.h>
+#include "utils/test_async_waiter.h"
namespace transport_manager {
namespace transport_adapter {
@@ -59,8 +59,8 @@ namespace transport_adapter {
const char* tc_enabled = "enabled";
const char* tc_tcp_port = "tcp_port";
const char* tc_tcp_ip_address = "tcp_ip_address";
-}
-}
+} // namespace transport_adapter
+} // namespace transport_manager
namespace test {
namespace components {
@@ -70,50 +70,50 @@ namespace protocol_handler_test {
#define NEW_SESSION_ID 0u
#define SESSION_START_REJECT 0u
// Protocol Handler Entities
-using protocol_handler::ProtocolHandlerImpl;
-using protocol_handler::ServiceType;
-using protocol_handler::RawMessage;
-using protocol_handler::RawMessagePtr;
-using protocol_handler::PROTECTION_ON;
-using protocol_handler::PROTECTION_OFF;
-using protocol_handler::PROTOCOL_VERSION_1;
-using protocol_handler::PROTOCOL_VERSION_2;
-using protocol_handler::PROTOCOL_VERSION_3;
-using protocol_handler::PROTOCOL_VERSION_4;
-using protocol_handler::PROTOCOL_VERSION_5;
-using protocol_handler::PROTOCOL_VERSION_MAX;
-using protocol_handler::FRAME_TYPE_CONTROL;
-using protocol_handler::FRAME_TYPE_SINGLE;
-using protocol_handler::FRAME_TYPE_FIRST;
-using protocol_handler::FRAME_TYPE_CONSECUTIVE;
-using protocol_handler::FRAME_TYPE_MAX_VALUE;
-using protocol_handler::MAXIMUM_FRAME_DATA_V2_SIZE;
-using protocol_handler::FRAME_DATA_START_SERVICE;
-using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
-using protocol_handler::FRAME_DATA_END_SERVICE_NACK;
-using protocol_handler::FRAME_DATA_END_SERVICE_ACK;
using protocol_handler::FRAME_DATA_END_SERVICE;
+using protocol_handler::FRAME_DATA_END_SERVICE_ACK;
+using protocol_handler::FRAME_DATA_END_SERVICE_NACK;
+using protocol_handler::FRAME_DATA_FIRST;
using protocol_handler::FRAME_DATA_HEART_BEAT;
using protocol_handler::FRAME_DATA_HEART_BEAT_ACK;
-using protocol_handler::FRAME_DATA_SERVICE_DATA_ACK;
-using protocol_handler::FRAME_DATA_SINGLE;
-using protocol_handler::FRAME_DATA_FIRST;
using protocol_handler::FRAME_DATA_LAST_CONSECUTIVE;
using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT;
using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK;
using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK;
+using protocol_handler::FRAME_DATA_SERVICE_DATA_ACK;
+using protocol_handler::FRAME_DATA_SINGLE;
+using protocol_handler::FRAME_DATA_START_SERVICE;
+using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
using protocol_handler::FRAME_DATA_TRANSPORT_EVENT_UPDATE;
-using protocol_handler::kRpc;
-using protocol_handler::kControl;
+using protocol_handler::FRAME_TYPE_CONSECUTIVE;
+using protocol_handler::FRAME_TYPE_CONTROL;
+using protocol_handler::FRAME_TYPE_FIRST;
+using protocol_handler::FRAME_TYPE_MAX_VALUE;
+using protocol_handler::FRAME_TYPE_SINGLE;
using protocol_handler::kAudio;
-using protocol_handler::kMobileNav;
using protocol_handler::kBulk;
+using protocol_handler::kControl;
using protocol_handler::kInvalidServiceType;
+using protocol_handler::kMobileNav;
+using protocol_handler::kRpc;
+using protocol_handler::MAXIMUM_FRAME_DATA_V2_SIZE;
+using protocol_handler::PROTECTION_OFF;
+using protocol_handler::PROTECTION_ON;
+using protocol_handler::PROTOCOL_VERSION_1;
+using protocol_handler::PROTOCOL_VERSION_2;
+using protocol_handler::PROTOCOL_VERSION_3;
+using protocol_handler::PROTOCOL_VERSION_4;
+using protocol_handler::PROTOCOL_VERSION_5;
+using protocol_handler::PROTOCOL_VERSION_MAX;
+using protocol_handler::ProtocolHandlerImpl;
+using protocol_handler::RawMessage;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::ServiceType;
// For TM states
-using transport_manager::TransportManagerListener;
using test::components::security_manager_test::MockSystemTimeHandler;
-using transport_manager::E_SUCCESS;
using transport_manager::DeviceInfo;
+using transport_manager::E_SUCCESS;
+using transport_manager::TransportManagerListener;
#ifdef ENABLE_SECURITY
// For security
using ContextCreationStrategy =
@@ -122,21 +122,21 @@ using ContextCreationStrategy =
// For CH entities
using connection_handler::DeviceHandle;
// Google Testing Framework Entities
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::ReturnRefOfCopy;
-using ::testing::ReturnNull;
+using ::testing::_;
using ::testing::An;
using ::testing::AnyOf;
using ::testing::AtLeast;
using ::testing::ByRef;
using ::testing::DoAll;
-using ::testing::SaveArg;
using ::testing::Eq;
-using ::testing::_;
using ::testing::Invoke;
-using ::testing::SetArgReferee;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::ReturnRef;
+using ::testing::ReturnRefOfCopy;
+using ::testing::SaveArg;
using ::testing::SetArgPointee;
+using ::testing::SetArgReferee;
typedef std::vector<uint8_t> UCharDataVector;
@@ -149,7 +149,7 @@ namespace {
const uint32_t kAsyncExpectationsTimeout = 10000u;
const uint32_t kMicrosecondsInMillisecond = 1000u;
const uint32_t kAddSessionWaitTimeMs = 100u;
-}
+} // namespace
class ProtocolHandlerImplTest : public ::testing::Test {
protected:
@@ -383,6 +383,9 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const std::vector<int32_t>& expected_audio_service_transports,
const std::vector<int32_t>& expected_video_service_transports);
+ void VerifyCloudAppParamsInStartSessionAck(const std::string& policy_app_id,
+ char* auth_token);
+
testing::NiceMock<MockProtocolHandlerSettings> protocol_handler_settings_mock;
std::shared_ptr<ProtocolHandlerImpl> protocol_handler_impl;
TransportManagerListener* tm_listener;
@@ -1920,6 +1923,117 @@ void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
bson_object_deinitialize(&expected_obj);
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(
+ FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
+ const std::string& policy_app_id, char* auth_token) {
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 2, 0);
+ char full_version_string[] = "5.2.0";
+
+ // configuration setup
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(connection_handler_mock, GetCloudAppID(connection_id))
+ .WillOnce(Return(policy_app_id));
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(false));
+ std::vector<std::string> empty_vec;
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillRepeatedly(ReturnRef(empty_vec));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillRepeatedly(ReturnRef(empty_vec));
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return("WEBSOCKET"));
+
+ // Prepare expected BSON parameters. When we add another param in Start
+ // Service ACK frame in future, it should be also added here.
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+
+ // mtu
+ bson_object_put_int64(&expected_obj,
+ protocol_handler::strings::mtu,
+ static_cast<int64_t>(maximum_rpc_payload_size));
+ // hashId
+ bson_object_put_int32(&expected_obj,
+ protocol_handler::strings::hash_id,
+ static_cast<int32_t>(hash_id));
+ // protocolVersion
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::protocol_version,
+ full_version_string);
+
+ // secondaryTransports
+ BsonArray secondary_transports;
+ bson_array_initialize(&secondary_transports, 0);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::secondary_transports,
+ &secondary_transports);
+
+ BsonArray audio_service_transports;
+ bson_array_initialize(&audio_service_transports, 1);
+ bson_array_add_int32(&audio_service_transports, 1);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::audio_service_transports,
+ &audio_service_transports);
+
+ BsonArray video_service_transports;
+ bson_array_initialize(&video_service_transports, 1);
+ bson_array_add_int32(&video_service_transports, 1);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::video_service_transports,
+ &video_service_transports);
+
+ // authToken
+ bson_object_put_string(
+ &expected_obj, protocol_handler::strings::auth_token, auth_token);
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK,
PROTECTION_OFF,
@@ -1938,6 +2052,8 @@ void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
.WillOnce(ReturnNull());
#endif // ENABLE_SECURITY
+ protocol_handler_impl->OnAuthTokenUpdated(policy_app_id,
+ std::string(auth_token));
protocol_handler_impl->SendStartSessionAck(connection_id,
session_id,
input_protocol_version,
@@ -2468,6 +2584,18 @@ TEST_F(ProtocolHandlerImplTest, StartSessionAck_PrimaryTransportUSBHostMode) {
expected_video_service_transports);
}
+TEST_F(ProtocolHandlerImplTest, StartSessionAck_CloudAppAuthTokenAvailable) {
+ std::string policy_id = "policy_id";
+ char auth_token[] = "Sample auth token";
+
+ // A TransportUpdateEvent is also issued after Start Service ACK. We don't
+ // check it in this test case.
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifyCloudAppParamsInStartSessionAck(policy_id, auth_token);
+}
+
TEST_F(ProtocolHandlerImplTest,
TransportEventUpdate_afterVersionNegotiation_TCPEnabled) {
TestAsyncWaiter waiter;
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
index 6c8bb359af..960ca10e21 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
@@ -206,6 +206,7 @@ String<minlen, maxlen>::String(const Json::Value* value,
if (!is_initialized()) {
value_state_ = kValid;
} else if (is_valid()) {
+ value_ = value->asString();
value_state_ = length_range_.Includes(value_.length()) ? kValid : kInvalid;
}
}
diff --git a/src/components/security_manager/CMakeLists.txt b/src/components/security_manager/CMakeLists.txt
index 88bc1ddab4..272c7aad2f 100644
--- a/src/components/security_manager/CMakeLists.txt
+++ b/src/components/security_manager/CMakeLists.txt
@@ -39,6 +39,7 @@ include_directories(
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/application_manager/include/
${JSONCPP_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${APR_INCLUDE_DIRECTORY}
)
diff --git a/src/components/smart_objects/CMakeLists.txt b/src/components/smart_objects/CMakeLists.txt
index 84da05ce03..ef84c52ab9 100644
--- a/src/components/smart_objects/CMakeLists.txt
+++ b/src/components/smart_objects/CMakeLists.txt
@@ -34,6 +34,7 @@ include_directories(
${COMPONENTS_DIR}/include
${COMPONENTS_DIR}/smart_objects/include
${COMPONENTS_DIR}/utils/include
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
index bfa39af10a..05c53ec582 100644
--- a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
@@ -53,12 +53,17 @@ class CAlwaysFalseSchemaItem : public ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
CAlwaysFalseSchemaItem();
diff --git a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
index 4750c280e5..a2d305d0f9 100644
--- a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
@@ -53,12 +53,17 @@ class CAlwaysTrueSchemaItem : public ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
CAlwaysTrueSchemaItem();
diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h
index a81fdd637e..7706b6e091 100644
--- a/src/components/smart_objects/include/smart_objects/array_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h
@@ -68,23 +68,28 @@ class CArraySchemaItem : public ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Apply schema.
*
* @param Object Object to apply schema.
- *
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion =
utils::SemanticVersion()) OVERRIDE;
@@ -92,8 +97,11 @@ class CArraySchemaItem : public ISchemaItem {
* @brief Unapply schema.
*
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
/**
* @brief Build smart object by smart schema having copied matched
diff --git a/src/components/smart_objects/include/smart_objects/default_shema_item.h b/src/components/smart_objects/include/smart_objects/default_shema_item.h
index 5978fcb282..beeeaac81f 100644
--- a/src/components/smart_objects/include/smart_objects/default_shema_item.h
+++ b/src/components/smart_objects/include/smart_objects/default_shema_item.h
@@ -53,12 +53,17 @@ class CDefaultSchemaItem : public ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Set default value to an object.
@@ -105,7 +110,8 @@ template <typename Type>
errors::eType CDefaultSchemaItem<Type>::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (getSmartType() != Object.getType()) {
std::string validation_info = "Incorrect type, expected: " +
SmartObject::typeToString(getSmartType()) +
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..2a27f765d2 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
@@ -108,12 +108,17 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Return the correct history signature based on message version.
* @param signatures Vector reference of enums history items.
@@ -129,18 +134,22 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> {
* and tries to convert it to integer according to element-to-string
* map.
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion =
utils::SemanticVersion()) OVERRIDE;
/**
* @brief Unapply schema.
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
private:
/**
@@ -220,11 +229,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;
}
@@ -307,10 +315,14 @@ template <typename EnumType>
errors::eType TEnumSchemaItem<EnumType>::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Integer != Object.getType()) {
std::string validation_info;
if (SmartType_String == Object.getType()) {
+ if (allow_unknown_enums) {
+ return errors::OK;
+ }
validation_info = "Invalid enum value: " + Object.asString();
} else {
validation_info = "Incorrect type, expected: " +
@@ -366,7 +378,7 @@ errors::eType TEnumSchemaItem<EnumType>::validate(
template <typename EnumType>
void TEnumSchemaItem<EnumType>::applySchema(
SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {
if (SmartType_String == Object.getType()) {
EnumType enum_val = static_cast<EnumType>(-1);
@@ -377,7 +389,8 @@ void TEnumSchemaItem<EnumType>::applySchema(
}
template <typename EnumType>
-void TEnumSchemaItem<EnumType>::unapplySchema(SmartObject& Object) {
+void TEnumSchemaItem<EnumType>::unapplySchema(
+ SmartObject& Object, const bool remove_unknown_parameters) {
if (SmartType_Integer == Object.getType()) {
const char* str;
if (ConversionHelper::EnumToCString(static_cast<EnumType>(Object.asInt()),
diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h
index 6481605daf..b3e227e0f1 100644
--- a/src/components/smart_objects/include/smart_objects/number_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h
@@ -70,12 +70,17 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
/**
@@ -137,7 +142,8 @@ template <typename NumberType>
errors::eType TNumberSchemaItem<NumberType>::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (!isValidNumberType(Object.getType())) {
SmartType expectedType = (typeid(double) == typeid(Object.getType()))
? SmartType_Double
diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h
index 45d161320b..7b57792c1e 100644
--- a/src/components/smart_objects/include/smart_objects/object_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h
@@ -109,27 +109,36 @@ class CObjectSchemaItem : public ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Apply schema.
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion =
utils::SemanticVersion()) OVERRIDE;
/**
* @brief Unapply schema.
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
/**
* @brief Build smart object by smart schema having copied matched
* parameters from pattern smart object
diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h
index 24c642c0ba..fa5f6d3adc 100644
--- a/src/components/smart_objects/include/smart_objects/schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/schema_item.h
@@ -58,13 +58,18 @@ class ISchemaItem {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* message if an error occurs
- * @param MessageVersion to check mobile RPC version against RPC Spec Histor
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
virtual errors::eType validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false);
/**
* @brief Set default value to an object.
@@ -88,21 +93,25 @@ class ISchemaItem {
* @brief Apply schema.
*
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
virtual void applySchema(
ns_smart_device_link::ns_smart_objects::SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
* @brief Unapply schema.
*
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
virtual void unapplySchema(
- ns_smart_device_link::ns_smart_objects::SmartObject& Object);
+ ns_smart_device_link::ns_smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters = true);
/**
* @brief Build smart object by smart schema having copied matched
diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h
index 2abc221972..b862d25a17 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -676,11 +676,16 @@ class SmartObject FINAL {
*
* @param report__ object for reporting errors during validation
* @param messageVersion of the mobile app to check against RPC Spec Schema
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return Result of validation.
*/
errors::eType validate(
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false);
/**
* @brief Sets new schema
diff --git a/src/components/smart_objects/include/smart_objects/smart_schema.h b/src/components/smart_objects/include/smart_objects/smart_schema.h
index 5e1497fdde..ece2696539 100644
--- a/src/components/smart_objects/include/smart_objects/smart_schema.h
+++ b/src/components/smart_objects/include/smart_objects/smart_schema.h
@@ -66,12 +66,17 @@ class CSmartSchema FINAL {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& messageVersion =
- utils::SemanticVersion()) const;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& messageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) const;
/**
* @brief Set new root schema item.
@@ -85,22 +90,26 @@ class CSmartSchema FINAL {
*
* @param Object Object to apply schema.
*
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(
SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
* @brief The reverse SmartObject conversion using schema.
*
* @param object Object to convert.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
*/
// TODO(cpplint): Is this a non-const reference?
// If so, make const or use a pointer.
- void unapplySchema(SmartObject& object);
+ void unapplySchema(SmartObject& object,
+ const bool remove_unknown_parameters = true);
/**
* @brief Build smart object by smart schema having copied matched
diff --git a/src/components/smart_objects/include/smart_objects/string_schema_item.h b/src/components/smart_objects/include/smart_objects/string_schema_item.h
index 5b37db584d..7104ff47a9 100644
--- a/src/components/smart_objects/include/smart_objects/string_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/string_schema_item.h
@@ -65,12 +65,17 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> {
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return ns_smart_objects::errors::eType
**/
- errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion =
- utils::SemanticVersion()) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
/**
diff --git a/src/components/smart_objects/src/always_false_schema_item.cc b/src/components/smart_objects/src/always_false_schema_item.cc
index ca247eed09..4f8f4584af 100644
--- a/src/components/smart_objects/src/always_false_schema_item.cc
+++ b/src/components/smart_objects/src/always_false_schema_item.cc
@@ -44,7 +44,8 @@ std::shared_ptr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() {
errors::eType CAlwaysFalseSchemaItem::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
report__->set_validation_info("Generic error");
return errors::ERROR;
}
diff --git a/src/components/smart_objects/src/always_true_schema_item.cc b/src/components/smart_objects/src/always_true_schema_item.cc
index 983733165c..855bfef2a0 100644
--- a/src/components/smart_objects/src/always_true_schema_item.cc
+++ b/src/components/smart_objects/src/always_true_schema_item.cc
@@ -42,7 +42,8 @@ std::shared_ptr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() {
errors::eType CAlwaysTrueSchemaItem::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
return errors::OK;
}
diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc
index 7d5f8bcf84..1671a97644 100644
--- a/src/components/smart_objects/src/array_schema_item.cc
+++ b/src/components/smart_objects/src/array_schema_item.cc
@@ -45,7 +45,8 @@ std::shared_ptr<CArraySchemaItem> CArraySchemaItem::create(
errors::eType CArraySchemaItem::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Array != Object.getType()) {
std::string validation_info = "Incorrect type, expected: " +
SmartObject::typeToString(SmartType_Array) +
@@ -80,7 +81,8 @@ errors::eType CArraySchemaItem::validate(
const errors::eType result =
mElementSchemaItem->validate(Object.getElement(i),
&report__->ReportSubobject(strVal.str()),
- MessageVersion);
+ MessageVersion,
+ allow_unknown_enums);
if (errors::OK != result) {
return result;
}
@@ -90,20 +92,21 @@ errors::eType CArraySchemaItem::validate(
void CArraySchemaItem::applySchema(
SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {
if (SmartType_Array == Object.getType()) {
for (size_t i = 0U; i < Object.length(); ++i) {
mElementSchemaItem->applySchema(
- Object[i], RemoveFakeParameters, MessageVersion);
+ Object[i], remove_unknown_parameters, MessageVersion);
}
}
}
-void CArraySchemaItem::unapplySchema(SmartObject& Object) {
+void CArraySchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
if (SmartType_Array == Object.getType()) {
for (size_t i = 0U; i < Object.length(); ++i) {
- mElementSchemaItem->unapplySchema(Object[i]);
+ mElementSchemaItem->unapplySchema(Object[i], remove_unknown_parameters);
}
}
}
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index 742c2ec353..21d2316e48 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -110,7 +110,8 @@ std::shared_ptr<CObjectSchemaItem> CObjectSchemaItem::create(
errors::eType CObjectSchemaItem::validate(
const SmartObject& object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Map != object.getType()) {
std::string validation_info = "Incorrect type, expected: " +
SmartObject::typeToString(SmartType_Map) +
@@ -142,8 +143,11 @@ errors::eType CObjectSchemaItem::validate(
errors::eType result = errors::OK;
// Check if MessageVersion matches schema version
- result = correct_member.mSchemaItem->validate(
- field, &report__->ReportSubobject(key), MessageVersion);
+ result =
+ correct_member.mSchemaItem->validate(field,
+ &report__->ReportSubobject(key),
+ MessageVersion,
+ allow_unknown_enums);
if (errors::OK != result) {
return result;
}
@@ -154,13 +158,13 @@ errors::eType CObjectSchemaItem::validate(
void CObjectSchemaItem::applySchema(
SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {
if (SmartType_Map != Object.getType()) {
return;
}
- if (RemoveFakeParameters) {
+ if (remove_unknown_parameters) {
RemoveFakeParams(Object, MessageVersion);
}
@@ -173,16 +177,17 @@ void CObjectSchemaItem::applySchema(
if (member.mSchemaItem->setDefaultValue(default_value)) {
Object[key] = default_value;
member.mSchemaItem->applySchema(
- Object[key], RemoveFakeParameters, MessageVersion);
+ Object[key], remove_unknown_parameters, MessageVersion);
}
} else {
member.mSchemaItem->applySchema(
- Object[key], RemoveFakeParameters, MessageVersion);
+ Object[key], remove_unknown_parameters, MessageVersion);
}
}
}
-void CObjectSchemaItem::unapplySchema(SmartObject& Object) {
+void CObjectSchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
if (SmartType_Map != Object.getType()) {
return;
}
@@ -191,7 +196,7 @@ void CObjectSchemaItem::unapplySchema(SmartObject& Object) {
const std::string& key = it->first;
// move next to avoid wrong iterator on erase
++it;
- if (mMembers.end() == mMembers.find(key)) {
+ if (mMembers.end() == mMembers.find(key) && remove_unknown_parameters) {
// remove fake params
Object.erase(key);
}
@@ -202,7 +207,7 @@ void CObjectSchemaItem::unapplySchema(SmartObject& Object) {
const std::string& key = it->first;
const SMember& member = it->second;
if (Object.keyExists(key)) {
- member.mSchemaItem->unapplySchema(Object[key]);
+ member.mSchemaItem->unapplySchema(Object[key], remove_unknown_parameters);
}
}
}
diff --git a/src/components/smart_objects/src/schema_item.cc b/src/components/smart_objects/src/schema_item.cc
index 5e9358092a..8c40e2c7bd 100644
--- a/src/components/smart_objects/src/schema_item.cc
+++ b/src/components/smart_objects/src/schema_item.cc
@@ -38,7 +38,8 @@ namespace ns_smart_objects {
errors::eType ISchemaItem::validate(
const SmartObject& object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
return errors::ERROR;
}
@@ -51,10 +52,11 @@ bool ISchemaItem::hasDefaultValue(SmartObject& Object) {
}
void ISchemaItem::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {}
-void ISchemaItem::unapplySchema(SmartObject& Object) {}
+void ISchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {}
void ISchemaItem::BuildObjectBySchema(const SmartObject& pattern_object,
SmartObject& result_object) {}
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index 1322757ab1..ef5dc787be 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -701,6 +701,9 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
case SmartType_Integer:
newData.int_value = OtherObject.m_data.int_value;
break;
+ case SmartType_UInteger:
+ newData.int_value = OtherObject.m_data.int_value;
+ break;
case SmartType_Double:
newData.double_value = OtherObject.m_data.double_value;
break;
@@ -875,8 +878,10 @@ bool SmartObject::isValid() const {
errors::eType SmartObject::validate(
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
- return m_schema.validate(*this, report__, MessageVersion);
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
+ return m_schema.validate(
+ *this, report__, MessageVersion, allow_unknown_enums);
}
void SmartObject::setSchema(const CSmartSchema& schema) {
diff --git a/src/components/smart_objects/src/smart_schema.cc b/src/components/smart_objects/src/smart_schema.cc
index f7cd22c4bc..4ab5e5ff23 100644
--- a/src/components/smart_objects/src/smart_schema.cc
+++ b/src/components/smart_objects/src/smart_schema.cc
@@ -43,8 +43,10 @@ CSmartSchema::CSmartSchema(const ISchemaItemPtr SchemaItem)
errors::eType CSmartSchema::validate(
const SmartObject& object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) const {
- return mSchemaItem->validate(object, report__, MessageVersion);
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) const {
+ return mSchemaItem->validate(
+ object, report__, MessageVersion, allow_unknown_enums);
}
void CSmartSchema::setSchemaItem(const ISchemaItemPtr schemaItem) {
@@ -52,13 +54,14 @@ void CSmartSchema::setSchemaItem(const ISchemaItemPtr schemaItem) {
}
void CSmartSchema::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters,
+ const bool remove_unknown_parameters,
const utils::SemanticVersion& MessageVersion) {
- mSchemaItem->applySchema(Object, RemoveFakeParameters, MessageVersion);
+ mSchemaItem->applySchema(Object, remove_unknown_parameters, MessageVersion);
}
-void CSmartSchema::unapplySchema(SmartObject& Object) {
- mSchemaItem->unapplySchema(Object);
+void CSmartSchema::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
+ mSchemaItem->unapplySchema(Object, remove_unknown_parameters);
}
void CSmartSchema::BuildObjectBySchema(const SmartObject& pattern_object,
diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc
index 0288ad85e8..e2ebde1861 100644
--- a/src/components/smart_objects/src/string_schema_item.cc
+++ b/src/components/smart_objects/src/string_schema_item.cc
@@ -49,7 +49,8 @@ std::shared_ptr<CStringSchemaItem> CStringSchemaItem::create(
errors::eType CStringSchemaItem::validate(
const SmartObject& Object,
rpc::ValidationReport* report__,
- const utils::SemanticVersion& MessageVersion) {
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_String != Object.getType()) {
std::string validation_info = "Incorrect type, expected: " +
SmartObject::typeToString(SmartType_String) +
diff --git a/src/components/telemetry_monitor/CMakeLists.txt b/src/components/telemetry_monitor/CMakeLists.txt
index bb33857ecd..093413ef3b 100644
--- a/src/components/telemetry_monitor/CMakeLists.txt
+++ b/src/components/telemetry_monitor/CMakeLists.txt
@@ -50,6 +50,7 @@ include_directories (
${JSONCPP_INCLUDE_DIRECTORY}
${CMAKE_BINARY_DIR}/src/components/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
index ff7b9da9d6..0d31573d8e 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
@@ -40,7 +40,7 @@
#include "utils/threads/thread_delegate.h"
#include "telemetry_monitor/metric_wrapper.h"
#include "telemetry_monitor/application_manager_observer.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager.h"
#include "telemetry_monitor/transport_manager_observer.h"
#include "transport_manager/transport_manager_impl.h"
#include "protocol_handler_observer.h"
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index 2f734b3a05..f1edb6e298 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -41,6 +41,7 @@ include_directories (
${POLICY_GLOBAL_INCLUDE_PATH}/
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
@@ -72,6 +73,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 +135,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..138f9ca895
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
@@ -0,0 +1,107 @@
+/*
+ * \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();
+
+ /**
+ * @brief Set CloudTransportConfig for specified app_id
+ *
+ * @param app_id app ID string
+ * @param properties New cloud app properties for the app
+ */
+ void SetAppCloudTransportConfig(std::string app_id,
+ CloudAppProperties properties);
+
+ /**
+ * @brief Get CloudTransportConfig for specified app_id
+ *
+ * @param app_id app ID string
+ * @return CloudAppProperties for the app
+ */
+ const CloudAppProperties& GetAppCloudTransportConfig(std::string app_id);
+
+ 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:
+ CloudAppTransportConfig transport_config_;
+};
+
+} // 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..a726524af2
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
@@ -0,0 +1,205 @@
+/*
+ * \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/asio/connect.hpp>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/thread_pool.hpp>
+#ifdef ENABLE_SECURITY
+#include <boost/asio/ssl/stream.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#endif // ENABLE_SECURITY
+#include <cstdlib>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <string>
+#include <thread>
+#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/message_queue.h"
+
+namespace websocket =
+ boost::beast::websocket; // from <boost/beast/websocket.hpp>
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+typedef websocket::stream<tcp::socket> WS;
+
+#ifdef ENABLE_SECURITY
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+typedef websocket::stream<ssl::stream<tcp::socket> > WSS;
+#endif // ENABLE_SECURITY
+
+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();
+
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Attempt to add provided certificate to the ssl::context
+ *
+ * @param cert Certificate string from policy table
+ */
+ void AddCertificateAuthority(std::string cert, boost::system::error_code& ec);
+#endif // ENABLE_SECURITY
+
+ 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_;
+ boost::beast::flat_buffer buffer_;
+ std::string host_;
+ std::string text_;
+ WS ws_;
+#ifdef ENABLE_SECURITY
+ ssl::context ctx_;
+ WSS wss_;
+#endif // ENABLE_SECURITY
+
+ std::atomic_bool shutdown_;
+
+ CloudAppProperties cloud_properties;
+ 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_;
+
+ boost::asio::thread_pool io_pool_;
+};
+
+} // 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..7a0a37758c 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
@@ -88,6 +88,10 @@ class TransportAdapterController {
*/
virtual DeviceSptr FindDevice(const DeviceUID& device_handle) const = 0;
+ virtual ConnectionSPtr FindPendingConnection(
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) const = 0;
+
/**
* @brief Create connection and fill its parameters.
*
@@ -100,6 +104,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..b30f1e35b2 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.
@@ -245,6 +264,10 @@ class TransportAdapterImpl : public TransportAdapter,
*/
DeviceSptr FindDevice(const DeviceUID& device_handle) const OVERRIDE;
+ ConnectionSPtr FindPendingConnection(
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) const OVERRIDE;
+
/**
* @brief Search for device in container of devices, if it is not there - adds
*it.
@@ -306,6 +329,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 +467,10 @@ class TransportAdapterImpl : public TransportAdapter,
return TransportConfig();
}
+ void CreateDevice(const std::string& uid) OVERRIDE {
+ return;
+ }
+
/**
* @brief Return name of device.
*
@@ -533,6 +570,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 +618,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 +648,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..60303c1bca 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,12 @@ class TransportManagerImpl
**/
int SearchDevices() OVERRIDE;
+ void AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) OVERRIDE;
+
+ void RemoveCloudDevice(const DeviceHandle device_id) OVERRIDE;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -150,6 +155,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 +380,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 +395,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..35510f4cf8
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_device.cc
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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 (!other_cloud_device) {
+ return false;
+ }
+
+ 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..0d9fda6fe5
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
@@ -0,0 +1,85 @@
+/*
+ * \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_);
+ auto connection = controller_->FindPendingConnection(device_uid, app_handle);
+
+ std::shared_ptr<WebsocketClientConnection> ws_connection =
+ std::dynamic_pointer_cast<WebsocketClientConnection>(connection);
+ if (ws_connection.use_count() == 0) {
+ return TransportAdapter::Error::BAD_PARAM;
+ }
+
+ TransportAdapter::Error error = ws_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..8298042d41
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -0,0 +1,128 @@
+/*
+ * 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() {}
+
+void CloudWebsocketTransportAdapter::SetAppCloudTransportConfig(
+ std::string app_id, CloudAppProperties properties) {
+ transport_config_[app_id] = properties;
+}
+
+const CloudAppProperties&
+CloudWebsocketTransportAdapter::GetAppCloudTransportConfig(std::string app_id) {
+ return transport_config_[app_id];
+}
+
+DeviceType CloudWebsocketTransportAdapter::GetDeviceType() const {
+ return CLOUD_WEBSOCKET;
+}
+
+void CloudWebsocketTransportAdapter::Store() const {}
+
+bool CloudWebsocketTransportAdapter::Restore() {
+ return true;
+}
+
+void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
+ // If the device has already been created, just ignore the request
+ DeviceSptr device = FindDevice(uid);
+ if (device.use_count() != 0) {
+ return;
+ }
+
+ // 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,5})(\\/"
+ "[A-Z\\d\\.-]+)*\\/?");
+ boost::smatch results;
+ std::string str = uid;
+
+ if (!boost::regex_search(str, results, group_pattern)) {
+ LOG4CXX_DEBUG(logger_, "Invalid Pattern: " << uid);
+ return;
+ }
+
+ std::string host = results[2];
+ std::string port = results[5];
+
+ LOG4CXX_DEBUG(logger_,
+ "Results: " << results[0] << " " << results[1] << " "
+ << results[2] << " " << results[3] << " "
+ << results[4] << " " << results[5] << " ");
+ 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..bb654822c3
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -0,0 +1,358 @@
+/*
+ *
+ * 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_)
+#ifdef ENABLE_SECURITY
+ , ctx_(ssl::context::sslv23_client)
+ , wss_(ioc_, ctx_)
+#endif // ENABLE_SECURITY
+ , 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)
+ , io_pool_(1) {
+}
+
+WebsocketClientConnection::~WebsocketClientConnection() {
+ ioc_.stop();
+ io_pool_.join();
+}
+
+#ifdef ENABLE_SECURITY
+void WebsocketClientConnection::AddCertificateAuthority(
+ const std::string cert, boost::system::error_code& ec) {
+ ctx_.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()),
+ ec);
+ if (ec) {
+ return;
+ }
+
+ wss_.next_layer().set_verify_mode(ssl::verify_peer);
+}
+#endif // ENABLE_SECURITY
+
+TransportAdapter::Error WebsocketClientConnection::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DeviceSptr device = controller_->FindDevice(device_uid_);
+ CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get());
+ CloudWebsocketTransportAdapter* cloud_ta =
+ static_cast<CloudWebsocketTransportAdapter*>(controller_);
+ cloud_properties = cloud_ta->GetAppCloudTransportConfig(device_uid_);
+ auto const host = cloud_device->GetHost();
+ auto const port = cloud_device->GetPort();
+ boost::system::error_code ec;
+
+ LOG4CXX_DEBUG(logger_, "Cloud app endpoint: " << cloud_properties.endpoint);
+ LOG4CXX_DEBUG(logger_,
+ "Cloud app certificate: " << cloud_properties.certificate);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Cloud app authentication token: " << cloud_properties.auth_token);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Cloud app transport type: " << cloud_properties.cloud_transport_type);
+ LOG4CXX_DEBUG(logger_,
+ "Cloud app hybrid app preference: "
+ << cloud_properties.hybrid_app_preference);
+
+ 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);
+ return TransportAdapter::FAIL;
+ }
+
+ // Make Connection to host IP Address over TCP
+ if (cloud_properties.cloud_transport_type == "WS") {
+ boost::asio::connect(ws_.next_layer(), results.begin(), results.end(), ec);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ boost::asio::connect(
+ wss_.next_layer().next_layer(), results.begin(), results.end(), ec);
+ }
+#endif // ENABLE_SECURITY
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not connect to websocket: " << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ return TransportAdapter::FAIL;
+ }
+
+#ifdef ENABLE_SECURITY
+ if (cloud_properties.cloud_transport_type == "WSS") {
+ AddCertificateAuthority(cloud_properties.certificate, ec);
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Failed to add certificate authority: "
+ << cloud_properties.certificate);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+
+ // Perform SSL Handshake
+ wss_.next_layer().handshake(ssl::stream_base::client, ec);
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not complete SSL Handshake failed with host/port: "
+ << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+ }
+#endif // ENABLE_SECURITY
+
+ // Perform websocket handshake
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.handshake(host, "/", ec);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.handshake(host, "/", ec);
+ }
+#endif // ENABLE_SECURITY
+ 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);
+ return TransportAdapter::FAIL;
+ }
+
+ // Set the binary message write option
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.binary(true);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.binary(true);
+ }
+#endif // ENABLE_SECURITY
+ write_thread_->start(threads::ThreadOptions());
+ controller_->ConnectDone(device_uid_, app_handle_);
+
+ // Start async read
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#endif // ENABLE_SECURITY
+
+ boost::asio::post(io_pool_, [&]() { ioc_.run(); });
+
+ 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;
+ }
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#endif // ENABLE_SECURITY
+}
+
+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);
+ ws_.lowest_layer().close();
+ ioc_.stop();
+ Shutdown();
+ return;
+ }
+ std::string data_str = boost::beast::buffers_to_string(buffer_.data());
+
+ 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_;
+ thread_delegate_ = NULL;
+ threads::DeleteThread(write_thread_);
+ write_thread_ = NULL;
+ }
+ 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;
+ if (handler_.cloud_properties.cloud_transport_type == "WS") {
+ handler_.ws_.write(
+ boost::asio::buffer(message_ptr->data(), message_ptr->data_size()));
+ }
+#ifdef ENABLE_SECURITY
+ else if (handler_.cloud_properties.cloud_transport_type == "WSS") {
+ handler_.wss_.write(
+ boost::asio::buffer(message_ptr->data(), message_ptr->data_size()));
+ }
+#endif // ENABLE_SECURITY
+ if (ec) {
+ LOG4CXX_ERROR(logger_, "Error writing to websocket");
+ 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..865e8d6aa8 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;
}
@@ -226,7 +233,9 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
server_connection_factory_->CreateConnection(device_id, app_handle);
if (TransportAdapter::OK != err) {
connections_lock_.AcquireForWriting();
- connections_.erase(std::make_pair(device_id, app_handle));
+ if (!pending_app) {
+ connections_.erase(std::make_pair(device_id, app_handle));
+ }
connections_lock_.Release();
}
LOG4CXX_TRACE(logger_, "exit with error: " << err);
@@ -239,6 +248,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 +283,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 +366,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 +487,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) {
@@ -728,6 +821,26 @@ void TransportAdapterImpl::DeviceSwitched(const DeviceUID& device_handle) {
UNUSED(device_handle);
}
+ConnectionSPtr TransportAdapterImpl::FindPendingConnection(
+ const DeviceUID& device_id, const ApplicationHandle& app_handle) const {
+ LOG4CXX_TRACE(logger_,
+ "enter. device_id: " << &device_id
+ << ", app_handle: " << &app_handle);
+ ConnectionSPtr connection;
+ connections_lock_.AcquireForReading();
+ ConnectionMap::const_iterator it =
+ connections_.find(std::make_pair(device_id, app_handle));
+ if (it != connections_.end()) {
+ const ConnectionInfo& info = it->second;
+ if (info.state == ConnectionInfo::PENDING) {
+ connection = info.connection;
+ }
+ }
+ connections_lock_.Release();
+ LOG4CXX_TRACE(logger_, "exit with Connection: " << connection);
+ return connection;
+}
+
DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
DeviceSptr ret;
@@ -743,6 +856,34 @@ DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
return ret;
}
+void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
+ const ApplicationHandle& app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ connections_lock_.AcquireForWriting();
+ 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();
+
+ DeviceSptr device = FindDevice(device_id);
+ if (device.use_count() == 0) {
+ LOG4CXX_ERROR(
+ logger_, "Unable to find device, cannot set connection pending status");
+ return;
+ } else {
+ device->set_connection_status(ConnectionStatus::PENDING);
+ }
+
+ 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_,
@@ -1036,12 +1177,13 @@ void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid,
void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device_handle: " << &device_handle);
+ LOG4CXX_DEBUG(logger_, "Remove Device_handle: " << &device_handle);
sync_primitives::AutoLock locker(devices_mutex_);
DeviceMap::iterator i = devices_.find(device_handle);
if (i != devices_.end()) {
DeviceSptr device = i->second;
- if (!device->keep_on_disconnect()) {
+ bool is_cloud_device = (GetDeviceType() == DeviceType::CLOUD_WEBSOCKET);
+ if (!device->keep_on_disconnect() || is_cloud_device) {
devices_.erase(i);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
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..41487b054b 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,19 @@ 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());
+#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..2d93b898b4 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -50,6 +50,7 @@
#include "transport_manager/transport_manager_listener.h"
#include "transport_manager/transport_manager_listener_empty.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
#include "config_profile/profile.h"
@@ -129,6 +130,40 @@ void TransportManagerImpl::ReconnectionTimeout() {
device_to_reconnect_);
}
+void TransportManagerImpl::AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) {
+ transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN;
+ if (cloud_properties.cloud_transport_type == "WS") {
+ type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
+ }
+#endif // ENABLE_SECURITY
+ else {
+ return;
+ }
+
+ std::vector<TransportAdapter*>::iterator ta = transport_adapters_.begin();
+ for (; ta != transport_adapters_.end(); ++ta) {
+ if ((*ta)->GetDeviceType() == type) {
+ (*ta)->CreateDevice(cloud_properties.endpoint);
+ transport_adapter::CloudWebsocketTransportAdapter* cta =
+ static_cast<transport_adapter::CloudWebsocketTransportAdapter*>(*ta);
+ cta->SetAppCloudTransportConfig(cloud_properties.endpoint,
+ cloud_properties);
+ }
+ }
+
+ 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 +192,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,22 +1005,93 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST");
break;
}
+ 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());
+ 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::OnConnectionPending,
+ 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_PENDING");
+ break;
+ }
case EventTypeEnum::ON_CONNECT_DONE: {
const DeviceHandle device_handle = converter_.UidToHandle(
event.device_uid, event.transport_adapter->GetConnectionType());
- AddConnection(ConnectionInternal(this,
- event.transport_adapter,
- ++connection_id_counter_,
- event.device_uid,
- event.application_id,
- device_handle));
+
+ 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_counter_);
+ 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_controller.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
index 642c193d63..1de5eac702 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
@@ -55,6 +55,9 @@ class MockTransportAdapterController : public TransportAdapterController {
void(ConnectionSPtr connection,
const DeviceUID& device_handle,
const ApplicationHandle& app_handle));
+ MOCK_CONST_METHOD2(FindPendingConnection,
+ ConnectionSPtr(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/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..1f4a17cf6c 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -69,10 +69,16 @@ class MockTransportAdapterController : public TransportAdapterController {
MOCK_METHOD1(SearchDeviceDone, void(const DeviceVector& devices));
MOCK_METHOD1(SearchDeviceFailed, void(const SearchDeviceError& error));
MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle));
+ MOCK_CONST_METHOD2(FindPendingConnection,
+ ConnectionSPtr(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle));
MOCK_METHOD3(ConnectionCreated,
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..5abfa4dfdd 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));
@@ -416,10 +478,142 @@ TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) {
EXPECT_CALL(*serverMock, Terminate());
}
+TEST_F(TransportAdapterTest, FindPending) {
+ 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();
+
+ MockTransportAdapterListener mock_listener;
+ transport_adapter.AddListener(&mock_listener);
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices{mockdev};
+ transport_adapter.SearchDeviceDone(devices);
+
+ // Create cloud app device with connection in pending state
+ std::shared_ptr<MockConnection> connection =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ transport_adapter.ConnectionCreated(connection, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ ConnectionSPtr mock_connection =
+ transport_adapter.FindPendingConnection(uniq_id, 0);
+ ASSERT_TRUE(mock_connection.use_count() != 0);
+
+ ConnectionSPtr mock_connection_fake =
+ transport_adapter.FindPendingConnection(uniq_id, 1);
+ ASSERT_TRUE(mock_connection_fake.use_count() == 0);
+}
+
+TEST_F(TransportAdapterTest,
+ Pending_Connect_Disconnect_ConnectDoneSuccess_PendingDeviceAdded) {
+ 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();
+
+ MockTransportAdapterListener mock_listener;
+ transport_adapter.AddListener(&mock_listener);
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices{mockdev};
+ transport_adapter.SearchDeviceDone(devices);
+
+ // Create cloud app device with connection in pending state
+ std::shared_ptr<MockConnection> connection =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ transport_adapter.ConnectionCreated(connection, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ // Connect cloud app
+ int app_handle = 0;
+ std::vector<int> int_list = {app_handle};
+ EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(int_list));
+
+ 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));
+
+ 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, dev_id, app_handle);
+
+ EXPECT_CALL(transport_adapter, Store());
+ transport_adapter.ConnectDone(dev_id, app_handle);
+
+ // Disconnect cloud app
+ EXPECT_CALL(*mock_connection, Disconnect())
+ .WillOnce(Return(TransportAdapter::OK));
+ TransportAdapter::Error new_res =
+ transport_adapter.Disconnect(dev_id, app_handle);
+ EXPECT_EQ(TransportAdapter::OK, new_res);
+
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, GetDeviceType())
+ .WillOnce(Return(DeviceType::CLOUD_WEBSOCKET));
+ EXPECT_CALL(mock_listener,
+ OnDisconnectDeviceDone(&transport_adapter, uniq_id));
+ EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)).Times(2);
+ EXPECT_CALL(transport_adapter, Store());
+ transport_adapter.DisconnectDone(uniq_id, 0);
+
+ dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(0u, dev_list.size());
+
+ // Recreate device and put cloud app back into pending state
+ std::shared_ptr<MockDevice> mockdev2 =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices2{mockdev2};
+ transport_adapter.SearchDeviceDone(devices2);
+
+ std::shared_ptr<MockConnection> connection2 =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id))
+ .WillOnce(Return(mockdev2));
+ transport_adapter.ConnectionCreated(connection2, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev2->connection_status());
+
+ EXPECT_CALL(*serverMock, Terminate());
+}
+
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 +633,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 +647,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 +656,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 +682,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 +706,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 +733,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 +775,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 +811,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 +833,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 +860,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 +895,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 +917,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 +942,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 +972,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 +992,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 +1024,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 +1043,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/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index 5f13adcd44..dbf0899a1b 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -190,6 +190,24 @@ class TransportManagerImplTest : public ::testing::Test {
tm_.TestHandle(test_event);
}
+ void HandlePending() {
+ TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_PENDING,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
+
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillRepeatedly(Return(dev_info_.connection_type()));
+
+ EXPECT_CALL(*tm_listener_, OnConnectionPending(dev_info_, connection_key_));
+
+ tm_.TestHandle(test_event);
+ }
+
void HandleConnectionFailed() {
TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_FAIL,
mock_adapter_,
@@ -405,6 +423,32 @@ TEST_F(TransportManagerImplTest, DisconnectDevice_DeviceNotConnected) {
EXPECT_EQ(E_INVALID_HANDLE, tm_.DisconnectDevice(device_handle_));
}
+TEST_F(TransportManagerImplTest, Pending) {
+ // Calling HandlePending twice verifies the connection_id stays the same if
+ // the connection exists.
+ HandlePending();
+ HandlePending();
+
+ // Now create pending event for new app id and verify connection_id is
+ // incremented
+ TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_PENDING,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_ + 1,
+ test_message_,
+ error_);
+
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillRepeatedly(Return(dev_info_.connection_type()));
+
+ EXPECT_CALL(*tm_listener_,
+ OnConnectionPending(dev_info_, connection_key_ + 1));
+
+ tm_.TestHandle(test_event);
+}
+
TEST_F(TransportManagerImplTest, Disconnect) {
// Arrange
HandleConnection();
diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt
index 98da4cf2ab..9562b50e78 100644
--- a/src/components/utils/CMakeLists.txt
+++ b/src/components/utils/CMakeLists.txt
@@ -40,6 +40,7 @@ include_directories (
${COMPONENTS_DIR}/protocol_handler/include
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src
)
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index e26fef34bb..e6e5fdc0d4 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -241,6 +241,19 @@ bool WriteBinaryFile(const std::string& name,
*/
bool ReadBinaryFile(const std::string& name, std::vector<uint8_t>& result);
+/**
+ * @brief Reads from file
+ *
+ * @param name path to file
+ * @param result read data
+ * @param offset number of bytes to be ignored from begining of file
+ * @return returns true if the operation is successfully.
+ */
+bool ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length);
+
bool ReadFile(const std::string& name, std::string& result);
/**
diff --git a/src/components/utils/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/file_system.cc b/src/components/utils/src/file_system.cc
index f98aeda056..430cf40da0 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -316,6 +316,26 @@ bool file_system::ReadBinaryFile(const std::string& name,
return true;
}
+bool file_system::ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length) {
+ if (!FileExists(name) || !IsAccessible(name, R_OK)) {
+ return false;
+ }
+
+ std::ifstream file(name.c_str(), std::ios_base::binary);
+ file.ignore(offset);
+ std::ostringstream ss;
+ std::string s;
+ s.resize(length);
+ file.read(&s[0], length);
+
+ result.resize(s.length());
+ std::copy(s.begin(), s.end(), result.begin());
+ return true;
+}
+
bool file_system::ReadFile(const std::string& name, std::string& result) {
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
return false;
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)