summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kalinich (GitHub) <AKalinich@luxoft.com>2021-10-19 09:52:35 -0400
committerGitHub <noreply@github.com>2021-10-19 09:52:35 -0400
commit21f31b39bc482eddf6954e274caad420279a8be5 (patch)
tree755fa919910005513386f565a0998ee21f6032e0
parentaaff24abc43eb3ea85478e0f534e4bf466d1d102 (diff)
parent3f765bc5a5e49293d1aea4e3f3fe75feefe999a0 (diff)
downloadsdl_core-21f31b39bc482eddf6954e274caad420279a8be5.tar.gz
Merge pull request #304 from CustomSDL/feature/merge_release_8.0.0
Merge release 8.0.0
-rw-r--r--.github/CONTRIBUTING.md2
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md2
-rw-r--r--.github/workflows/sdl_core_github_ci.yml44
-rw-r--r--.github/workflows/sdl_core_github_ci_coverity.yml63
-rw-r--r--.travis.yml32
-rw-r--r--CMakeLists.txt45
-rw-r--r--README.md9
-rw-r--r--src/3rd_party-static/encryption/CMakeLists.txt4
-rw-r--r--src/3rd_party-static/gmock-1.7.0/fused-src/gtest/gtest.h12
-rw-r--r--src/3rd_party-static/gmock-1.7.0/gtest/fused-src/gtest/gtest.h12
-rw-r--r--src/3rd_party-static/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h12
-rw-r--r--src/3rd_party/CMakeLists.txt52
-rw-r--r--src/appMain/CMakeLists.txt17
-rw-r--r--src/appMain/android_platform_interface.cc150
-rw-r--r--src/appMain/boostlogconfig.ini51
-rw-r--r--src/appMain/daemon.sh2
-rwxr-xr-xsrc/appMain/hmi_capabilities.json159
-rw-r--r--src/appMain/life_cycle_impl.cc6
-rw-r--r--src/appMain/low_voltage_signals_handler.h3
-rw-r--r--src/appMain/main.cc23
-rw-r--r--src/appMain/sample_policy_manager.py6
-rw-r--r--src/appMain/sdl_preloaded_pt.json446
-rw-r--r--src/appMain/smartDeviceLink.ini10
-rw-r--r--src/appMain/test/CMakeLists.txt1
-rw-r--r--src/components/application_manager/CMakeLists.txt2
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h8
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h10
-rw-r--r--src/components/application_manager/include/application_manager/application.h32
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h3
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h191
-rw-r--r--src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h109
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h77
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h368
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_from_hmi.h17
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h372
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_to_hmi.h3
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h9
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h3
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_observer.h18
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h8
-rw-r--r--src/components/application_manager/include/application_manager/hmi_language_handler.h5
-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.h121
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h8
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h7
-rw-r--r--src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h6
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h25
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h5
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h6
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h54
-rw-r--r--src/components/application_manager/include/application_manager/request_controller_impl.h (renamed from src/components/application_manager/include/application_manager/request_controller.h)215
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h17
-rw-r--r--src/components/application_manager/include/application_manager/request_timeout_handler_impl.h75
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h3
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h2
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h32
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h8
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h13
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h4
-rw-r--r--src/components/application_manager/include/application_manager/rpc_handler_impl.h1
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h26
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h3
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h3
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h7
-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.h2
-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.h2
-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.h5
-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.h4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc33
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h12
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h18
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc85
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_on_app_capability_updated_notification.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h)37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h)20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h)52
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h)32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h)47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h)40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h39
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_capability_updated_notification.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h)43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h)36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_on_app_capability_updated_notification.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc)23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc)11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc70
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc163
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc)61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc124
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc)65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc132
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc42
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc107
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc100
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc200
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_capability_updated_notification.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc)46
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc144
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc153
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc210
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc57
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc204
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc53
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc44
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc41
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_on_app_capability_updated_notification_test.cc101
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc53
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc57
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc203
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc5
-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/sdl_activate_app_request_test.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc217
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc147
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc185
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc146
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc46
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc37
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc29
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc498
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc195
-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/on_app_capability_updated_notification_test.cc107
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc50
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc50
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc42
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc388
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc52
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt4
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h3
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h3
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h7
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc41
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc2
-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/on_vehicle_data_notification_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc16
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_json.cc2
-rw-r--r--src/components/application_manager/src/app_service_manager.cc19
-rw-r--r--src/components/application_manager/src/application_data_impl.cc18
-rw-r--r--src/components/application_manager/src/application_impl.cc152
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc907
-rw-r--r--src/components/application_manager/src/application_state.cc9
-rw-r--r--src/components/application_manager/src/commands/button_notification_to_mobile.cc219
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc245
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc906
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc54
-rw-r--r--src/components/application_manager/src/commands/request_from_mobile_impl.cc906
-rw-r--r--src/components/application_manager/src/commands/request_to_hmi.cc45
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher_impl.cc21
-rw-r--r--src/components/application_manager/src/event_engine/event_observer.cc10
-rw-r--r--src/components/application_manager/src/help_prompt_manager_impl.cc4
-rw-r--r--src/components/application_manager/src/helpers/application_helper.cc29
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc18
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc8
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc8
-rw-r--r--src/components/application_manager/src/hmi_state.cc26
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc499
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc9
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc121
-rw-r--r--src/components/application_manager/src/policies/policy_retry_sequence.cc77
-rw-r--r--src/components/application_manager/src/request_controller_impl.cc (renamed from src/components/application_manager/src/request_controller.cc)327
-rw-r--r--src/components/application_manager/src/request_info.cc39
-rw-r--r--src/components/application_manager/src/request_timeout_handler_impl.cc123
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc30
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc2
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc138
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc8
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_processor_impl.cc120
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc44
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc6
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc4
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc42
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc27
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc19
-rw-r--r--src/components/application_manager/src/system_time/system_time_handler_impl.cc2
-rwxr-xr-xsrc/components/application_manager/test/CMakeLists.txt9
-rw-r--r--src/components/application_manager/test/app_launch/CMakeLists.txt2
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc30
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_data_json_test.cc14
-rw-r--r--src/components/application_manager/test/application_helper_test.cc20
-rw-r--r--src/components/application_manager/test/application_impl_test.cc45
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc64
-rw-r--r--src/components/application_manager/test/commands/command_impl_test.cc6
-rw-r--r--src/components/application_manager/test/commands/command_mobile_request_impl_test.cc (renamed from src/components/application_manager/test/commands/command_request_impl_test.cc)222
-rw-r--r--src/components/application_manager/test/event_engine_test.cc2
-rw-r--r--src/components/application_manager/test/help_prompt_manager_test.cc3
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc37
-rw-r--r--src/components/application_manager/test/hmi_language_handler_test.cc26
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/command_request_test.h7
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/commands_test.h59
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_app_service_manager.h1
-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.h4
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_event_observer.h4
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h5
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h53
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_request.h3
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h3
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h1
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc64
-rw-r--r--src/components/application_manager/test/mobile_event_engine_test.cc2
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc67
-rw-r--r--src/components/application_manager/test/policy_event_observer_test.cc2
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc200
-rw-r--r--src/components/application_manager/test/request_controller/request_controller_test.cc59
-rw-r--r--src/components/application_manager/test/request_timeout_handler_test.cc306
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc38
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc2
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc2
-rw-r--r--src/components/application_manager/test/rpc_passing_handler_test.cc2
-rw-r--r--src/components/application_manager/test/rpc_service_impl_test.cc13
-rw-r--r--src/components/application_manager/test/sdl_preloaded_pt.json1979
-rw-r--r--src/components/application_manager/test/sdl_pt_update.json116
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc126
-rw-r--r--src/components/application_manager/test/zero_request_amount_test.cc18
-rw-r--r--src/components/config_profile/CMakeLists.txt2
-rw-r--r--src/components/config_profile/include/config_profile/android_profile.h24
-rw-r--r--src/components/config_profile/include/config_profile/ini_file.h132
-rw-r--r--src/components/config_profile/include/config_profile/profile.h27
-rw-r--r--src/components/config_profile/src/android_profile.cc40
-rw-r--r--src/components/config_profile/src/ini_file.cc418
-rw-r--r--src/components/config_profile/src/profile.cc263
-rw-r--r--src/components/config_profile/test/CMakeLists.txt2
-rw-r--r--src/components/config_profile/test/ini_file_test.cc330
-rw-r--r--src/components/config_profile/test/profile_test.cc5
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h8
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h10
-rw-r--r--src/components/connection_handler/include/connection_handler/heartbeat_monitor.h10
-rw-r--r--src/components/connection_handler/src/connection.cc4
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc52
-rw-r--r--src/components/connection_handler/src/heartbeat_monitor.cc16
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc135
-rw-r--r--src/components/connection_handler/test/heart_beat_monitor_test.cc36
-rw-r--r--src/components/formatters/src/CFormatterJsonBase.cc6
-rw-r--r--src/components/hmi_message_handler/CMakeLists.txt2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h3
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_handler_impl.cc193
-rw-r--r--src/components/hmi_message_handler/src/websocket_session.cc16
-rw-r--r--src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc6
-rw-r--r--src/components/include/application_manager/application_manager.h164
-rw-r--r--src/components/include/application_manager/application_manager_settings.h1
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h22
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h18
-rw-r--r--src/components/include/application_manager/request_controller.h224
-rw-r--r--src/components/include/application_manager/request_timeout_handler.h85
-rw-r--r--src/components/include/connection_handler/connection_handler.h29
-rw-r--r--src/components/include/connection_handler/connection_handler_observer.h8
-rw-r--r--src/components/include/media_manager/media_manager.h15
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h27
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h13
-rw-r--r--src/components/include/protocol/bson_object_keys.h6
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h4
-rw-r--r--src/components/include/protocol_handler/session_observer.h7
-rw-r--r--src/components/include/resumption/last_state.h12
-rw-r--r--src/components/include/security_manager/crypto_manager.h2
-rw-r--r--src/components/include/security_manager/security_manager.h15
-rw-r--r--src/components/include/security_manager/security_manager_settings.h1
-rw-r--r--src/components/include/security_manager/ssl_context.h1
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h70
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h1
-rw-r--r--src/components/include/test/application_manager/mock_request_controller.h96
-rw-r--r--src/components/include/test/application_manager/mock_request_timeout_handler.h (renamed from src/components/include/test/protocol_handler/mock_telemetry_observer.h)32
-rw-r--r--src/components/include/test/application_manager/mock_rpc_plugin.h7
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h6
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h4
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h2
-rw-r--r--src/components/include/test/media_manager/mock_media_manager.h7
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h2
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h3
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h2
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h2
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h6
-rw-r--r--src/components/include/test/resumption/mock_last_state.h4
-rw-r--r--src/components/include/test/security_manager/mock_security_manager.h2
-rw-r--r--src/components/include/test/security_manager/mock_security_manager_settings.h1
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager.h2
-rw-r--r--src/components/include/test/utils/test_async_waiter.h14
-rw-r--r--src/components/include/transport_manager/transport_adapter/device.h2
-rw-r--r--src/components/include/transport_manager/transport_manager.h3
-rw-r--r--src/components/include/utils/logger.h6
-rw-r--r--src/components/include/utils/semantic_version.h6
-rw-r--r--src/components/include/utils/threads/pt-internal.h14
-rw-r--r--src/components/include/utils/threads/pthread_android.h162
-rw-r--r--src/components/include/utils/time64.h6
-rw-r--r--src/components/interfaces/HMI_API.xml542
-rw-r--r--src/components/media_manager/CMakeLists.txt2
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h1
-rw-r--r--src/components/media_manager/include/media_manager/media_manager_impl.h17
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_adapter.cc4
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc6
-rw-r--r--src/components/media_manager/src/file_streamer_adapter.cc2
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc100
-rw-r--r--src/components/media_manager/src/pipe_streamer_adapter.cc2
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc2
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc4
-rw-r--r--src/components/media_manager/test/CMakeLists.txt2
-rw-r--r--src/components/media_manager/test/media_manager_impl_test.cc29
-rw-r--r--src/components/policy/policy_external/CMakeLists.txt2
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h10
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h14
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h17
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml3
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h1
-rw-r--r--src/components/policy/policy_external/include/policy/pt_ext_representation.h8
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_ext_queries.h1
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h4
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc53
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc31
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc27
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_queries.cc15
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc34
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc5
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc12
-rw-r--r--src/components/policy/policy_external/test/CMakeLists.txt2
-rw-r--r--src/components/policy/policy_external/test/boostlogconfig.ini46
-rw-r--r--src/components/policy/policy_external/test/cache_manager_test.cc12
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h1
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json161
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json161
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_test.cc2
-rw-r--r--src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc2
-rw-r--r--src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc334
-rw-r--r--src/components/policy/policy_external/test/sql_pt_representation_test.cc443
-rw-r--r--src/components/policy/policy_external/test/update_status_manager_test.cc54
-rw-r--r--src/components/policy/policy_regular/CMakeLists.txt4
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h10
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h14
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h14
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h5
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_types.h1
-rw-r--r--src/components/policy/policy_regular/include/policy/pt_representation.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_queries.h1
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_representation.h3
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc27
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc41
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc60
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc15
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc37
-rw-r--r--src/components/policy/policy_regular/test/CMakeLists.txt1
-rw-r--r--src/components/policy/policy_regular/test/boostlogconfig.ini51
-rw-r--r--src/components/policy/policy_regular/test/cache_manager_test.cc12
-rw-r--r--src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json161
-rw-r--r--src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json161
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc14
-rw-r--r--src/components/policy/policy_regular/test/sql_pt_representation_test.cc498
-rw-r--r--src/components/protocol/src/bson_object_keys.cc6
-rw-r--r--src/components/protocol_handler/CMakeLists.txt5
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h32
-rw-r--r--src/components/protocol_handler/src/handshake_handler.cc8
-rw-r--r--src/components/protocol_handler/src/incoming_data_handler.cc18
-rw-r--r--src/components/protocol_handler/src/multiframe_builder.cc21
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc246
-rw-r--r--src/components/protocol_handler/src/protocol_packet.cc17
-rw-r--r--src/components/protocol_handler/src/service_status_update_handler.cc4
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h4
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc945
-rw-r--r--src/components/protocol_handler/test/service_status_update_handler_test.cc4
-rw-r--r--src/components/resumption/include/resumption/last_state_impl.h9
-rw-r--r--src/components/resumption/src/last_state_impl.cc41
-rw-r--r--src/components/resumption/test/last_state_test.cc7
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_inl.h4
-rw-r--r--src/components/security_manager/CMakeLists.txt9
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_impl.h3
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h4
-rw-r--r--src/components/security_manager/include/security_manager/security_manager_impl.h19
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc63
-rw-r--r--src/components/security_manager/src/security_manager_impl.cc52
-rw-r--r--src/components/security_manager/src/ssl_context_impl.cc17
-rw-r--r--src/components/security_manager/test/crypto_manager_impl_test.cc8
-rw-r--r--src/components/security_manager/test/security_manager_test.cc214
-rw-r--r--src/components/security_manager/test/security_query_test.cc17
-rw-r--r--src/components/security_manager/test/ssl_certificate_handshake_test.cc14
-rw-r--r--src/components/smart_objects/CMakeLists.txt2
-rw-r--r--src/components/smart_objects/include/smart_objects/array_schema_item.h15
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h2
-rw-r--r--src/components/smart_objects/include/smart_objects/number_schema_item.h23
-rw-r--r--src/components/smart_objects/include/smart_objects/object_schema_item.h11
-rw-r--r--src/components/smart_objects/src/array_schema_item.cc21
-rw-r--r--src/components/smart_objects/src/number_schema_item.cc5
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc33
-rw-r--r--src/components/smart_objects/test/SmartObjectConvertionTime_test.cc1
-rw-r--r--src/components/telemetry_monitor/test/CMakeLists.txt8
-rw-r--r--src/components/telemetry_monitor/test/boostlogconfig.ini22
-rw-r--r--src/components/test_main.cc3
-rw-r--r--src/components/transport_manager/CMakeLists.txt3
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_connection_factory.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_device_scanner.h3
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_ipc_control_protocol.h26
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_ipc_device.h5
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_socket_connection.h33
-rw-r--r--src/components/transport_manager/include/transport_manager/android/android_transport_adapter.h20
-rw-r--r--src/components/transport_manager/include/transport_manager/android/ipc_receiver.h19
-rw-r--r--src/components/transport_manager/include/transport_manager/android/ipc_sender.h53
-rw-r--r--src/components/transport_manager/include/transport_manager/android/local_socket_receiver.h31
-rw-r--r--src/components/transport_manager/include/transport_manager/android/local_socket_sender.h44
-rw-r--r--src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h1
-rw-r--r--src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h11
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/LocalArray.h77
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ScopedFd.h28
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ifaddrs-android.h301
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h5
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h11
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_default.h3
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_impl.h3
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h2
-rw-r--r--src/components/transport_manager/src/android/android_connection_factory.cc3
-rw-r--r--src/components/transport_manager/src/android/android_device_scanner.cc50
-rw-r--r--src/components/transport_manager/src/android/android_ipc_control_protocol.cc109
-rw-r--r--src/components/transport_manager/src/android/android_ipc_device.cc44
-rw-r--r--src/components/transport_manager/src/android/android_socket_connection.cc124
-rw-r--r--src/components/transport_manager/src/android/android_transport_adapter.cc216
-rw-r--r--src/components/transport_manager/src/android/local_socket_receiver.cc163
-rw-r--r--src/components/transport_manager/src/android/local_socket_sender.cc144
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc58
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc2
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc2
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc2
-rw-r--r--src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc2
-rw-r--r--src/components/transport_manager/src/tcp/tcp_client_listener.cc2
-rw-r--r--src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc6
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc8
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc30
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc21
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_connection.cc100
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_connection.cc10
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_secure_session.cc8
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc10
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_session.cc21
-rw-r--r--src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h2
-rw-r--r--src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h4
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h7
-rw-r--r--src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h1
-rw-r--r--src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc6
-rw-r--r--src/components/transport_manager/test/sample_websocket_server.cc9
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc6
-rw-r--r--src/components/transport_manager/test/transport_manager_default_test.cc2
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc56
-rw-r--r--src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc7
-rw-r--r--src/components/transport_manager/test/websocket_server_listener_test.cc2
-rw-r--r--src/components/utils/CMakeLists.txt34
-rw-r--r--src/components/utils/include/utils/convert_utils.h16
-rw-r--r--src/components/utils/include/utils/file_system.h9
-rw-r--r--src/components/utils/include/utils/logger/boostlogger.h (renamed from src/components/utils/src/threads/thread_manager.cc)39
-rw-r--r--src/components/utils/include/utils/resource_usage.h5
-rw-r--r--src/components/utils/include/utils/threads/pulse_thread_delegate.h101
-rw-r--r--src/components/utils/include/utils/threads/thread_manager.h81
-rw-r--r--src/components/utils/src/back_trace.cc66
-rw-r--r--src/components/utils/src/file_system.cc19
-rw-r--r--src/components/utils/src/lock_boost.cc8
-rw-r--r--src/components/utils/src/logger/androidlogger.cc43
-rw-r--r--src/components/utils/src/logger/boostlogger.cc209
-rw-r--r--src/components/utils/src/logger/log4cxxlogger.cc1
-rw-r--r--src/components/utils/src/logger/logger_impl.cc5
-rw-r--r--src/components/utils/src/threads/pulse_thread_delegate.cc111
-rw-r--r--src/components/utils/src/threads/thread_delegate.cc2
-rw-r--r--src/components/utils/src/threads/thread_posix.cc2
-rw-r--r--src/components/utils/src/timer.cc6
-rw-r--r--src/components/utils/test/CMakeLists.txt7
-rw-r--r--src/components/utils/test/boostlogconfig.ini51
-rw-r--r--src/components/utils/test/file_system_test.cc13
-rw-r--r--src/components/utils/test/policy.sql1
-rw-r--r--src/plugins/CMakeLists.txt2
-rw-r--r--src/plugins/appenders/CMakeLists.txt4
-rw-r--r--tools/InterfaceGenerator/generator/generators/PolicyTypes.py10
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactoryBase.py90
-rwxr-xr-x[-rw-r--r--]tools/infrastructure/api_compare.py62
-rwxr-xr-xtools/infrastructure/check_style.sh2
-rw-r--r--tools/infrastructure/format_src.py37
-rwxr-xr-xtools/infrastructure/git-hooks/pre-commit6
-rw-r--r--tools/infrastructure/install_hooks.py8
-rw-r--r--tools/intergen/test/test_hmi_interface.xml6
-rw-r--r--tools/policy_table_validator/main.cpp15
m---------tools/rpc_spec0
809 files changed, 17799 insertions, 16831 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 1da30fbf62..c24cd68807 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -4,8 +4,8 @@ Third party contributions are essential for making SDL great. However, we do hav
## Environment
Currently supported:
-* Ubuntu Linux 16.04 with GCC 5.4.x
* Ubuntu Linux 18.04 with GCC 7.3.x
+* Ubuntu Linux 20.04 with GCC 9.3.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
### Issues
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 301a22eafe..319edc5458 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, 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.
+[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 @JackLivio.
Delete the above section when you've read it.]
diff --git a/.github/workflows/sdl_core_github_ci.yml b/.github/workflows/sdl_core_github_ci.yml
new file mode 100644
index 0000000000..14ff51c2fe
--- /dev/null
+++ b/.github/workflows/sdl_core_github_ci.yml
@@ -0,0 +1,44 @@
+name: SDL Core Build
+on: [push, pull_request]
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Init Submodules
+ run: git -C ${{ github.workspace }} submodule update --init --recursive
+ # Install Dependencies
+ - name: Apt Get Dependencies
+ run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-8
+ - name: Setup CMAKE
+ uses: jwlawson/actions-setup-cmake@v1.8
+ with:
+ cmake-version: '3.16.3'
+ # Check Style
+ - name: Check Style
+ run: ${{ github.workspace }}/tools/infrastructure/check_style.sh
+ # Build Project
+ - name: Cache 3rd Party
+ id: core-3rd-party
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/core_3rd_party
+ key: ${{ runner.os }}-core-3rd-party-v3
+ - name: Make 3rd Party Directory
+ if: steps.core-3rd-party.outputs.cache-hit != 'true'
+ run: mkdir ${{ github.workspace }}/core_3rd_party
+ - name: Make Directories
+ run: cd ${{ github.workspace }} && cd ../ && mkdir build && cd build
+ - name: Set 3rd Party Path
+ run: echo "THIRD_PARTY_INSTALL_PREFIX=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV
+ - name: Set 3rd Party ARCH Path
+ run: echo "THIRD_PARTY_INSTALL_PREFIX_ARCH=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV
+ - name: Configure
+ run: cmake ../sdl_core -DBUILD_TESTS=ON -DLOGGER_NAME=BOOST
+ - name: Build
+ run: make install-3rd_party && make -j `nproc` install
+ - name: Set Library Path
+ run: echo "LD_LIBRARY_PATH=$THIRD_PARTY_INSTALL_PREFIX/lib:." >> $GITHUB_ENV
+ # run tests
+ - name: Unit Tests
+ run: make test
diff --git a/.github/workflows/sdl_core_github_ci_coverity.yml b/.github/workflows/sdl_core_github_ci_coverity.yml
new file mode 100644
index 0000000000..c60482d30f
--- /dev/null
+++ b/.github/workflows/sdl_core_github_ci_coverity.yml
@@ -0,0 +1,63 @@
+name: SDL Core Build With Coverity
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+jobs:
+ build:
+ environment: Coverity
+ runs-on: ubuntu-20.04
+ steps:
+ - shell: bash
+ env:
+ COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }}
+ run: |
+ echo "$COVERITY_SECRET" && echo ${{ secrets.COVERITY_TOKEN }} && echo "end"
+ - uses: actions/checkout@v2
+ - name: Init Submodules
+ run: git -C ${{ github.workspace }} submodule update --init --recursive
+ # Install Dependencies
+ - name: Apt Get Dependencies
+ run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-6.0
+ - name: Setup CMAKE
+ uses: jwlawson/actions-setup-cmake@v1.8
+ with:
+ cmake-version: '3.16.3'
+ # Build Project
+ - name: Cache 3rd Party
+ id: core-3rd-party
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/core_3rd_party
+ key: ${{ runner.os }}-core-3rd-party-v3
+ - name: Make 3rd Party Directory
+ if: steps.core-3rd-party.outputs.cache-hit != 'true'
+ run: mkdir ${{ github.workspace }}/core_3rd_party
+ - name: Make Directories
+ run: cd ${{ github.workspace }} && cd ../ && mkdir build && cd build
+ - name: Set 3rd Party Path
+ run: echo "THIRD_PARTY_INSTALL_PREFIX=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV
+ - name: Set 3rd Party ARCH Path
+ run: echo "THIRD_PARTY_INSTALL_PREFIX_ARCH=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV
+ - name: Configure
+ run: cmake ../sdl_core -DLOGGER_NAME=BOOST
+ - name: Download Coverity
+ env:
+ COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }}
+ run: wget https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_SECRET}&project=smartdevicelink%2Fsdl_core" -O coverity_tool.tgz
+ - name: unzip
+ run: tar zxvf coverity_tool.tgz
+ - name: Build
+ run: make install-3rd_party && ./cov-analysis-linux64-2020.09/bin/cov-build --dir cov-int make -j `nproc` install
+ - name: Set Library Path
+ run: echo "LD_LIBRARY_PATH=$THIRD_PARTY_INSTALL_PREFIX/lib:." >> $GITHUB_ENV
+ - name: Compress Coverity
+ run: tar czvf myproject.tgz cov-int
+ - name: Upload Coverity
+ env:
+ COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }}
+ run: curl --form token=${COVERITY_SECRET} --form email=jack@livio.io --form file=@myproject.tgz --form version="Version" --form description="Description" https://scan.coverity.com/builds?project=smartdevicelink%2Fsdl_core
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9d9cfedb82..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-language: cpp
-dist: xenial
-sudo: required
-only:
- - master
- - develop
- - \/feature\/.+
- - \/fix\/.+
- - \/hotfix\/.+
- - \/release\/.+
-
-addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
-
-before_install:
- - sudo apt-get update
- - sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools
- - sudo apt-get install -f clang-format-6.0
-
-script:
- - cppcheck --force -isrc/3rd_party -isrc/3rd_party-static --quiet --error-exitcode=1 src
- - ./tools/infrastructure/check_style.sh
- - mkdir build && cd build
- - cmake ../ -DBUILD_TESTS=ON
- - make install-3rd_party && make -j `nproc` install && sudo ldconfig && make test
-env:
- global:
- - LC_CTYPE=en_US.UTF-8
- - CTEST_OUTPUT_ON_FAILURE=TRUE
- - LD_LIBRARY_PATH=.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 210c9394c7..2b328fdced 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 2.8.11)
+cmake_policy(SET CMP0054 NEW)
set (PROJECT smartDeviceLinkCore)
project (${PROJECT})
@@ -54,13 +55,18 @@ option(ENABLE_LOG "Logging feature" ON)
option(ENABLE_GCOV "gcov code coverage feature" OFF)
option(ENABLE_SANITIZE "Sanitize tool" OFF)
option(ENABLE_SECURITY "Security Ford protocol protection" ON)
-option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON)
option(ENABLE_IAP2EMULATION "IAP2 emulation via tcp" OFF)
option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON)
option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
option(USE_CCACHE "Turn on ccache usage" ON)
option(USE_DISTCC "Turn on distributed build_usage" OFF)
+set(LOGGER_NAME "LOG4CXX" CACHE STRING "Logging library to use (BOOST, LOG4CXX)")
+set_property(CACHE LOGGER_NAME PROPERTY STRINGS BOOST LOG4CXX)
+if(LOGGER_NAME STREQUAL "")
+ set(LOGGER_NAME "LOG4CXX")
+endif()
+
set (EXTENDED_POLICY "PROPRIETARY" CACHE STRING "Policy mode (PROPRIETARY, HTTP or EXTERNAL_PROPRIETARY)")
set_property(CACHE EXTENDED_POLICY PROPERTY STRINGS PROPRIETARY HTTP EXTERNAL_PROPRIETARY)
if(EXTENDED_POLICY STREQUAL "")
@@ -200,6 +206,12 @@ get_property(cValue CACHE ENABLE_SECURITY PROPERTY VALUE)
file(APPEND "${build_config_path}" "//${cHelpString}\n")
file(APPEND "${build_config_path}" "ENABLE_SECURITY:${cType}=${cValue}\n\n")
+get_property(cHelpString CACHE LOGGER_NAME PROPERTY HELPSTRING)
+get_property(cType CACHE LOGGER_NAME PROPERTY TYPE)
+get_property(cValue CACHE LOGGER_NAME PROPERTY VALUE)
+file(APPEND "${build_config_path}" "//${cHelpString}\n")
+file(APPEND "${build_config_path}" "LOGGER_NAME:${cType}=${cValue}\n\n")
+
get_property(cHelpString CACHE EXTENDED_MEDIA_MODE PROPERTY HELPSTRING)
get_property(cType CACHE EXTENDED_MEDIA_MODE PROPERTY TYPE)
get_property(cValue CACHE EXTENDED_MEDIA_MODE PROPERTY VALUE)
@@ -218,12 +230,6 @@ get_property(cValue CACHE HMI PROPERTY VALUE)
file(APPEND "${build_config_path}" "//${cHelpString}\n")
file(APPEND "${build_config_path}" "HMI:${cType}=${cValue}\n\n")
-get_property(cHelpString CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY HELPSTRING)
-get_property(cType CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY TYPE)
-get_property(cValue CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY VALUE)
-file(APPEND "${build_config_path}" "//${cHelpString}\n")
-file(APPEND "${build_config_path}" "ENABLE_HMI_PTU_DECRYPTION:${cType}=${cValue}\n")
-
get_property(cHelpString CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY HELPSTRING)
get_property(cType CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY TYPE)
get_property(cValue CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY VALUE)
@@ -405,6 +411,14 @@ else()
set(POLICY_MOCK_INCLUDE_PATH ${COMPONENTS_DIR}/include/test/policy/policy_regular/)
endif()
+if(${LOGGER_NAME} STREQUAL "LOG4CXX")
+ add_definitions(-DLOG4CXX_LOGGER)
+ message(STATUS "Selected the apache log4cxx logging library")
+else()
+ add_definitions(-DBOOST_LOGGER)
+ message(STATUS "Selected the boost logging library")
+endif()
+
# TODO(AK): check current OS here
add_definitions(-DOS_POSIX)
@@ -448,10 +462,18 @@ include_directories(
add_subdirectory(./src/3rd_party EXCLUDE_FROM_ALL)
if (NOT ANDROID)
-if(ENABLE_LOG)
+ find_package(OpenSSL REQUIRED)
+endif()
+
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
+ message(STATUS "Including log4cxx")
include_directories ( ${LOG4CXX_INCLUDE_DIRECTORY} )
endif()
-endif ()
+
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST")
+ message(STATUS "Including boost")
+ include_directories ( ${BOOST_INCLUDE_DIR} )
+endif()
if(ENABLE_SECURITY)
add_definitions(-DENABLE_SECURITY)
@@ -461,11 +483,6 @@ if(ENABLE_SECURITY)
message(STATUS "Security enabled")
endif()
-if(ENABLE_HMI_PTU_DECRYPTION)
- add_definitions(-DUSE_HMI_PTU_DECRYPTION)
- message(STATUS "HMI PTU decription enabled")
-endif()
-
if(ENABLE_IAP2EMULATION)
add_definitions(-DENABLE_IAP2EMULATION)
message(STATUS "IAP2 emulation enabled")
diff --git a/README.md b/README.md
index 0046a0f679..c933b81162 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
-[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/)
-[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/)
-[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/)
+[![Github Actions Build Status](https://github.com/smartdevicelink/sdl_core/actions/workflows/sdl_core_github_ci.yml/badge.svg)](https://github.com/smartdevicelink/sdl_core/actions/workflows/sdl_core_github_ci.yml)
+[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/)
+[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/)
+[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/)
# SmartDeviceLink (SDL)
@@ -19,8 +20,8 @@ Pull Requests Welcome!
## Environment
Currently supported:
-* Ubuntu Linux 16.04 with GCC 5.4.x
* Ubuntu Linux 18.04 with GCC 7.5.x
+* Ubuntu Linux 20.04 with GCC 9.3.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
## Getting Started
diff --git a/src/3rd_party-static/encryption/CMakeLists.txt b/src/3rd_party-static/encryption/CMakeLists.txt
index 2074397cfd..b3860925ba 100644
--- a/src/3rd_party-static/encryption/CMakeLists.txt
+++ b/src/3rd_party-static/encryption/CMakeLists.txt
@@ -45,4 +45,8 @@ set (LIBRARIES crypto -L$ENV{THIRD_PARTY_INSTALL_PREFIX}/${CMAKE_ANDROID_ARCH_AB
add_library("encryption" ${SOURCES})
target_include_directories("encryption" PUBLIC "$ENV{THIRD_PARTY_INSTALL_PREFIX}/${CMAKE_ANDROID_ARCH_ABI}/include")
target_link_libraries("encryption" "${LIBRARIES}")
+
+if(ANDROID)
add_dependencies("encryption" openssl_external)
+endif()
+
diff --git a/src/3rd_party-static/gmock-1.7.0/fused-src/gtest/gtest.h b/src/3rd_party-static/gmock-1.7.0/fused-src/gtest/gtest.h
index 93359b6164..5f6ce8dbc7 100644
--- a/src/3rd_party-static/gmock-1.7.0/fused-src/gtest/gtest.h
+++ b/src/3rd_party-static/gmock-1.7.0/fused-src/gtest/gtest.h
@@ -1823,16 +1823,16 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_UNUSED_
#endif
-// A macro to disallow operator=
+// A macro to disallow copy operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
+#define GTEST_DISALLOW_ASSIGN_(type) \
+ type& operator=(type const &) = delete
// A macro to disallow copy constructor and operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
+#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
+ type(type const&) = delete; \
+ type& operator=(type const&) = delete
// Tell the compiler to warn about unused return values for functions declared
// with this macro. The macro should be used on function declarations
diff --git a/src/3rd_party-static/gmock-1.7.0/gtest/fused-src/gtest/gtest.h b/src/3rd_party-static/gmock-1.7.0/gtest/fused-src/gtest/gtest.h
index 93359b6164..5f6ce8dbc7 100644
--- a/src/3rd_party-static/gmock-1.7.0/gtest/fused-src/gtest/gtest.h
+++ b/src/3rd_party-static/gmock-1.7.0/gtest/fused-src/gtest/gtest.h
@@ -1823,16 +1823,16 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_UNUSED_
#endif
-// A macro to disallow operator=
+// A macro to disallow copy operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
+#define GTEST_DISALLOW_ASSIGN_(type) \
+ type& operator=(type const &) = delete
// A macro to disallow copy constructor and operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
+#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
+ type(type const&) = delete; \
+ type& operator=(type const&) = delete
// Tell the compiler to warn about unused return values for functions declared
// with this macro. The macro should be used on function declarations
diff --git a/src/3rd_party-static/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h b/src/3rd_party-static/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h
index 280935daca..307a65d592 100644
--- a/src/3rd_party-static/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h
+++ b/src/3rd_party-static/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h
@@ -716,16 +716,16 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_UNUSED_
#endif
-// A macro to disallow operator=
+// A macro to disallow copy operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
+#define GTEST_DISALLOW_ASSIGN_(type) \
+ type& operator=(type const &) = delete
// A macro to disallow copy constructor and operator=
// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
+#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
+ type(type const&) = delete; \
+ type& operator=(type const&) = delete
// Tell the compiler to warn about unused return values for functions declared
// with this macro. The macro should be used on function declarations
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index fabc56e665..275b5b9800 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -47,7 +47,7 @@ if(FORCE_3RD_PARTY)
endif()
endif()
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
# --- libexpat
add_subdirectory(expat-2.1.0)
set(EXPAT_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE)
@@ -211,7 +211,7 @@ find_package(PkgConfig)
pkg_check_modules(BSON libbson)
message (STATUS "bson installed in " ${BSON_LIBDIR} ", " ${BSON_INCLUDEDIR})
-if ((NOT "${BSON_FOUND}") OR ("${BSON_VERSION}" VERSION_LESS "1.2.0"))
+if ((NOT "${BSON_FOUND}") OR ("${BSON_VERSION}" VERSION_LESS "1.2.5"))
message (STATUS "Building bson required")
set(BSON_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bson_c_lib CACHE INTERNAL "Sources of bson library" FORCE)
set(BSON_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib CACHE INTERNAL "Installation path of bson libraries" FORCE)
@@ -269,13 +269,18 @@ else()
endif()
set(BOOST_ROOT ${3RD_PARTY_INSTALL_PREFIX})
-find_package(Boost 1.68.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_NO_BOOST_CMAKE ON)
+set(BOOST_COMPONENTS system thread date_time filesystem regex)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST")
+ list(APPEND BOOST_COMPONENTS log log_setup)
+endif()
+find_package(Boost 1.72.0 COMPONENTS ${BOOST_COMPONENTS})
if (NOT ${Boost_FOUND})
- message(STATUS "Did not find boost. Downloading and installing boost 1.68")
+ 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})
+ message(STATUS "Did not find boost. Downloading and installing boost 1.72")
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set(BOOST_FOR_ANDROID_DIR ${3RD_PARTY_SOURCE_DIRECTORY}/android-helpers/boost)
set(BOOST_FOR_ANDROID_TARGET_VER 21)
@@ -287,18 +292,17 @@ if (NOT ${Boost_FOUND})
include(ExternalProject)
ExternalProject_Add(
Boost
- URL https://mirror.bazel.build/dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
- URL_HASH SHA256=da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf
+ URL https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.gz/download
+ URL_HASH SHA1=668c29007e5380d71fac8a39ecba6a02cb0086d5
DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
- CONFIGURE_COMMAND ./bootstrap.sh
+ CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=${boost_component_libraries_str} --prefix=${3RD_PARTY_INSTALL_PREFIX}
BUILD_COMMAND cp ${BOOST_FOR_ANDROID_DIR}/user-config.jam ${BOOST_LIB_SOURCE_DIRECTORY}/tools/build/src/user-config.jam &&
cd ${BOOST_LIB_SOURCE_DIRECTORY}/tools/build/src &&
sed -i "s@%NDK_ROOT%@${CMAKE_ANDROID_NDK}@" user-config.jam &&
sed -i "s@%BINARIES_PATH%@${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin@" user-config.jam &&
sed -i "s@%TARGET_VERSION_32%@${BOOST_FOR_ANDROID_TARGET_VER}@" user-config.jam &&
- sed -i "s@%TARGET_VERSION_64%@${BOOST_FOR_ANDROID_TARGET_VER}@" user-config.jam &&
- cd ${BOOST_LIB_SOURCE_DIRECTORY} && patch -p1 < ${BOOST_FOR_ANDROID_DIR}/boost-1_68_0.patch
+ sed -i "s@%TARGET_VERSION_64%@${BOOST_FOR_ANDROID_TARGET_VER}@" user-config.jam
INSTALL_COMMAND ./b2 -q -d+2
--ignore-site-config -j4
target-os=android
@@ -319,21 +323,33 @@ if (NOT ${Boost_FOUND})
set(BOOST_INSTALL_COMMAND sudo ./b2 install)
endif()
include(ExternalProject)
+
+ set(boost_component_install_flags --with-system --with-thread --with-date_time --with-filesystem --with-regex)
+ set(boost_component_libraries system thread date_time filesystem regex)
+ if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST")
+ list(APPEND boost_component_install_flags --with-log)
+ list(APPEND boost_component_libraries log)
+ endif()
+ string (REPLACE ";" "," boost_component_libraries_str "${boost_component_libraries}")
ExternalProject_Add(
Boost
- URL https://mirror.bazel.build/dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
- URL_HASH SHA256=da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf
+ URL https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.gz/download
+ URL_HASH SHA1=668c29007e5380d71fac8a39ecba6a02cb0086d5
DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
- CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem,regex --prefix=${3RD_PARTY_INSTALL_PREFIX}
+ CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=${boost_component_libraries_str} --prefix=${3RD_PARTY_INSTALL_PREFIX}
BUILD_COMMAND ./b2
- 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_COMMAND ${BOOST_INSTALL_COMMAND} --clean --prefix=${3RD_PARTY_INSTALL_PREFIX} && ${BOOST_INSTALL_COMMAND} ${boost_component_install_flags} --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log
INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX}
BUILD_IN_SOURCE true
)
endif()
else()
-add_custom_target(Boost) # empty target, Boost is already installed
+ message (STATUS "Boost installed in " ${Boost_LIBRARY_DIRS} ", " ${Boost_INCLUDE_DIRS})
+ set(BOOST_LIBS_DIRECTORY ${Boost_LIBRARY_DIRS})
+ set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS} PARENT_SCOPE)
+ SET_PROPERTY(GLOBAL PROPERTY GLOBAL_BOOST_LIBS ${BOOST_LIBS_DIRECTORY})
+ add_custom_target(Boost) # empty target, Boost is already installed
endif()
if(ANDROID)
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index fb498a6fd9..db2308374e 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -30,7 +30,9 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
-#find_package(SDLOpenSSL REQUIRED)
+if( NOT ANDROID)
+ find_package(SDLOpenSSL REQUIRED)
+endif()
if (EXTENDED_MEDIA_MODE)
set(default_media_inc
@@ -144,7 +146,7 @@ if (BUILD_USB_SUPPORT)
endif()
endif()
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
@@ -182,7 +184,12 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
endif()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/build_config.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+if (${LOGGER_NAME} STREQUAL "LOG4CXX")
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+else()
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/audio.8bit.wav DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${INI_FILE_NAME} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -239,8 +246,8 @@ endif ()
# Install rules
install(TARGETS ${PROJECT} DESTINATION bin)
install(
- FILES build_config.txt log4cxx.properties audio.8bit.wav test.txt
- ${CMAKE_CURRENT_BINARY_DIR}/${INI_FILE_NAME}
+ FILES build_config.txt log4cxx.properties boostlogconfig.ini audio.8bit.wav test.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/${INI_FILE_NAME}
hmi_capabilities.json sdl_preloaded_pt.json sample_policy_manager.py
${CMAKE_SOURCE_DIR}/mycert.pem ${CMAKE_SOURCE_DIR}/mykey.pem
DESTINATION bin
diff --git a/src/appMain/android_platform_interface.cc b/src/appMain/android_platform_interface.cc
index f3ef0e94f3..d4afdc1575 100644
--- a/src/appMain/android_platform_interface.cc
+++ b/src/appMain/android_platform_interface.cc
@@ -1,9 +1,9 @@
#include <jni.h>
-#include "config_profile/android_profile.h"
#include "appMain/life_cycle_impl.h"
-#include "utils/lock.h"
+#include "config_profile/android_profile.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
#ifdef ENABLE_LOG
#include "utils/logger/androidlogger.h"
@@ -16,122 +16,122 @@ void StartSDLNative(JNIEnv* env, jobject);
void StopSDLNative(JNIEnv* env, jobject);
static JNINativeMethod s_methods[] = {
- {"StartSDLNative", "()V", (void*)StartSDLNative},
- {"StopSDLNative", "()V", (void*)StopSDLNative}
-};
+ {"StartSDLNative", "()V", (void*)StartSDLNative},
+ {"StopSDLNative", "()V", (void*)StopSDLNative}};
// To call Java methods when running native code inside an Android activity,
// a reference is needed to the JavaVM
-static JavaVM *gJavaVM;
+static JavaVM* gJavaVM;
sync_primitives::Lock wait_lock_;
sync_primitives::ConditionalVariable wait_var_;
std::string JNI_GetMainActivityStringProperty(const char* property) {
- JNIEnv *env = NULL;
- gJavaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ JNIEnv* env = NULL;
+ gJavaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
- jclass cls = env->FindClass("org/luxoft/sdl_core/MainActivity");
- jfieldID fieldID = env->GetStaticFieldID(cls, property, "Ljava/lang/String;");
- auto fieldValue = static_cast<jstring>(env->GetStaticObjectField(cls, fieldID));
+ jclass cls = env->FindClass("org/luxoft/sdl_core/MainActivity");
+ jfieldID fieldID = env->GetStaticFieldID(cls, property, "Ljava/lang/String;");
+ auto fieldValue =
+ static_cast<jstring>(env->GetStaticObjectField(cls, fieldID));
- const char *path_chars = env->GetStringUTFChars(fieldValue, NULL);
- return std::string(path_chars);
+ const char* path_chars = env->GetStringUTFChars(fieldValue, NULL);
+ return std::string(path_chars);
}
jint JNI_OnLoad(JavaVM* vm, void*) {
- gJavaVM = vm;
- JNIEnv *env = NULL;
- gJavaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ gJavaVM = vm;
+ JNIEnv* env = NULL;
+ gJavaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
- jclass cls = env->FindClass("org/luxoft/sdl_core/SdlLauncherService");
- auto globalClass = reinterpret_cast<jclass>(env->NewGlobalRef(cls));
- int len = sizeof(s_methods) / sizeof(s_methods[0]);
+ jclass cls = env->FindClass("org/luxoft/sdl_core/SdlLauncherService");
+ auto globalClass = reinterpret_cast<jclass>(env->NewGlobalRef(cls));
+ int len = sizeof(s_methods) / sizeof(s_methods[0]);
- env->RegisterNatives(globalClass, s_methods, len);
+ env->RegisterNatives(globalClass, s_methods, len);
- return JNI_VERSION_1_6;
+ return JNI_VERSION_1_6;
}
-void StartSDLNative(JNIEnv* env, jobject)
-{
+void StartSDLNative(JNIEnv* env, jobject) {
#ifdef ENABLE_LOG
- auto logger_impl =
- std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl());
- logger::Logger::instance(logger_impl.get());
+ auto logger_impl =
+ std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl());
+ logger::Logger::instance(logger_impl.get());
#endif // ENABLE_LOG
- const std::string internal_storage = JNI_GetMainActivityStringProperty("sdl_cache_folder_path");
- const std::string external_storage = JNI_GetMainActivityStringProperty("sdl_external_dir_folder_path");
+ const std::string internal_storage =
+ JNI_GetMainActivityStringProperty("sdl_cache_folder_path");
+ const std::string external_storage =
+ JNI_GetMainActivityStringProperty("sdl_external_dir_folder_path");
- profile::AndroidProfile profile_instance(internal_storage, external_storage);
- std::unique_ptr<main_namespace::LifeCycle> life_cycle(
+ profile::AndroidProfile profile_instance(internal_storage, external_storage);
+ std::unique_ptr<main_namespace::LifeCycle> life_cycle(
new main_namespace::LifeCycleImpl(profile_instance));
+ std::string ini_name = "androidSmartDeviceLink.ini";
+ if (!internal_storage.empty()) {
+ ini_name = internal_storage + "/files/" + ini_name;
+ }
- std::string ini_name = "androidSmartDeviceLink.ini";
- if (!internal_storage.empty()) {
- ini_name = internal_storage + "/files/" + ini_name;
- }
-
- profile_instance.set_config_file_name(ini_name);
+ profile_instance.set_config_file_name(ini_name);
#ifdef ENABLE_LOG
if (profile_instance.logs_enabled()) {
// Logger initialization
// Redefine for each paticular logger implementation
- auto logger = std::unique_ptr<logger::AndroidLogger>(
- new logger::AndroidLogger());
+ auto logger =
+ std::unique_ptr<logger::AndroidLogger>(new logger::AndroidLogger());
logger_impl->Init(std::move(logger));
}
#endif
- SDL_LOG_INFO("Application started!");
- SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version());
+ SDL_LOG_INFO("Application started!");
+ SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version());
- // Check if no error values were read from config file
- if (profile_instance.ErrorOccured()) {
- SDL_LOG_FATAL(profile_instance.ErrorDescription());
- SDL_DEINIT_LOGGER();
- exit(EXIT_FAILURE);
- }
+ // Check if no error values were read from config file
+ if (profile_instance.ErrorOccured()) {
+ SDL_LOG_FATAL(profile_instance.ErrorDescription());
+ SDL_DEINIT_LOGGER();
+ exit(EXIT_FAILURE);
+ }
- if (!life_cycle->StartComponents()) {
- SDL_LOG_FATAL("Failed to start components");
- life_cycle->StopComponents();
- SDL_DEINIT_LOGGER();
- return;
- }
+ if (!life_cycle->StartComponents()) {
+ SDL_LOG_FATAL("Failed to start components");
+ life_cycle->StopComponents();
+ SDL_DEINIT_LOGGER();
+ return;
+ }
- SDL_LOG_INFO("Components Started");
+ SDL_LOG_INFO("Components Started");
- if (!life_cycle->InitMessageSystem()) {
- SDL_LOG_FATAL("Failed to init message system");
- life_cycle->StopComponents();
- SDL_DEINIT_LOGGER();
- return;
- }
+ if (!life_cycle->InitMessageSystem()) {
+ SDL_LOG_FATAL("Failed to init message system");
+ life_cycle->StopComponents();
+ SDL_DEINIT_LOGGER();
+ return;
+ }
- {
- // TODO: Replace with lifecycle Run() once signal handling is fixed
- sync_primitives::AutoLock auto_lock(wait_lock_);
- wait_var_.Wait(auto_lock);
- }
+ {
+ // TODO: Replace with lifecycle Run() once signal handling is fixed
+ sync_primitives::AutoLock auto_lock(wait_lock_);
+ wait_var_.Wait(auto_lock);
+ }
- SDL_LOG_INFO("Stop SDL due to caught signal");
+ SDL_LOG_INFO("Stop SDL due to caught signal");
- life_cycle->StopComponents();
- SDL_LOG_INFO("Application has been stopped successfully");
+ life_cycle->StopComponents();
+ SDL_LOG_INFO("Application has been stopped successfully");
- SDL_LOG_TRACE("StartSDL: exit");
+ SDL_LOG_TRACE("StartSDL: exit");
- SDL_DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
}
void StopSDLNative(JNIEnv*, jobject) {
- SDL_LOG_INFO("Stop from main activity requested");
- {
- // TODO: Replace with sigkill(SIGINT) once signal handling is fixed
- sync_primitives::AutoLock auto_lock(wait_lock_);
- wait_var_.NotifyOne();
- }
+ SDL_LOG_INFO("Stop from main activity requested");
+ {
+ // TODO: Replace with sigkill(SIGINT) once signal handling is fixed
+ sync_primitives::AutoLock auto_lock(wait_lock_);
+ wait_var_.NotifyOne();
+ }
} \ No newline at end of file
diff --git a/src/appMain/boostlogconfig.ini b/src/appMain/boostlogconfig.ini
new file mode 100644
index 0000000000..a5d43a5bf0
--- /dev/null
+++ b/src/appMain/boostlogconfig.ini
@@ -0,0 +1,51 @@
+# Core settings
+[Core]
+DisableLogging=false
+
+# Console Logging
+[Sinks.Console]
+DisableLogging=true
+Destination=Console
+Filter="%Severity% >= debug"
+Format="%Severity% [%TimeStamp%][%Component%] %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# SDL log file
+[Sinks.AllMessages]
+DisableLogging=false
+Destination=TextFile
+FileName=SmartDeviceLinkCore.log
+Append=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for all TransportManager messages
+[Sinks.TransportManager]
+DisableLogging=false
+Destination=TextFile
+FileName=TransportManager.log
+Append=false
+Filter="%Component% = TransportManager"
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager)
+[Sinks.ProtocolFordHandling]
+DisableLogging=false
+Destination=TextFile
+FileName=ProtocolFordHandling.log
+Append=false
+Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager"
+Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+[Sinks.Telnet]
+DisableLogging=true
+Destination=Syslog
+Asynchronous=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file
diff --git a/src/appMain/daemon.sh b/src/appMain/daemon.sh
index fbde0d750a..04431de039 100644
--- a/src/appMain/daemon.sh
+++ b/src/appMain/daemon.sh
@@ -19,7 +19,7 @@ function core_start() {
return 2
else
echo "Starting SmartDeviceLink Core"
- LD_LIBRARY_PATH=$DIR ${DIR}/${CORE_APPLICATION_NAME} &
+ ${DIR}/${CORE_APPLICATION_NAME} &
CORE_PID=$!
echo $CORE_PID > $CORE_PID_FILE
return 0
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index 1e1c5aea79..e5ee4f00b6 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -105,55 +105,67 @@
"rows": 1
},
{
- "name": "navigationText",
+ "name": "audioPassThruDisplayText1",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "audioPassThruDisplayText1",
+ "name": "audioPassThruDisplayText2",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "audioPassThruDisplayText2",
+ "name": "sliderHeader",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "sliderHeader",
+ "name": "sliderFooter",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "sliderFooter",
+ "name": "menuName",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "notificationText",
+ "name": "secondaryText",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "menuName",
+ "name": "tertiaryText",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "secondaryText",
+ "name": "menuCommandSecondaryText",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
},
{
- "name": "tertiaryText",
+ "name": "menuCommandTertiaryText",
+ "characterSet": "UTF_8",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuSubMenuSecondaryText",
+ "characterSet": "UTF_8",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuSubMenuTertiaryText",
"characterSet": "UTF_8",
"width": 500,
"rows": 1
@@ -213,6 +225,20 @@
}
},
{
+ "name": "menuCommandSecondaryImage",
+ "imageResolution": {
+ "resolutionWidth": 35,
+ "resolutionHeight": 35
+ }
+ },
+ {
+ "name": "menuSubMenuSecondaryImage",
+ "imageResolution": {
+ "resolutionWidth": 35,
+ "resolutionHeight": 35
+ }
+ },
+ {
"name": "appIcon",
"imageResolution": {
"resolutionWidth": 35,
@@ -311,19 +337,106 @@
"dialNumberEnabled": true
},
"videoStreamingCapability": {
- "preferredResolution": {
+ "preferredResolution": {
+ "resolutionWidth": 800,
+ "resolutionHeight": 380
+ },
+ "maxBitrate": 20000,
+ "supportedFormats": [
+ {
+ "protocol": "RAW",
+ "codec": "H264"
+ },
+ {
+ "protocol": "RTP",
+ "codec": "H264"
+ },
+ {
+ "protocol": "RTSP",
+ "codec": "Theora"
+ },
+ {
+ "protocol": "RTMP",
+ "codec": "VP8"
+ },
+ {
+ "protocol": "WEBM",
+ "codec": "VP9"
+ }
+ ],
+ "hapticSpatialDataSupported": true,
+ "diagonalScreenSize": 8,
+ "pixelPerInch": 96,
+ "scale": 1,
+ "preferredFPS": 15,
+ "additionalVideoStreamingCapabilities": [
+ {
+ "preferredResolution":
+ {
"resolutionWidth": 800,
- "resolutionHeight": 350
+ "resolutionHeight": 380
+ },
+ "hapticSpatialDataSupported": true,
+ "scale": 1,
+ "diagonalScreenSize": 8
+ },
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 320,
+ "resolutionHeight": 200
+ },
+ "hapticSpatialDataSupported": false,
+ "diagonalScreenSize": 3
+ },
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 480,
+ "resolutionHeight": 320
+ },
+ "hapticSpatialDataSupported": true,
+ "diagonalScreenSize": 5
+ },
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 400,
+ "resolutionHeight": 380
+ },
+ "hapticSpatialDataSupported": true,
+ "diagonalScreenSize": 4
+ },
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 800,
+ "resolutionHeight": 240
+ },
+ "hapticSpatialDataSupported": true,
+ "diagonalScreenSize": 4
},
- "maxBitrate": 10000,
- "supportedFormats": [{
- "protocol": "RAW",
- "codec": "H264"
- }],
- "hapticSpatialDataSupported": false,
- "diagonalScreenSize": 8,
- "pixelPerInch": 117,
- "scale": 1
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 800,
+ "resolutionHeight": 380
+ },
+ "hapticSpatialDataSupported": true,
+ "scale": 1.5,
+ "diagonalScreenSize": 5
+ },
+ {
+ "preferredResolution":
+ {
+ "resolutionWidth": 800,
+ "resolutionHeight": 380
+ },
+ "hapticSpatialDataSupported": true,
+ "scale": 2,
+ "diagonalScreenSize": 4
+ }
+ ]
},
"driverDistractionCapability": {
"menuLength": 10,
@@ -1047,6 +1160,12 @@
"shortPressAvailable": true,
"longPressAvailable": true,
"upDownAvailable": true
+ },
+ {
+ "name" : "CUSTOM_BUTTON",
+ "longPressAvailable" : true,
+ "shortPressAvailable" : true,
+ "upDownAvailable" : true
}
],
"presetBankCapabilities": {
diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc
index a14ca1240c..8b67877ac8 100644
--- a/src/appMain/life_cycle_impl.cc
+++ b/src/appMain/life_cycle_impl.cc
@@ -264,15 +264,15 @@ void LifeCycleImpl::StopComponents() {
DCHECK_OR_RETURN_VOID(hmi_handler_);
hmi_handler_->set_message_observer(NULL);
- DCHECK_OR_RETURN_VOID(connection_handler_);
- connection_handler_->set_connection_handler_observer(NULL);
-
DCHECK_OR_RETURN_VOID(protocol_handler_);
protocol_handler_->RemoveProtocolObserver(&(app_manager_->GetRPCHandler()));
DCHECK_OR_RETURN_VOID(app_manager_);
app_manager_->Stop();
+ DCHECK_OR_RETURN_VOID(connection_handler_);
+ connection_handler_->set_connection_handler_observer(NULL);
+
SDL_LOG_INFO("Stopping Protocol Handler");
DCHECK_OR_RETURN_VOID(protocol_handler_);
protocol_handler_->RemoveProtocolObserver(media_manager_);
diff --git a/src/appMain/low_voltage_signals_handler.h b/src/appMain/low_voltage_signals_handler.h
index c4c1d93806..a4cb5c1584 100644
--- a/src/appMain/low_voltage_signals_handler.h
+++ b/src/appMain/low_voltage_signals_handler.h
@@ -116,7 +116,8 @@ class NotificationThreadDelegate : public threads::ThreadDelegate {
public:
NotificationThreadDelegate(
LowVoltageSignalsHandler& low_voltage_signals_handler)
- : is_stopped_(false), low_voltage_signals_handler_(low_voltage_signals_handler) {}
+ : is_stopped_(false)
+ , low_voltage_signals_handler_(low_voltage_signals_handler) {}
~NotificationThreadDelegate() {}
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index 34c5b4dbfa..cedaf50497 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -43,7 +43,15 @@
// ----------------------------------------------------------------------------
#ifdef ENABLE_LOG
+
+#ifdef LOG4CXX_LOGGER
+#include "utils/appenders_loader.h"
#include "utils/logger/log4cxxlogger.h"
+
+#else // LOG4CXX_LOGGER
+#include "utils/logger/boostlogger.h"
+#endif // LOG4CXX_LOGGER
+
#include "utils/logger/logger_impl.h"
#endif // ENABLE_LOG
@@ -53,7 +61,6 @@
#include "signal_handlers.h"
#include "config_profile/profile.h"
-#include "utils/appenders_loader.h"
#include "utils/signals.h"
#include "utils/system.h"
@@ -142,18 +149,24 @@ int32_t main(int32_t argc, char** argv) {
if (profile_instance.logs_enabled()) {
// Logger initialization
// Redefine for each paticular logger implementation
+#ifdef LOG4CXX_LOGGER
auto logger = std::unique_ptr<logger::Log4CXXLogger>(
new logger::Log4CXXLogger("log4cxx.properties"));
+
+ if (!utils::appenders_loader.Loaded()) {
+ SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled");
+ }
+#else // LOG4CXX_LOGGER
+ auto logger = std::unique_ptr<logger::BoostLogger>(
+ new logger::BoostLogger("boostlogconfig.ini"));
+#endif // LOG4CXX_LOGGER
+
logger_impl->Init(std::move(logger));
}
#endif
threads::Thread::SetNameForId(threads::Thread::CurrentId(), "SDLCore");
- if (!utils::appenders_loader.Loaded()) {
- SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled");
- }
-
SDL_LOG_INFO("Application started!");
SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version());
diff --git a/src/appMain/sample_policy_manager.py b/src/appMain/sample_policy_manager.py
index 2b65208418..cae7c4eab1 100644
--- a/src/appMain/sample_policy_manager.py
+++ b/src/appMain/sample_policy_manager.py
@@ -165,7 +165,11 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
print('\033[31;1mMissing fileName parameter: %s\033[0m' % str(json_data))
return
- self.write_message(self.handle_func(json_data, self.encryption, self.add_http_header, self.is_android))
+ msg = {
+ "requestType": json_data['requestType'],
+ "data": self.handle_func(json_data, self.encryption, self.add_http_header, self.is_android)
+ }
+ self.write_message(msg)
def on_close(self):
print ("Connection Closed\n")
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index eff433fd1e..4887405909 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -189,6 +189,13 @@
"NONE"
]
},
+ "OnAppCapabilityUpdated": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
"OnAppInterfaceUnregistered": {
"hmi_levels": [
"BACKGROUND",
@@ -545,6 +552,7 @@
"rpm",
"steeringWheelAngle",
"gearStatus",
+ "seatOccupancy",
"handsOffSteering"
]
},
@@ -564,6 +572,7 @@
"rpm",
"steeringWheelAngle",
"gearStatus",
+ "seatOccupancy",
"handsOffSteering"
]
},
@@ -583,6 +592,7 @@
"rpm",
"steeringWheelAngle",
"gearStatus",
+ "seatOccupancy",
"handsOffSteering"
]
},
@@ -602,6 +612,7 @@
"rpm",
"steeringWheelAngle",
"gearStatus",
+ "seatOccupancy",
"handsOffSteering"
]
}
@@ -621,6 +632,7 @@
"deviceStatus",
"engineOilLife",
"engineTorque",
+ "climateData",
"externalTemperature",
"turnSignal",
"fuelLevel",
@@ -648,6 +660,7 @@
"deviceStatus",
"engineOilLife",
"engineTorque",
+ "climateData",
"externalTemperature",
"turnSignal",
"fuelLevel",
@@ -675,6 +688,7 @@
"deviceStatus",
"engineOilLife",
"engineTorque",
+ "climateData",
"externalTemperature",
"turnSignal",
"fuelLevel",
@@ -701,6 +715,7 @@
"deviceStatus",
"engineOilLife",
"engineTorque",
+ "climateData",
"externalTemperature",
"turnSignal",
"fuelLevel",
@@ -854,8 +869,7 @@
"hmi_levels": [
"FULL",
"LIMITED",
- "BACKGROUND",
- "NONE"
+ "BACKGROUND"
]
},
"UnpublishAppService": {
@@ -1647,6 +1661,7 @@
"rpcs": {
"CreateWindow": {
"hmi_levels": [
+ "NONE",
"BACKGROUND",
"FULL",
"LIMITED"
@@ -1654,6 +1669,7 @@
},
"DeleteWindow": {
"hmi_levels": [
+ "NONE",
"BACKGROUND",
"FULL",
"LIMITED"
@@ -1720,12 +1736,6 @@
"line2": "Permission(s)?",
"textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
},
- "es-en": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
- },
"es-es": {
"tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
"line1": "¿Conceder permisos",
@@ -1817,9 +1827,6 @@
"en-us": {
"tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es": {
"tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
},
@@ -1881,9 +1888,6 @@
"en-us": {
"tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es": {
"tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
},
@@ -1952,11 +1956,6 @@
"line1": "Not Authorized",
"textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
},
- "es-en": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es": {
"tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
"line1": "No autorizada"
@@ -2041,11 +2040,6 @@
"line1": "Not Supported",
"textBody": "Your version of %appName% is not supported by SYNC."
},
- "es-en": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es": {
"tts": "Esta versión de %appName% no es compatible con SYNC.",
"line1": "No compatible"
@@ -2166,12 +2160,6 @@
"line2": "and Mobile Apps?",
"textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
},
- "es-en": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es": {
"tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
"line1": "¿Desact. actual. auto",
@@ -2270,11 +2258,6 @@
"label": "Driving Characteristics",
"textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
},
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es": {
"tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
"label": "Características de conducción"
@@ -2359,11 +2342,6 @@
"label": "GPS and speed",
"textBody": "An app can access vehicle GPS and speed."
},
- "es-en": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es": {
"tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
"label": "GPS y velocidad"
@@ -2455,11 +2433,6 @@
"label": "Push notifications",
"textBody": "An app can send notifications when running in the background."
},
- "es-en": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es": {
"tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
"label": "Notificaciones push"
@@ -2538,10 +2511,6 @@
"line1": "Disable Updates",
"textBody": "Disable Updates"
},
- "es-en": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
"es-es": {
"line1": "Desact. actual."
},
@@ -2605,9 +2574,6 @@
"en-us": {
"line1": "Enable Apps"
},
- "es-en": {
- "line1": "Hab. aplic."
- },
"es-es": {
"line1": "Activar apl."
},
@@ -2671,10 +2637,6 @@
"line1": "Request Update",
"textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
},
- "es-en": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
"es-es": {
"line1": "Solicitar actual."
},
@@ -2740,10 +2702,6 @@
"line1": "Update Needed",
"textBody": "Update Needed"
},
- "es-en": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
"es-es": {
"line1": "Actu. necesaria"
},
@@ -2809,10 +2767,6 @@
"line1": "Updating...",
"textBody": "Updating..."
},
- "es-en": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
"es-es": {
"line1": "Actualizando..."
},
@@ -2878,10 +2832,6 @@
"line1": "Up-To-Date",
"textBody": "Up-To-Date"
},
- "es-en": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
"es-es": {
"line1": "Actualizada"
},
@@ -2952,11 +2902,6 @@
"label": "Vehicle information",
"textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
},
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es": {
"tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
"label": "Información del vehículo"
@@ -3477,12 +3422,71 @@
"since": "5.0"
},
{
+ "name": "climateData",
+ "params": [
+ {
+ "name": "externalTemperature",
+ "key": "OEM_REF_EXT_TEMP",
+ "params": [
+ {
+ "name": "unit",
+ "key": "OEM_REF_EXT_TEMP_UNIT",
+ "type": "TemperatureUnit",
+ "mandatory": true
+ },
+ {
+ "name": "value",
+ "key": "OEM_REF_EXT_TEMP_VALUE",
+ "type": "Float",
+ "mandatory": true
+ }
+ ],
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "cabinTemperature",
+ "key": "OEM_REF_CABIN_TEMP",
+ "params": [
+ {
+ "name": "unit",
+ "key": "OEM_REF_CABIN_TEMP_VALUE",
+ "type": "TemperatureUnit",
+ "mandatory": true
+ },
+ {
+ "name": "value",
+ "key": "OEM_REF_CABIN_TEMP_VALUE",
+ "type": "Float",
+ "mandatory": true
+ }
+ ],
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "atmosphericPressure",
+ "key": "OEM_REF_ATMOSPHERIC_PRESSURE",
+ "type": "Float",
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "mandatory": false
+ }
+ ],
+ "key": "OEM_REF_CLIMATE_DATA",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "7.1"
+ },
+ {
"name": "externalTemperature",
"key": "OEM_REF_EXT_TEMP",
"type": "Float",
"mandatory": false,
"minvalue": -40,
- "maxvalue": 100
+ "maxvalue": 100,
+ "deprecated": true,
+ "since": "7.1"
},
{
"name": "turnSignal",
@@ -3541,7 +3545,16 @@
"name": "pressureTelltale",
"key": "OEM_REF_PRES_TEL",
"type": "WarningLightStatus",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "pressureTelltale",
+ "key": "OEM_REF_PRES_TEL",
+ "type": "WarningLightStatus",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "leftFront",
@@ -3571,7 +3584,40 @@
],
"key": "OEM_REF_LEFT_FR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "leftFront",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_LEFT_FR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_LEFT_FR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_LEFT_FR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_LEFT_FR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "rightFront",
@@ -3601,7 +3647,40 @@
],
"key": "OEM_REF_RIGHT_FR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "rightFront",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_RIGHT_FR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_RIGHT_FR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_RIGHT_FR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_RIGHT_FR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "leftRear",
@@ -3631,7 +3710,40 @@
],
"key": "OEM_REF_LEFT_REAR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "leftRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_LEFT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_LEFT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_LEFT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_LEFT_REAR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "rightRear",
@@ -3661,7 +3773,40 @@
],
"key": "OEM_REF_RIGHT_REAR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "rightRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_RIGHT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_RIGHT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_RIGHT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_RIGHT_REAR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "innerLeftRear",
@@ -3691,7 +3836,40 @@
],
"key": "OEM_REF_IN_LEFT_REAR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "innerLeftRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_IN_LEFT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_IN_LEFT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_IN_LEFT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_IN_LEFT_REAR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
},
{
"name": "innerRightRear",
@@ -3721,7 +3899,40 @@
],
"key": "OEM_REF_IN_RIGHT_REAR",
"type": "Struct",
- "mandatory": true
+ "mandatory": true,
+ "since": "2.0",
+ "until": "8.0"
+ },
+ {
+ "name": "innerRightRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_IN_RIGHT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_IN_RIGHT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_IN_RIGHT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_IN_RIGHT_REAR",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "8.0"
}
],
"key": "OEM_REF_TIRE_PRES",
@@ -3859,25 +4070,63 @@
"name": "driverDoorAjar",
"key": "OEM_REF_DR_DOOR_AJ",
"type": "Boolean",
- "mandatory": false
+ "mandatory": false,
+ "deprecated": true,
+ "since": "7.1"
},
{
"name": "passengerDoorAjar",
"key": "OEM_REF_PAS_DOOR_AJ",
"type": "Boolean",
- "mandatory": false
+ "mandatory": false,
+ "deprecated": true,
+ "since": "7.1"
},
{
"name": "rearLeftDoorAjar",
"key": "OEM_REF_REAR_LEFT_DOOR_AJ",
"type": "Boolean",
- "mandatory": false
+ "mandatory": false,
+ "deprecated": true,
+ "since": "7.1"
},
{
"name": "rearRightDoorAjar",
"key": "OEM_REF_REAR_RIGHT_DOOR_AJ",
"type": "Boolean",
- "mandatory": false
+ "mandatory": false,
+ "deprecated": true,
+ "since": "7.1"
+ },
+ {
+ "name": "doorStatuses",
+ "key": "OEM_REF_DOOR_STATUSES",
+ "array": true,
+ "type": "DoorStatus",
+ "mandatory": false,
+ "minsize": 0,
+ "maxsize": 100,
+ "since": "7.1"
+ },
+ {
+ "name": "gateStatuses",
+ "key": "OEM_REF_GATE_STATUSES",
+ "array": true,
+ "type": "GateStatus",
+ "mandatory": false,
+ "minsize": 0,
+ "maxsize": 100,
+ "since": "7.1"
+ },
+ {
+ "name": "roofStatuses",
+ "key": "OEM_REF_ROOF_STATUSES",
+ "array": true,
+ "type": "RoofStatus",
+ "mandatory": false,
+ "minsize": 0,
+ "maxsize": 100,
+ "since": "7.1"
}
],
"key": "OEM_REF_BODY_INF",
@@ -4335,6 +4584,33 @@
"type": "Boolean",
"mandatory": false,
"since": "7.0"
+ },
+ {
+ "name": "seatOccupancy",
+ "key": "OEM_REF_SEAT_OCCUP",
+ "params": [
+ {
+ "name": "seatsOccupied",
+ "key": "OEM_REF_SEATS_OCCUP",
+ "type": "SeatStatus",
+ "array": true,
+ "minsize": 0,
+ "maxsize": 100,
+ "mandatory": false
+ },
+ {
+ "name": "seatsBelted",
+ "key": "OEM_REF_SEATS_BELT",
+ "type": "SeatStatus",
+ "array": true,
+ "minsize": 0,
+ "maxsize": 100,
+ "mandatory": false
+ }
+ ],
+ "type": "Struct",
+ "mandatory": false,
+ "since": "7.1"
}
]
}
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index 8c4c60d5d0..69b52ca7e0 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -58,6 +58,8 @@ HMICapabilitiesCacheFile = hmi_capabilities_cache.json
MaxCmdID = 2000000000
; SDL respond timeout (in milliseconds) in case of HMI has not respond on a mobile request
DefaultTimeout = 10000
+; Extra time to compensate default timeout due to external delays
+DefaultTimeoutCompensation = 1000
; Available disk space in bytes for each application file handling
; Default value is 100 MiB
AppDirectoryQuota = 104857600
@@ -158,7 +160,7 @@ ListFilesRequest = 5
HelpCommand = Help
[AppInfo]
-; The path for applications info storage.
+; The file name for applications info storage.
AppInfoStorage = app_info.dat
[Security Manager]
@@ -185,6 +187,9 @@ ForceUnprotectedService = Non
; The PTU will be triggered in case expiration date of certificate
; then certain hours amount
UpdateBeforeHours = 24
+; Security level for openssl lib according to:
+; https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_get_security_level.html
+SecurityLevel = 1
[Policy]
EnablePolicy = true
@@ -266,7 +271,8 @@ HashStringSize = 32
[SDL4]
; Section for features added in protocol version 4
; Path where apps icons must be stored
-AppIconsFolder = storage
+; Specify a dedicated folder, as old files in this folder can be automatically removed
+AppIconsFolder = icons
; Max size of the folder in bytes
AppIconsFolderMaxSize = 104857600
; Amount of oldest icons to remove in case of max folder size was reached
diff --git a/src/appMain/test/CMakeLists.txt b/src/appMain/test/CMakeLists.txt
index 057e1e9869..c700c5dc57 100644
--- a/src/appMain/test/CMakeLists.txt
+++ b/src/appMain/test/CMakeLists.txt
@@ -41,6 +41,7 @@ set(testSources
set(LIBRARIES
gmock
+ SmartObjects
)
create_test(low_voltage_signals_handler_test "${testSources}" "${LIBRARIES}")
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index a48ed83d7b..e29b150983 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -176,7 +176,7 @@ list(APPEND LIBRARIES
AMPolicyLibrary
)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
index 9e60183960..dba2579f8f 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
@@ -54,10 +54,6 @@ class AppLaunchDataJson : public AppLaunchDataImpl {
AppLaunchDataJson(const AppLaunchSettings& settings,
resumption::LastStateWrapperPtr last_state_wrapper);
- DEPRECATED
- AppLaunchDataJson(const AppLaunchSettings& settings,
- resumption::LastState& last_state);
-
/**
* @brief allows to destroy AppLaunchDataJson object
*/
@@ -99,10 +95,6 @@ class AppLaunchDataJson : public AppLaunchDataImpl {
int32_t& found_index,
Json::Value& dictionary) const;
- DEPRECATED
- Json::Value& GetApplicationListAndIndex(const ApplicationData& app_data,
- int32_t& founded_index) const;
-
private:
/**
* @brief update time stamp
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h
index d26598c1e9..e3a5f64602 100644
--- a/src/components/application_manager/include/application_manager/app_service_manager.h
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -65,9 +65,6 @@ class AppServiceManager {
AppServiceManager(ApplicationManager& app_manager,
resumption::LastStateWrapperPtr last_state);
- DEPRECATED AppServiceManager(ApplicationManager& app_manager,
- resumption::LastState& last_state);
-
/**
* @brief Class destructor
*/
@@ -215,6 +212,13 @@ class AppServiceManager {
smart_objects::SmartObject& out_params);
/**
+ * @brief Retrieve the active service for handling waypoints if available
+ * @return The active NAVIGATION service if it handles waypoints, nullptr
+ * otherwise
+ */
+ virtual AppService* FindWayPointsHandler();
+
+ /**
* @brief Get the RPCPassingHandler tied to this object
* @return The RPCPassingHandler tied to this object
*/
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index c08bb37082..86b26f24ef 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -46,6 +46,7 @@
#include "application_manager/hmi_state.h"
#include "application_manager/message.h"
#include "connection_handler/device.h"
+#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "protocol_handler/protocol_handler.h"
#include "smart_objects/smart_object.h"
@@ -106,6 +107,8 @@ struct AppFile {
mobile_apis::FileType::eType file_type;
};
typedef std::map<std::string, AppFile> AppFilesMap;
+typedef std::map<int32_t, hmi_apis::Common_ButtonName::eType>
+ ButtonSubscriptionsMap;
class InitialApplicationData {
public:
virtual ~InitialApplicationData() {}
@@ -170,9 +173,14 @@ typedef std::map<uint32_t, smart_objects::SmartObject*> PerformChoice;
typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;
/**
- * @brief Defines id of SoftButton
+ * @brief Defines id of SoftButtons for specified WindowID
*/
-typedef std::set<std::pair<uint32_t, WindowID> > SoftButtonID;
+typedef std::pair<WindowID, std::set<uint32_t> > WindowSoftButtons;
+
+/**
+ * @brief Defines id of SoftButtons related to a specified WindowID
+ */
+typedef std::set<WindowSoftButtons> SoftButtonIDs;
/**
* @brief Defines set of buttons subscription
@@ -198,6 +206,7 @@ class DynamicApplicationData {
virtual const smart_objects::SmartObject* keyboard_props() const = 0;
virtual const smart_objects::SmartObject* menu_title() const = 0;
virtual const smart_objects::SmartObject* menu_icon() const = 0;
+ virtual const smart_objects::SmartObject* menu_layout() const = 0;
virtual smart_objects::SmartObject day_color_scheme() const = 0;
virtual smart_objects::SmartObject night_color_scheme() const = 0;
virtual std::string display_layout() const = 0;
@@ -237,6 +246,8 @@ class DynamicApplicationData {
const smart_objects::SmartObject& keyboard_props) = 0;
virtual void set_menu_title(const smart_objects::SmartObject& menu_title) = 0;
virtual void set_menu_icon(const smart_objects::SmartObject& menu_icon) = 0;
+ virtual void set_menu_layout(
+ const smart_objects::SmartObject& menu_layout) = 0;
virtual uint32_t audio_stream_retry_number() const = 0;
@@ -367,12 +378,6 @@ class DynamicApplicationData {
virtual smart_objects::SmartObject FindSubMenu(uint32_t menu_id) const = 0;
/*
- * @brief Returns true if sub menu with such name already exist
- */
- virtual bool IsSubMenuNameAlreadyExist(const std::string& name,
- const uint32_t parent_id) = 0;
-
- /*
* @brief Adds a interaction choice set to the application
*
* @param choice_set_id Unique ID used for this interaction choice set
@@ -524,6 +529,7 @@ class Application : public virtual InitialApplicationData,
* @brief The StreamingState enum defines current streaming state
*/
enum class StreamingState { kStopped, kStarted, kSuspended };
+
enum ApplicationRegisterState { kRegistered = 0, kWaitingForRegistration };
Application() : is_greyed_out_(false) {}
@@ -664,8 +670,10 @@ class Application : public virtual InitialApplicationData,
/**
* @brief Wakes up streaming process for application
* @param service_type Type of streaming service
+ * @param timer_len The amount of time in ms the timer will wait
*/
- virtual void WakeUpStreaming(protocol_handler::ServiceType service_type) = 0;
+ virtual void WakeUpStreaming(protocol_handler::ServiceType service_type,
+ uint32_t timer_len = 0) = 0;
virtual bool is_voice_communication_supported() const = 0;
virtual void set_voice_communication_supported(
@@ -961,10 +969,10 @@ class Application : public virtual InitialApplicationData,
* Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver,
* UpdateTurnList
* @param cmd_id Unique command id from mobile API
- * @param list of softbuttons were created by command.
+ * @param window_softbuttons list of softbuttons were created by command.
*/
- virtual void SubscribeToSoftButtons(int32_t cmd_id,
- const SoftButtonID& softbuttons_id) = 0;
+ virtual void SubscribeToSoftButtons(
+ int32_t cmd_id, const WindowSoftButtons& window_softbuttons) = 0;
/**
* @brief Retreives window id on which given button is created
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index a64e0c8f33..086e71b48b 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -102,6 +102,7 @@ class DynamicApplicationDataImpl : public virtual Application {
const smart_objects::SmartObject* keyboard_props() const;
const smart_objects::SmartObject* menu_title() const;
const smart_objects::SmartObject* menu_icon() const;
+ const smart_objects::SmartObject* menu_layout() const;
smart_objects::SmartObject day_color_scheme() const OVERRIDE;
smart_objects::SmartObject night_color_scheme() const OVERRIDE;
@@ -141,6 +142,7 @@ class DynamicApplicationDataImpl : public virtual Application {
void set_keyboard_props(const smart_objects::SmartObject& keyboard_props);
void set_menu_title(const smart_objects::SmartObject& menu_title);
void set_menu_icon(const smart_objects::SmartObject& menu_icon);
+ void set_menu_layout(const smart_objects::SmartObject& menu_layout);
void set_day_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_night_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_display_layout(const std::string& layout);
@@ -323,6 +325,7 @@ class DynamicApplicationDataImpl : public virtual Application {
smart_objects::SmartObject* keyboard_props_;
smart_objects::SmartObject* menu_title_;
smart_objects::SmartObject* menu_icon_;
+ smart_objects::SmartObject* menu_layout_;
smart_objects::SmartObject* tbt_show_command_;
smart_objects::SmartObjectSPtr display_capabilities_;
AppWindowsTemplates window_templates_;
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 88668a2505..21e45b4515 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -142,7 +142,8 @@ class ApplicationImpl : public virtual Application,
void StopStreamingForce(protocol_handler::ServiceType service_type);
void StopStreaming(protocol_handler::ServiceType service_type);
void SuspendStreaming(protocol_handler::ServiceType service_type);
- void WakeUpStreaming(protocol_handler::ServiceType service_type);
+ void WakeUpStreaming(protocol_handler::ServiceType service_type,
+ uint32_t timer_len = 0);
virtual bool is_voice_communication_supported() const;
virtual void set_voice_communication_supported(bool option);
@@ -279,8 +280,8 @@ class ApplicationImpl : public virtual Application,
bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
TLimitSource source);
- virtual void SubscribeToSoftButtons(int32_t cmd_id,
- const SoftButtonID& softbuttons_id);
+ virtual void SubscribeToSoftButtons(
+ int32_t cmd_id, const WindowSoftButtons& window_softbuttons);
virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id);
virtual void UnsubscribeFromSoftButtons(int32_t cmd_id);
@@ -638,7 +639,7 @@ class ApplicationImpl : public virtual Application,
/**
* @brief Defines id of SoftButton which is related from name of command
*/
- typedef std::map<int32_t, SoftButtonID> CommandSoftButtonID;
+ typedef std::map<int32_t, SoftButtonIDs> CommandSoftButtonID;
CommandNumberTimeLimit cmd_number_to_time_limits_;
CommandSoftButtonID cmd_softbuttonid_;
// Lock for command soft button id
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 bda1e5f49e..c59456a022 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
@@ -53,7 +53,6 @@
#include "application_manager/hmi_interfaces_impl.h"
#include "application_manager/message.h"
#include "application_manager/message_helper.h"
-#include "application_manager/request_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/rpc_handler.h"
#include "application_manager/rpc_service.h"
@@ -121,6 +120,9 @@ enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging };
typedef std::map<protocol_handler::ServiceType, std::set<uint32_t> >
ServiceStreamingStatusMap;
+typedef std::map<const int32_t, ExpiredButtonRequestData>
+ ExpiredButtonRequestsMap;
+
struct CommandParametersPermissions;
typedef std::map<std::string, hmi_apis::Common_TransportType::eType>
DeviceTypes;
@@ -159,10 +161,6 @@ class ApplicationManagerImpl
const policy::PolicySettings& policy_settings);
~ApplicationManagerImpl();
- DEPRECATED
- bool Init(resumption::LastState&,
- media_manager::MediaManager* media_manager) OVERRIDE;
-
/**
* Inits application manager
*/
@@ -189,8 +187,6 @@ class ApplicationManagerImpl
uint32_t hmi_app_id) const OVERRIDE;
ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const OVERRIDE;
- DEPRECATED 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;
ApplicationSharedPtr reregister_application_by_policy_id(
@@ -286,32 +282,22 @@ class ApplicationManagerImpl
*/
bool IsAppSubscribedForWayPoints(Application& app) const OVERRIDE;
- void SaveWayPointsMessage(
- smart_objects::SmartObjectSPtr way_points_message) OVERRIDE;
+ void SaveWayPointsMessage(smart_objects::SmartObjectSPtr way_points_message,
+ uint32_t app_id = 0) OVERRIDE;
- /**
- * @brief Subscribe Application for way points
- * @param Application id
- */
- void SubscribeAppForWayPoints(uint32_t app_id) OVERRIDE;
+ void SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Subscribe Application for way points
- * @param Application pointer
- */
- void SubscribeAppForWayPoints(ApplicationSharedPtr app) OVERRIDE;
+ void SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Unsubscribe Application for way points
- * @param Application id
- */
- void UnsubscribeAppFromWayPoints(uint32_t app_id) OVERRIDE;
+ void UnsubscribeAppFromWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) OVERRIDE;
- /**
- * @brief Unsubscribe Application for way points
- * @param Application pointer
- */
- void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) OVERRIDE;
+ void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) OVERRIDE;
+
+ bool IsSubscribedToHMIWayPoints() const OVERRIDE;
/**
* @brief Is Any Application is subscribed for way points
@@ -700,6 +686,15 @@ class ApplicationManagerImpl
const uint32_t corr_id,
const int32_t function_id) OVERRIDE;
+ bool RetainRequestInstance(const uint32_t connection_key,
+ const uint32_t correlation_id) OVERRIDE;
+
+ bool RemoveRetainedRequest(const uint32_t connection_key,
+ const uint32_t correlation_id) OVERRIDE;
+
+ bool IsStillWaitingForResponse(const uint32_t connection_key,
+ const uint32_t correlation_id) const OVERRIDE;
+
void OnQueryAppsRequest(
const connection_handler::DeviceHandle device) OVERRIDE;
@@ -710,6 +705,9 @@ class ApplicationManagerImpl
void RemoveDevice(
const connection_handler::DeviceHandle& device_handle) OVERRIDE;
+ bool GetProtocolVehicleData(
+ connection_handler::ProtocolVehicleData& data) OVERRIDE;
+
/**
* @brief OnDeviceSwitchingStart is invoked on device transport switching
* start (e.g. from Bluetooth to USB) and creates waiting list of applications
@@ -794,14 +792,14 @@ class ApplicationManagerImpl
*
* @param ptr Reference to shared pointer that point on hmi notification
*/
- void addNotification(const CommandSharedPtr ptr);
+ void AddNotification(const CommandSharedPtr ptr);
/**
* @ Add notification to collection
*
- * @param ptr Reference to shared pointer that point on hmi notification
+ * @param notification Pointer that points to hmi notification
*/
- void removeNotification(const commands::Command* notification);
+ void RemoveNotification(const commands::Command* notification);
/**
* @ Updates request timeout
@@ -810,7 +808,7 @@ class ApplicationManagerImpl
* @param mobile_correlation_id Correlation ID of the mobile request
* @param new_timeout_value New timeout in milliseconds to be set
*/
- void updateRequestTimeout(uint32_t connection_key,
+ void UpdateRequestTimeout(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) OVERRIDE;
@@ -860,13 +858,18 @@ class ApplicationManagerImpl
protocol_handler::ServiceType service_type) const OVERRIDE;
/**
- * @brief Ends opened navi services (audio/video) for application
+ * @brief Ends opened navi services audio and video for application
* @param app_id Application id
*/
void EndNaviServices(uint32_t app_id) OVERRIDE;
- DEPRECATED
- void ForbidStreaming(uint32_t app_id) OVERRIDE;
+ /**
+ * @brief Ends opened navi service audio or video for application
+ * @param app_id Application id
+ * @param service_type Service type to check
+ */
+ void EndService(const uint32_t app_id,
+ const protocol_handler::ServiceType service_type) OVERRIDE;
void ForbidStreaming(uint32_t app_id,
protocol_handler::ServiceType service_type) OVERRIDE;
@@ -880,7 +883,7 @@ class ApplicationManagerImpl
void OnAppStreaming(uint32_t app_id,
protocol_handler::ServiceType service_type,
- const Application::StreamingState new_state) OVERRIDE;
+ bool state) OVERRIDE;
mobile_api::HMILevel::eType GetDefaultHmiLevel(
ApplicationConstSharedPtr application) const;
@@ -1002,6 +1005,18 @@ class ApplicationManagerImpl
return *rpc_handler_;
}
+ request_controller::RequestTimeoutHandler& get_request_timeout_handler()
+ const OVERRIDE {
+ DCHECK(request_timeout_handler_);
+ return *request_timeout_handler_;
+ }
+
+ request_controller::RequestController& get_request_controller()
+ const OVERRIDE {
+ DCHECK(request_ctrl_);
+ return *request_ctrl_;
+ }
+
void SetRPCService(std::unique_ptr<rpc_service::RPCService>& rpc_service) {
rpc_service_ = std::move(rpc_service);
}
@@ -1154,6 +1169,8 @@ class ApplicationManagerImpl
return is_stopping_;
}
+ bool WaitForHmiIsReady() OVERRIDE;
+
/**
* @brief ProcessReconnection handles reconnection flow for application on
* transport switch
@@ -1182,6 +1199,9 @@ class ApplicationManagerImpl
bool IsSOStructValid(const hmi_apis::StructIdentifiers::eType struct_id,
const smart_objects::SmartObject& display_capabilities);
+ virtual bool UnsubscribeAppFromSoftButtons(
+ const commands::MessageSharedPtr response) OVERRIDE;
+
/**
* @brief Function returns supported SDL Protocol Version
* @return protocol version depends on parameters from smartDeviceLink.ini.
@@ -1191,8 +1211,16 @@ class ApplicationManagerImpl
void ApplyFunctorForEachPlugin(
std::function<void(plugin_manager::RPCPlugin&)> functor) OVERRIDE;
+ ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra&
+ mobile_v4_protocol_so_factory() OVERRIDE;
+
private:
/**
+ * @brief Sets is_stopping flag to true
+ */
+ void InitiateStopping();
+
+ /**
* @brief Adds application to registered applications list and marks it as
* registered
* @param application Application that should be added to registered
@@ -1313,10 +1341,12 @@ class ApplicationManagerImpl
const HmiStatePtr to);
/**
- * @brief Starts EndStream timer for a specified application
+ * @brief Starts EndStream timer for a specified application service type
* @param app_id Application to process
+ * @param service_type Type of service to track
*/
- void StartEndStreamTimer(const uint32_t app_id);
+ void StartEndStreamTimer(const uint32_t app_id,
+ const protocol_handler::ServiceType service_type);
/**
* @brief Allows to send appropriate message to mobile device.
@@ -1359,13 +1389,19 @@ class ApplicationManagerImpl
bool ResetVrHelpTitleItems(ApplicationSharedPtr app) const;
private:
- /*
- * NaviServiceStatusMap shows which navi service (audio/video) is opened
- * for specified application. Two bool values in std::pair mean:
- * 1st value - is video service opened or not
- * 2nd value - is audio service opened or not
- */
- typedef std::map<uint32_t, std::pair<bool, bool> > NaviServiceStatusMap;
+ struct NaviServiceStatusDescriptor {
+ bool is_video_service_active_;
+ bool is_audio_service_active_;
+ };
+
+ struct NaviServiceDescriptor {
+ uint32_t app_id_;
+ protocol_handler::ServiceType service_type_;
+ TimerSPtr timer_to_stop_service_;
+ };
+
+ typedef std::map<uint32_t, NaviServiceStatusDescriptor> NaviServiceStatusMap;
+ typedef std::deque<NaviServiceDescriptor> NaviServicesDequeue;
/**
* @brief GetHashedAppID allows to obtain unique application id as a string.
@@ -1405,10 +1441,9 @@ class ApplicationManagerImpl
/**
* @brief Suspends streaming ability of application in case application's HMI
- * level
- * has been changed to not allowed for streaming
+ * level has been changed to not allowed for streaming
*/
- void EndNaviStreaming();
+ void EndStreaming();
/**
* @brief Starts specified navi service for application
@@ -1441,8 +1476,10 @@ class ApplicationManagerImpl
* @brief Disallows streaming for application, but doesn't close
* opened services. Streaming ability could be restored by AllowStreaming();
* @param app_id Application to proceed
+ * @param service_type Type of service to disallow
*/
- void DisallowStreaming(uint32_t app_id);
+ void DisallowStreaming(const uint32_t app_id,
+ const protocol_handler::ServiceType service_type);
/**
* @brief Types of directories used by Application Manager
@@ -1534,6 +1571,16 @@ class ApplicationManagerImpl
static std::vector<std::string> ConvertRejectedParamList(
const std::vector<std::string>& input);
+ void AddExpiredButtonRequest(
+ const uint32_t app_id,
+ const int32_t corr_id,
+ const hmi_apis::Common_ButtonName::eType button_name) OVERRIDE;
+
+ utils::Optional<ExpiredButtonRequestData> GetExpiredButtonRequestData(
+ const int32_t corr_id) const OVERRIDE;
+
+ void DeleteExpiredButtonRequest(const int32_t corr_id) OVERRIDE;
+
private:
const ApplicationManagerSettings& settings_;
/**
@@ -1562,7 +1609,11 @@ class ApplicationManagerImpl
*/
std::set<uint32_t> subscribed_way_points_apps_list_;
- smart_objects::SmartObjectSPtr way_points_data_;
+ bool subscribed_to_hmi_way_points_;
+
+ smart_objects::SmartObjectSPtr hmi_way_points_data_;
+
+ std::map<uint32_t, smart_objects::SmartObject> mobile_way_points_data_;
/**
* @brief Map contains applications which
@@ -1588,8 +1639,10 @@ class ApplicationManagerImpl
connection_handler::ConnectionHandler* connection_handler_;
std::unique_ptr<policy::PolicyHandlerInterface> policy_handler_;
protocol_handler::ProtocolHandler* protocol_handler_;
+ std::unique_ptr<request_controller::RequestTimeoutHandler>
+ request_timeout_handler_;
+ std::unique_ptr<request_controller::RequestController> request_ctrl_;
std::unique_ptr<plugin_manager::RPCPluginManager> plugin_manager_;
- request_controller::RequestController request_ctrl_;
std::unique_ptr<application_manager::AppServiceManager> app_service_manager_;
/**
@@ -1610,12 +1663,14 @@ class ApplicationManagerImpl
mobile_apis::SystemContext::eType system_context;
};
- hmi_apis::HMI_API* hmi_so_factory_;
- mobile_apis::MOBILE_API* mobile_so_factory_;
+ hmi_apis::HMI_API hmi_so_factory_;
+ mobile_apis::MOBILE_API mobile_so_factory_;
+ ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra
+ mobile_v4_protocol_so_factory_;
- static uint32_t mobile_corelation_id_;
- static uint32_t corelation_id_;
- static const uint32_t max_corelation_id_;
+ std::atomic<uint32_t> mobile_correlation_id_;
+ std::atomic<uint32_t> correlation_id_;
+ const uint32_t max_correlation_id_;
std::unique_ptr<HMICapabilities> hmi_capabilities_;
// The reason of HU shutdown
@@ -1630,18 +1685,23 @@ class ApplicationManagerImpl
HmiInterfacesImpl hmi_interfaces_;
- NaviServiceStatusMap navi_service_status_;
sync_primitives::Lock navi_service_status_lock_;
- std::deque<uint32_t> navi_app_to_stop_;
+ NaviServiceStatusMap navi_service_status_;
+
sync_primitives::Lock navi_app_to_stop_lock_;
- std::deque<uint32_t> navi_app_to_end_stream_;
+ NaviServicesDequeue navi_app_to_stop_;
+
+ sync_primitives::Lock navi_app_to_end_stream_lock_;
+ NaviServicesDequeue navi_app_to_end_stream_;
+
+ sync_primitives::Lock streaming_timer_pool_lock_;
+ std::vector<TimerSPtr> streaming_timer_pool_;
+
uint32_t navi_close_app_timeout_;
uint32_t navi_end_stream_timeout_;
- std::vector<TimerSPtr> close_app_timer_pool_;
- std::vector<TimerSPtr> end_stream_timer_pool_;
- sync_primitives::Lock close_app_timer_pool_lock_;
- sync_primitives::Lock end_stream_timer_pool_lock_;
+ mutable sync_primitives::Lock wait_for_hmi_lock_;
+ sync_primitives::ConditionalVariable wait_for_hmi_condvar_;
StateControllerImpl state_ctrl_;
std::unique_ptr<app_launch::AppLaunchData> app_launch_dto_;
@@ -1686,6 +1746,9 @@ class ApplicationManagerImpl
ServiceStreamingStatusMap streaming_application_services_;
sync_primitives::Lock streaming_services_lock_;
+ mutable sync_primitives::Lock expired_button_requests_lock_;
+ mutable ExpiredButtonRequestsMap expired_button_requests_;
+
#ifdef BUILD_TESTS
public:
/**
diff --git a/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h b/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h
new file mode 100644
index 0000000000..66a2683133
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2021, 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_BUTTON_NOTIFICATION_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_BUTTON_NOTIFICATION_TO_MOBILE_H_
+
+#include "application_manager/application.h"
+#include "command_notification_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace application_manager {
+namespace commands {
+namespace app_mngr = application_manager;
+
+/**
+ * @brief Class is intended to encapsulate shared button notification logic in
+ * base class. Entities defined in this file do not conform to any version of
+ * HMI or mobile API, and exist only to remove duplication in OnButtonPress and
+ * OnButtonEvent notifications.
+ **/
+class ButtonNotificationToMobile
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ /**
+ * @brief ButtonNotificationToMobile class constructor
+ **/
+ ButtonNotificationToMobile(
+ 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 ButtonNotificationToMobile class destructor
+ **/
+ ~ButtonNotificationToMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ protected:
+ virtual void SendButtonNotification(app_mngr::ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief HandleCustomButton handle event for custom buttons
+ * @param app pointer to application data.
+ **/
+ void HandleCustomButton(app_mngr::ApplicationSharedPtr app);
+
+ /**
+ * @brief HandleOKButton handle event for OK button
+ * @param app pointer to application data.
+ **/
+ void HandleOKButton(app_mngr::ApplicationSharedPtr app);
+
+ /**
+ * @brief HandleMediaButton handle event for media buttons
+ * @param app pointer to application data.
+ **/
+ void HandleMediaButton(app_mngr::ApplicationSharedPtr app);
+
+ /**
+ * @brief DoesParamExist check whether param is exists in msg_params
+ * @param param_name name of parameter to find
+ **/
+ bool DoesParamExist(const std::string& param_name) const;
+
+ /**
+ * @brief SubscribedApps get subscribed apps for btn id received in message
+ * @return Return applications list subscribed to current button
+ **/
+ std::vector<ApplicationSharedPtr> SubscribedApps() const;
+};
+} // namespace commands
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_BUTTON_NOTIFICATION_TO_MOBILE_H_
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 a7241ce16d..f8bc66df2a 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -115,7 +115,14 @@ class Command {
* has exceed it's limit
*
*/
- virtual void onTimeOut() = 0;
+ virtual void HandleTimeOut() = 0;
+
+ /**
+ * @brief Function is called by RequestInfo when request controller
+ * updates request timeout
+ * Function sets request state to "AwaitingResponse"
+ */
+ virtual void OnUpdateTimeOut() = 0;
/**
* @brief AllowedToTerminate tells if request controller is allowed
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 e3e30a9eff..534f07aa37 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
@@ -40,6 +40,8 @@
#include "policy/policy_types.h"
#include "utils/logger.h"
+#include <algorithm>
+
namespace application_manager {
/**
@@ -50,9 +52,40 @@ struct CommandParametersPermissions {
RPCParams allowed_params;
RPCParams disallowed_params;
RPCParams undefined_params;
+
+ bool AreDisallowedParamsIncluded(const RPCParams& parameters) {
+ return std::includes(disallowed_params.begin(),
+ disallowed_params.end(),
+ parameters.begin(),
+ parameters.end());
+ }
+
+ bool AreUndefinedParamsIncluded(const RPCParams& parameters) {
+ return std::includes(undefined_params.begin(),
+ undefined_params.end(),
+ parameters.begin(),
+ parameters.end());
+ }
};
namespace commands {
+
+/**
+ * @brief Checks Mobile result code for single RPC
+ * @param result_code contains result code from response to Mobile
+ * @return true if result code complies to successful result codes,
+ * false otherwise.
+ */
+bool IsMobileResultSuccess(const mobile_apis::Result::eType result_code);
+
+/**
+ * @brief Checks HMI result code for single RPC
+ * @param result_code contains result code from HMI response
+ * @return true if result code complies to successful result codes,
+ * false otherwise.
+ */
+bool IsHMIResultSuccess(const hmi_apis::Common_Result::eType result_code);
+
/**
* @brief Class is intended to encapsulate RPC as an object
**/
@@ -131,7 +164,7 @@ class CommandImpl : public Command {
* has exceed it's limit
*
*/
- void onTimeOut() OVERRIDE;
+ void HandleTimeOut() OVERRIDE;
/**
* @brief AllowedToTerminate tells request Controller if it can terminate this
@@ -149,6 +182,8 @@ class CommandImpl : public Command {
*/
void SetAllowedToTerminate(const bool allowed) OVERRIDE;
+ void OnUpdateTimeOut() OVERRIDE;
+
/**
* @brief Calculates command`s internal consecutive number
* for specified application used during resumption.
@@ -167,6 +202,16 @@ class CommandImpl : public Command {
*/
bool CheckSyntax(const std::string& str, bool allow_empty_line = false) const;
+ /**
+ * @brief Checks HMI result code for single RPC
+ * @param result_code contains result code from HMI response
+ * @param interface to check availability
+ * @return true if result code complies to successful result codes,
+ * false otherwise.
+ */
+ bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const;
+
// members
static const int32_t hmi_protocol_type_;
static const int32_t mobile_protocol_type_;
@@ -183,6 +228,29 @@ class CommandImpl : public Command {
bool CheckAllowedParameters(const Command::CommandSource source);
/**
+ * @brief Adds disallowed parameters back to response with appropriate
+ * reasons
+ * @param response Response message, which should be extended with blocked
+ * parameters reasons
+ */
+ void AddDisallowedParameters(smart_objects::SmartObject& response);
+
+ /**
+ * @brief Adds disallowed parameters to response info
+ * @param response Response message, which info should be extended
+ */
+ void AddDisallowedParametersToInfo(
+ smart_objects::SmartObject& response) const;
+
+ /**
+ * @brief Adds param to disallowed parameters enumeration
+ * @param info string with disallowed params enumeration
+ * @param param disallowed param
+ */
+ void AddDisallowedParameterToInfoString(std::string& info,
+ const std::string& param) const;
+
+ /**
* @brief Remove from current message parameters disallowed by policy table
*/
void RemoveDisallowedParameters();
@@ -201,6 +269,13 @@ class CommandImpl : public Command {
*/
bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message);
+ /**
+ * @brief Adds disallowed parameters to info string, sets result codes if
+ * necessary
+ * @param response Command smart object
+ */
+ void FormatResponse(smart_objects::SmartObject& response);
+
MessageSharedPtr message_;
uint32_t default_timeout_;
bool allowed_to_terminate_;
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 87c19ca1d1..97e2dce0eb 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
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2016, Ford Motor Company
All rights reserved.
@@ -33,196 +33,104 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_
+#include <memory>
+
+#include "application_manager/application_manager.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "smart_objects/smart_object.h"
#include "utils/lock.h"
namespace application_manager {
-namespace commands {
-
-struct ResponseInfo {
- ResponseInfo();
- ResponseInfo(const hmi_apis::Common_Result::eType result,
- const HmiInterfaces::InterfaceID hmi_interface,
- ApplicationManager& application_manager);
- hmi_apis::Common_Result::eType result_code;
- HmiInterfaces::InterfaceID interface;
- HmiInterfaces::InterfaceState interface_state;
- bool is_ok;
- bool is_unsupported_resource;
- bool is_not_used;
-};
-
-namespace ns_smart = ns_smart_device_link::ns_smart_objects;
-
-/**
- * @brief MergeInfos merge 2 infos in one string
- * @param first - info string that should be first in result info
- * @param second - info string that should be second in result info
- * @return if first is empty return second
- * if second is empty return first
- * if both are empty return empty string
- * if both are not empty return empty first +", " + second
- */
-std::string MergeInfos(const std::string& first, const std::string& second);
-
-/**
- * @brief MergeInfos merge 2 infos into one string with info
- * @param first_info -contains result_code from HMI response and
- * interface that returns response
- * @param first_str - info string that should be first in result info
- * @param second_info -contains result_code from HMI response and
- * interface that returns response
- * @param second_str - info string that should be second in result info
- * @return if first_info is not available and second_str not empty return second
- * if second_info is not available and first_str not empty return first
- * other cases return result MergeInfos for 2 params
- */
-std::string MergeInfos(const ResponseInfo& first_info,
- const std::string& first_str,
- const ResponseInfo& second_info,
- const std::string& second_str);
+namespace commands {
/**
- * @brief MergeInfos merge 3 infos in one string
- * @param first - info string that should be first in result info
- * @param second - info string that should be second in result info
- * @param third - info string that should be second in result info
- * @return resulting string contain merge all incoming parameters
- */
-std::string MergeInfos(const std::string& first,
- const std::string& second,
- const std::string& third);
-
+ * @brief Class is intended to encapsulate RPC as an object
+ **/
class CommandRequestImpl : public CommandImpl,
public event_engine::EventObserver {
public:
- enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted };
+ enum RequestState {
+ kAwaitingResponse = 0,
+ kTimedOut,
+ kProcessEvent,
+ };
/**
- * @brief The HashUpdateMode enum defines whether request has to update
- * hash after its execution is finished
- */
- enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate };
-
+ * @brief CommandRequestImpl class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
CommandRequestImpl(const MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler);
- ~CommandRequestImpl();
-
- /**
- * @brief Checks command permissions according to policy table
- */
- bool CheckPermissions() OVERRIDE;
-
/**
- * @brief Init sets hash update mode for request
- */
- bool Init() OVERRIDE;
+ * @brief CommandRequestImpl class destructor
+ *
+ **/
+ virtual ~CommandRequestImpl();
/**
- * @brief Cleanup all resources used by command
+ * @brief Send request to mobile
+ * @param function_id Function id
+ * @param msg Request to mobile
+ * @param use_event - true if request should be subscribed to an event,
+ * otherwise false
**/
- bool CleanUp() OVERRIDE;
+ void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
+ smart_objects::SmartObjectSPtr msg,
+ bool use_events);
/**
* @brief Execute corresponding command by calling the action on reciever
**/
void Run() OVERRIDE;
+ virtual void on_event(const event_engine::MobileEvent& event);
+
/*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
*/
- virtual void onTimeOut();
+ void HandleTimeOut() FINAL;
/**
* @brief Default EvenObserver's pure virtual method implementation
*
* @param event The received event
*/
- virtual void on_event(const event_engine::Event& event);
-
- virtual void on_event(const event_engine::MobileEvent& event);
+ void HandleOnEvent(const event_engine::Event& event) FINAL;
- /*
- * @brief Creates Mobile response
+ /**
+ * @brief Default EvenObserver's pure virtual method implementation
*
- * @param success true if successful; false, if failed
- * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c)
- * @param info Provides additional human readable info regarding the result
- * @param response_params Additional params in response
+ * @param event The received event
*/
- 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>());
-
- 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);
+ void HandleOnEvent(const event_engine::MobileEvent& event) FINAL;
- /*
- * @brief Sends HMI request
- *
- * @param function_id HMI request ID
- * @param msg_params HMI request msg params
- * @param use_events true if we need subscribe on event(HMI request)
- * @return hmi correlation id
+ /**
+ * @brief Function is called by RequestController when request execution time
+ * has exceeded its limit
+ * @note default value is required as a lot of requests don't use it
+ * as they use automatically generated reason
*/
- uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject* msg_params = NULL,
- bool use_events = false);
+ virtual void OnTimeOut();
- /*
- * @brief Creates HMI request
- *
- * @param function_id HMI request ID
- * @param msg_params HMI request msg params
- */
- void CreateHMINotification(const hmi_apis::FunctionID::eType& function_id,
- const ns_smart::SmartObject& msg_params) const;
+ virtual void on_event(const event_engine::Event&);
- /**
- * @brief Converts HMI result code to Mobile result code
- *
- * @param hmi_code HMI result code
- * @return Mobile result code
- */
- mobile_apis::Result::eType GetMobileResultCode(
- const hmi_apis::Common_Result::eType& hmi_code) const;
+ void OnUpdateTimeOut() OVERRIDE;
- /**
- * @brief Checks Mobile result code for single RPC
- * @param result_code contains result code from response to Mobile
- * @return true if result code complies to successful result codes,
- * false otherwise.
- */
- static bool IsMobileResultSuccess(
- const mobile_apis::Result::eType result_code);
+ bool IncrementReferenceCount() const OVERRIDE;
- /**
- * @brief Checks HMI result code for single RPC
- * @param result_code contains result code from HMI response
- * @return true if result code complies to successful result codes,
- * false otherwise.
- */
- static bool IsHMIResultSuccess(
- const hmi_apis::Common_Result::eType result_code);
+ bool DecrementReferenceCount() const OVERRIDE;
protected:
/**
@@ -235,125 +143,50 @@ class CommandRequestImpl : public CommandImpl,
bool CheckAllowedParameters(const Command::CommandSource source);
/**
- * @brief Checks HMI capabilities for specified button support
- * @param button Button to check
- * @return true if button is present in HMI capabilities
- * otherwise returns false
- */
- bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const;
-
- /**
- * @brief Adds disallowed parameters back to response with appropriate
- * reasons
- * @param response Response message, which should be extended with blocked
- * parameters reasons
- */
- void AddDisallowedParameters(smart_objects::SmartObject& response);
-
- /**
- * @brief Checks if any request param was marked as disallowed by policy
- * @return true if any param was marked as disallowed
- */
- bool HasDisallowedParams() 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
- * @param interface contains interface for which HMI sent response
- * @return true if result code complies successful result cods
- * otherwise returns false.
- */
- bool PrepareResultForMobileResponse(
- hmi_apis::Common_Result::eType result_code,
- HmiInterfaces::InterfaceID interface) const;
-
- /**
- * @brief Checks result code from HMI for splitted RPC
- * and returns parameter for sending to mobile app.
- * @param first contains result_code from HMI response and
- * interface that returns response
- * @param second contains result_code from HMI response and
- * interface that returns response
- * @return true if result code complies successful result code
- * otherwise returns false
- */
- bool PrepareResultForMobileResponse(ResponseInfo& out_first,
- ResponseInfo& out_second) const;
-
- /**
- * @brief If message from HMI contains returns this info
- * or process result code from HMI and checks state of interface
- * and create info.
- * @param interface contains interface for which HMI sent response
- * @param result_code contains result code from HMI
- * @param response_from_hmi contains response from HMI
- * @param out_info contain info for sending to application
+ * @brief Adds interface to be awaited by SDL request
+ * @param interface_id interface from which SDL expects response in given time
*/
- void GetInfo(const smart_objects::SmartObject& response_from_hmi,
- std::string& out_info);
+ void StartAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id);
/**
- * @brief Prepare result code for sending to mobile application
- * @param first contains result_code from HMI response and
- * interface that returns response
- * @param second contains result_code from HMI response and
- * interface that returns response.
- * @return resulting code for sending to mobile application.
+ * @brief Gets interface awaiting state.
+ * @param interface_id interface which SDL awaits for response in given time
+ * @return true if SDL awaits for response from given interface in
+ * interface_id
*/
- mobile_apis::Result::eType PrepareResultCodeForResponse(
- const ResponseInfo& first, const ResponseInfo& second);
+ bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const;
/**
- * @brief Resolves if the return code must be
- * UNSUPPORTED_RESOURCE
- * @param first contains result_code from HMI response and
- * interface that returns response
- * @param second contains result_code from HMI response and
- * interface that returns response.
- * @return True, if the communication return code must be
- * UNSUPPORTED_RESOURCE, otherwise false.
+ * @brief Stops SDL awaiting from given HMI interface
+ * @param interface_id interface from which SDL no longer awaits
+ * for response in given time
*/
- bool IsResultCodeUnsupported(const ResponseInfo& first,
- const ResponseInfo& second) const;
+ void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id);
/**
- * @brief CheckResult checks whether the overall result
- * of the responses is successful
- * @param first response
- * @param second response
- * @return true if the overall result is successful
- * otherwise - false
+ * @brief Checks if there some not delivered hmi responses exist
+ * @return true if pending responses exist, otherwise - false
*/
- bool CheckResult(const ResponseInfo& first, const ResponseInfo& second) const;
+ bool IsPendingResponseExist() const;
- protected:
/**
- * @brief Returns policy parameters permissions
- * @return Parameters permissions struct reference
+ * @brief Checks if there some not delivered hmi responses exist
+ * @return true if pending responses exist, otherwise - false
*/
- const CommandParametersPermissions& parameters_permissions() const;
-
- /**
- * @brief Adds interface to be awaited for by sdl request command
- @param interface_id interface which SDL expects to response in given time
- */
- void StartAwaitForInterface(const HmiInterfaces::InterfaceID interface_id);
/**
- * @brief Gets interface await state.
- * @param interface_id interface which SDL awaits for response in given time
- * @return true if SDL awaits for response from given interface in
- * interface_id
+ * @brief Returns current state of request
+ * @return current request state. E.g. kAwaitingResponse, kTimedOut,
+ * kResponded
*/
- bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const;
+ virtual RequestState current_state() const;
/**
- * @brief Sets given HMI interface await status to false
- * @param interface_id interface which SDL no longer awaits for response in
- * given time
+ * @brief Sets current state of request
+ * @param request state to set. E.g. kAwaitingResponse, kTimedOut,
+ * kResponded
*/
- void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id);
+ virtual void set_current_state(const RequestState state);
/**
* @brief This set stores all the interfaces which are awaited by SDL to
@@ -363,60 +196,33 @@ class CommandRequestImpl : public CommandImpl,
mutable sync_primitives::Lock awaiting_response_interfaces_lock_;
- RequestState current_state_;
- sync_primitives::Lock state_lock_;
-
- /**
- * @brief hash_update_mode_ Defines whether request must update hash value of
- * application or not
- */
- HashUpdateMode hash_update_mode_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl);
-
/**
- * @brief Adds param to disallowed parameters enumeration
- * @param info string with disallowed params enumeration
- * @param param disallowed param
+ * @brief This lock is used to guarantee thread safe access to request state
*/
- void AddDisallowedParameterToInfoString(std::string& info,
- const std::string& param) const;
+ mutable sync_primitives::RecursiveLock state_lock_;
/**
- * @brief Adds disallowed parameters to response info
- * @param response Response message, which info should be extended
+ * @brief Current state of request to synchronize its life cycle
*/
- void AddDisallowedParametersToInfo(
- smart_objects::SmartObject& response) const;
-
- bool ProcessHMIInterfacesAvailability(
- const uint32_t hmi_correlation_id,
- const hmi_apis::FunctionID::eType& function_id);
+ RequestState current_state_;
- /**
- * @brief UpdateHash updates hash field for application and sends
- * OnHashChanged notification to mobile side in case of approriate hash mode
- * is set
- */
- void UpdateHash();
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl);
/**
- * @brief is_success_result_ Defines whether request succeded, at the moment
- * it is value of 'success' field of appropriate response sent to mobile
+ * @brief Changes request state to "kProcessEvent", retain request instance
+ * @return false if request is not ready to handle event right now.
+ * If request is succesfully retained returns true
*/
- bool is_success_result_;
+ bool StartOnEventHandling();
/**
- * @brief Add information for the component of response in case of timeout
- * @param response Response message, which info should be extended
+ * @brief Changes request state to "kAwaitingResponse", removes request
+ * instance retained before
*/
- void AddTimeOutComponentInfoToMessage(
- smart_objects::SmartObject& response) const;
+ void FinalizeOnEventHandling();
};
} // namespace commands
-
} // namespace application_manager
-
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_
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 4464056175..c4fd25f5e0 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
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_
-#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/command_request_impl.h"
#include "interfaces/HMI_API.h"
#include "smart_objects/smart_object.h"
@@ -43,7 +43,7 @@ namespace commands {
namespace ns_smart = ns_smart_device_link::ns_smart_objects;
-class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
+class RequestFromHMI : public CommandRequestImpl {
public:
RequestFromHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -54,8 +54,11 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
virtual bool Init();
virtual bool CleanUp();
virtual void Run();
- virtual void on_event(const event_engine::Event& event);
+
+ void on_event(const event_engine::Event& event);
void on_event(const event_engine::MobileEvent& event) OVERRIDE;
+ void OnTimeOut() OVERRIDE;
+
/**
* @brief SendResponse allows to send response to hmi
* @param correlation_id the correlation id for the rfesponse.
@@ -91,7 +94,7 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
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);
+ bool use_events);
void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
const ApplicationSharedPtr app,
@@ -106,12 +109,6 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
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:
/**
* @brief Fills common parameters for SO
diff --git a/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h
new file mode 100644
index 0000000000..e4f0bed223
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h
@@ -0,0 +1,372 @@
+/*
+ Copyright (c) 2020, 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_REQUEST_FROM_MOBILE_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/lock.h"
+
+namespace application_manager {
+namespace commands {
+
+struct ResponseInfo {
+ ResponseInfo();
+ ResponseInfo(const hmi_apis::Common_Result::eType result,
+ const HmiInterfaces::InterfaceID hmi_interface,
+ ApplicationManager& application_manager);
+ hmi_apis::Common_Result::eType result_code;
+ HmiInterfaces::InterfaceID interface;
+ HmiInterfaces::InterfaceState interface_state;
+ bool is_ok;
+ bool is_unsupported_resource;
+ bool is_not_used;
+};
+
+/**
+ * @brief MergeInfos merge 2 infos in one string
+ * @param first - info string that should be first in result info
+ * @param second - info string that should be second in result info
+ * @return if first is empty return second
+ * if second is empty return first
+ * if both are empty return empty string
+ * if both are not empty return empty first +", " + second
+ */
+std::string MergeInfos(const std::string& first, const std::string& second);
+
+/**
+ * @brief MergeInfos merge 2 infos into one string with info
+ * @param first_info -contains result_code from HMI response and
+ * interface that returns response
+ * @param first_str - info string that should be first in result info
+ * @param second_info -contains result_code from HMI response and
+ * interface that returns response
+ * @param second_str - info string that should be second in result info
+ * @return if first_info is not available and second_str not empty return second
+ * if second_info is not available and first_str not empty return first
+ * other cases return result MergeInfos for 2 params
+ */
+std::string MergeInfos(const ResponseInfo& first_info,
+ const std::string& first_str,
+ const ResponseInfo& second_info,
+ const std::string& second_str);
+
+/**
+ * @brief MergeInfos merge 3 infos in one string
+ * @param first - info string that should be first in result info
+ * @param second - info string that should be second in result info
+ * @param third - info string that should be second in result info
+ * @return resulting string contain merge all incoming parameters
+ */
+std::string MergeInfos(const std::string& first,
+ const std::string& second,
+ const std::string& third);
+
+class RequestFromMobileImpl : public CommandRequestImpl {
+ public:
+ /**
+ * @brief The HashUpdateMode enum defines whether request has to update
+ * hash after its execution is finished
+ */
+ enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate };
+
+ RequestFromMobileImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief RequestFromMobileImpl class destructor
+ *
+ **/
+ virtual ~RequestFromMobileImpl();
+
+ /**
+ * @brief Checks command permissions according to policy table
+ */
+ bool CheckPermissions() OVERRIDE;
+
+ /**
+ * @brief Init sets hash update mode for request
+ */
+ bool Init() OVERRIDE;
+
+ /**
+ * @brief Cleanup all resources used by command
+ **/
+ bool CleanUp() OVERRIDE;
+
+ /**
+ * @brief Execute corresponding command by calling the action on reciever
+ **/
+ void Run() OVERRIDE;
+
+ void on_event(const event_engine::Event& event) OVERRIDE;
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
+
+ void OnTimeOut() OVERRIDE;
+
+ 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);
+
+ /*
+ * @brief Creates Mobile response
+ *
+ * @param success true if successful; false, if failed
+ * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c)
+ * @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,
+ const std::vector<uint8_t> binary_data = std::vector<uint8_t>());
+ /*
+ * @brief Sends HMI request
+ *
+ * @param function_id HMI request ID
+ * @param msg_params HMI request msg params
+ * @param use_events true if we need subscribe on event(HMI request)
+ * @return hmi correlation id
+ */
+ uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
+ const smart_objects::SmartObject* msg_params = NULL,
+ bool use_events = false);
+
+ /*
+ * @brief Creates HMI request
+ *
+ * @param function_id HMI request ID
+ * @param msg_params HMI request msg params
+ */
+ void CreateHMINotification(
+ const hmi_apis::FunctionID::eType& function_id,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params)
+ const;
+
+ /**
+ * @brief Converts HMI result code to Mobile result code
+ *
+ * @param hmi_code HMI result code
+ * @return Mobile result code
+ */
+ mobile_apis::Result::eType GetMobileResultCode(
+ const hmi_apis::Common_Result::eType& hmi_code) const;
+
+ protected:
+ /**
+ * @brief Checks HMI capabilities for specified button support
+ * @param button Button to check
+ * @return true if button is present in HMI capabilities
+ * otherwise returns false
+ */
+ bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const;
+
+ /**
+ * @brief Remove from current message parameters disallowed by policy table
+ */
+ void RemoveDisallowedParameters();
+
+ /**
+ * @brief Checks if any request param was marked as disallowed by policy
+ * @return true if any param was marked as disallowed
+ */
+ bool HasDisallowedParams() 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
+ * @param interface contains interface for which HMI sent response
+ * @return true if result code complies successful result code
+ * otherwise returns false.
+ */
+ bool PrepareResultForMobileResponse(
+ hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const;
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app.
+ * @param out_first contains result_code from HMI response and
+ * interface that returns response
+ * @param out_second contains result_code from HMI response and
+ * interface that returns response
+ * @return true if result code complies successful result code
+ * otherwise returns false
+ */
+ bool PrepareResultForMobileResponse(ResponseInfo& out_first,
+ ResponseInfo& out_second) const;
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app.
+ * @param out_first Contains result_code from HMI response and
+ * interface that returns response
+ * @param out_second Contains result_code from HMI response and
+ * interface that returns response
+ * @param out_third Contains result_code from HMI response and
+ * interface that returns response
+ * @return true if result code complies successful result code
+ * otherwise returns false
+ */
+ bool PrepareResultForMobileResponse(ResponseInfo& out_first,
+ ResponseInfo& out_second,
+ ResponseInfo& out_third) const;
+
+ /**
+ * @brief If message from HMI contains returns this info
+ * or process result code from HMI and checks state of interface
+ * and create info.
+ * @param response_from_hmi contains response from HMI
+ * @param out_info contain info for sending to application
+ */
+ void GetInfo(const smart_objects::SmartObject& response_from_hmi,
+ std::string& out_info) const;
+
+ /**
+ * @brief Prepare result code for sending to mobile application
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * @return resulting code for sending to mobile application.
+ */
+ mobile_apis::Result::eType PrepareResultCodeForResponse(
+ const ResponseInfo& first, const ResponseInfo& second);
+
+ /**
+ * @brief Prepare result code for sending to mobile application
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * @return resulting code for sending to mobile application.
+ */
+ mobile_apis::Result::eType PrepareResultCodeForResponse(
+ const ResponseInfo& first,
+ const ResponseInfo& second,
+ const ResponseInfo& third);
+
+ /**
+ * @brief Resolves if the return code must be
+ * UNSUPPORTED_RESOURCE
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * @return True, if the communication return code must be
+ * UNSUPPORTED_RESOURCE, otherwise false.
+ */
+ bool IsResultCodeUnsupported(const ResponseInfo& first,
+ const ResponseInfo& second) const;
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app.
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response
+ * @return true if result code complies successful result code
+ * otherwise returns false
+ */
+ bool CheckResultCode(const ResponseInfo& first,
+ const ResponseInfo& second) const;
+
+ /**
+ * @brief Returns policy parameters permissions
+ * @return Parameters permissions struct reference
+ */
+ const CommandParametersPermissions& parameters_permissions() const;
+
+ /**
+ * @brief hash_update_mode_ Defines whether request must update hash value of
+ * application or not
+ */
+ HashUpdateMode hash_update_mode_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RequestFromMobileImpl);
+
+ /**
+ * @brief Checks if HMI interface is available for the target function
+ * @param hmi_correlation_id HMI correlation id
+ * @param function_id Response message, which info should be extended
+ */
+ bool ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id);
+
+ /**
+ * @brief UpdateHash updates hash field for application and sends
+ * OnHashChanged notification to mobile side in case of approriate hash mode
+ * is set
+ */
+ void UpdateHash();
+
+ /**
+ * @brief Add information for the component of response in case of timeout
+ * @param response Response message, which info should be extended
+ */
+ void AddTimeOutComponentInfoToMessage(
+ smart_objects::SmartObject& response) const;
+
+ /**
+ * @brief AddRequestToTimeoutHandler checks the request and adds it to
+ * request_timeout_handler map for tracking
+ * @param request_to_hmi request to HMI
+ */
+ void AddRequestToTimeoutHandler(
+ const smart_objects::SmartObject& request_to_hmi) const;
+
+ /**
+ * @brief is_success_result_ Defines whether request succeded, at the moment
+ * it is value of 'success' field of appropriate response sent to mobile
+ */
+ bool is_success_result_;
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
index 3057476937..78c8281a03 100644
--- a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
@@ -35,6 +35,7 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/command_request_impl.h"
namespace application_manager {
@@ -61,7 +62,7 @@ bool ChangeInterfaceState(ApplicationManager& application_manager,
const smart_objects::SmartObject& response_from_hmi,
HmiInterfaces::InterfaceID interface);
-class RequestToHMI : public CommandImpl {
+class RequestToHMI : public CommandRequestImpl {
public:
RequestToHMI(const MessageSharedPtr& message,
ApplicationManager& 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 0656372f47..b232875f43 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
@@ -64,6 +64,15 @@ class EventDispatcher {
/*
* @brief Unsubscribes the observer from specific event
*
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ */
+ virtual void remove_observer(const Event::EventID& event_id,
+ const int32_t hmi_correlation_id) = 0;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
* @param event_id The event ID to unsubscribe from
* @param observer The observer to be unsubscribed
*/
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 3644299499..ffe659a07c 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
@@ -83,6 +83,9 @@ class EventDispatcherImpl : public EventDispatcher {
*/
void raise_event(const Event& event) OVERRIDE;
+ void remove_observer(const Event::EventID& event_id,
+ const int32_t hmi_correlation_id) OVERRIDE;
+
/*
* @brief Subscribe the observer to event
*
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 1f4eccaf46..0ebf90133e 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
@@ -70,9 +70,23 @@ class EventObserver {
*
* @param event The received event
*/
- virtual void on_event(const Event& event) = 0;
+ virtual void HandleOnEvent(const Event& event) = 0;
- virtual void on_event(const MobileEvent& event);
+ virtual void HandleOnEvent(const MobileEvent& event);
+
+ /**
+ * @brief Increments reference count to avoid observer destruction while
+ * event dispatcher keeping pointer to that observer
+ * @return true if request reference was incremented, otherwise returns false
+ */
+ virtual bool IncrementReferenceCount() const;
+
+ /**
+ * @brief Decrements reference count to allow observer be safely destroyed
+ * as event dispatcher does not keep any pointers to it
+ * @return true if request reference was decremented, otherwise returns false
+ */
+ virtual bool DecrementReferenceCount() const;
protected:
/*
diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
index 0bc98827c8..9a22b2a4aa 100644
--- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
+++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
@@ -81,6 +81,10 @@ class HMICapabilitiesImpl : public HMICapabilities {
const std::string& ccpu_version() const OVERRIDE;
+ void set_hardware_version(const std::string& hardware_version) OVERRIDE;
+
+ const std::string& hardware_version() const OVERRIDE;
+
bool attenuated_supported() const OVERRIDE;
void set_attenuated_supported(const bool state) OVERRIDE;
@@ -253,9 +257,6 @@ class HMICapabilitiesImpl : public HMICapabilities {
void Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
- DEPRECATED
- void Init(resumption::LastState* last_state) OVERRIDE;
-
HMILanguageHandler& get_hmi_language_handler() OVERRIDE;
void set_handle_response_for(
@@ -476,6 +477,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool is_rc_supported_;
bool is_driver_distraction_supported_;
std::string ccpu_version_;
+ std::string hardware_version_;
smart_objects::SmartObjectSPtr navigation_capability_;
smart_objects::SmartObjectSPtr phone_capability_;
smart_objects::SmartObjectSPtr video_streaming_capability_;
diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h
index 2ef034450d..10ae1f8967 100644
--- a/src/components/application_manager/include/application_manager/hmi_language_handler.h
+++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h
@@ -78,7 +78,7 @@ class HMILanguageHandler : public event_engine::EventObserver {
*/
hmi_apis::Common_Language::eType get_language_for(Interface interface) const;
- void on_event(const event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(const event_engine::Event& event) OVERRIDE;
/**
* @brief Trigger waiting for response
@@ -96,9 +96,6 @@ class HMILanguageHandler : public event_engine::EventObserver {
hmi_apis::Common_Language::eType vr,
hmi_apis::Common_Language::eType tts);
- DEPRECATED
- void Init(resumption::LastState*);
-
void Init(resumption::LastStateWrapperPtr value);
/**
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 e3a9784346..8271edcbd8 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -434,13 +434,11 @@ class PhoneCallHmiState : public HmiState {
PhoneCallHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
}
- mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
const OVERRIDE {
return audio_streaming_state();
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 7af9bacf27..9cfb504b00 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -75,6 +75,7 @@ struct ResetGlobalPropertiesResult {
bool menu_name;
bool menu_icon;
bool keyboard_properties;
+ bool user_location;
bool vr_has_been_reset;
ResetGlobalPropertiesResult()
@@ -84,6 +85,7 @@ struct ResetGlobalPropertiesResult {
, menu_name(false)
, menu_icon(false)
, keyboard_properties(false)
+ , user_location(false)
, vr_has_been_reset(false) {}
bool HasUIPropertiesReset() const {
@@ -93,6 +95,10 @@ struct ResetGlobalPropertiesResult {
bool HasTTSPropertiesReset() const {
return timeout_prompt || help_prompt;
}
+
+ bool HasRCPropertiesReset() const {
+ return user_location;
+ }
};
/**
@@ -267,52 +273,46 @@ class MessageHelper {
const std::string& path_to_icon, uint32_t app_id);
/**
- * @brief Sends button subscription notification
- * @param app_id Application ID
- * @param button Enum with button name
- * @param is_subscribed true if subscribed, false otherwise
+ * @brief Creates button subscription requests for buttons
+ * that application is subscribed on
+ * @param app application to be subscribed for button
+ * @param button_subscriptions collection of subscribed buttons
+ * @param function_id function ID
* @param app_mngr reference to application manager
+ * @return list of all buttons subscription requests ready to be sent to hmi
+ * @note for every button separate request is created in the list
*/
- static void SendOnButtonSubscriptionNotification(
- const uint32_t app_id,
- const hmi_apis::Common_ButtonName::eType button,
- const bool is_subscribed,
+ static smart_objects::SmartObjectList
+ CreateButtonSubscriptionsHandlingRequestsList(
+ ApplicationConstSharedPtr app,
+ const ButtonSubscriptions& button_subscriptions,
+ const hmi_apis::FunctionID::eType function_id,
ApplicationManager& app_mngr);
/**
- * @brief Creates button subscription notification
- * @param app_id Application ID
- * @param button Enum with button name
- * @param is_subscribed true if subscribed, false otherwise
- * @return notification message in SmartObject format
- */
- static smart_objects::SmartObjectSPtr CreateOnButtonSubscriptionNotification(
- const uint32_t app_id,
- const hmi_apis::Common_ButtonName::eType button,
- const bool is_subscribed);
-
- /**
- * @brief Sends button subscription notifications for all buttons
- * that application is subscribed on
+ * @brief Creates button subscription request to mobile
* @param app shared pointer to application instance
- * @param app_mngr reference to application manager
+ * @param source_message source message
+ * @return Smart object with fulfilled request
*/
- static void SendAllOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr CreateButtonNotificationToMobile(
+ ApplicationSharedPtr app,
+ const smart_objects::SmartObject& source_message);
/**
- * @brief Creates button subscription notifications for buttons
- * that application is subscribed on
- * @param app shared pointer to application instance
+ * @brief Creates button subscription request to hmi
+ * @param app_id id of application for which request should be created
+ * @param button_name button to be subscribed
+ * @param function_id function ID
* @param app_mngr reference to application manager
- * @param button_subscriptions collection of subscribed buttons
- * @return list of notification messages in SmartObject format
+ * @return Smart object with fulfilled request
*/
- static smart_objects::SmartObjectList
- CreateOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr,
- const ButtonSubscriptions& button_subscriptions);
+ static smart_objects::SmartObjectSPtr
+ CreateButtonSubscriptionHandlingRequestToHmi(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button_name,
+ const hmi_apis::FunctionID::eType function_id,
+ ApplicationManager& app_mngr);
static void SendAppDataToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_man);
@@ -484,18 +484,22 @@ class MessageHelper {
* @param permissions Array of groups permissions
* @param external_consent_status External user consent status
* @param correlation_id Correlation id of request
+ * @param app_mngr ApplicationManager instance
+ * @param success_flag Indication that we were able to collect permissions
*/
#ifdef EXTERNAL_PROPRIETARY_MODE
static void SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
const policy::ExternalConsentStatus& external_consent_status,
const uint32_t correlation_id,
- ApplicationManager& app_mngr);
+ ApplicationManager& app_mngr,
+ const bool success_flag = true);
#else
static void SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
const uint32_t correlation_id,
- ApplicationManager& app_mngr);
+ ApplicationManager& app_mngr,
+ const bool success_flag = true);
#endif // EXTERNAL_PROPRIETARY_MODE
/**
@@ -983,18 +987,6 @@ class MessageHelper {
ApplicationManager& app_mngr);
/**
- * @brief SendUnsubscribeButtonNotification sends notification to HMI to
- * remove button subscription for application
- * @param button Button type
- * @param application Application to unsubscribe
- * @param app_mngr Application manager
- */
- static void SendUnsubscribeButtonNotification(
- mobile_apis::ButtonName::eType button,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr);
-
- /**
* @brief Sends HMI status notification to mobile
* @param application application with changed HMI status
* @param window_id id of affected window
@@ -1062,6 +1054,18 @@ class MessageHelper {
const ResetGlobalPropertiesResult& reset_result,
const ApplicationSharedPtr application);
+ /**
+ * @brief CreateRCResetGlobalPropertiesRequest Creates request
+ * to reset global properties for RC
+ * @param reset_result struct containing result of global properties reset
+ * procedure
+ * @param application application for which properties are to be reset
+ * @return filled smart object with relevant request data
+ */
+ static smart_objects::SmartObjectSPtr CreateRCResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application);
+
static smart_objects::SmartObject CreateAppServiceCapabilities(
std::vector<smart_objects::SmartObject>& all_services);
@@ -1091,6 +1095,25 @@ class MessageHelper {
ApplicationManager& app_mngr,
const WindowID window_id);
+ /**
+ * @brief Recursively removes empty parameters of composite type from message
+ * @param msg_params smart object containing message params
+ * @return amount of empty parameters removed
+ */
+ static uint16_t RemoveEmptyMessageParams(
+ smart_objects::SmartObject& msg_params);
+
+ /**
+ * @brief AddDefaultParamsToTireStatus adds missing default sub-params to
+ * tirePressure param, if version of related application requires presence of
+ * all sub-params in response
+ * @param application shared pointer to related application
+ * @param response_from_hmi reference to response from HMI
+ */
+ static void AddDefaultParamsToTireStatus(
+ ApplicationSharedPtr application,
+ smart_objects::SmartObject& response_from_hmi);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
index 88f91d14fc..4f143dc365 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
@@ -62,6 +62,7 @@ enum ApplicationEvent {
kApplicationUnregistered,
kDeleteApplicationData,
kGlobalPropertiesUpdated,
+ kAppHmiTypesChanged,
kRCStatusChanged
};
@@ -86,13 +87,6 @@ class RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) = 0;
- DEPRECATED
- virtual bool Init(ApplicationManager& app_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) = 0;
-
/**
* @brief IsAbleToProcess check if plugin is able to process function
* @param function_id RPC identifier
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
index 004d6418f5..a447034d86 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
@@ -59,13 +59,6 @@ class RPCPluginManagerImpl : public RPCPluginManager {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state);
- DEPRECATED
- RPCPluginManagerImpl(ApplicationManager& app_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state);
-
uint32_t LoadPlugins(const std::string& plugins_path) OVERRIDE;
utils::Optional<RPCPlugin> FindPluginToProcess(
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 7d71611a3c..93b35ff99d 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
@@ -47,8 +47,10 @@ class PolicyEventObserver
policy::PolicyHandlerInterface* const policy_handler,
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 HandleOnEvent(
+ const application_manager::event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(
+ const application_manager::event_engine::MobileEvent& event) OVERRIDE;
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 c123bcc764..662e255871 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
@@ -86,8 +86,6 @@ class PolicyHandler : public PolicyHandlerInterface,
bool InitPolicyTable() OVERRIDE;
bool ResetPolicyTable() OVERRIDE;
bool ClearUserConsent() OVERRIDE;
- DEPRECATED bool SendMessageToSDK(const BinaryMessage& pt_string,
- const std::string& url) OVERRIDE;
bool ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) OVERRIDE;
bool UnloadPolicyLibrary() OVERRIDE;
@@ -386,10 +384,14 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void OnHardwareVersionReceived(const std::string& hardware_version) OVERRIDE;
+
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
std::string GetCCPUVersionFromPT() const OVERRIDE;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
@@ -812,6 +814,9 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void LinkAppsToDevice();
+ void SetHeartBeatTimeout(const std::string& policy_app_id,
+ const uint32_t app_id);
+
typedef std::vector<application_manager::ApplicationSharedPtr> Applications;
/**
@@ -873,19 +878,21 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Collects permissions for all currently registered applications on
* all devices
- * @return consolidated permissions list or empty list if no
- * applications/devices currently present
+ * @param out_permissions output ref on list of application permissions
+ * @return true if app connection information is valid, otherwise - false
*/
- std::vector<FunctionalGroupPermission> CollectRegisteredAppsPermissions();
+ bool CollectRegisteredAppsPermissions(
+ std::vector<FunctionalGroupPermission>& out_permissions);
/**
* @brief Collects permissions for application with certain connection key
* @param connection_key Connection key of application to look for
- * @return list of application permissions or empty list if no such
- * application found
+ * @param out_permissions output ref on list of application permissions
+ * @return true if app connection information is valid, otherwise - false
*/
- std::vector<FunctionalGroupPermission> CollectAppPermissions(
- const uint32_t connection_key);
+ bool CollectAppPermissions(
+ const uint32_t connection_key,
+ std::vector<policy::FunctionalGroupPermission>& out_permissions);
private:
static const std::string kLibrary;
diff --git a/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h b/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h
deleted file mode 100644
index 334a7b3a2d..0000000000
--- a/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifdef EXTERNAL_PROPRIETARY_MODE
-#error "policy_handler_observer.h is not available in policy external"
-#else
-#include "application_manager/policies/regular/policy_handler_observer.h"
-#endif
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 4a104812a4..479d433d50 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
@@ -47,8 +47,10 @@ class PolicyEventObserver
policy::PolicyHandlerInterface* const policy_handler,
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 HandleOnEvent(
+ const application_manager::event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(
+ const application_manager::event_engine::MobileEvent& event) OVERRIDE;
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_retry_sequence.h b/src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h
deleted file mode 100644
index f1a9ff55b8..0000000000
--- a/src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- 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.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_
-
-#include "utils/threads/thread_delegate.h"
-
-namespace policy {
-
-class PolicyHandler;
-
-class RetrySequence : public threads::ThreadDelegate {
- public:
- explicit RetrySequence(PolicyHandler* const policy_handler);
- void threadMain();
-
- private:
- PolicyHandler* const policy_handler_;
- void StartNextRetry();
-};
-
-} // namespace policy
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_
diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller_impl.h
index 8a3c90061e..41d2419ba6 100644
--- a/src/components/application_manager/include/application_manager/request_controller.h
+++ b/src/components/application_manager/include/application_manager/request_controller_impl.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_
#include <climits>
#include <list>
@@ -40,6 +40,7 @@
#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/threads/async_runner.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
#include "utils/timer.h"
@@ -47,6 +48,8 @@
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "application_manager/request_controller.h"
#include "application_manager/request_controller_settings.h"
#include "application_manager/request_info.h"
#include "application_manager/request_tracker.h"
@@ -55,85 +58,40 @@ namespace application_manager {
namespace request_controller {
-/**
- * @brief RequestController class is used to control currently active mobile
- * requests.
- */
-class RequestController {
+class RequestControllerImpl : public RequestController, threads::AsyncRunner {
public:
/**
- * @brief Result code for addRequest
+ * @brief Class constructor
+ *
*/
- enum TResult {
- SUCCESS = 0,
- TOO_MANY_REQUESTS,
- TOO_MANY_PENDING_REQUESTS,
- NONE_HMI_LEVEL_MANY_REQUESTS,
- INVALID_DATA
- };
+ RequestControllerImpl(const RequestControlerSettings& settings,
+ RequestTimeoutHandler& request_timeout_handler,
+ event_engine::EventDispatcher& event_disptacher);
- /**
- * @brief Thread pool state
- */
- enum TPoolState {
- UNDEFINED = 0,
- STARTED,
- STOPPED,
- };
+ ~RequestControllerImpl();
- // Methods
+ void Stop() OVERRIDE;
- /**
- * @brief Class constructor
- *
- */
- RequestController(const RequestControlerSettings& settings);
+ void InitializeThreadpool() OVERRIDE;
- /**
- * @brief Class destructor
- *
- */
- virtual ~RequestController();
+ void DestroyThreadpool() OVERRIDE;
- /**
- * @brief Initialize thread pool
- *
- */
- void InitializeThreadpool();
+ TResult AddMobileRequest(
+ const RequestPtr request,
+ const mobile_apis::HMILevel::eType& hmi_level) OVERRIDE;
- /**
- * @brief Destroy thread pool
- *
- */
- void DestroyThreadpool();
+ TResult AddHMIRequest(const RequestPtr request) OVERRIDE;
- /**
- * @brief Check if max request amount wasn't exceed and adds request to queue.
- *
- * @param request Active mobile request
- * @param hmi_level Current application hmi_level
- *
- * @return Result code
- *
- */
- TResult addMobileRequest(const RequestPtr request,
- const mobile_apis::HMILevel::eType& hmi_level);
+ void AddNotification(const RequestPtr ptr) OVERRIDE;
- /**
- * @brief Store HMI request until response or timeout won't remove it
- *
- * @param request Active hmi request
- * @return Result code
- *
- */
- TResult addHMIRequest(const RequestPtr request);
+ bool RetainRequestInstance(const uint32_t connection_key,
+ const uint32_t correlation_id) OVERRIDE;
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void addNotification(const RequestPtr ptr);
+ bool RemoveRetainedRequest(const uint32_t connection_key,
+ const uint32_t correlation_id) OVERRIDE;
+
+ bool IsStillWaitingForResponse(const uint32_t connection_key,
+ const uint32_t correlation_id) const OVERRIDE;
/**
* @brief Removes request from queue
@@ -144,76 +102,36 @@ class RequestController {
* @param force_terminate if true, request controller will terminate
* even if not allowed by request
*/
+
void TerminateRequest(const uint32_t correlation_id,
const uint32_t connection_key,
const int32_t function_id,
- bool force_terminate = false);
+ const bool force_terminate = false) OVERRIDE;
- /**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
void OnMobileResponse(const uint32_t mobile_correlation_id,
const uint32_t connection_key,
- const int32_t function_id);
+ const int32_t function_id) OVERRIDE;
- /**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
- void OnHMIResponse(const uint32_t correlation_id, const int32_t function_id);
+ void OnHMIResponse(const uint32_t correlation_id,
+ const int32_t function_id) OVERRIDE;
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void removeNotification(const commands::Command* notification);
+ void RemoveNotification(const commands::Command* notification) OVERRIDE;
- /**
- * @brief Removes all requests from queue for specified application
- *
- * @param app_id Mobile application ID (app_id)
- *
- */
- void terminateAppRequests(const uint32_t& app_id);
+ void TerminateAppRequests(const uint32_t app_id) OVERRIDE;
- /**
- * @brief Terminates all requests from HMI
- */
- void terminateAllHMIRequests();
+ void TerminateAllHMIRequests() OVERRIDE;
- /**
- * @brief Terminates all requests from Mobile
- */
- void terminateAllMobileRequests();
+ void TerminateAllMobileRequests() OVERRIDE;
- /**
- * @brief Updates request timeout
- *
- * @param app_id Connection key of application
- * @param mobile_correlation_id Correlation ID of the mobile request
- * @param new_timeout_value New timeout to be set in milliseconds
- */
- void updateRequestTimeout(const uint32_t& app_id,
- const uint32_t& mobile_correlation_id,
- const uint32_t& new_timeout);
+ void UpdateRequestTimeout(const uint32_t app_id,
+ const uint32_t mobile_correlation_id,
+ const uint32_t new_timeout) OVERRIDE;
- /*
- * @brief Function Should be called when Low Voltage is occured
- */
- void OnLowVoltage();
+ void OnLowVoltage() OVERRIDE;
- /*
- * @brief Function Should be called when Low Voltage is occured
- */
- void OnWakeUp();
+ void OnWakeUp() OVERRIDE;
- bool IsLowVoltage();
+ bool IsLowVoltage() OVERRIDE;
protected:
/**
@@ -226,8 +144,17 @@ class RequestController {
*/
void NotifyTimer();
- void terminateWaitingForExecutionAppRequests(const uint32_t& app_id);
- void terminateWaitingForResponseAppRequests(const uint32_t& app_id);
+ void TerminateWaitingForExecutionAppRequests(const uint32_t app_id);
+ void TerminateWaitingForResponseAppRequests(const uint32_t app_id);
+
+ /**
+ * @brief Starts a new async task for cleaning up the provided requests
+ * references
+ * and perform the rest of cleanup actions for each request
+ * @param requests list of requests to cleanup
+ */
+ typedef std::list<RequestInfoPtr> RequestInfoPtrs;
+ void scheduleRequestsCleanup(const RequestInfoPtrs& requests);
/**
* @brief Checks whether all constraints are met before adding of request into
@@ -246,23 +173,36 @@ class RequestController {
* allowed for all applications
* @return True if new request could be added, false otherwise
*/
- bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount);
+ bool CheckPendingRequestsAmount(const uint32_t pending_requests_amount);
private:
class Worker : public threads::ThreadDelegate {
public:
- explicit Worker(RequestController* requestController);
+ explicit Worker(RequestControllerImpl* request_controller);
virtual ~Worker();
virtual void threadMain();
virtual void exitThreadMain();
protected:
private:
- RequestController* request_controller_;
+ RequestControllerImpl* request_controller_;
sync_primitives::Lock thread_lock_;
volatile bool stop_flag_;
};
+ class RequestCleanerDelegate : public threads::ThreadDelegate {
+ public:
+ explicit RequestCleanerDelegate(const RequestInfoPtrs& requests);
+ ~RequestCleanerDelegate();
+ void threadMain() OVERRIDE;
+ void exitThreadMain() OVERRIDE;
+
+ private:
+ sync_primitives::Lock state_lock_;
+ sync_primitives::ConditionalVariable state_cond_;
+ RequestInfoPtrs requests_;
+ };
+
std::vector<threads::Thread*> pool_;
volatile TPoolState pool_state_;
uint32_t pool_size_;
@@ -271,14 +211,20 @@ class RequestController {
std::list<RequestPtr> mobile_request_list_;
sync_primitives::Lock mobile_request_list_lock_;
- /*
- * Requests, that are waiting for responses
+ /**
+ * @brief Requests, that are waiting for responses
* RequestInfoSet provides correct processing of requests with thre same
* app_id and corr_id
*/
RequestInfoSet waiting_for_response_;
/**
+ * @brief Requests, that are retained to be not destroyed right after
+ * sending response to mobile request
+ */
+ HashSortedRequestInfoSet retained_mobile_requests_;
+
+ /**
* @brief Tracker verifying time scale and maximum requests amount in
* different HMI levels
*/
@@ -310,11 +256,14 @@ class RequestController {
bool is_low_voltage_;
const RequestControlerSettings& settings_;
- DISALLOW_COPY_AND_ASSIGN(RequestController);
+
+ RequestTimeoutHandler& request_timeout_handler_;
+ event_engine::EventDispatcher& event_dispatcher_;
+ DISALLOW_COPY_AND_ASSIGN(RequestControllerImpl);
};
} // namespace request_controller
} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h
index c6cf00caea..3d9ecfa630 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -39,7 +39,7 @@
#include <stdint.h>
#include <set>
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "commands/request_to_hmi.h"
#include "utils/date_time.h"
@@ -127,7 +127,7 @@ struct RequestInfo {
}
uint64_t hash();
static uint64_t GenerateHash(uint32_t var1, uint32_t var2);
- static uint32_t HmiConnectionKey;
+ static constexpr uint32_t kHmiConnectionKey = 0;
protected:
RequestPtr request_;
@@ -199,7 +199,7 @@ class RequestInfoSet {
* @return founded request or shared_ptr with NULL
*/
RequestInfoPtr Find(const uint32_t connection_key,
- const uint32_t correlation_id);
+ const uint32_t correlation_id) const;
/*
* @brief Get request with smalest end_time_
@@ -213,6 +213,15 @@ class RequestInfoSet {
*/
RequestInfoPtr FrontWithNotNullTimeout();
+ /**
+ * @brief GetRequestsByConnectionKey gets all pending requests by provided
+ * connection key
+ * @param connection_key connection key for related requests
+ * @return list of all pending requests for a specified connection key
+ */
+ std::list<RequestInfoPtr> GetRequestsByConnectionKey(
+ const uint32_t connection_key);
+
/*
* @brief Erase request from colletion by log(n) time
* @param request_info - request to erase
@@ -269,7 +278,7 @@ class RequestInfoSet {
TimeSortedRequestInfoSet time_sorted_pending_requests_;
HashSortedRequestInfoSet hash_sorted_pending_requests_;
- sync_primitives::Lock pending_requests_lock_;
+ mutable sync_primitives::Lock pending_requests_lock_;
};
/**
diff --git a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h
new file mode 100644
index 0000000000..207f19e0c5
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h
@@ -0,0 +1,75 @@
+/*
+ * 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_REQUEST_TIMEOUT_HANDLER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_IMPL_H_
+
+#include <map>
+#include "application_manager/application_manager.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/request_timeout_handler.h"
+
+namespace application_manager {
+
+namespace request_controller {
+
+class RequestTimeoutHandlerImpl : public event_engine::EventObserver,
+ public RequestTimeoutHandler {
+ public:
+ RequestTimeoutHandlerImpl(ApplicationManager& application_manager);
+ void AddRequest(const uint32_t hmi_correlation_id,
+ const Request& request) OVERRIDE;
+ void RemoveRequest(const uint32_t hmi_correlation_id) OVERRIDE;
+ void HandleOnEvent(const event_engine::Event& event) OVERRIDE;
+
+ private:
+ /**
+ * @brief Checks whether specified request timeout should be updated or not
+ * @param request reference to request structure to check
+ * @param timeout new timeout to apply
+ * @param method_name name of method to check
+ * @return true if timeout update is required for this request, otherwise
+ * returns false
+ */
+ bool IsTimeoutUpdateRequired(const Request& request,
+ const uint32_t timeout,
+ const hmi_apis::FunctionID::eType method_name);
+
+ std::map<uint32_t, Request> requests_;
+ ApplicationManager& application_manager_;
+ mutable sync_primitives::Lock requests_lock_;
+};
+
+} // namespace request_controller
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 456eccd29c..4cc42699bc 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -276,9 +276,6 @@ class ResumeCtrl {
*/
virtual void RemoveFromResumption(uint32_t app_id) = 0;
- DEPRECATED
- virtual bool Init(resumption::LastState& last_state) = 0;
-
/**
* @brief Initialization data for Resume controller
* @return true if initialization is success otherwise
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index 9c529b5f9a..b93b914a48 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -256,8 +256,6 @@ class ResumeCtrlImpl : public ResumeCtrl {
*/
void RemoveFromResumption(uint32_t app_id) OVERRIDE;
- DEPRECATED bool Init(resumption::LastState& last_state) FINAL;
-
/**
* @brief Initialization data for Resume controller
* @return true if initialization is success otherwise
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index a667dbf8e2..a4614d4f2c 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -353,6 +353,16 @@ class ResumptionDataDB : public ResumptionData {
const std::string& device_id);
/**
+ * @brief Deletes userLocation from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteUserLocation(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
* @brief Deletes commands from saved application
* @param policy_app_id - mobile application id
* @param device_id - contains id of device on which is running application
@@ -442,6 +452,16 @@ class ResumptionDataDB : public ResumptionData {
int64_t application_primary_key) const;
/**
+ * @brief Saves user location data to DB
+ * @param user_location contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertUserLocationData(const smart_objects::SmartObject& user_location,
+ int64_t application_primary_key) const;
+
+ /**
* @brief Saves globalProperties data to DB
* @param global_properties contains data for saving
* @param global_properties_key - will contain primary key from global
@@ -690,6 +710,18 @@ class ResumptionDataDB : public ResumptionData {
smart_objects::SmartObject& saved_app) const;
/**
+ * @brief Selects data from applicationUserLocation table
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app contains userLocation
+ * @return true if query has been executed successfully otherwise returns
+ * false
+ */
+ bool SelectUserLocationData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
* @brief Selects choice set data from DB
* @param policy_app_id contains mobile application id of application
* @param device_id contains id of device on which is running application
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 2394fe00dc..f33ef83a9b 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -52,11 +52,6 @@ class ResumptionDataJson : public ResumptionData {
resumption::LastStateWrapperPtr last_state_wrapper,
const application_manager::ApplicationManager& application_manager);
- DEPRECATED
- ResumptionDataJson(
- LastState&,
- const application_manager::ApplicationManager& application_manager);
-
/**
* @brief allows to destroy ResumptionDataJson object
*/
@@ -180,9 +175,6 @@ class ResumptionDataJson : public ResumptionData {
*/
void Persist() OVERRIDE;
- DEPRECATED
- resumption::LastState& last_state() const;
-
private:
/**
* @brief GetFromSavedOrAppend allows to get existed record about application
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
index c2040852ca..312302d157 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
@@ -79,7 +79,7 @@ class ResumptionDataProcessorImpl
smart_objects::SmartObject& saved_app,
ResumeCtrl::ResumptionCallBack callback) override;
- void on_event(const app_mngr::event_engine::Event& event) override;
+ void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE;
void HandleOnTimeOut(const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id) override;
@@ -367,6 +367,17 @@ class ResumptionDataProcessorImpl
const smart_objects::SmartObject& request,
const smart_objects::SmartObject& response) const;
+ /**
+ * @brief Checks whether SubscribeButton response successful or not and
+ * subscribes application if successful
+ * @param app_id application id
+ * @param request reference to request SO
+ * @param response reference to response SO
+ */
+ void ProcessSubscribeButtonResponse(
+ const uint32_t app_id,
+ const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response);
app_mngr::ApplicationManager& application_manager_;
/**
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
index eee7650697..c62d115448 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -66,6 +66,7 @@ extern const std::string kDeleteApplicationFilesArray;
extern const std::string kDeleteSubMenu;
extern const std::string kDeleteApplicationSubMenuArray;
extern const std::string kDeleteApplicationSubscriptionsArray;
+extern const std::string kDeleteApplicationUserLocation;
extern const std::string kDeleteImageFromCommands;
extern const std::string kDeleteVrCommands;
extern const std::string kDeleteCommands;
@@ -97,6 +98,7 @@ extern const std::string kInsertToCommand;
extern const std::string kInsertApplicationCommandArray;
extern const std::string kInsertVrCommand;
extern const std::string kInsertSubscriptions;
+extern const std::string kInsertUserLocation;
extern const std::string kInsertChoice;
extern const std::string kInsertApplicationChoiceSet;
extern const std::string kInsertChoiceArray;
@@ -117,6 +119,8 @@ extern const std::string kSelectCountCommands;
extern const std::string kSelectCommands;
extern const std::string kSelectCountSubscriptions;
extern const std::string kSelectSubscriptions;
+extern const std::string kSelectCountUserLocation;
+extern const std::string kSelectUserLocation;
extern const std::string kSelectCountChoiceSet;
extern const std::string kSelectChoiceSets;
extern const std::string kSelectImage;
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 ab140dbd8a..dd4fb3d309 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
@@ -181,6 +181,7 @@ class RPCHandlerImpl : public RPCHandler,
const bool validate_params = true);
std::shared_ptr<Message> ConvertRawMsgToMessage(
const ::protocol_handler::RawMessagePtr message);
+
hmi_apis::HMI_API& hmi_so_factory();
mobile_apis::MOBILE_API& mobile_so_factory();
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 c96c9ebe69..b1b3c5f000 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
@@ -171,6 +171,9 @@ extern const char* minutes;
extern const char* seconds;
extern const char* update_mode;
extern const char* audioStreamingIndicator;
+extern const char* seek_time;
+extern const char* forward_seek_indicator;
+extern const char* back_seek_indicator;
extern const char* trigger_source;
extern const char* hmi_level;
extern const char* activate_app_hmi_level;
@@ -227,6 +230,8 @@ extern const char* policy_type;
extern const char* property;
extern const char* displays;
extern const char* seat_location;
+extern const char* app_capability;
+extern const char* app_capability_type;
// PutFile
extern const char* sync_file_name;
@@ -296,12 +301,20 @@ 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* climate_data;
extern const char* external_temp;
extern const char* turn_signal;
extern const char* vin;
extern const char* gearStatus;
extern const char* prndl;
extern const char* tire_pressure;
+extern const char* pressure_telltale;
+extern const char* left_front;
+extern const char* right_front;
+extern const char* left_rear;
+extern const char* right_rear;
+extern const char* inner_left_rear;
+extern const char* inner_right_rear;
extern const char* odometer;
extern const char* belt_status;
extern const char* electronic_park_brake_status;
@@ -336,11 +349,13 @@ extern const char* video_streaming;
extern const char* remote_control;
extern const char* sdl_version;
extern const char* system_software_version;
+extern const char* system_hardware_version;
extern const char* priority;
extern const char* engine_oil_life;
extern const char* oem_custom_data_type;
extern const char* window_status;
extern const char* hands_off_steering;
+extern const char* seat_occupancy;
// app services
extern const char* app_service_manifest;
@@ -480,10 +495,16 @@ extern const char* const haptic_spatial_data_supported;
extern const char* const diagonal_screen_size;
extern const char* const pixel_per_inch;
extern const char* const scale;
+extern const char* const additional_video_streaming_capabilities;
extern const char* const haptic_rect_data;
extern const char* const rect;
extern const char* const x;
extern const char* const y;
+extern const char* const preferred_fps;
+
+// OnResetTimeout
+extern const char* const request_id;
+extern const char* const reset_period;
} // namespace strings
namespace hmi_interface {
@@ -584,6 +605,8 @@ extern const char* method_name;
extern const char* keyboard_layout;
extern const char* limited_character_list;
extern const char* auto_complete_list;
+extern const char* mask_input_characters;
+extern const char* custom_keys;
extern const char* file;
extern const char* file_name;
extern const char* retry;
@@ -621,6 +644,9 @@ extern const char* image_capabilities;
extern const char* display_type;
extern const char* display_name;
extern const char* text_fields;
+extern const char* keyboard_capabilities;
+extern const char* supported_keyboards;
+extern const char* num_configurable_keys;
extern const char* media_clock_formats;
extern const char* graphic_supported;
extern const char* image_fields;
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 4dc4c1ad7d..6845851f97 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
@@ -103,6 +103,10 @@ class StateControllerImpl : public event_engine::EventObserver,
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) OVERRIDE;
+ // EventObserver interface
+ void HandleOnEvent(const event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(const event_engine::MobileEvent& event) OVERRIDE;
+
void OnAppWindowAdded(
ApplicationSharedPtr app,
const WindowID window_id,
@@ -120,10 +124,6 @@ class StateControllerImpl : public event_engine::EventObserver,
bool IsStateActive(HmiState::StateID state_id) const OVERRIDE;
- // EventObserver interface
- void on_event(const event_engine::Event& event) OVERRIDE;
- void on_event(const event_engine::MobileEvent& event) OVERRIDE;
-
void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
void DeactivateApp(ApplicationSharedPtr app,
@@ -139,6 +139,7 @@ class StateControllerImpl : public event_engine::EventObserver,
int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority);
+
/**
* @brief The HmiLevelConflictResolver struct
* Move other application to HmiStates if applied moved to FULL or LIMITED
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 294baac9b5..a21dc72b4a 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
@@ -70,7 +70,8 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler,
* in order to send system time query and GetSystemTimeResponse in order
* to retrieve utc time and notify all the listeners with new time value.
*/
- void on_event(const application_manager::event_engine::Event& event) FINAL;
+ void HandleOnEvent(
+ const application_manager::event_engine::Event& event) FINAL;
/**
* @brief DoSystemTimeQuery sends the appropriate request to the system
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
index 79011ff314..0222741b74 100644
--- 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
@@ -62,7 +62,7 @@ set(LIBRARIES
sdl_rpc_plugin_static
)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
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
index 8d307325fc..b7898709ab 100644
--- 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
@@ -44,7 +44,6 @@ class AppServiceRpcPlugin;
namespace app_mngr = application_manager;
-typedef int AppExtensionUID;
typedef mobile_apis::VehicleDataType::eType VehicleDataType;
/**
* @brief Defines set of app service types
@@ -114,6 +113,8 @@ class AppServiceAppExtension : public app_mngr::AppExtension {
static AppServiceAppExtension& ExtractASExtension(
application_manager::Application& app);
+ static const app_mngr::AppExtensionUID AppServiceAppExtensionUID = 455;
+
private:
AppServiceSubscriptions subscribed_data_;
AppServiceRpcPlugin& plugin_;
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
index 444636ed75..bae4738524 100644
--- 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
@@ -50,13 +50,6 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) OVERRIDE;
- DEPRECATED
- bool Init(app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state);
-
bool IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource source) OVERRIDE;
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
index d9eb7528e4..dc8bfa4533 100644
--- 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
@@ -71,7 +71,7 @@ class ASGetAppServiceDataRequestFromHMI
/**
* @brief onTimeOut from request controller
*/
- virtual void onTimeOut();
+ void OnTimeOut() FINAL;
/**
* @brief on_event allows to handle events
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
index 36acf116f4..09b7829745 100644
--- 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
@@ -86,7 +86,7 @@ class ASPerformAppServiceInteractionRequestFromHMI
/**
* @brief onTimeOut from request controller
*/
- virtual void onTimeOut();
+ void OnTimeOut() FINAL;
private:
DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI);
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
index 6971354806..f628b94cd1 100644
--- 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
@@ -34,7 +34,7 @@
#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"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace app_service_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,7 +44,8 @@ namespace commands {
/**
* @brief GetAppServiceDataRequest command class
**/
-class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl {
+class GetAppServiceDataRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief GetAppServiceDataRequest class constructor
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
index 854ed3c6aa..e0665b9427 100644
--- 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
@@ -34,7 +34,7 @@
#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"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace app_service_rpc_plugin {
namespace app_mngr = application_manager;
@@ -45,7 +45,7 @@ namespace commands {
* @brief PerformAppServiceInteractionRequest command class
**/
class PerformAppServiceInteractionRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief PerformAppServiceInteractionRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
index d70f279658..5145b42171 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
@@ -34,7 +34,7 @@
#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"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace app_service_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,7 +44,8 @@ namespace commands {
/**
* @brief PublishAppServiceRequest command class
**/
-class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl {
+class PublishAppServiceRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief PublishAppServiceRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
index 4a883b92ee..6a85d10fd4 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace app_service_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,7 +44,7 @@ namespace commands {
* @brief UnpublishAppServiceRequest command class
**/
class UnpublishAppServiceRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief UnpublishAppServiceRequest class constructor
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
index 5a1815d974..1cd2fd690a 100644
--- 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
@@ -38,8 +38,6 @@ SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin")
namespace app_service_rpc_plugin {
-const AppExtensionUID AppServiceAppExtensionUID = 455;
-
AppServiceAppExtension::AppServiceAppExtension(
AppServiceRpcPlugin& plugin, application_manager::Application& app)
: app_mngr::AppExtension(AppServiceAppExtensionUID)
@@ -91,7 +89,7 @@ void AppServiceAppExtension::SaveResumptionData(
int i = 0;
for (const auto& subscription : subscribed_data_) {
resumption_data[app_mngr::hmi_interface::app_service][i] = subscription;
- i++;
+ ++i;
}
}
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
index e03973614d..e842ea7276 100644
--- 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
@@ -58,18 +58,6 @@ bool AppServiceRpcPlugin::Init(
return true;
}
-bool AppServiceRpcPlugin::Init(app_mngr::ApplicationManager& app_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
- UNUSED(last_state);
- 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);
@@ -88,11 +76,22 @@ 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);
+ switch (event) {
+ case plugins::ApplicationEvent::kApplicationRegistered: {
+ application->AddExtension(
+ std::make_shared<AppServiceAppExtension>(*this, *application));
+ break;
+ }
+
+ case plugins::ApplicationEvent::kApplicationUnregistered:
+ case plugins::ApplicationEvent::kDeleteApplicationData: {
+ DeleteSubscriptions(application);
+ break;
+ }
+
+ default: {
+ break;
+ }
}
}
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
index 32fccb0192..ff9d4e436a 100644
--- 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
@@ -92,7 +92,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths(
if (data.keyExists(strings::minute_forecast)) {
smart_objects::SmartObject& minute_forecast =
data[strings::minute_forecast];
- for (size_t i = 0; i < minute_forecast.length(); i++) {
+ for (size_t i = 0; i < minute_forecast.length(); ++i) {
if (minute_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon],
app,
@@ -104,7 +104,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths(
if (data.keyExists(strings::hourly_forecast)) {
smart_objects::SmartObject& hourly_forecast =
data[strings::hourly_forecast];
- for (size_t i = 0; i < hourly_forecast.length(); i++) {
+ for (size_t i = 0; i < hourly_forecast.length(); ++i) {
if (hourly_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon],
app,
@@ -116,7 +116,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths(
if (data.keyExists(strings::multiday_forecast)) {
smart_objects::SmartObject& multiday_forecast =
data[strings::multiday_forecast];
- for (size_t i = 0; i < multiday_forecast.length(); i++) {
+ for (size_t i = 0; i < multiday_forecast.length(); ++i) {
if (multiday_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon],
app,
@@ -145,7 +145,7 @@ void ASGetAppServiceDataRequestFromHMI::GetNavigationImagePaths(
if (data.keyExists(strings::instructions)) {
smart_objects::SmartObject& instructions = data[strings::instructions];
- for (size_t i = 0; i < instructions.length(); i++) {
+ for (size_t i = 0; i < instructions.length(); ++i) {
if (instructions[i].keyExists(strings::image)) {
MessageHelper::VerifyImage(
instructions[i][strings::image], app, application_manager_);
@@ -240,8 +240,8 @@ void ASGetAppServiceDataRequestFromHMI::on_event(
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);
+ bool success = CommandImpl::IsHMIResultSuccess(
+ result, HmiInterfaces::HMI_INTERFACE_AppService);
if (ValidateResponse(msg_params)) {
SendResponse(success,
correlation_id(),
@@ -263,7 +263,8 @@ void ASGetAppServiceDataRequestFromHMI::on_event(
msg_params[strings::result_code].asInt());
hmi_apis::Common_Result::eType result =
MessageHelper::MobileToHMIResult(mobile_result);
- bool success = IsMobileResultSuccess(mobile_result);
+ bool success =
+ application_manager::commands::IsMobileResultSuccess(mobile_result);
if (ValidateResponse(msg_params)) {
SendResponse(success,
@@ -275,7 +276,7 @@ void ASGetAppServiceDataRequestFromHMI::on_event(
}
}
-void ASGetAppServiceDataRequestFromHMI::onTimeOut() {
+void ASGetAppServiceDataRequestFromHMI::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
SendErrorResponse(correlation_id(),
hmi_apis::FunctionID::AppService_GetAppServiceData,
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
index ac3666bf2e..843971e16d 100644
--- 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
@@ -75,7 +75,7 @@ void ASGetAppServiceRecordsRequest::Run() {
continue;
}
records[index] = record;
- index++;
+ ++index;
}
if (!records.empty()) {
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
index f5a1aac05c..eafefa663f 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -140,7 +140,8 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event(
msg_params[strings::result_code].asInt());
hmi_apis::Common_Result::eType result =
MessageHelper::MobileToHMIResult(mobile_result);
- bool success = IsMobileResultSuccess(mobile_result);
+ bool success =
+ application_manager::commands::IsMobileResultSuccess(mobile_result);
SendResponse(success,
correlation_id(),
hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
@@ -149,7 +150,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event(
application_manager::commands::Command::SOURCE_SDL_TO_HMI);
}
-void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() {
+void ASPerformAppServiceInteractionRequestFromHMI::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject response_params;
response_params[strings::info] =
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
index 0f1fbcf1ce..15b5e093a5 100644
--- 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
@@ -84,7 +84,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths(
if (data.keyExists(strings::minute_forecast)) {
smart_objects::SmartObject& minute_forecast =
data[strings::minute_forecast];
- for (size_t i = 0; i < minute_forecast.length(); i++) {
+ for (size_t i = 0; i < minute_forecast.length(); ++i) {
if (minute_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon],
app,
@@ -96,7 +96,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths(
if (data.keyExists(strings::hourly_forecast)) {
smart_objects::SmartObject& hourly_forecast =
data[strings::hourly_forecast];
- for (size_t i = 0; i < hourly_forecast.length(); i++) {
+ for (size_t i = 0; i < hourly_forecast.length(); ++i) {
if (hourly_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon],
app,
@@ -108,7 +108,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths(
if (data.keyExists(strings::multiday_forecast)) {
smart_objects::SmartObject& multiday_forecast =
data[strings::multiday_forecast];
- for (size_t i = 0; i < multiday_forecast.length(); i++) {
+ for (size_t i = 0; i < multiday_forecast.length(); ++i) {
if (multiday_forecast[i].keyExists(strings::weather_icon)) {
MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon],
app,
@@ -137,7 +137,7 @@ void OnASAppServiceDataNotification::GetNavigationImagePaths(
if (data.keyExists(strings::instructions)) {
smart_objects::SmartObject& instructions = data[strings::instructions];
- for (size_t i = 0; i < instructions.length(); i++) {
+ for (size_t i = 0; i < instructions.length(); ++i) {
if (instructions[i].keyExists(strings::image)) {
MessageHelper::VerifyImage(
instructions[i][strings::image], app, application_manager_);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
index 719856625d..8560112bf3 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
@@ -50,11 +50,11 @@ GetAppServiceDataRequest::GetAppServiceDataRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
GetAppServiceDataRequest::~GetAppServiceDataRequest() {}
@@ -96,7 +96,7 @@ void GetAppServiceDataRequest::on_event(
mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
msg_params[strings::result_code].asInt());
- bool success = IsMobileResultSuccess(result);
+ bool success = application_manager::commands::IsMobileResultSuccess(result);
if (success) {
HandleSubscribe();
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
index c303e6d99f..35b7543a2c 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -49,11 +49,11 @@ PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {}
@@ -181,7 +181,7 @@ void PerformAppServiceInteractionRequest::on_event(
: NULL;
mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
msg_params[strings::result_code].asInt());
- bool success = IsMobileResultSuccess(result);
+ bool success = application_manager::commands::IsMobileResultSuccess(result);
SendResponse(success, result, info, &msg_params);
}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
index f2bc66520b..b2ae67610e 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -51,11 +51,11 @@ PublishAppServiceRequest::PublishAppServiceRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
PublishAppServiceRequest::~PublishAppServiceRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
index 200bae01d9..cba87d3173 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
@@ -49,11 +49,11 @@ UnpublishAppServiceRequest::UnpublishAppServiceRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {}
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
index 4236ac23f9..4e79bad899 100644
--- 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
@@ -92,14 +92,10 @@ class HMICommandsTest : public components::commands_test::CommandRequestTest<
typedef Command CommandType;
void InitCommand(const uint32_t& timeout) OVERRIDE {
+ CommandRequestTest<kIsNice>::InitCommand(timeout);
+
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_));
}
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
index 69bff3ad76..3c70028574 100644
--- 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
@@ -88,12 +88,8 @@ class MobileCommandsTest : public components::commands_test::CommandRequestTest<
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_));
+ CommandRequestTest<kIsNice>::InitCommand(timeout);
+
ON_CALL(app_mngr_settings_, app_icons_folder())
.WillByDefault(ReturnRef(kEmptyString_));
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
index 8d4f66d52f..7b718452bb 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
@@ -60,7 +60,7 @@ set(LIBRARIES
crypto
)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
index f81919f4fa..e10b794685 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
@@ -51,7 +51,7 @@ class RCGetInteriorVehicleDataRequest
const RCCommandParams& params);
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
~RCGetInteriorVehicleDataRequest();
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
index 82e0a8c13b..bb5e7a9b8f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
@@ -76,6 +76,18 @@ class RCOnRemoteControlSettingsNotification
* notifications
*/
void DisallowRCFunctionality();
+
+ /**
+ * @brief Performs the set of actions depending on access mode param received
+ * in the message
+ */
+ void ProcessAccessModeParam();
+
+ /**
+ * @brief Performs the set of actions depending on allowed param received in
+ * the message
+ */
+ void ProcessAllowedParam();
};
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
index 6bca1017e0..91f9b6564a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "rc_rpc_plugin/commands/rc_command_params.h"
#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/rc_app_extension.h"
@@ -48,7 +48,7 @@ enum TypeAccess { kDisallowed, kAllowed };
namespace commands {
-class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
+class RCCommandRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief RCCommandRequest class constructor
@@ -65,11 +65,11 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
virtual ~RCCommandRequest();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
void Run() OVERRIDE;
- virtual void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
protected:
bool is_subscribed;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
index 8b2162c9ab..031e89fd85 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
@@ -143,8 +143,7 @@ class RCRPCPlugin;
class RCAppExtension : public application_manager::AppExtension {
public:
- explicit RCAppExtension(application_manager::AppExtensionUID uid,
- RCRPCPlugin& plugin,
+ explicit RCAppExtension(RCRPCPlugin& plugin,
application_manager::Application& application);
~RCAppExtension();
@@ -232,6 +231,8 @@ class RCAppExtension : public application_manager::AppExtension {
*/
void SetUserLocation(const Grid& grid);
+ static const application_manager::AppExtensionUID RCAppExtensionID = 153;
+
private:
/**
* @brief Checks if the application's pointer is valid and update the
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
index 5cbc4b977e..fd8c40405e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
@@ -50,12 +50,6 @@ class RCConsentManagerImpl : public RCConsentManager {
application_manager::ApplicationManager& application_manager,
const uint32_t period_of_consent_expired);
- DEPRECATED
- RCConsentManagerImpl(
- resumption::LastState& last_state,
- application_manager::ApplicationManager& application_manager,
- const uint32_t period_of_consent_expired);
-
void SaveModuleConsents(
const std::string& policy_app_id,
const std::string& mac_address,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h
index 944d47b052..eeeb9988d7 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h
@@ -22,7 +22,8 @@ class RCPendingResumptionHandler : public resumption::PendingResumptionHandler {
application_manager::ApplicationManager& application_manager,
rc_rpc_plugin::InteriorDataCache& interior_data_cache);
- void on_event(const application_manager::event_engine::Event& event) override;
+ void HandleOnEvent(
+ const application_manager::event_engine::Event& event) override;
void HandleResumptionSubscriptionRequest(
application_manager::AppExtension& extension,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
index 528e116403..e45d48d63a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
@@ -65,12 +65,6 @@ class RCRPCPlugin : public plugins::RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) OVERRIDE;
- DEPRECATED
- bool Init(app_mngr::ApplicationManager& app_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) OVERRIDE;
/**
* @param int32_t command id
* @param CommandSource source
@@ -131,7 +125,17 @@ class RCRPCPlugin : public plugins::RPCPlugin {
bool IsOtherAppsSubscribed(const rc_rpc_types::ModuleUid& module,
const uint32_t app_id);
- static const uint32_t kRCPluginID = 153;
+ /**
+ * @brief Creates the RC extension for specified application
+ * @param application pointer to app to work with
+ */
+ void CreateRcExtension(application_manager::ApplicationSharedPtr application);
+
+ /**
+ * @brief Removes the RC extensions for specified application
+ * @param application pointer to app to work with
+ */
+ void RemoveRcExtension(application_manager::ApplicationSharedPtr application);
typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
static Apps GetRCApplications(
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
index ee0bd11885..db785e4a4f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
@@ -130,6 +130,19 @@ class ResourceAllocationManager {
const std::string& module_id) const = 0;
/**
+ * @brief IsResourceAllocated check if module is allocated by certain
+ * application
+ * @param module_type module to be checked
+ * @param module_id uuid of a resource to be checked
+ * @param app_id app to be checked
+ * @return true if module_type is allocated by application with provided
+ * app_id
+ */
+ virtual bool IsResourceAllocated(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) = 0;
+
+ /**
* @brief AcquireResource forces acquiring resource by application
* @param module_type resource to acquire
* @param module_id uuid of a resource
@@ -196,8 +209,16 @@ class ResourceAllocationManager {
NotificationTrigger::eType event,
application_manager::ApplicationSharedPtr application) = 0;
+ /**
+ * @brief Returns current state of RC functionality
+ * @return current state of RC functionality
+ */
virtual bool is_rc_enabled() const = 0;
+ /**
+ * @brief Sets current state of RC functionality to a new one
+ * @param value new RC functionality state
+ */
virtual void set_rc_enabled(const bool value) = 0;
/**
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
index 0fd5449912..4361312dde 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
@@ -94,6 +94,10 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
bool IsResourceFree(const std::string& module_type,
const std::string& module_id) const FINAL;
+ bool IsResourceAllocated(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) FINAL;
+
void SetAccessMode(
const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
index fede1dbd11..0aaee81ad4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
@@ -57,7 +57,7 @@ void RCGetInteriorVehicleDataRequest::Run() {
SendRequest();
}
-void RCGetInteriorVehicleDataRequest::onTimeOut() {
+void RCGetInteriorVehicleDataRequest::OnTimeOut() {
SDL_LOG_TRACE("function_id: " << function_id()
<< " correlation_id: " << correlation_id());
using namespace application_manager;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
index 217258b086..580937bc8a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
@@ -87,42 +87,56 @@ void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() {
void RCOnRemoteControlSettingsNotification::Run() {
SDL_LOG_AUTO_TRACE();
+ if ((*message_)[app_mngr::strings::msg_params].empty()) {
+ SDL_LOG_DEBUG("Notification is ignored due to absence of any parameters");
+ SDL_LOG_DEBUG("RC Functionality remains unchanged");
+ return;
+ }
+
+ ProcessAccessModeParam();
+ ProcessAllowedParam();
+}
+
+void RCOnRemoteControlSettingsNotification::ProcessAccessModeParam() {
+ if (!(*message_)[app_mngr::strings::msg_params].keyExists(
+ message_params::kAccessMode)) {
+ SDL_LOG_DEBUG(
+ "No access mode received. Using last known: "
+ << AccessModeToString(resource_allocation_manager_.GetAccessMode()));
+ return;
+ }
+
+ const auto access_mode = static_cast<hmi_apis::Common_RCAccessMode::eType>(
+ (*message_)[app_mngr::strings::msg_params][message_params::kAccessMode]
+ .asUInt());
+ SDL_LOG_DEBUG("Setting up access mode : " << AccessModeToString(access_mode));
+ resource_allocation_manager_.SetAccessMode(access_mode);
+}
+
+void RCOnRemoteControlSettingsNotification::ProcessAllowedParam() {
if (!(*message_)[app_mngr::strings::msg_params].keyExists(
message_params::kAllowed)) {
- SDL_LOG_DEBUG("Notification is ignored due to \"allow\" parameter absense");
- SDL_LOG_DEBUG("RC Functionality remains unchanged");
+ SDL_LOG_DEBUG("No allowed param received. Using last known: "
+ << std::boolalpha
+ << resource_allocation_manager_.is_rc_enabled());
return;
}
const bool is_allowed =
(*message_)[app_mngr::strings::msg_params][message_params::kAllowed]
.asBool();
+
if (is_allowed) {
- hmi_apis::Common_RCAccessMode::eType access_mode =
- hmi_apis::Common_RCAccessMode::INVALID_ENUM;
SDL_LOG_DEBUG("Allowing RC Functionality");
resource_allocation_manager_.set_rc_enabled(true);
- if ((*message_)[app_mngr::strings::msg_params].keyExists(
- message_params::kAccessMode)) {
- access_mode = static_cast<hmi_apis::Common_RCAccessMode::eType>(
- (*message_)[app_mngr::strings::msg_params]
- [message_params::kAccessMode]
- .asUInt());
- SDL_LOG_DEBUG(
- "Setting up access mode : " << AccessModeToString(access_mode));
- } else {
- access_mode = resource_allocation_manager_.GetAccessMode();
- SDL_LOG_DEBUG("No access mode received. Using last known: "
- << AccessModeToString(access_mode));
- }
- resource_allocation_manager_.SetAccessMode(access_mode);
- } else {
- SDL_LOG_DEBUG("Disallowing RC Functionality");
- DisallowRCFunctionality();
- resource_allocation_manager_.ResetAllAllocations();
- resource_allocation_manager_.set_rc_enabled(false);
- rc_consent_manager_.RemoveAllConsents();
+ return;
}
+
+ SDL_LOG_DEBUG("Disallowing RC Functionality");
+ DisallowRCFunctionality();
+ resource_allocation_manager_.ResetAllAllocations();
+ resource_allocation_manager_.set_rc_enabled(false);
+ rc_consent_manager_.RemoveAllConsents();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
index 9bf7977bdf..297c4b70bb 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
@@ -125,7 +125,7 @@ AcquireResult::eType ButtonPressRequest::AcquireResource(
SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
return resource_allocation_manager_.AcquireResource(
module_type, ModuleId(), app->app_id());
@@ -141,8 +141,7 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type,
const ResourceState::eType state) {
SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
-
+ application_manager_.application(RequestFromMobileImpl::connection_key());
resource_allocation_manager_.SetResourceState(
module_type, ModuleId(), app->app_id(), state);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
index a13a7f2a9e..b2b164b9ad 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
@@ -116,7 +116,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() {
module_ids_for_consent->clear();
auto module_ids = msg_params[message_params::kModuleIds].asArray();
- for (uint32_t i = 0; i < module_ids->size(); i++) {
+ for (uint32_t i = 0; i < module_ids->size(); ++i) {
// Only add modules whose consent is unknown(needs to be sent to the hmi)
bool is_consent_undefined =
(*hmi_request_consents_.asArray())[i].getType() ==
@@ -207,7 +207,7 @@ void GetInteriorVehicleDataConsentRequest::on_event(
consent.getType() == smart_objects::SmartType::SmartType_Null;
if (is_consent_undefined) {
consent = (*response_consents)[response_consents_counter];
- response_consents_counter++;
+ ++response_consents_counter;
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index 8d3a3d796e..f5c5c9278d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -284,10 +284,8 @@ void GetInteriorVehicleDataRequest::on_event(
[message_params::kModuleData][data_mapping(module_type)];
interior_data_cache_.Add(module, module_data);
}
- } else {
- hmi_response[app_mngr::strings::msg_params].erase(
- message_params::kIsSubscribed);
}
+
std::string response_info;
GetInfo(hmi_response, response_info);
SetResourceState(ModuleType(), ResourceState::FREE);
@@ -295,7 +293,7 @@ void GetInteriorVehicleDataRequest::on_event(
SendResponse(result,
result_code,
response_info.c_str(),
- &hmi_response[app_mngr::strings::msg_params]);
+ result ? &hmi_response[app_mngr::strings::msg_params] : nullptr);
}
GetInteriorVehicleDataRequest::~GetInteriorVehicleDataRequest() {}
@@ -317,7 +315,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
const_cast<smart_objects::SmartObject&>(hmi_response);
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
const auto extension = RCHelpers::GetRCExtension(*app);
const char* module_type;
ns_smart_device_link::ns_smart_objects::
@@ -405,8 +403,8 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() {
message_params::kSubscribe);
if (is_subscribe_present_in_request) {
- app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ app_mngr::ApplicationSharedPtr app = application_manager_.application(
+ RequestFromMobileImpl::connection_key());
const auto extension = RCHelpers::GetRCExtension(*app);
const std::string module_type = ModuleType();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index dea660b780..5b500dfa30 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -372,7 +372,7 @@ AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource(
SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
return resource_allocation_manager_.AcquireResource(
module_type, ModuleId(), app->app_id());
@@ -387,7 +387,7 @@ void SetInteriorVehicleDataRequest::SetResourceState(
const std::string& module_type, const ResourceState::eType state) {
SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
resource_allocation_manager_.SetResourceState(
module_type, ModuleId(), app->app_id(), state);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
index 12608d64c1..376723b964 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
@@ -31,7 +31,9 @@
*/
#include "rc_rpc_plugin/commands/rc_command_request.h"
+
#include <sstream>
+
#include "application_manager/hmi_interfaces.h"
#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler_interface.h"
@@ -49,7 +51,7 @@ namespace commands {
RCCommandRequest::RCCommandRequest(
const app_mngr::commands::MessageSharedPtr& message,
const RCCommandParams& params)
- : application_manager::commands::CommandRequestImpl(
+ : application_manager::commands::RequestFromMobileImpl(
message,
params.application_manager_,
params.rpc_service_,
@@ -74,18 +76,18 @@ bool RCCommandRequest::IsInterfaceAvailable(
return app_mngr::HmiInterfaces::STATE_NOT_AVAILABLE != state;
}
-void RCCommandRequest::onTimeOut() {
+void RCCommandRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
const std::string module_type = ModuleType();
SetResourceState(module_type, ResourceState::FREE);
- SendResponse(
- false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired");
+
+ RequestFromMobileImpl::OnTimeOut();
}
bool RCCommandRequest::CheckDriverConsent() {
SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(connection_key());
const std::string module_type = ModuleType();
rc_rpc_plugin::TypeAccess access = CheckModule(module_type, app);
@@ -131,7 +133,7 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) {
void RCCommandRequest::Run() {
SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(connection_key());
if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) {
SDL_LOG_WARN("HMI interface RC is not available");
@@ -224,19 +226,19 @@ void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) {
void RCCommandRequest::ProcessAccessResponse(
const app_mngr::event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
- app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+
+ auto app = application_manager_.application(connection_key());
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
+
if (!app) {
SDL_LOG_ERROR("NULL pointer.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
return;
}
- const smart_objects::SmartObject& message = event.smart_object();
-
- mobile_apis::Result::eType result_code =
+ const auto& message = event.smart_object();
+ const auto result_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
message[app_mngr::strings::params][app_mngr::hmi_response::code]
.asUInt()));
@@ -278,6 +280,11 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed,
SDL_LOG_AUTO_TRACE();
if (is_allowed) {
SetResourceState(module_type, ResourceState::BUSY);
+ const auto default_timeout =
+ application_manager_.get_settings().default_timeout() +
+ application_manager_.get_settings().default_timeout_compensation();
+ application_manager_.UpdateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout);
Execute(); // run child's logic
} else {
resource_allocation_manager_.OnDriverDisallowed(
@@ -323,7 +330,7 @@ void RCCommandRequest::SendGetUserConsent(
const smart_objects::SmartObject& module_ids) {
SDL_LOG_AUTO_TRACE();
app_mngr::ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(connection_key());
DCHECK(app);
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
index 569da641d2..8e29f327c0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
@@ -71,10 +71,11 @@ std::set<rc_rpc_plugin::ModuleUid> ConvertSmartObjectToModuleCollection(
} // namespace
namespace rc_rpc_plugin {
-RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid,
- RCRPCPlugin& plugin,
+RCAppExtension::RCAppExtension(RCRPCPlugin& plugin,
application_manager::Application& application)
- : AppExtension(uid), plugin_(plugin), application_(application) {}
+ : AppExtension(RCAppExtensionID)
+ , plugin_(plugin)
+ , application_(application) {}
void RCAppExtension::SubscribeToInteriorVehicleData(const ModuleUid& module) {
subscribed_interior_vehicle_data_.insert(module);
@@ -199,15 +200,13 @@ void RCAppExtension::RevertResumption(
const auto module_subscriptions =
ConvertSmartObjectToModuleCollection(resumption_data);
- for (auto& module : module_subscriptions) {
- SDL_LOG_TRACE("Requested to unsubscribe module_type "
- << module.first << "module_id: " << module.second);
- }
std::set<rc_rpc_plugin::ModuleUid> to_be_unsubscribed;
const auto app_id = application_.app_id();
auto no_apps_subscribed = [app_id,
this](const rc_rpc_plugin::ModuleUid& module) {
+ SDL_LOG_TRACE("Requested to unsubscribe module_type "
+ << module.first << "module_id: " << module.second);
if (plugin_.IsOtherAppsSubscribed(module, app_id)) {
SDL_LOG_DEBUG("Some other app except " << app_id
<< " is already subscribed to "
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 c1743c8540..6e5d1b6e5c 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
@@ -217,7 +217,8 @@ CommandCreator& RCCommandFactory::get_mobile_command_creator(
: rc_factory.GetCreator<
commands::GetInteriorVehicleDataConsentResponse>();
}
- default: {}
+ default: {
+ }
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
@@ -230,7 +231,8 @@ CommandCreator& RCCommandFactory::get_mobile_notification_creator(
return rc_factory
.GetCreator<commands::OnInteriorVehicleDataNotification>();
}
- default: {}
+ default: {
+ }
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
@@ -259,7 +261,8 @@ CommandCreator& RCCommandFactory::get_mobile_creator_factory(
}
break;
}
- default: {}
+ default: {
+ }
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
@@ -314,7 +317,9 @@ CommandCreator& RCCommandFactory::get_hmi_creator_factory(
: rc_factory
.GetCreator<commands::RCSetGlobalPropertiesResponse>();
}
- default: { return rc_factory.GetCreator<RCInvalidCommand>(); }
+ default: {
+ return rc_factory.GetCreator<RCInvalidCommand>();
+ }
}
}
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
index b2d1f1513b..7b6d5041c0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
@@ -186,7 +186,8 @@ const std::vector<std::string> RCHelpers::GetModuleTypesList() {
RCAppExtensionPtr RCHelpers::GetRCExtension(
application_manager::Application& app) {
SDL_LOG_AUTO_TRACE();
- auto extension_interface = app.QueryInterface(RCRPCPlugin::kRCPluginID);
+ auto extension_interface =
+ app.QueryInterface(RCAppExtension::RCAppExtensionID);
auto extension =
std::static_pointer_cast<RCAppExtension>(extension_interface);
return extension;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
index e66023f27a..ba681b0136 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc
@@ -14,7 +14,7 @@ RCPendingResumptionHandler::RCPendingResumptionHandler(
, rpc_service_(application_manager.GetRPCService())
, interior_data_cache_(interior_data_cache) {}
-void RCPendingResumptionHandler::on_event(
+void RCPendingResumptionHandler::HandleOnEvent(
const application_manager::event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
namespace am_strings = application_manager::strings;
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 87090405e7..b110d3157d 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
@@ -86,14 +86,6 @@ bool RCRPCPlugin::Init(
return true;
}
-bool RCRPCPlugin::Init(application_manager::ApplicationManager&,
- application_manager::rpc_service::RPCService&,
- application_manager::HMICapabilities&,
- policy::PolicyHandlerInterface&,
- resumption::LastState&) {
- return false;
-}
-
bool RCRPCPlugin::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource
@@ -119,42 +111,50 @@ void RCRPCPlugin::OnApplicationEvent(
application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application) {
SDL_LOG_AUTO_TRACE();
- if (!application->is_remote_control_supported()) {
- SDL_LOG_DEBUG(
- "Remote control is not supported for application with app_id: "
- << application->app_id());
- return;
- }
+
switch (event) {
case plugins::kApplicationRegistered: {
- auto extension = std::shared_ptr<RCAppExtension>(
- new RCAppExtension(kRCPluginID, *this, *application));
- DCHECK_OR_RETURN_VOID(application->AddExtension(extension));
- const auto driver_location =
- rc_capabilities_manager_
- ->GetDriverLocationFromSeatLocationCapability();
- extension->SetUserLocation(driver_location);
+ if (application->is_remote_control_supported()) {
+ CreateRcExtension(application);
+ }
+
break;
}
+ case plugins::kApplicationUnregistered:
case plugins::kApplicationExit: {
- resource_allocation_manager_->OnApplicationEvent(event, application);
- interior_data_manager_->OnApplicationEvent(event, application);
- break;
- }
- case plugins::kApplicationUnregistered: {
- resource_allocation_manager_->OnApplicationEvent(event, application);
- interior_data_manager_->OnApplicationEvent(event, application);
+ if (application->is_remote_control_supported()) {
+ resource_allocation_manager_->OnApplicationEvent(event, application);
+ interior_data_manager_->OnApplicationEvent(event, application);
+ }
+
break;
}
case plugins::kGlobalPropertiesUpdated: {
- const auto user_location = application->get_user_location();
- auto extension = RCHelpers::GetRCExtension(*application);
- extension->SetUserLocation(user_location);
+ if (application->is_remote_control_supported()) {
+ const auto user_location = application->get_user_location();
+ auto extension = RCHelpers::GetRCExtension(*application);
+ extension->SetUserLocation(user_location);
+ }
+
break;
}
case plugins::kRCStatusChanged: {
- resource_allocation_manager_->SendOnRCStatusNotifications(
- NotificationTrigger::APP_REGISTRATION, application);
+ if (application->is_remote_control_supported()) {
+ resource_allocation_manager_->SendOnRCStatusNotifications(
+ NotificationTrigger::APP_REGISTRATION, application);
+ }
+
+ break;
+ }
+ case plugins::kAppHmiTypesChanged: {
+ auto extension =
+ application->QueryInterface(RCAppExtension::RCAppExtensionID);
+ if (!application->is_remote_control_supported() && extension) {
+ RemoveRcExtension(application);
+ } else if (application->is_remote_control_supported() && !extension) {
+ CreateRcExtension(application);
+ }
+
break;
}
default:
@@ -162,6 +162,25 @@ void RCRPCPlugin::OnApplicationEvent(
}
}
+void RCRPCPlugin::CreateRcExtension(
+ application_manager::ApplicationSharedPtr application) {
+ auto extension =
+ std::shared_ptr<RCAppExtension>(new RCAppExtension(*this, *application));
+ DCHECK_OR_RETURN_VOID(application->AddExtension(extension));
+ const auto driver_location =
+ rc_capabilities_manager_->GetDriverLocationFromSeatLocationCapability();
+ extension->SetUserLocation(driver_location);
+}
+
+void RCRPCPlugin::RemoveRcExtension(
+ application_manager::ApplicationSharedPtr application) {
+ resource_allocation_manager_->OnApplicationEvent(
+ plugins::kApplicationUnregistered, application);
+ interior_data_manager_->OnApplicationEvent(plugins::kApplicationUnregistered,
+ application);
+ application->RemoveExtension(RCAppExtension::RCAppExtensionID);
+}
+
void RCRPCPlugin::ProcessResumptionSubscription(
application_manager::Application& app, RCAppExtension& ext) {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
index fe9bb5eec3..0c513cb01e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
@@ -140,7 +140,9 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
<< module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
- default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); }
+ default: {
+ DCHECK_OR_RETURN(false, AcquireResult::IN_USE);
+ }
}
}
@@ -486,6 +488,28 @@ bool ResourceAllocationManagerImpl::IsResourceFree(
return ResourceState::FREE == resource->second;
}
+bool ResourceAllocationManagerImpl::IsResourceAllocated(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
+ ModuleUid module(module_type, module_id);
+ sync_primitives::AutoLock lock(allocated_resources_lock_);
+ const auto allocation = allocated_resources_.find(module);
+ if (allocated_resources_.end() == allocation) {
+ SDL_LOG_DEBUG("Resource " << module_type << " is not allocated.");
+ return false;
+ }
+
+ if (app_id != allocation->second) {
+ SDL_LOG_DEBUG("Resource " << module_type
+ << " is allocated by different application "
+ << allocation->second);
+ return true;
+ }
+
+ return false;
+}
+
void ResourceAllocationManagerImpl::SetAccessMode(
const hmi_apis::Common_RCAccessMode::eType access_mode) {
if (hmi_apis::Common_RCAccessMode::ASK_DRIVER != access_mode) {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
index f27020a7f1..9c40470a99 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
@@ -63,7 +63,7 @@ set(LIBRARIES
gmock_main
)
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
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 6c0962a557..f4ef39f488 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
@@ -65,7 +65,6 @@ using ::testing::ReturnRef;
using ::testing::SaveArg;
namespace {
-const int kModuleId = 153u;
const uint32_t kConnectionKey = 1u;
const uint32_t kAppId = 0u;
const std::string kPolicyAppId = "Test";
@@ -83,13 +82,13 @@ class ButtonPressRequestTest
smart_objects::SmartType_Map))
, mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extension_(std::make_shared<rc_rpc_plugin::RCAppExtension>(
- kModuleId, rc_plugin_, *mock_app_)) {}
+ rc_plugin_, *mock_app_)) {}
void SetUp() OVERRIDE {
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
(*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillByDefault(Return(rc_app_extension_));
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
@@ -105,6 +104,8 @@ class ButtonPressRequestTest
.WillByDefault(Return(true));
ON_CALL(mock_allocation_manager_, is_rc_enabled())
.WillByDefault(Return(true));
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_ALLOW));
ON_CALL(mock_rc_capabilities_manager_, CheckButtonName(_, _))
.WillByDefault(Return(true));
ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
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 20f9c27912..5fa474c631 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
@@ -95,9 +95,9 @@ class GetInteriorVehicleDataRequestTest
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, mock_app2_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extension_(
- std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
- , rc_app_extension2_(std::make_shared<RCAppExtension>(
- kModuleId, rc_plugin_, *mock_app2_))
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_))
+ , rc_app_extension2_(
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app2_))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_)
, rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
@@ -734,6 +734,8 @@ TEST_F(GetInteriorVehicleDataRequestTest,
available_hd_chanels[1] = chanel2_index;
available_hd_chanels[2] = chanel3_index;
+ msg_params[message_params::kModuleData][message_params::kModuleId] =
+ kModuleId;
msg_params[message_params::kModuleData][message_params::kRadioControlData]
[message_params::kAvailableHdChannels] = available_hd_chanels;
@@ -792,6 +794,8 @@ TEST_F(GetInteriorVehicleDataRequestTest,
smart_objects::SmartObject(smart_objects::SmartType_Boolean);
climate_control_data = true;
+ msg_params[message_params::kModuleData][message_params::kModuleId] =
+ kModuleId;
msg_params[message_params::kModuleData][message_params::kClimateControlData]
[message_params::kClimateEnableAvailable] = climate_control_data;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
index 6c7a7ba67e..9acfc084c5 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
@@ -62,7 +62,6 @@ const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "Test";
const std::string module_type = "CLIMATE";
const std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
-const int kModuleId = 153u;
} // namespace
namespace rc_rpc_plugin_test {
@@ -75,7 +74,7 @@ class OnInteriorVehicleDataNotificationTest
OnInteriorVehicleDataNotificationTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extension_(
- std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_) {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
index 62b726ac60..5d569e93d2 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
@@ -117,18 +117,61 @@ class RCOnRemoteControlSettingsNotificationTest
};
TEST_F(RCOnRemoteControlSettingsNotificationTest,
- Run_Allowed_SetAccessMode) { // Arrange
+ Run_Allowed_MissedAccessMode) { // Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kAllowed] = true;
// Expectations
+ EXPECT_CALL(mock_allocation_manager_, SetAccessMode(_)).Times(0);
+ EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(true));
- ON_CALL(mock_allocation_manager_, GetAccessMode())
- .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
+ // Act
+ std::shared_ptr<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>(
+ mobile_message);
+
+ command->Run();
+}
+
+TEST_F(RCOnRemoteControlSettingsNotificationTest,
+ Run_AccessMode_MissedAllowed) { // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kAccessMode] =
+ hmi_apis::Common_RCAccessMode::ASK_DRIVER;
+
+ // Expectations
+ EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(_)).Times(0);
+ EXPECT_CALL(mock_allocation_manager_,
+ SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
+
+ // Act
+ std::shared_ptr<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>(
+ mobile_message);
+ command->Run();
+}
+
+TEST_F(RCOnRemoteControlSettingsNotificationTest,
+ Run_AccessModeAndAllowed_BothPresent) { // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed] = true;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kAccessMode] =
+ hmi_apis::Common_RCAccessMode::ASK_DRIVER;
+
+ // Expectations
+ EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(true));
EXPECT_CALL(mock_allocation_manager_,
SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
+
// Act
std::shared_ptr<
rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>
@@ -145,9 +188,10 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest,
MessageSharedPtr mobile_message = CreateBasicMessage();
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kAllowed] = false;
-
- EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
EXPECT_CALL(mock_interior_data_manager_, OnDisablingRC());
+ EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
EXPECT_CALL(mock_rc_consent_manger_, RemoveAllConsents());
// Act
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
index 8fbaeda2f2..82d1b128f0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
@@ -39,10 +39,11 @@
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_request_timeout_handler.h"
#include "application_manager/mock_rpc_plugin.h"
#include "application_manager/mock_rpc_plugin_manager.h"
#include "application_manager/mock_rpc_protection_manager.h"
-#include "application_manager/request_controller.h"
+#include "application_manager/request_controller_impl.h"
#include "application_manager/rpc_service_impl.h"
#include "hmi_message_handler/mock_hmi_message_handler.h"
#include "include/test/protocol_handler/mock_protocol_handler.h"
@@ -81,6 +82,7 @@ using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockCommandFactory;
using test::components::application_manager_test::MockHMICapabilities;
using test::components::application_manager_test::MockRequestControlerSettings;
+using test::components::application_manager_test::MockRequestTimeoutHandler;
using test::components::commands_test::CommandRequestTest;
using test::components::commands_test::CommandsTestMocks;
using test::components::hmi_message_handler_test::MockHMIMessageHandler;
@@ -97,7 +99,6 @@ const std::string kResource = "CLIMATE";
const std::string kResourceId = "34045662-a9dc-4823-8435-91056d4c26cb";
const std::string kPolicyAppId = "policy_app_id";
const std::string kMacAddress = "device1";
-const uint32_t kPluginID = RCRPCPlugin::kRCPluginID;
} // namespace
class RCGetInteriorVehicleDataConsentTest
@@ -108,9 +109,11 @@ class RCGetInteriorVehicleDataConsentTest
, command_holder(app_mngr_)
, rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType::SmartType_Array))
- , request_controller(mock_request_controler)
, rpc_protection_manager_(
std::make_shared<application_manager::MockRPCProtectionManager>())
+ , request_controller(mock_request_controler,
+ mock_request_timeout_handler_,
+ event_dispatcher_)
, rpc_service_(app_mngr_,
request_controller,
&mock_protocol_handler,
@@ -120,7 +123,7 @@ class RCGetInteriorVehicleDataConsentTest
hmi_so_factory_,
mobile_so_factoy_)
, rc_app_extension_(
- std::make_shared<RCAppExtension>(kPluginID, rc_plugin_, *mock_app_))
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_))
, mock_rpc_plugin_manager(
std::make_shared<NiceMock<MockRPCPluginManager> >())
, rpc_plugin(mock_rpc_plugin)
@@ -136,7 +139,7 @@ class RCGetInteriorVehicleDataConsentTest
.WillByDefault(Return(application_manager::HmiInterfaces::
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillByDefault(Return(rc_app_extension_));
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
mock_interior_data_cache_;
@@ -214,9 +217,10 @@ class RCGetInteriorVehicleDataConsentTest
smart_objects::SmartObjectSPtr rc_capabilities_;
MockRPCPlugin mock_rpc_plugin;
MockCommandFactory mock_command_factory;
- am::request_controller::RequestController request_controller;
std::shared_ptr<application_manager::MockRPCProtectionManager>
rpc_protection_manager_;
+ MockRequestTimeoutHandler mock_request_timeout_handler_;
+ am::request_controller::RequestControllerImpl request_controller;
am::rpc_service::RPCServiceImpl rpc_service_;
RCRPCPlugin rc_plugin_;
std::shared_ptr<RCAppExtension> rc_app_extension_;
@@ -235,6 +239,8 @@ TEST_F(RCGetInteriorVehicleDataConsentTest,
Run_MobileSendButtonPressMessage_HMISendASKDRIVERModeToMobile) {
// Arrange
auto mobile_message = CreateBasicMessage();
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
// Expectations
EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _, _))
@@ -279,6 +285,9 @@ TEST_F(RCGetInteriorVehicleDataConsentTest,
.WillOnce(ReturnRef(mock_command_factory));
auto mobile_message = CreateBasicMessage();
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_DENY));
+
auto rc_consent_response =
CreateRCCommand<commands::RCGetInteriorVehicleDataConsentResponse>(
mobile_message);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
index 9b06ddb137..fe190a796f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
@@ -74,7 +74,7 @@ class SetInteriorVehicleDataRequestTest
SetInteriorVehicleDataRequestTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extension_(
- std::make_shared<RCAppExtension>(kModuleId, rc_plugin_, *mock_app_))
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_))
, rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType::SmartType_Array)) {}
@@ -89,7 +89,7 @@ class SetInteriorVehicleDataRequestTest
.WillByDefault(Return(application_manager::HmiInterfaces::
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillByDefault(Return(rc_app_extension_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
@@ -112,6 +112,8 @@ class SetInteriorVehicleDataRequestTest
ON_CALL(mock_rc_capabilities_manager_, GetModuleDataCapabilities(_, _))
.WillByDefault(
Return(std::make_pair("", capabilitiesStatus::kSuccess)));
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_ALLOW));
}
MessageSharedPtr CreateBasicMessage() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
index fca6c9c77e..2f128d64a8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
@@ -70,6 +70,10 @@ class MockResourceAllocationManager
MOCK_CONST_METHOD2(IsResourceFree,
bool(const std::string& module_type,
const std::string& module_id));
+ MOCK_METHOD3(IsResourceAllocated,
+ bool(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id));
MOCK_METHOD0(ResetAllAllocations, void());
MOCK_METHOD2(SendOnRCStatusNotifications,
void(rc_rpc_plugin::NotificationTrigger::eType,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc
index 60c3fb9135..ea099ef901 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc
@@ -40,10 +40,6 @@
#include "rc_rpc_plugin/rc_module_constants.h"
#include "rc_rpc_plugin/rc_rpc_plugin.h"
-namespace {
-const uint32_t kRCAppExtensionId = 1ull;
-} // namespace
-
namespace test {
namespace components {
namespace rc_rpc_plugin_test {
@@ -57,7 +53,7 @@ class RcAppExtensionTest : public testing::Test {
RcAppExtensionTest()
: mock_app_(new NiceMock<MockApplication>())
, rc_app_extension_(std::make_shared<rc_rpc_plugin::RCAppExtension>(
- kRCAppExtensionId, rc_plugin_, *mock_app_)) {}
+ rc_plugin_, *mock_app_)) {}
protected:
std::unique_ptr<MockApplication> mock_app_;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc
index fe8ade1e05..8ea478cd19 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc
@@ -78,7 +78,6 @@ const std::string kModuleType_1 = "CLIMATE";
const std::string kModuleId_1 = "9cb963f3-c5e8-41cb-b001-19421cc16552";
const std::string kModuleType_2 = "RADIO";
const std::string kModuleId_2 = "357a3918-9f35-4d86-a8b6-60cd4308d76f";
-const uint32_t kRCPluginID = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
const auto kSourceHMI = application_manager::commands::Command::SOURCE_HMI;
} // namespace
@@ -171,9 +170,11 @@ class RCPendingResumptionHandlerTest : public ::testing::Test {
}
rc_rpc_plugin::RCAppExtensionPtr CreateExtension(MockApplication& app) {
- auto rc_app_ext = std::make_shared<rc_rpc_plugin::RCAppExtension>(
- kRCPluginID, rc_plugin_, app);
- ON_CALL(app, QueryInterface(kRCPluginID)).WillByDefault(Return(rc_app_ext));
+ auto rc_app_ext =
+ std::make_shared<rc_rpc_plugin::RCAppExtension>(rc_plugin_, app);
+ ON_CALL(app,
+ QueryInterface(rc_rpc_plugin::RCAppExtension::RCAppExtensionID))
+ .WillByDefault(Return(rc_app_ext));
return rc_app_ext;
}
@@ -369,7 +370,7 @@ TEST_F(RCPendingResumptionHandlerTest,
EXPECT_CALL(event_dispatcher_mock_, raise_event(EventCheck(kAppId_2)));
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
}
TEST_F(RCPendingResumptionHandlerTest,
@@ -415,7 +416,7 @@ TEST_F(RCPendingResumptionHandlerTest,
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI));
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
}
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
index baed1437ce..835cf29f13 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
@@ -71,7 +71,7 @@ set(LIBRARIES
dl
)
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
index 501fbc323d..bae6ed805c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
@@ -112,9 +112,8 @@ class RAManagerTest : public ::testing::Test {
, mock_rc_helpers_(MockRCHelpers::rc_helpers_mock()) {
ON_CALL(mock_app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
- auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
app_ext_ptr_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(
- plugin_id, rc_plugin_, *mock_app_1_);
+ rc_plugin_, *mock_app_1_);
ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1));
PrepareResources();
@@ -130,13 +129,12 @@ class RAManagerTest : public ::testing::Test {
ON_CALL(mock_app_mngr_, application(kAppId1))
.WillByDefault(Return(mock_app_1_));
ON_CALL(*mock_app_1_,
- QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID))
+ QueryInterface(rc_rpc_plugin::RCAppExtension::RCAppExtensionID))
.WillByDefault(Return(app_ext_ptr_));
ON_CALL(mock_app_mngr_, application(kAppId2))
.WillByDefault(Return(mock_app_2_));
- ON_CALL(*mock_app_2_,
- QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID))
+ ON_CALL(*mock_app_2_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillByDefault(Return(app_ext_ptr_));
OnRCStatusNotificationExpectations();
@@ -144,10 +142,7 @@ class RAManagerTest : public ::testing::Test {
void SetUp() OVERRIDE {
rc_app_extension_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(
- static_cast<application_manager::AppExtensionUID>(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
- rc_plugin_,
- *mock_app_1_);
+ rc_plugin_, *mock_app_1_);
ON_CALL(mock_rc_capabilities_manager_,
GetDriverLocationFromSeatLocationCapability())
.WillByDefault(Return(kDriverLocation));
@@ -407,11 +402,8 @@ TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
- RCAppExtensionPtr rc_extension_ptr = std::make_shared<RCAppExtension>(
- application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
- rc_plugin_,
- *mock_app_1_);
+ RCAppExtensionPtr rc_extension_ptr =
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_1_);
EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
@@ -483,13 +475,10 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
- RCAppExtensionPtr rc_extension_ptr = std::make_shared<RCAppExtension>(
- application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
- rc_plugin_,
- *mock_app_1_);
+ RCAppExtensionPtr rc_extension_ptr =
+ std::make_shared<RCAppExtension>(rc_plugin_, *mock_app_1_);
- EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ EXPECT_CALL(*mock_app_1_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillRepeatedly(Return(rc_extension_ptr));
// Act
@@ -517,13 +506,9 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
.WillRepeatedly(Return(mock_app_1_));
RCAppExtensionPtr rc_extension_ptr =
- std::make_shared<rc_rpc_plugin::RCAppExtension>(
- application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID),
- rc_plugin_,
- *mock_app_1_);
+ std::make_shared<rc_rpc_plugin::RCAppExtension>(rc_plugin_, *mock_app_1_);
- EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ EXPECT_CALL(*mock_app_1_, QueryInterface(RCAppExtension::RCAppExtensionID))
.WillRepeatedly(Return(rc_extension_ptr));
ON_CALL(*mock_app_1_, is_remote_control_supported())
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 ef70f5908f..bface1542c 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
@@ -28,7 +28,10 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-include_directories(include)
+include_directories(
+ include
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/sdl_rpc_plugin
+)
set (COMMANDS_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/src/commands
@@ -63,7 +66,7 @@ set(LIBRARIES
crypto
)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h
index 2208671e0b..b6406901be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h
@@ -61,12 +61,7 @@ class BasicCommunicationGetSystemTimeRequest
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler);
- /**
- * @brief onTimeOut allows to handle case when
- * system does not respond for certain request in
- * appropriate time window.
- */
- void onTimeOut() FINAL;
+ void OnTimeOut() FINAL;
};
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_on_app_capability_updated_notification.h
index 0a0a8c3c5d..f4883cecaf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_on_app_capability_updated_notification.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
#include "application_manager/commands/notification_to_hmi.h"
@@ -40,44 +40,25 @@ namespace app_mngr = application_manager;
namespace commands {
-namespace hmi {
-
-/**
- * @brief OnButtonSubscriptionNotification command class
- **/
-class OnButtonSubscriptionNotification
+class BCOnAppCapabilityUpdatedNotification
: public app_mngr::commands::NotificationToHMI {
public:
- /**
- * @brief OnButtonSubscriptionNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnButtonSubscriptionNotification(
+ BCOnAppCapabilityUpdatedNotification(
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 OnButtonSubscriptionNotification class destructor
- **/
- virtual ~OnButtonSubscriptionNotification();
+ ~BCOnAppCapabilityUpdatedNotification() OVERRIDE;
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnButtonSubscriptionNotification);
+ DISALLOW_COPY_AND_ASSIGN(BCOnAppCapabilityUpdatedNotification);
};
-} // namespace hmi
-
} // namespace commands
-
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
index 62be7e8836..7b0e3f4590 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
@@ -64,7 +64,7 @@ class ButtonGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ButtonGetCapabilitiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
index 0b82feb1c5..98f96c29c4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
@@ -67,9 +67,9 @@ class GetSystemInfoRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
/**
- * @brief onTimeOut from request controller
+ * @brief OnTimeOut from request controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
index 2d3c40c3f3..5254d641de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
@@ -45,6 +45,7 @@ struct SystemInfo {
std::string ccpu_version;
std::string wers_country_code;
std::string language;
+ std::string hardware_version;
};
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
index ac6f1474e6..0cf1e0872e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
@@ -43,8 +43,7 @@ namespace commands {
/**
* @brief AudioStartStreamRequest command class
**/
-class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief AudioStartStreamRequest class constructor
@@ -62,10 +61,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
**/
virtual ~AudioStartStreamRequest();
- /**
- * @brief onTimeOut from requrst Controller
- */
- virtual void onTimeOut();
+ void OnTimeOut() FINAL;
/**
* @brief Execute command
@@ -75,7 +71,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief On event callback
**/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
index 17d4eb483f..7cc4181f6e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
@@ -43,8 +43,7 @@ namespace commands {
/**
* @brief NaviIsReadyRequest command class
**/
-class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief NaviIsReadyRequest class constructor
@@ -72,6 +71,8 @@ class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI,
**/
void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+ void OnTimeOut() OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(NaviIsReadyRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
index 437d58861c..8a62f31933 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
@@ -43,8 +43,7 @@ namespace commands {
/**
* @brief NaviSetVideoConfigRequest command class
**/
-class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief NaviSetVideoConfigRequest class constructor
@@ -76,7 +75,7 @@ class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut callback
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NaviSetVideoConfigRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
index 76413cd55d..9527ae0a7d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
@@ -43,8 +43,7 @@ namespace commands {
/**
* @brief NaviStartStreamRequest command class
**/
-class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief NaviStartStreamRequest class constructor
@@ -70,12 +69,9 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief On event callback
**/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
- /**
- * @brief onTimeOut from requrst Controller
- */
- virtual void onTimeOut();
+ void OnTimeOut() FINAL;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
index 898a2a8f67..c836ad3cc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
@@ -65,7 +65,7 @@ class NaviSubscribeWayPointsRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
index 39b5c3aee3..41b5846a46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
@@ -87,6 +87,18 @@ class OnBCSystemCapabilityUpdatedNotificationFromHMI
ProcessSystemDisplayCapabilitiesResult ProcessSystemDisplayCapabilities(
const smart_objects::SmartObject& display_capabilities);
+ /**
+ * @brief ProcessVideoStreamingCapability processes provided video
+ * streaming capabilities according to its structure
+ * @param system_capability capabilities to process
+ * @return true if video streaming capabilities have been processed
+ * properly, otherwise returns false
+ */
+ bool ProcessVideoStreamingCapability(
+ const smart_objects::SmartObject& system_capability);
+
+ void RemoveAppIdFromNotification();
+
DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotificationFromHMI);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h
index 1c87f82349..57c6f55e03 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_
#include "application_manager/commands/notification_from_hmi.h"
@@ -43,17 +43,17 @@ namespace commands {
namespace hmi {
/**
- * @brief OnUIResetTimeoutNotification command class
+ * @brief OnResetTimeoutNotification command class
**/
-class OnUIResetTimeoutNotification
+class OnResetTimeoutNotification
: public app_mngr::commands::NotificationFromHMI {
public:
/**
- * @brief OnUIResetTimeoutNotification class constructor
+ * @brief OnResetTimeoutNotification class constructor
*
* @param message Incoming SmartObject message
**/
- OnUIResetTimeoutNotification(
+ OnResetTimeoutNotification(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -61,9 +61,9 @@ class OnUIResetTimeoutNotification
policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief OnUIResetTimeoutNotification class destructor
+ * @brief OnResetTimeoutNotification class destructor
**/
- virtual ~OnUIResetTimeoutNotification();
+ virtual ~OnResetTimeoutNotification();
/**
* @brief Execute command
@@ -71,7 +71,7 @@ class OnUIResetTimeoutNotification
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(OnUIResetTimeoutNotification);
+ DISALLOW_COPY_AND_ASSIGN(OnResetTimeoutNotification);
};
} // namespace hmi
@@ -80,4 +80,4 @@ class OnUIResetTimeoutNotification
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h
deleted file mode 100644
index 0cb3e04f4e..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIBeltStatusNotification command class
- **/
-class OnVIBeltStatusNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIBeltStatusNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIBeltStatusNotification(
- 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 OnVIBeltStatusNotification class destructor
- **/
- virtual ~OnVIBeltStatusNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIBeltStatusNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h
deleted file mode 100644
index 6ab920204d..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIBodyInformationNotification command class
- **/
-class OnVIBodyInformationNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIBodyInformationNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIBodyInformationNotification(
- 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 OnVIBodyInformationNotification class destructor
- **/
- virtual ~OnVIBodyInformationNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIBodyInformationNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h
deleted file mode 100644
index b3afeb82b3..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIDeviceStatusNotification command class
- **/
-class OnVIDeviceStatusNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIDeviceStatusNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIDeviceStatusNotification(
- 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 OnVIDeviceStatusNotification class destructor
- **/
- virtual ~OnVIDeviceStatusNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIDeviceStatusNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h
deleted file mode 100644
index a1885c5e29..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIDriverBrakingNotification command class
- **/
-class OnVIDriverBrakingNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIDriverBrakingNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIDriverBrakingNotification(
- 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 OnVIDriverBrakingNotification class destructor
- **/
- virtual ~OnVIDriverBrakingNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIDriverBrakingNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h
deleted file mode 100644
index feb6cc6060..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIEngineTorqueNotification command class
- **/
-class OnVIEngineTorqueNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIEngineTorqueNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIEngineTorqueNotification(
- 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 OnVIEngineTorqueNotification class destructor
- **/
- virtual ~OnVIEngineTorqueNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIEngineTorqueNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h
deleted file mode 100644
index 5ed661cdbf..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIFuelLevelStateNotification command class
- **/
-class OnVIFuelLevelStateNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIFuelLevelStateNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIFuelLevelStateNotification(
- 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 OnVIFuelLevelStateNotification class destructor
- **/
- virtual ~OnVIFuelLevelStateNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIFuelLevelStateNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h
deleted file mode 100644
index 5ef1e3ed92..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIHeadLampStatusNotification command class
- **/
-class OnVIHeadLampStatusNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIHeadLampStatusNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIHeadLampStatusNotification(
- 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 OnVIHeadLampStatusNotification class destructor
- **/
- virtual ~OnVIHeadLampStatusNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIHeadLampStatusNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h
deleted file mode 100644
index 7bb7756fc5..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIInstantFuelConsumptionNotification command class
- **/
-class OnVIInstantFuelConsumptionNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIInstantFuelConsumptionNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIInstantFuelConsumptionNotification(
- 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 OnVIInstantFuelConsumptionNotification class destructor
- **/
- virtual ~OnVIInstantFuelConsumptionNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIInstantFuelConsumptionNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h
deleted file mode 100644
index cdebc99768..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIMyKeyNotification command class
- **/
-class OnVIMyKeyNotification : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIMyKeyNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIMyKeyNotification(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 OnVIMyKeyNotification class destructor
- **/
- virtual ~OnVIMyKeyNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIMyKeyNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h
deleted file mode 100644
index 7d03c62633..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_HMI_ON_VI_PRNDL_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIPrndlNotification command class
- **/
-class OnVIPrndlNotification : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIPrndlNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIPrndlNotification(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 OnVIPrndlNotification class destructor
- **/
- virtual ~OnVIPrndlNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIPrndlNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h
deleted file mode 100644
index 60a0ce0782..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_HMI_ON_VI_RPM_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIRpmNotification command class
- **/
-class OnVIRpmNotification : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIRpmNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIRpmNotification(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 OnVIRpmNotification class destructor
- **/
- virtual ~OnVIRpmNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIRpmNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h
deleted file mode 100644
index 4920fbd661..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_HMI_ON_VI_SPEED_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVISpeedNotification command class
- **/
-class OnVISpeedNotification : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVISpeedNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVISpeedNotification(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 OnVISpeedNotification class destructor
- **/
- virtual ~OnVISpeedNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVISpeedNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h
deleted file mode 100644
index cff99ecf8e..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVISteeringWheelAngleNotification command class
- **/
-class OnVISteeringWheelAngleNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVISteeringWheelAngleNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVISteeringWheelAngleNotification(
- 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 OnVISteeringWheelAngleNotification class destructor
- **/
- virtual ~OnVISteeringWheelAngleNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVISteeringWheelAngleNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h
deleted file mode 100644
index 0399780869..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVITirePressureNotification command class
- **/
-class OnVITirePressureNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVITirePressureNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVITirePressureNotification(
- 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 OnVITirePressureNotification class destructor
- **/
- virtual ~OnVITirePressureNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVITirePressureNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h
deleted file mode 100644
index 60b686683f..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_HMI_ON_VI_VIN_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIVinNotification command class
- **/
-class OnVIVinNotification : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIVinNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIVinNotification(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 OnVIVinNotification class destructor
- **/
- virtual ~OnVIVinNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIVinNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h
deleted file mode 100644
index a6e1ba9921..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
-
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief OnVIWiperStatusNotification command class
- **/
-class OnVIWiperStatusNotification
- : public app_mngr::commands::NotificationFromHMI {
- public:
- /**
- * @brief OnVIWiperStatusNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIWiperStatusNotification(
- 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 OnVIWiperStatusNotification class destructor
- **/
- virtual ~OnVIWiperStatusNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OnVIWiperStatusNotification);
-};
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
index 6dd06f283d..353b265908 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
@@ -63,7 +63,7 @@ class RCGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(RCGetCapabilitiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
index 15b2e13867..393442801c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
@@ -43,8 +43,7 @@ namespace commands {
/**
* @brief RCIsReadyRequest command class
**/
-class RCIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class RCIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief RCIsReadyRequest class constructor
@@ -75,7 +74,7 @@ class RCIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(RCIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
index 2751104486..21dc6a3bb2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
@@ -76,7 +76,7 @@ class SDLActivateAppRequest : public app_mngr::commands::RequestFromHMI {
* @brief onTimeOut allows to process case when timeout has appeared
* during request execution.
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
/**
* @brief on_event allows to handle events
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h
index 734420aaee..3d38e10525 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,51 +30,57 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/event_engine/event.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-
+namespace hmi {
/**
- * @brief OnVIExternalTemperatureNotification command class
+ * @brief SubscribeButtonRequest command class
**/
-class OnVIExternalTemperatureNotification
- : public app_mngr::commands::NotificationFromHMI {
+class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI {
public:
/**
- * @brief OnVIExternalTemperatureNotification class constructor
- *
+ * @brief SubscribeButtonRequest class constructor
* @param message Incoming SmartObject message
**/
- OnVIExternalTemperatureNotification(
- 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);
+ SubscribeButtonRequest(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 OnVIExternalTemperatureNotification class destructor
+ * @brief SubscribeButtonRequest class destructor
**/
- virtual ~OnVIExternalTemperatureNotification();
+ ~SubscribeButtonRequest();
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
+
+ void OnTimeOut() OVERRIDE;
+
+ void on_event(const application_manager::event_engine::Event& event) OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnVIExternalTemperatureNotification);
+ app_mngr::ApplicationSharedPtr GetApplicationPtr();
+
+ DISALLOW_COPY_AND_ASSIGN(SubscribeButtonRequest);
+
+ hmi_apis::Common_ButtonName::eType button_name_;
};
+} // namespace hmi
} // namespace commands
-
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h
index 70ee5f6c00..14c9753d0c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,49 +30,49 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_
#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-
+namespace hmi {
/**
- * @brief OnVIGpsDataNotification command class
+ * @brief SubscribeButtonResponse command class
**/
-class OnVIGpsDataNotification : public app_mngr::commands::NotificationFromHMI {
+class SubscribeButtonResponse : public app_mngr::commands::ResponseFromHMI {
public:
/**
- * @brief OnVIGpsDataNotification class constructor
- *
+ * @brief SubscribeButtonResponse class constructor
* @param message Incoming SmartObject message
**/
- OnVIGpsDataNotification(const app_mngr::commands::MessageSharedPtr& message,
+ SubscribeButtonResponse(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 OnVIGpsDataNotification class destructor
+ * @brief SubscribeButtonResponse class destructor
**/
- virtual ~OnVIGpsDataNotification();
+ ~SubscribeButtonResponse();
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnVIGpsDataNotification);
+ DISALLOW_COPY_AND_ASSIGN(SubscribeButtonResponse);
};
+} // namespace hmi
} // namespace commands
-
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
index 4ddd6f25fc..6d87158e57 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
@@ -63,7 +63,7 @@ class TTSGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TTSGetCapabilitiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
index b00fc9cffa..c2c02e50ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
@@ -63,7 +63,7 @@ class TTSGetLanguageRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TTSGetLanguageRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
index 802a196c46..e4a7ec5dee 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
@@ -65,7 +65,7 @@ class TTSGetSupportedLanguagesRequest
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TTSGetSupportedLanguagesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
index 039df31972..97d8e02e59 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
@@ -45,8 +45,7 @@ namespace commands {
/**
* @brief TTSIsReadyRequest command class
**/
-class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief TTSIsReadyRequest class constructor
@@ -77,7 +76,7 @@ class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TTSIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
index 2ac47ab013..536fe767bc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
@@ -67,7 +67,7 @@ class TTSSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TTSSetGlobalPropertiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
index 20e9004503..a572aa53e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
@@ -66,7 +66,7 @@ class UIAddCommandRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIAddCommandRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
index 660c81c4f8..0823e7e7b3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
@@ -66,7 +66,7 @@ class UIAddSubmenuRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIAddSubmenuRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
index baa181fb53..015dca8789 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
@@ -55,7 +55,7 @@ class UICreateWindowRequest : public app_mngr::commands::RequestToHMI {
void Run() FINAL;
- void onTimeOut() FINAL;
+ void OnTimeOut() FINAL;
private:
DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
index 32e878e733..bb4799c0d0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
@@ -63,7 +63,7 @@ class UIGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIGetCapabilitiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
index d642beb341..3b395dc685 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
@@ -63,7 +63,7 @@ class UIGetLanguageRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIGetLanguageRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
index 9c2492b9fe..1422035a2c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
@@ -64,7 +64,7 @@ class UIGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIGetSupportedLanguagesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
index 5c7f6d4cc8..168f961e50 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
@@ -45,8 +45,7 @@ namespace commands {
/**
* @brief UIIsReadyRequest command class
**/
-class UIIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class UIIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief UIIsReadyRequest class constructor
@@ -77,7 +76,7 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UIIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
index 145f1d7c07..6f8002ce78 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
@@ -67,7 +67,7 @@ class UISetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(UISetGlobalPropertiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h
index 1da26dd316..5a5f9228e0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,50 +30,45 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/event_engine/event.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-/**
- * @brief OnVIOdometerNotification command class
- **/
-class OnVIOdometerNotification
- : public app_mngr::commands::NotificationFromHMI {
+namespace hmi {
+
+class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI {
public:
- /**
- * @brief OnVIOdometerNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIOdometerNotification(const app_mngr::commands::MessageSharedPtr& message,
+ UnsubscribeButtonRequest(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 OnVIOdometerNotification class destructor
- **/
- virtual ~OnVIOdometerNotification();
+ ~UnsubscribeButtonRequest();
+
+ void Run() OVERRIDE;
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void OnTimeOut() OVERRIDE;
+
+ void on_event(const application_manager::event_engine::Event& event) OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnVIOdometerNotification);
+ DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonRequest);
+
+ hmi_apis::Common_ButtonName::eType button_name_;
};
+} // namespace hmi
} // namespace commands
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h
index a5588901f7..5697fa0584 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,50 +30,40 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_
#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-/**
- * @brief OnVIFuelLevelNotification command class
- **/
-class OnVIFuelLevelNotification
- : public app_mngr::commands::NotificationFromHMI {
+namespace hmi {
+
+class UnsubscribeButtonResponse : public app_mngr::commands::ResponseFromHMI {
public:
- /**
- * @brief OnVIFuelLevelNotification class constructor
- *
- * @param message Incoming SmartObject message
- **/
- OnVIFuelLevelNotification(const app_mngr::commands::MessageSharedPtr& message,
+ UnsubscribeButtonResponse(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 OnVIFuelLevelNotification class destructor
- **/
- virtual ~OnVIFuelLevelNotification();
+ ~UnsubscribeButtonResponse();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnVIFuelLevelNotification);
+ DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonResponse);
};
+} // namespace hmi
+
} // namespace commands
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
index db4f265a9f..ed89bc73ec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
@@ -46,8 +46,7 @@ namespace commands {
/**
* @brief UpdateDeviceListRequest command class
**/
-class UpdateDeviceListRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class UpdateDeviceListRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief UpdateDeviceListRequest class constructor
@@ -70,23 +69,7 @@ class UpdateDeviceListRequest : public app_mngr::commands::RequestToHMI,
**/
virtual void Run();
- /**
- * @brief Interface method that is called whenever new event received
- * Need to observe OnHMIReady event, to send UpdateDeviceListRequest
- * when HMI will be ready
- * @param event The received event
- */
- virtual void on_event(const app_mngr::event_engine::Event& event);
-
- /**
- * @brief Need to stop execution StopMethod if HMI did not started
- */
- virtual bool CleanUp();
-
private:
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::ConditionalVariable termination_condition_;
-
DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
index ba4c49ab01..44cb779beb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
@@ -66,7 +66,7 @@ class VRAddCommandRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VRAddCommandRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
index 7f8485ffa0..40e63651cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
@@ -63,7 +63,7 @@ class VRGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
index abcaa35726..3e3976244e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
@@ -63,7 +63,7 @@ class VRGetLanguageRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VRGetLanguageRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
index fb6d05b0aa..4bf7d68e75 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
@@ -64,7 +64,7 @@ class VRGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VRGetSupportedLanguagesRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
index cbd77087b2..651f318b9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
@@ -45,8 +45,7 @@ namespace commands {
/**
* @brief VRIsReadyRequest command class
**/
-class VRIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class VRIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief VRIsReadyRequest class constructor
@@ -77,7 +76,7 @@ class VRIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VRIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
index 8cac0d686d..d55b4f5af7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
@@ -37,7 +37,7 @@
#include <string>
#include "application_manager/application.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -48,7 +48,7 @@ namespace commands {
/**
* @brief AddCommandRequest command class
**/
-class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
+class AddCommandRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief AddCommandRequest class constructor
@@ -71,18 +71,9 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
**/
void Run() FINAL;
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
void on_event(const app_mngr::event_engine::Event& event) FINAL;
- /**
- * @brief Function is called by RequestController when request execution time
- * has exceed it's limit
- */
- void onTimeOut() FINAL;
+ void OnTimeOut() FINAL;
/**
* @brief Init sets hash update mode for request
@@ -91,16 +82,6 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
private:
/*
- * @brief Check if command name doesn't exist in application
- * Please see SDLAQ-CRS-407 for more information
- *
- * @param app Mobile application
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool CheckCommandName(app_mngr::ApplicationConstSharedPtr app);
-
- /*
* @brief Check if command VR synonyms doesn't exist in application commands
* Please see SDLAQ-CRS-407 for more information
*
@@ -127,13 +108,6 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
DISALLOW_COPY_AND_ASSIGN(AddCommandRequest);
- /*
- * @brief Check if there some not delivered hmi responses exist
- *
- * @return true if all responses received
- */
- bool IsPendingResponseExist();
-
/**
* @brief Checks add command param
* When type is String there is a check on the contents \t\n \\t \\n
@@ -150,17 +124,14 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
* @return info for mobile response
*/
const std::string GenerateMobileResponseInfo();
- bool send_ui_;
- bool send_vr_;
-
- bool is_ui_received_;
- bool is_vr_received_;
std::string ui_info_;
std::string vr_info_;
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType vr_result_;
+ bool ui_is_sent_;
+ bool vr_is_sent_;
};
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
index d99c5dab38..943d634f70 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief AddSubMenuRequest command class
**/
-class AddSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
+class AddSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief AddSubMenuRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
index 8b7e86fb3f..4abe7d4ece 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/pending.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -47,7 +47,7 @@ namespace commands {
/**
* @brief AlertManeuverRequest command class
**/
-class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl {
+class AlertManeuverRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief AlertManeuverRequest class constructor
@@ -70,12 +70,7 @@ class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl {
**/
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);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
index 2250d7a8de..5352148289 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
@@ -36,7 +36,7 @@
#include <string>
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -48,7 +48,7 @@ namespace commands {
/**
* @brief AlertRequest command class
**/
-class AlertRequest : public app_mngr::commands::CommandRequestImpl {
+class AlertRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief AlertRequest class constructor
@@ -76,12 +76,9 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl {
**/
virtual void Run();
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ void OnTimeOut() FINAL;
protected:
private:
@@ -116,7 +113,7 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl {
/*
* @brief Tells if there are sent requests without responses
*/
- bool HasHmiResponsesToWait();
+ bool IsPendingResponseExist();
/*
* @brief Check if all strings have valid syntax in request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
index 0063c07512..f381317cf0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
namespace sdl_rpc_plugin {
@@ -44,7 +44,8 @@ namespace commands {
/**
* @brief CancelInteractionRequest command class
**/
-class CancelInteractionRequest : public app_mngr::commands::CommandRequestImpl {
+class CancelInteractionRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief CancelInteractionRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
index f9f780b84b..384b9da4ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
@@ -36,8 +36,8 @@
#include <strings.h>
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/pending.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/custom_string.h"
#include "utils/macro.h"
@@ -52,7 +52,7 @@ namespace custom_str = utils::custom_string;
* @brief ChangeRegistrationRequest command class
**/
class ChangeRegistrationRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ChangeRegistrationRequest class constructor
@@ -75,12 +75,7 @@ class ChangeRegistrationRequest
**/
virtual void Run();
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
private:
/*
@@ -104,13 +99,6 @@ class ChangeRegistrationRequest
*/
bool IsLanguageSupportedByTTS(const int32_t& hmi_display_lang);
- /*
- * @brief Check if there some not delivered hmi responses exist
- *
- * @return true if all responses received
- */
- bool IsPendingResponseExist();
-
/**
* @brief Checks change_registration params(ttsName, appname,
* ngnMediaScreenAppName, vrSynonyms) on invalid characters.
@@ -164,8 +152,6 @@ class ChangeRegistrationRequest
const custom_str::CustomString& newItem_;
};
- app_mngr::commands::Pending pending_requests_;
-
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType vr_result_;
hmi_apis::Common_Result::eType tts_result_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
index b965e880b4..3f768c95e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
namespace sdl_rpc_plugin {
@@ -44,7 +44,8 @@ namespace commands {
/**
* @brief CloseApplicationRequest command class
**/
-class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl {
+class CloseApplicationRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief CloseApplicationRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
index a1bc866347..82967b717b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
@@ -37,7 +37,7 @@
#include <string>
#include "application_manager/application.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/event_engine/event_observer.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -53,7 +53,7 @@ namespace commands {
* @brief CreateInteractionChoiceSetRequest command class
**/
class CreateInteractionChoiceSetRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief CreateInteractionChoiceSetRequest class constructor
@@ -77,18 +77,9 @@ class CreateInteractionChoiceSetRequest
**/
void Run() FINAL;
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
void on_event(const app_mngr::event_engine::Event& event) FINAL;
- /**
- * @brief Function is called by RequestController when request execution time
- * has exceed it's limit
- */
- void onTimeOut() FINAL;
+ void OnTimeOut() FINAL;
/**
* @brief Init sets hash update mode for request
@@ -137,12 +128,6 @@ class CreateInteractionChoiceSetRequest
volatile bool error_from_hmi_;
sync_primitives::Lock error_from_hmi_lock_;
- /**
- * @brief Flag shows if request already was expired by timeout
- */
- volatile bool is_timed_out_;
- sync_primitives::Lock is_timed_out_lock_;
-
sync_primitives::RecursiveLock vr_commands_lock_;
/*
* @brief Sends VR AddCommand request to HMI
@@ -162,56 +147,6 @@ class CreateInteractionChoiceSetRequest
app_mngr::ApplicationConstSharedPtr app);
/*
- * @brief Predicate for using with CheckChoiceSet method to compare choice ID
- *param
- *
- * return TRUE if there is coincidence of choice ID, otherwise FALSE
- */
- struct CoincidencePredicateChoiceID {
- CoincidencePredicateChoiceID(const uint32_t newItem) : newItem_(newItem) {}
-
- bool operator()(smart_objects::SmartObject obj) {
- return obj[app_mngr::strings::choice_id].asUInt() == newItem_;
- }
-
- const uint32_t newItem_;
- };
-
- /*
- * @brief Predicate for using with CheckChoiceSet method to compare menu name
- *param
- *
- * return TRUE if there is coincidence of menu name, otherwise FALSE
- */
- struct CoincidencePredicateMenuName {
- CoincidencePredicateMenuName(const std::string& newItem)
- : newItem_(newItem) {}
-
- bool operator()(smart_objects::SmartObject obj) {
- return obj[app_mngr::strings::menu_name].asString() == newItem_;
- }
-
- const std::string& newItem_;
- };
-
- /*
- * @brief Predicate for using with CheckChoiceSet method to compare VR
- *commands param
- *
- * return TRUE if there is coincidence of VR commands, otherwise FALSE
- */
- struct CoincidencePredicateVRCommands {
- CoincidencePredicateVRCommands(const smart_objects::SmartObject& newItem)
- : newItem_(newItem) {}
-
- bool operator()(smart_objects::SmartObject obj) {
- return compareStr(obj, newItem_);
- }
-
- const smart_objects::SmartObject& newItem_;
- };
-
- /*
* @brief Checks if incoming choice set doesn't has similar VR synonyms.
*
* @param choice1 Choice to compare
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
index cfbfc460b7..3a3f84c0b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/hmi_state.h"
#include "utils/macro.h"
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief CreateWindow request command class
**/
-class CreateWindowRequest : public app_mngr::commands::CommandRequestImpl {
+class CreateWindowRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
CreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
index 45864ca3aa..0092b0c917 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
@@ -36,7 +36,7 @@
#include <string>
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -47,7 +47,7 @@ namespace commands {
/**
* @brief DeleteCommandRequest command class
**/
-class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl {
+class DeleteCommandRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief DeleteCommandRequest class constructor
@@ -70,11 +70,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl {
**/
void Run() FINAL;
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
void on_event(const app_mngr::event_engine::Event& event) FINAL;
/**
@@ -86,13 +81,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl {
DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest);
/*
- * @brief Check if there some not delivered hmi responses exist
- *
- * @return true if all responses received
- */
- bool IsPendingResponseExist();
-
- /*
* @brief Prepare result code and result for sending to mobile application
* @param result_code contains result code for sending to mobile application
* @param info contains info for mobile app.
@@ -101,12 +89,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl {
bool PrepareResponseParameters(mobile_apis::Result::eType& result_code,
std::string& info);
- bool is_ui_send_;
- bool is_vr_send_;
-
- bool is_ui_received_;
- bool is_vr_received_;
-
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType vr_result_;
std::string ui_info_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
index 8e4d63df4a..60633cfbea 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -47,7 +47,7 @@ namespace commands {
/**
* @brief DeleteFileRequest command class
**/
-class DeleteFileRequest : public app_mngr::commands::CommandRequestImpl {
+class DeleteFileRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief DeleteFileRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
index c1d8759962..ad478bc70d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
@@ -34,8 +34,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_
+#include <cstdint>
+#include <set>
+
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -43,11 +47,13 @@ namespace app_mngr = application_manager;
namespace commands {
+typedef std::set<uint32_t> SentRequestsSet;
+
/**
* @brief DeleteInteractionChoiceSetRequest command class
**/
class DeleteInteractionChoiceSetRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief DeleteInteractionChoiceSetRequest class constructor
@@ -76,6 +82,14 @@ class DeleteInteractionChoiceSetRequest
*/
bool Init() FINAL;
+ /**
+ * @brief Interface method that is called whenever new event received
+ * Need to observe VR_DeleteCommand event, to send
+ * DeleteInteractionChoiceSetResponse when VR command was delete from HMI.
+ * @param event The received event.
+ */
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
private:
/*
* @brief Check if requested choice set ID in use by perform interaction
@@ -86,6 +100,24 @@ class DeleteInteractionChoiceSetRequest
void SendVrDeleteCommand(app_mngr::ApplicationSharedPtr app);
+ void SendDeleteInteractionChoiceSetResponse();
+
+ /**
+ * @brief Final result_code for sending to Mobile.
+ */
+ std::vector<hmi_apis::Common_Result::eType> response_result_codes_;
+
+ sync_primitives::Lock requests_lock_;
+
+ /**
+ * @brief Collection that contains sent request to HMI.
+ * When HMI response will start come, that collection will helps to control,
+ * when SDL should sends DeleteInteractionChoiceSetResponse to Mobile.
+ * Because, for send DeleteInteractionChoiceSetResponse SDL should will be saw
+ * all response results from HMI.
+ */
+ SentRequestsSet sent_requests_;
+
DISALLOW_COPY_AND_ASSIGN(DeleteInteractionChoiceSetRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
index af2ba4a1ea..acb1565ec5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
@@ -36,6 +36,7 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -46,7 +47,7 @@ namespace commands {
/**
* @brief DeleteSubMenuRequest command class
**/
-class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
+class DeleteSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief DeleteSubMenuRequest class constructor
@@ -82,34 +83,45 @@ class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
bool Init() FINAL;
private:
- /*
- * @brief Deletes submenus that have a parentID that matches the parentID
- * parameter
+ /**
+ * @brief Creates and queues up delete requests for a submenus that have a
+ * parent ID which matches the parentID parameter
*
* @param app_id Application ID
* @param parentID Parent ID of a nested submenu
*/
void DeleteNestedSubMenus(app_mngr::ApplicationSharedPtr const app,
- uint32_t parentID,
+ const uint32_t parentID,
const app_mngr::SubMenuMap& subMenus);
- /*
- * @brief Deletes VR commands from SDL for corresponding submenu ID
+ /**
+ * @brief Creates and queues up delete requests for each VR command tied to
+ * the given submenu ID
*
* @param app_id Application ID
* @param parentID Parent ID of a nested submenu
*/
void DeleteSubMenuVRCommands(app_mngr::ApplicationConstSharedPtr app,
- uint32_t parentID);
+ const uint32_t parentID);
- /*
- * @brief Deletes UI commands from SDL for corresponding submenu ID
+ /**
+ * @brief Creates and queues up delete requests for each UI command tied to
+ * the given submenu ID
*
* @param app_id Application ID
* @param parentID Parent ID of a nested submenu
*/
void DeleteSubMenuUICommands(app_mngr::ApplicationSharedPtr const app,
- uint32_t parentID);
+ const uint32_t parentID);
+
+ /**
+ * @brief Takes the next request in the queue and sends it to HMI
+ */
+ void SendNextRequest();
+
+ typedef std::list<smart_objects::SmartObject> RequestsList;
+ RequestsList requests_list_;
+ uint32_t pending_request_corr_id_;
DISALLOW_COPY_AND_ASSIGN(DeleteSubMenuRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
index b837724d7b..8be513d9ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/hmi_state.h"
#include "utils/macro.h"
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief CreateWindow request command class
**/
-class DeleteWindowRequest : public app_mngr::commands::CommandRequestImpl {
+class DeleteWindowRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
DeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
index 750288f5e8..b7865122aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -44,7 +44,7 @@ namespace commands {
/**
* @brief DialNumber request command class
**/
-class DialNumberRequest : public app_mngr::commands::CommandRequestImpl {
+class DialNumberRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief DialNumberRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
index 1c18de3237..4f56a1b5f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,8 @@ namespace commands {
/**
* @brief EndAudioPassThruRequest command class
**/
-class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl {
+class EndAudioPassThruRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief EndAudioPassThruRequest class constructor
@@ -73,7 +74,7 @@ class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(EndAudioPassThruRequest);
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
index 3d74a80dc2..1166fead63 100644
--- 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
@@ -1,7 +1,7 @@
#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"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -9,7 +9,7 @@ namespace app_mngr = application_manager;
namespace commands {
class GetCloudAppPropertiesRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
GetCloudAppPropertiesRequest(
const app_mngr::commands::MessageSharedPtr& message,
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
index d4182ea004..2f9f591c73 100644
--- 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
@@ -33,7 +33,7 @@
#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/commands/request_from_mobile_impl.h"
#include "application_manager/event_engine/event.h"
namespace sdl_rpc_plugin {
@@ -44,7 +44,7 @@ namespace commands {
/**
* @brief GetFileRequest command class
**/
-class GetFileRequest : public app_mngr::commands::CommandRequestImpl {
+class GetFileRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief GetFileRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
index a5d1611f02..deff991b9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -42,7 +42,7 @@ namespace app_mngr = application_manager;
namespace commands {
class GetSystemCapabilityRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
GetSystemCapabilityRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -55,7 +55,7 @@ class GetSystemCapabilityRequest
virtual void Run() OVERRIDE;
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
index ec656820e5..a4aa606bd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -43,7 +43,7 @@ namespace commands {
/**
* @brief GetWayPointsRequest command class
**/
-class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl {
+class GetWayPointsRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief GetWayPointsRequest class constructor
@@ -63,12 +63,8 @@ class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl {
* @brief Execute command
**/
virtual void Run() OVERRIDE;
- /**
- * @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);
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
private:
DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
index d98fa433b4..9435e80222 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief ListFilesRequest command class
**/
-class ListFilesRequest : public app_mngr::commands::CommandRequestImpl {
+class ListFilesRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ListFilesRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_capability_updated_notification.h
index c848233497..64e16f57be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_capability_updated_notification.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,29 +30,30 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
-#include "application_manager/application_manager.h"
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
namespace commands {
+namespace mobile {
-/**
- * @brief OnVIAccPedalPositionNotification command class
- **/
-class OnVIAccPedalPositionNotification
- : public app_mngr::commands::NotificationFromHMI {
+namespace app_mngr = application_manager;
+class OnAppCapabilityUpdatedNotification
+ : public app_mngr::commands::CommandNotificationFromMobileImpl {
public:
/**
- * @brief OnVIAccPedalPositionNotification class constructor
- *
+ * @brief OnAppPermissionChangedNotification class constructor
* @param message Incoming SmartObject message
+ * @param application_manager Reference to the instance of the Application
+ *Manager
+ * @param rpc_service Reference to the instance of the RPCService
+ * @param hmi_capabilities Reference to the instance of the HMICapabilities
+ * @param policy_handle Reference to the instance of the PolicyHandler
**/
- OnVIAccPedalPositionNotification(
+ OnAppCapabilityUpdatedNotification(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -60,21 +61,21 @@ class OnVIAccPedalPositionNotification
policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief OnVIAccPedalPositionNotification class destructor
+ * @brief OnAppPermissionChangedNotification class destructor
**/
- virtual ~OnVIAccPedalPositionNotification();
+ ~OnAppCapabilityUpdatedNotification() OVERRIDE;
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnVIAccPedalPositionNotification);
+ DISALLOW_COPY_AND_ASSIGN(OnAppCapabilityUpdatedNotification);
};
+} // namespace mobile
} // namespace commands
-
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_CAPABILITY_UPDATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
index afde9bac92..f1ca0f546c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_EVENT_NOTIFICATION_H_
#include "application_manager/application.h"
+#include "application_manager/commands/button_notification_to_mobile.h"
#include "application_manager/commands/command_notification_impl.h"
#include "utils/macro.h"
@@ -50,7 +51,7 @@ namespace mobile {
* to mobile device that some button was pressed on HMI.
**/
class OnButtonEventNotification
- : public app_mngr::commands::CommandNotificationImpl {
+ : public app_mngr::commands::ButtonNotificationToMobile {
public:
/**
* @brief OnButtonEventNotification class constructor
@@ -68,18 +69,13 @@ class OnButtonEventNotification
**/
virtual ~OnButtonEventNotification();
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
+ protected:
/*
* @brief Sends button event notification to mobile device
*
* @param app Application to receive notification
*/
- void SendButtonEvent(app_mngr::ApplicationConstSharedPtr app);
+ void SendButtonNotification(app_mngr::ApplicationSharedPtr app) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(OnButtonEventNotification);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
index 57fda49be7..89f5d48f1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_PRESS_NOTIFICATION_H_
#include "application_manager/application.h"
+#include "application_manager/commands/button_notification_to_mobile.h"
#include "application_manager/commands/command_notification_impl.h"
#include "utils/macro.h"
@@ -50,7 +51,7 @@ namespace mobile {
* to mobile device that some button was pressed on HMI.
**/
class OnButtonPressNotification
- : public app_mngr::commands::CommandNotificationImpl {
+ : public app_mngr::commands::ButtonNotificationToMobile {
public:
/**
* @brief OnButtonPressNotification class constructor
@@ -66,12 +67,7 @@ class OnButtonPressNotification
/**
* @brief OnButtonEventCommand class destructor
**/
- virtual ~OnButtonPressNotification();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ ~OnButtonPressNotification();
private:
/*
@@ -79,7 +75,7 @@ class OnButtonPressNotification
*
* @param app Application to receive notification
*/
- void SendButtonPress(app_mngr::ApplicationConstSharedPtr app);
+ void SendButtonNotification(app_mngr::ApplicationSharedPtr app) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(OnButtonPressNotification);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h
index c8bd159064..2ad9a4c0af 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h
@@ -30,54 +30,46 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
-#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-namespace hmi {
-
-/**
- * @brief OnTTSResetTimeoutNotification command class
- **/
-class OnTTSResetTimeoutNotification
- : public app_mngr::commands::NotificationFromHMI {
+class OnWayPointChangeNotificationFromMobile
+ : public app_mngr::commands::CommandNotificationFromMobileImpl {
public:
/**
- * @brief OnTTSResetTimeoutNotification class constructor
+ * @brief OnWayPointChangeNotificationFromMobile class constructor
*
* @param message Incoming SmartObject message
**/
- OnTTSResetTimeoutNotification(
+ OnWayPointChangeNotificationFromMobile(
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);
+ policy::PolicyHandlerInterface& policy_handler);
/**
- * @brief OnTTSResetTimeoutNotification class destructor
+ * @brief OnWayPointChangeNotificationFromMobile class destructor
**/
- virtual ~OnTTSResetTimeoutNotification();
+ virtual ~OnWayPointChangeNotificationFromMobile();
/**
* @brief Execute command
**/
- virtual void Run();
+ virtual void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(OnTTSResetTimeoutNotification);
+ DISALLOW_COPY_AND_ASSIGN(OnWayPointChangeNotificationFromMobile);
};
-} // namespace hmi
-
} // namespace commands
-
} // namespace sdl_rpc_plugin
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
index 434b6de028..da8f13c5d7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -47,7 +47,7 @@ namespace commands {
* @brief PerformAudioPassThruRequest command class
**/
class PerformAudioPassThruRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief PerformAudioPassThruRequest class constructor
@@ -67,13 +67,6 @@ class PerformAudioPassThruRequest
virtual ~PerformAudioPassThruRequest();
/**
- * @brief Function is called by RequestController when request execution time
- * has exceed it's limit
- *
- */
- virtual void onTimeOut();
-
- /**
* @brief Init required by command resources
**/
bool Init();
@@ -83,12 +76,14 @@ class PerformAudioPassThruRequest
**/
virtual void Run();
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
/**
- * @brief Interface method that is called whenever new event received
+ * @brief Function is called by RequestController when request execution time
+ * has exceed it's limit
*
- * @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void OnTimeOut() FINAL;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 52a0ad4dc1..8652464fba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -38,6 +38,7 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -51,7 +52,7 @@ namespace commands {
* @brief PerformInteractionRequest command class
**/
class PerformInteractionRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief PerformInteractionRequest class constructor
@@ -79,19 +80,9 @@ class PerformInteractionRequest
**/
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);
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
- /*
- * @brief Function is called by RequestController when request execution time
- * has exceed it's limit
- *
- */
- virtual void onTimeOut();
+ void OnTimeOut() FINAL;
protected:
/**
@@ -128,15 +119,13 @@ class PerformInteractionRequest
* @return true if send response to mobile application otherwise
* return false.
*/
- bool ProcessVRResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ bool ProcessVRResponse(const smart_objects::SmartObject& message);
/**
* @brief Sends PerformInteraction response to mobile side
* @param message which should send to mobile side
*/
- void ProcessUIResponse(const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params);
+ void ProcessUIResponse(const smart_objects::SmartObject& message);
/*
* @brief Sends UI PerformInteraction request to HMI
@@ -164,16 +153,6 @@ class PerformInteractionRequest
void SendUIShowVRHelpRequest(app_mngr::ApplicationSharedPtr const app);
/*
- * @brief Checks if incoming choice set doesn't has similar menu names.
- *
- * @param app_id Application ID
- *
- * return Return TRUE if there are no similar menu names in choice set,
- * otherwise FALSE
- */
- bool CheckChoiceSetMenuNames(app_mngr::ApplicationSharedPtr const app);
-
- /*
* @brief Checks if incoming choice set doesn't has similar VR synonyms.
*
* @param app_id Application ID
@@ -277,11 +256,11 @@ class PerformInteractionRequest
smart_objects::SmartObject& msg_param) const;
mobile_apis::InteractionMode::eType interaction_mode_;
+
std::int32_t ui_choice_id_received_;
std::int32_t vr_choice_id_received_;
+ std::string ui_text_entry_received_;
- bool ui_response_received_;
- bool vr_response_received_;
bool app_pi_was_active_before_;
static uint32_t pi_requests_count_;
hmi_apis::Common_Result::eType vr_result_code_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
index b3e04f7796..f7aa0278a9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
@@ -36,6 +36,7 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -46,7 +47,7 @@ namespace commands {
/**
* @brief PutFileRequest command class
**/
-class PutFileRequest : public app_mngr::commands::CommandRequestImpl {
+class PutFileRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief PutFileRequest class constructor
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 fae8f5eeb7..d54f061228 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
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "utils/custom_string.h"
#include "utils/macro.h"
@@ -56,7 +56,7 @@ namespace custom_str = utils::custom_string;
* @brief Register app interface request command class
**/
class RegisterAppInterfaceRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief RegisterAppInterfaceRequest class constructor
@@ -210,10 +210,9 @@ class RegisterAppInterfaceRequest
const std::string& param,
const std::string& backup_value);
/**
- * @brief Sends ButtonSubscription notification at start up
- * to notify HMI that app subscribed on the custom button by default.
+ * @brief Sends ButtonSubscription request if approved by hmi_capabilities
*/
- void SendSubscribeCustomButtonNotification();
+ void SendSubscribeCustomButtonRequest();
/**
* @brief IsApplicationSwitched checks whether application is switched
@@ -261,12 +260,6 @@ class RegisterAppInterfaceRequest
const smart_objects::SmartObject& message);
/**
- * @brief WaitForHMIIsReady blocking function. Waits for HMI be ready for
- * requests processing
- */
- void WaitForHMIIsReady();
-
- /**
* @brief FillApplicationParams set app application attributes from the RAI
* request
* @param application applicaiton to fill params
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
index 7475520889..d156371ccd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
@@ -35,7 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_
#include "application_manager/application.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -47,7 +47,7 @@ namespace commands {
* @brief ResetGlobalPropertiesRequest command class
**/
class ResetGlobalPropertiesRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ResetGlobalPropertiesRequest class constructor
@@ -71,11 +71,6 @@ class ResetGlobalPropertiesRequest
**/
void Run() FINAL;
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
void on_event(const app_mngr::event_engine::Event& event) FINAL;
/**
@@ -94,18 +89,13 @@ class ResetGlobalPropertiesRequest
bool PrepareResponseParameters(mobile_apis::Result::eType& out_result_code,
std::string& out_response_info);
- /*
- * @brief Check if there some not delivered hmi responses exist
- *
- * @return true if all responses received
- */
- bool IsPendingResponseExist();
-
DISALLOW_COPY_AND_ASSIGN(ResetGlobalPropertiesRequest);
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType tts_result_;
+ hmi_apis::Common_Result::eType rc_result_;
std::string ui_response_info_;
+ std::string rc_response_info_;
std::string tts_response_info_;
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
index 58b7b4491a..fc7b8e0207 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -46,7 +46,8 @@ namespace commands {
/**
* @brief scrollable message request command class
**/
-class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl {
+class ScrollableMessageRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ScrollableMessageRequest class constructor
@@ -77,7 +78,7 @@ class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ScrollableMessageRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
index 2f00b58d9e..96f560bd9e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
@@ -34,8 +34,9 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_
#include <string>
+
#include "application_manager/application_manager.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/event_engine/event.h"
#include "smart_objects/smart_object.h"
@@ -47,7 +48,7 @@ namespace commands {
/**
* @brief SendHapticDataRequest command class
**/
-class SendHapticDataRequest : public app_mngr::commands::CommandRequestImpl {
+class SendHapticDataRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SendHapticDataRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
index 5a0dc67f35..c035ffca34 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
@@ -35,7 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_
#include <list>
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief send location request command class
*/
-class SendLocationRequest : public app_mngr::commands::CommandRequestImpl {
+class SendLocationRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SendLocationRquest class constructor
@@ -71,7 +71,7 @@ class SendLocationRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
index 520f27d8b9..aed482a8ab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief SetIconRequest command class
**/
-class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl {
+class SetAppIconRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief Contains information about the type of image
@@ -73,7 +73,7 @@ class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
/**
* @brief Execute command
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
index a3a3ea12f9..c05ba16684 100644
--- 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
@@ -1,7 +1,7 @@
#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"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -9,7 +9,7 @@ namespace app_mngr = application_manager;
namespace commands {
class SetCloudAppPropertiesRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
SetCloudAppPropertiesRequest(
const app_mngr::commands::MessageSharedPtr& message,
@@ -28,4 +28,4 @@ class 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
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
index 2f9c0946d3..0e0105c880 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,8 @@ namespace commands {
/**
* @brief SetDisplayLayoutRequest command class
**/
-class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl {
+class SetDisplayLayoutRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SetDisplayLayoutRequest class constructor
@@ -68,7 +69,7 @@ class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
**/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
/**
* @brief Execute command
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
index 190cb07459..37ad705930 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
@@ -33,8 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_
#include <string>
+
#include "application_manager/application.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -46,7 +47,7 @@ namespace commands {
* @brief Register app interface request command class
**/
class SetGlobalPropertiesRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SetGlobalPropertiesRequest class constructor
@@ -82,7 +83,7 @@ class SetGlobalPropertiesRequest
*/
bool Init() FINAL;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
/**
* @brief Prepares total result for mobile according to three results:
@@ -203,7 +204,30 @@ class SetGlobalPropertiesRequest
*/
bool IsWhiteSpaceExist();
- /*
+ /**
+ * @brief helps to determine layout of interest. Returns keyboard layout,
+ * mentioned in current request. If not, returns saved keyboard layout for
+ * current app. If such layout wasn't saved, returns default keyboard layout
+ * (QWERTY)
+ * @return KeyboardLayout enum value
+ */
+ hmi_apis::Common_KeyboardLayout::eType GetKeyboardLayout() const;
+
+ /**
+ * @brief Returns allowed number of configurable keys for certain layout
+ * @return allowed number of configurable keys, if provided, and zero
+ * otherwise
+ */
+ uint32_t GetAllowedNumberOfConfigurableKeys() const;
+
+ /**
+ * @brief Checks provided custom keys against capabilities.
+ * @return true if the specified keyboard layout supports the number of
+ * custom keys provided.
+ */
+ bool ValidateCustomKeys() const;
+
+ /**
* @brief Prepare result code and result for sending to mobile application
* @param result_code contains result code for sending to mobile application
* @param info contains info for sending to mobile applicaion
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
index adced13d73..af7427b2a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief SetMediaClockRequest request command class
**/
-class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl {
+class SetMediaClockRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief SetMediaClockRequest class constructor
@@ -71,10 +71,10 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
- bool isDataValid();
+ bool isDataValid(std::string& info);
DISALLOW_COPY_AND_ASSIGN(SetMediaClockRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
index c9691a808f..3cc7c4d539 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -43,7 +43,7 @@ namespace commands {
/**
* @brief ShowAppMenuRequest command class
**/
-class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl {
+class ShowAppMenuRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ShowAppMenuRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
index 7694070a72..692cf4b137 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -46,7 +46,8 @@ namespace commands {
/**
* @brief ShowConstantTBTRequest command class
**/
-class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl {
+class ShowConstantTBTRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ShowConstantTBTRequest class constructor
@@ -74,7 +75,7 @@ class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
index 26612609a4..1d9988c765 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -46,7 +46,7 @@ namespace commands {
/**
* @brief show request command class
**/
-class ShowRequest : public app_mngr::commands::CommandRequestImpl {
+class ShowRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief ShowRequest class constructor
@@ -72,7 +72,7 @@ class ShowRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/*
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
index 5dbcbb7d41..f9cf401c7c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief slider request command class
**/
-class SliderRequest : public app_mngr::commands::CommandRequestImpl {
+class SliderRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief SliderRequest class constructor
@@ -76,7 +76,7 @@ class SliderRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
index 68e35fcd1d..f753c02990 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief speak request command class
**/
-class SpeakRequest : public app_mngr::commands::CommandRequestImpl {
+class SpeakRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief SpeakRequest class constructor
@@ -71,7 +71,7 @@ class SpeakRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/*
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
index 2b9887daad..332d622895 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
@@ -35,7 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_
#include "application_manager/application_impl.h"
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -46,7 +46,8 @@ namespace commands {
/**
* @brief SubscribeButtonRequest command class
**/
-class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
+class SubscribeButtonRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SubscribeButtonRequest class constructor
@@ -74,6 +75,12 @@ class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
*/
bool Init() FINAL;
+ /**
+ * @brief Interface method that is called whenever new event received
+ * @param event The received event
+ */
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
private:
/**
* @brief Checks if button subscription allowed. In case non-media
@@ -88,12 +95,6 @@ class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
bool IsSubscriptionAllowed(app_mngr::ApplicationSharedPtr app,
const mobile_apis::ButtonName::eType btn_id);
- /**
- * @brief Sends ButtonSubscription notification
- * to notify HMI that app subscribed on the button.
- */
- void SendSubscribeButtonNotification();
-
DISALLOW_COPY_AND_ASSIGN(SubscribeButtonRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
index 8b88a1c884..fbda174553 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,7 +44,7 @@ namespace commands {
* @brief SubsribeWayPointsRequest command class
**/
class SubscribeWayPointsRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief SubscribeWayPointsRequest class constructor
@@ -76,6 +76,8 @@ class SubscribeWayPointsRequest
*/
bool Init() FINAL;
+ void OnTimeOut() FINAL;
+
private:
DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h
index 4789d35e60..c966be4dbe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
namespace sdl_rpc_plugin {
@@ -44,7 +44,7 @@ namespace commands {
/**
* @brief SubtleAlertRequest command class
**/
-class SubtleAlertRequest : public app_mngr::commands::CommandRequestImpl {
+class SubtleAlertRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SubtleAlertRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
index eb2398f279..9b031859c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
@@ -37,6 +37,7 @@
#include <string>
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/event_engine/event.h"
#include "smart_objects/smart_object.h"
@@ -48,7 +49,7 @@ namespace commands {
/**
* @brief SystemRequest command class
**/
-class SystemRequest : public app_mngr::commands::CommandRequestImpl {
+class SystemRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SystemRequest class constructor
@@ -76,7 +77,7 @@ class SystemRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
index 0bc01f2aaa..90d0c24b88 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -46,7 +46,7 @@ namespace commands {
* @brief Unregister app interface request command class
**/
class UnregisterAppInterfaceRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief UnregisterAppInterfaceRequest class constructor
@@ -57,11 +57,11 @@ class UnregisterAppInterfaceRequest
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
/**
* \brief UnregisterAppInterfaceRequest class destructor
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
index 51c10642cf..42e2a7ffde 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -45,41 +45,24 @@ namespace commands {
/**
* @brief UnsubscribeButtonRequest command class
**/
-class UnsubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
+class UnsubscribeButtonRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
- /**
- * @brief UnsubscribeButtonRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
UnsubscribeButtonRequest(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 UnsubscribeButtonRequest class destructor
- **/
~UnsubscribeButtonRequest() FINAL;
- /**
- * @brief Execute command
- **/
void Run() FINAL;
- /**
- * @brief Init sets hash update mode for request
- */
bool Init() FINAL;
- private:
- /**
- * @brief Sends ButtonSubscription notification
- * to notify HMI that app unsubscribed from the button.
- */
- void SendUnsubscribeButtonNotification();
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+ private:
DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
index e83e9b7509..33aa9f743a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -41,7 +41,7 @@ namespace app_mngr = application_manager;
namespace commands {
class UnsubscribeWayPointsRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* \brief UnsubscribeWayPointsRequest class constructor
@@ -75,6 +75,8 @@ class UnsubscribeWayPointsRequest
*/
bool Init() FINAL;
+ void OnTimeOut() FINAL;
+
private:
DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
index e1e5df2289..29bc269938 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -46,7 +46,7 @@ namespace commands {
/**
* @brief UpdateTurnListRequest command class
**/
-class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl {
+class UpdateTurnListRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief UpdateTurnListRequest class constructor
@@ -74,7 +74,7 @@ class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
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
index 09fbc565c5..6b25bb7316 100644
--- 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
@@ -69,7 +69,7 @@ class SystemCapabilityAppExtension : public app_mngr_::AppExtension {
void RevertResumption(
const smart_objects::SmartObject& subscriptions) OVERRIDE;
- static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID;
+ static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID = 200;
static SystemCapabilityAppExtension& ExtractExtension(
app_mngr_::Application& app);
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 b4ef7e6aed..ab74ed08fb 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
@@ -54,13 +54,6 @@ class SDLRPCPlugin : public plugins::RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) OVERRIDE;
- DEPRECATED
- bool Init(app_mngr::ApplicationManager& app_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) OVERRIDE;
-
/**
* @brief ProcessResumptionSubscription send appropriate subscribe requests
* to HMI
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h
index 9243baedee..ce4f56bd84 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h
@@ -59,7 +59,7 @@ class WayPointsAppExtension : public app_mngr::AppExtension {
* @brief WayPointsAppExtensionUID unique identifier of waypoints
* aplication extension
*/
- static unsigned WayPointsAppExtensionUID;
+ static const app_mngr::AppExtensionUID WayPointsAppExtensionUID = 138;
private:
SDLRPCPlugin& plugin_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h
index 871359bc9a..17842c17ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h
@@ -47,7 +47,7 @@ class WayPointsPendingResumptionHandler
app_mngr::ApplicationManager& application_manager);
// EventObserver interface
- void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE;
void HandleResumptionSubscriptionRequest(
app_mngr::AppExtension& extension,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
index a6e95f9f72..3429bd6059 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
@@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(
hmi_capabilities,
policy_handler) {}
-void BasicCommunicationGetSystemTimeRequest::onTimeOut() {
+void BasicCommunicationGetSystemTimeRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_on_app_capability_updated_notification.cc
index c8d36407b8..a5f2137136 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_on_app_capability_updated_notification.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,22 +30,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_on_app_capability_updated_notification.h"
namespace sdl_rpc_plugin {
-using namespace application_manager;
+namespace app_mngr = application_manager;
namespace commands {
-namespace hmi {
-
SDL_CREATE_LOG_VARIABLE("Commands")
-OnButtonSubscriptionNotification::OnButtonSubscriptionNotification(
+BCOnAppCapabilityUpdatedNotification::BCOnAppCapabilityUpdatedNotification(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handle)
: NotificationToHMI(message,
application_manager,
@@ -53,16 +51,13 @@ OnButtonSubscriptionNotification::OnButtonSubscriptionNotification(
hmi_capabilities,
policy_handle) {}
-OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {}
+BCOnAppCapabilityUpdatedNotification::~BCOnAppCapabilityUpdatedNotification() {}
-void OnButtonSubscriptionNotification::Run() {
+void BCOnAppCapabilityUpdatedNotification::Run() {
SDL_LOG_AUTO_TRACE();
SendNotification();
}
-} // namespace hmi
-
} // namespace commands
-
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
index d9c7901c67..2cda09dadc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
+
#include "utils/logger.h"
namespace sdl_rpc_plugin {
@@ -60,7 +61,7 @@ void ButtonGetCapabilitiesRequest::Run() {
SendRequest();
}
-void ButtonGetCapabilitiesRequest::onTimeOut() {
+void ButtonGetCapabilitiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::Buttons_GetCapabilities);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
index 20250af222..722bfc5097 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
@@ -60,11 +60,10 @@ void ButtonGetCapabilitiesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::Buttons_GetCapabilities);
-
if (hmi_apis::Common_Result::SUCCESS != code) {
SDL_LOG_ERROR("Error is returned. Capabilities won't be updated.");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities);
return;
}
@@ -81,6 +80,9 @@ void ButtonGetCapabilitiesResponse::Run() {
[hmi_response::preset_bank_capabilities]);
}
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::buttons, sections_to_update, message_->getSchema())) {
SDL_LOG_ERROR("Failed to save Buttons.GetCapabilities response to cache");
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
index 1b42abd055..33651426c9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
@@ -61,7 +61,7 @@ void GetSystemInfoRequest::Run() {
SendRequest();
}
-void GetSystemInfoRequest::onTimeOut() {
+void GetSystemInfoRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateCachedCapabilities();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
index 8229e1978c..50fb41a551 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
@@ -59,6 +59,8 @@ void GetSystemInfoResponse::Run() {
(*message_)[strings::params][hmi_response::code].asInt());
hmi_capabilities_.set_ccpu_version(policy_handler_.GetCCPUVersionFromPT());
+ hmi_capabilities_.set_hardware_version(
+ policy_handler_.GetHardwareVersionFromPT());
if (hmi_apis::Common_Result::SUCCESS != code) {
SDL_LOG_WARN("GetSystemError returns an error code " << code);
@@ -72,6 +74,11 @@ void GetSystemInfoResponse::Run() {
policy_handler_.OnGetSystemInfo(
info.ccpu_version, info.wers_country_code, info.language);
+ if (!info.hardware_version.empty()) {
+ policy_handler_.OnHardwareVersionReceived(info.hardware_version);
+ hmi_capabilities_.set_hardware_version(info.hardware_version);
+ }
+
hmi_capabilities_.OnSoftwareVersionReceived(info.ccpu_version);
}
@@ -89,6 +96,12 @@ const SystemInfo GetSystemInfoResponse::GetSystemInfo() const {
info.language = application_manager::EnumToString(
static_cast<hmi_apis::Common_Language::eType>(lang_code));
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::system_hardware_version)) {
+ info.hardware_version =
+ (*message_)[strings::msg_params][strings::system_hardware_version]
+ .asString();
+ }
return info;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
index 21d6282436..673e6570f5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -53,14 +53,15 @@ AudioStartStreamRequest::AudioStartStreamRequest(
rpc_service,
hmi_capabilities,
policy_handle)
- , EventObserver(application_manager.event_dispatcher())
, retry_number_(0) {
SDL_LOG_AUTO_TRACE();
std::pair<uint32_t, int32_t> stream_retry =
application_manager_.get_settings().start_stream_retry_amount();
- default_timeout_ = stream_retry.second;
+ default_timeout_ =
+ stream_retry.second +
+ application_manager_.get_settings().default_timeout_compensation();
retry_number_ = stream_retry.first;
- SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_
+ SDL_LOG_DEBUG("default_timeout_ = " << stream_retry.second
<< "; retry_number_ = " << retry_number_);
}
@@ -136,12 +137,13 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
}
}
-void AudioStartStreamRequest::onTimeOut() {
+void AudioStartStreamRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
RetryStartSession();
}
void AudioStartStreamRequest::RetryStartSession() {
+ using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
auto retry_start_session = [this](const uint32_t hmi_app_id) {
@@ -176,7 +178,7 @@ void AudioStartStreamRequest::RetryStartSession() {
SDL_LOG_DEBUG("Audio start stream retry sequence stopped. "
<< "Attempts expired.");
- application_manager_.EndNaviServices(app->app_id());
+ application_manager_.EndService(app->app_id(), ServiceType::kAudio);
}
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
index 4caa307be3..7eb2233202 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
@@ -49,8 +49,7 @@ NaviIsReadyRequest::NaviIsReadyRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handle) {}
NaviIsReadyRequest::~NaviIsReadyRequest() {}
@@ -75,6 +74,8 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_is_navi_cooperating(is_available);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Navigation_IsReady);
break;
}
default: {
@@ -84,6 +85,11 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
+void NaviIsReadyRequest::OnTimeOut() {
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Navigation_IsReady);
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
index ff9d861def..a660887019 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h"
+
#include <string>
#include <vector>
@@ -51,8 +52,7 @@ NaviSetVideoConfigRequest::NaviSetVideoConfigRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handle) {}
NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {}
@@ -106,7 +106,7 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartArray* list =
message[strings::msg_params][strings::rejected_params].asArray();
if (list != NULL) {
- for (unsigned int i = 0; i < list->size(); i++) {
+ for (unsigned int i = 0; i < list->size(); ++i) {
const std::string& param = (*list)[i].asString();
// Make sure that we actually sent the parameter in the request
if ((*message_)[strings::msg_params].keyExists(strings::config) &&
@@ -132,7 +132,7 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
}
}
-void NaviSetVideoConfigRequest::onTimeOut() {
+void NaviSetVideoConfigRequest::OnTimeOut() {
SDL_LOG_WARN("Timed out while waiting for SetVideoConfig response");
ApplicationSharedPtr app =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
index 973c323ebe..f5d96d0ea8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
@@ -53,14 +53,15 @@ NaviStartStreamRequest::NaviStartStreamRequest(
rpc_service,
hmi_capabilities,
policy_handle)
- , EventObserver(application_manager.event_dispatcher())
, retry_number_(0) {
SDL_LOG_AUTO_TRACE();
std::pair<uint32_t, int32_t> stream_retry =
application_manager_.get_settings().start_stream_retry_amount();
- default_timeout_ = stream_retry.second;
+ default_timeout_ =
+ stream_retry.second +
+ application_manager_.get_settings().default_timeout_compensation();
retry_number_ = stream_retry.first;
- SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_
+ SDL_LOG_DEBUG("default_timeout_ = " << stream_retry.second
<< "; retry_number_ = " << retry_number_);
}
@@ -138,12 +139,13 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
}
}
-void NaviStartStreamRequest::onTimeOut() {
+void NaviStartStreamRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
RetryStartSession();
}
void NaviStartStreamRequest::RetryStartSession() {
+ using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
auto retry_start_session = [this](const uint32_t hmi_app_id) {
@@ -178,7 +180,7 @@ void NaviStartStreamRequest::RetryStartSession() {
SDL_LOG_DEBUG("NaviStartStream retry sequence stopped. "
<< "Attempts expired");
- application_manager_.EndNaviServices(app->app_id());
+ application_manager_.EndService(app->app_id(), ServiceType::kMobileNav);
}
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
index 7305ae37b1..63735d84db 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
@@ -60,7 +60,7 @@ void NaviSubscribeWayPointsRequest::Run() {
SendRequest();
}
-void NaviSubscribeWayPointsRequest::onTimeOut() {
+void NaviSubscribeWayPointsRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
index 9caec22bd2..ed2b36b413 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -134,7 +134,7 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
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++) {
+ 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]
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
index 7ba330caa8..77544fc132 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
@@ -34,6 +34,7 @@
#include "application_manager/display_capabilities_builder.h"
#include "application_manager/message_helper.h"
+#include "extensions/system_capability_app_extension.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
@@ -84,11 +85,7 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI::
SDL_LOG_DEBUG("Updating display capabilities for app " << app_id);
app->set_display_capabilities(display_capabilities);
- // Remove app_id from notification to mobile
- (*message_)[strings::params][strings::connection_key] =
- (*message_)[strings::msg_params][strings::app_id];
- (*message_)[strings::msg_params].erase(strings::app_id);
-
+ RemoveAppIdFromNotification();
auto& builder = app->display_capabilities_builder();
if (builder.IsWaitingForWindowCapabilities(display_capabilities)) {
SDL_LOG_DEBUG("Application is waiting for capabilities");
@@ -99,6 +96,54 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI::
return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
}
+void OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ RemoveAppIdFromNotification() {
+ (*message_)[strings::params][strings::connection_key] =
+ (*message_)[strings::msg_params][strings::app_id];
+ (*message_)[strings::msg_params].erase(strings::app_id);
+}
+
+bool OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ProcessVideoStreamingCapability(
+ const smart_objects::SmartObject& system_capability) {
+ if (!system_capability.keyExists(strings::video_streaming_capability)) {
+ SDL_LOG_WARN(
+ "VideoStreamingCapability is absent in the notification. "
+ "Notification Will be ignored");
+ return false;
+ }
+ if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ SDL_LOG_WARN(
+ "Notification doesn't contain an application id. Will "
+ "be ignored");
+ return false;
+ }
+
+ const auto app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+
+ auto app = application_manager_.application(app_id);
+ if (!app) {
+ SDL_LOG_WARN("Application with app_id: "
+ << app_id
+ << " isn't registered. Notification will be ignored");
+ return false;
+ }
+
+ auto& system_capability_extension =
+ SystemCapabilityAppExtension::ExtractExtension(*app);
+
+ if (!system_capability_extension.IsSubscribedTo(
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING)) {
+ SDL_LOG_WARN("The Application with app_id: "
+ << app_id
+ << " isn't subscribed to the VIDEO_STREAMING system "
+ "capability type. Notification will be ignored");
+ return false;
+ }
+ return true;
+}
+
void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
SDL_LOG_AUTO_TRACE();
@@ -109,7 +154,11 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
const auto& system_capability =
(*message_)[strings::msg_params][strings::system_capability];
- switch (system_capability[strings::system_capability_type].asInt()) {
+ const auto system_capability_type =
+ static_cast<mobile_apis::SystemCapabilityType::eType>(
+ system_capability[strings::system_capability_type].asInt());
+
+ switch (system_capability_type) {
case mobile_apis::SystemCapabilityType::DISPLAYS: {
if (system_capability.keyExists(strings::display_capabilities)) {
const auto result = ProcessSystemDisplayCapabilities(
@@ -135,6 +184,16 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
}
break;
}
+ case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: {
+ if (!ProcessVideoStreamingCapability(system_capability)) {
+ return;
+ }
+ RemoveAppIdFromNotification();
+ break;
+ }
+ default: {
+ SDL_LOG_ERROR("Unknown system capability type received");
+ }
}
SendNotificationToMobile(message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
index 2440e918b7..02c2ccf31b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
@@ -32,6 +32,8 @@
#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
+#include "application_manager/app_service_manager.h"
+
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -56,8 +58,12 @@ void OnNaviWayPointChangeNotification::Run() {
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnWayPointChangeID);
+ application_manager_.SaveWayPointsMessage(message_, 0);
- SendNotificationToMobile(message_);
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() ==
+ nullptr) {
+ SendNotificationToMobile(message_);
+ }
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
index a11395183b..48db903ce5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
@@ -67,8 +67,10 @@ void OnReceivedPolicyUpdate::Run() {
std::string file_name = file_path;
#ifdef __ANDROID__
- const std::string t_name = file_path.substr(file_path.find_last_of("/\\") + 1);
- const std::string system_folder = application_manager_.get_settings().system_files_path();
+ const std::string t_name =
+ file_path.substr(file_path.find_last_of("/\\") + 1);
+ const std::string system_folder =
+ application_manager_.get_settings().system_files_path();
file_name = system_folder + "/" + t_name;
#endif
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc
index 96f6c5cd5b..ff5b2709c0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.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 "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h"
#include "application_manager/event_engine/event.h"
#include "interfaces/HMI_API.h"
@@ -42,7 +42,7 @@ namespace hmi {
SDL_CREATE_LOG_VARIABLE("Commands")
-OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification(
+OnResetTimeoutNotification::OnResetTimeoutNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -54,12 +54,13 @@ OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification(
hmi_capabilities,
policy_handle) {}
-OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {}
+OnResetTimeoutNotification::~OnResetTimeoutNotification() {}
-void OnTTSResetTimeoutNotification::Run() {
+void OnResetTimeoutNotification::Run() {
SDL_LOG_AUTO_TRACE();
- event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout);
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
index f652761178..d693c00ac3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
@@ -88,11 +88,15 @@ void OnTTSLanguageChangeNotification::Run() {
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
- const ApplicationSet& accessor =
- application_manager_.applications().GetData();
- ApplicationSetIt it = accessor.begin();
- for (; accessor.end() != it;) {
- ApplicationSharedPtr app = *it++;
+ const auto applications = application_manager_.applications().GetData();
+ for (const auto& app : applications) {
+ if (!app->IsRegistered()) {
+ SDL_LOG_DEBUG("Skipping app "
+ << app->app_id()
+ << " which has not finished the registration process");
+ continue;
+ }
+
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
index 2f2cb2ddc6..7f6ffaa4eb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
@@ -85,7 +85,8 @@ void OnUILanguageChangeNotification::Run() {
ApplicationSetConstIt it = accessor.begin();
for (; accessor.end() != it;) {
- ApplicationSharedPtr app = *it++;
+ ApplicationSharedPtr app = *it;
+ ++it;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
deleted file mode 100644
index 9f4e707b83..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {}
-
-void OnVIAccPedalPositionNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
deleted file mode 100644
index 4227847153..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIBeltStatusNotification::OnVIBeltStatusNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {}
-
-void OnVIBeltStatusNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
deleted file mode 100644
index 663f9342f4..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIBodyInformationNotification::OnVIBodyInformationNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {}
-
-void OnVIBodyInformationNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
deleted file mode 100644
index 722fddc5f1..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIDriverBrakingNotification::OnVIDriverBrakingNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {}
-
-void OnVIDriverBrakingNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
deleted file mode 100644
index 8c524a3f1d..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIEngineTorqueNotification::OnVIEngineTorqueNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {}
-
-void OnVIEngineTorqueNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
deleted file mode 100644
index 3cbd22eb97..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {}
-
-void OnVIExternalTemperatureNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
deleted file mode 100644
index 8065434063..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIFuelLevelNotification::OnVIFuelLevelNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {}
-
-void OnVIFuelLevelNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
deleted file mode 100644
index c0c60108f3..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {}
-
-void OnVIFuelLevelStateNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
deleted file mode 100644
index 1e18d18eba..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIGpsDataNotification::OnVIGpsDataNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIGpsDataNotification::~OnVIGpsDataNotification() {}
-
-void OnVIGpsDataNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
deleted file mode 100644
index 29906df43f..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {}
-
-void OnVIHeadLampStatusNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
deleted file mode 100644
index c4bc32e825..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIInstantFuelConsumptionNotification::
- ~OnVIInstantFuelConsumptionNotification() {}
-
-void OnVIInstantFuelConsumptionNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
deleted file mode 100644
index 6139d143f6..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIMyKeyNotification::OnVIMyKeyNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIMyKeyNotification::~OnVIMyKeyNotification() {}
-
-void OnVIMyKeyNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
deleted file mode 100644
index 92f4b47fcf..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIOdometerNotification::OnVIOdometerNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIOdometerNotification::~OnVIOdometerNotification() {}
-
-void OnVIOdometerNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
deleted file mode 100644
index c2afd7d697..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIPrndlNotification::OnVIPrndlNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIPrndlNotification::~OnVIPrndlNotification() {}
-
-void OnVIPrndlNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
deleted file mode 100644
index f41f5d3f56..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIRpmNotification::OnVIRpmNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIRpmNotification::~OnVIRpmNotification() {}
-
-void OnVIRpmNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
deleted file mode 100644
index 73313b6ea4..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVISpeedNotification::OnVISpeedNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVISpeedNotification::~OnVISpeedNotification() {}
-
-void OnVISpeedNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
deleted file mode 100644
index bc013c2e2c..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVITirePressureNotification::OnVITirePressureNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVITirePressureNotification::~OnVITirePressureNotification() {}
-
-void OnVITirePressureNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
deleted file mode 100644
index 4b33c2d589..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIVinNotification::OnVIVinNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIVinNotification::~OnVIVinNotification() {}
-
-void OnVIVinNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
deleted file mode 100644
index dde1e642c3..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 "sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SDL_CREATE_LOG_VARIABLE("Commands")
-
-OnVIWiperStatusNotification::OnVIWiperStatusNotification(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {}
-
-void OnVIWiperStatusNotification::Run() {
- SDL_LOG_AUTO_TRACE();
-
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
-
- SendNotificationToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
index bf00291c88..23c1ec1b80 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
@@ -79,10 +79,17 @@ void OnVRLanguageChangeNotification::Run() {
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
const auto applications = application_manager_.applications().GetData();
-
for (auto app : applications) {
+ if (!app->IsRegistered()) {
+ SDL_LOG_DEBUG("Skipping app "
+ << app->app_id()
+ << " which has not finished the registration process");
+ continue;
+ }
+
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
+
if (static_cast<int32_t>(app->language()) !=
(*message_)[strings::msg_params][strings::language].asInt()) {
application_manager_.state_controller().SetRegularState(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
index 774acf54f1..63aa4b11ef 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
@@ -59,7 +59,7 @@ void RCGetCapabilitiesRequest::Run() {
SendRequest();
}
-void RCGetCapabilitiesRequest::onTimeOut() {
+void RCGetCapabilitiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::RC_GetCapabilities);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
index 10507a516f..bd5da04cb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
@@ -58,11 +58,10 @@ void RCGetCapabilitiesResponse::Run() {
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::RC_GetCapabilities);
-
if (hmi_apis::Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities);
return;
}
@@ -88,6 +87,9 @@ void RCGetCapabilitiesResponse::Run() {
hmi_capabilities_.set_rc_supported(rc_capability_exists);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::rc, sections_to_update, message_->getSchema())) {
SDL_LOG_ERROR("Failed to save RC.GetCapabilities response to cache");
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
index c9a9af87fb..725a55c2b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
@@ -53,8 +53,7 @@ RCIsReadyRequest::RCIsReadyRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handle) {}
RCIsReadyRequest::~RCIsReadyRequest() {}
@@ -79,6 +78,8 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
if (!is_available) {
hmi_capabilities.set_rc_supported(false);
}
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_IsReady);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_RC)) {
@@ -97,8 +98,10 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
-void RCIsReadyRequest::onTimeOut() {
+void RCIsReadyRequest::OnTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_IsReady);
RequestInterfaceCapabilities(hmi_interface::rc);
}
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 66ac9c458b..88b3065fb0 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
@@ -136,18 +136,10 @@ 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()) {
- SDL_LOG_DEBUG("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();
+ return;
+ }
+
+ if (!app->is_cloud_app() || app->IsRegistered()) {
auto main_state =
app->CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) {
@@ -156,11 +148,30 @@ void SDLActivateAppRequest::Run() {
"yet, postpone activation");
auto& postponed_activation_ctrl = application_manager_.state_controller()
.GetPostponedActivationController();
- postponed_activation_ctrl.AddAppToActivate(application_id,
+ postponed_activation_ctrl.AddAppToActivate(app->app_id(),
correlation_id());
return;
}
+ }
+
+ const uint32_t application_id = app_id();
+ if (app->IsRegistered()) {
+ SDL_LOG_DEBUG("Application is registered. Activating.");
policy_handler_.OnActivateApp(application_id, correlation_id());
+ return;
+ }
+
+ if (app->is_cloud_app()) {
+ SDL_LOG_DEBUG("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());
+ return;
}
}
@@ -205,8 +216,7 @@ void SDLActivateAppRequest::Run() {
return;
}
- if (app_to_activate->IsRegistered()) {
- SDL_LOG_DEBUG("Application is registered. Activating.");
+ if (!app_to_activate->is_cloud_app() || app_to_activate->IsRegistered()) {
auto main_state = app_to_activate->CurrentHmiState(
mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) {
@@ -215,19 +225,25 @@ void SDLActivateAppRequest::Run() {
"yet, postpone activation");
auto& postponed_activation_ctrl = application_manager_.state_controller()
.GetPostponedActivationController();
- postponed_activation_ctrl.AddAppToActivate(application_id,
+ postponed_activation_ctrl.AddAppToActivate(app_to_activate->app_id(),
correlation_id());
return;
}
+ }
+
+ if (app_to_activate->IsRegistered()) {
+ SDL_LOG_DEBUG("Application is registered. Activating.");
policy_handler_.OnActivateApp(application_id, correlation_id());
return;
- } else if (app_to_activate->is_cloud_app()) {
+ }
+
+ if (app_to_activate->is_cloud_app()) {
SDL_LOG_DEBUG("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(
+ application_manager_.UpdateRequestTimeout(
0, correlation_id(), default_timeout_ + total_retry_timeout);
subscribe_on_event(BasicCommunication_OnAppRegistered);
application_manager_.connection_handler().ConnectToDevice(
@@ -272,7 +288,7 @@ void SDLActivateAppRequest::Run() {
}
#endif // EXTERNAL_PROPRIETARY_MODE
-void SDLActivateAppRequest::onTimeOut() {
+void SDLActivateAppRequest::OnTimeOut() {
using namespace hmi_apis::FunctionID;
using namespace hmi_apis::Common_Result;
using namespace application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
index 7478a40eeb..f366da82d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
@@ -144,7 +144,7 @@ smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam(
};
if (policy_property.type() == Json::arrayValue) {
- for (Json::ArrayIndex i = 0; i < policy_property.size(); i++) {
+ for (Json::ArrayIndex i = 0; i < policy_property.size(); ++i) {
put_element_in_value_array(policy_property[i], i);
}
return value;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc
new file mode 100644
index 0000000000..5a2420b223
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2021, 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 "sdl_rpc_plugin/commands/hmi/subscribe_button_request.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+namespace hmi {
+
+SubscribeButtonRequest::SubscribeButtonRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {
+ hmi_apis::Common_ButtonName::eType button_name =
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [app_mngr::strings::button_name]
+ .asInt());
+
+ button_name_ = button_name;
+}
+
+SubscribeButtonRequest::~SubscribeButtonRequest() {}
+
+app_mngr::ApplicationSharedPtr SubscribeButtonRequest::GetApplicationPtr() {
+ const uint32_t app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+
+ return application_manager_.application_by_hmi_app(app_id);
+}
+
+void SubscribeButtonRequest::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ // Specific case when app subscribes to CUSTOM_BUTTON upon registration and no
+ // explicit mobile request exist when response arrives. In this case event
+ // should be catched by HMI request itself.
+ if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) {
+ ApplicationSharedPtr app = GetApplicationPtr();
+ if (app) {
+ // Application should also be subscribed to CUSTOM_BUTTON even before
+ // response is received
+ app->SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON);
+ }
+
+ subscribe_on_event(hmi_apis::FunctionID::Buttons_SubscribeButton,
+ correlation_id());
+ }
+
+ SendRequest();
+}
+
+void SubscribeButtonRequest::on_event(const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace helpers;
+
+ if (hmi_apis::FunctionID::Buttons_SubscribeButton != event.id()) {
+ SDL_LOG_ERROR("Unexpected event id received: " << event.id());
+ return;
+ }
+
+ unsubscribe_from_event(hmi_apis::FunctionID::Buttons_SubscribeButton);
+
+ const smart_objects::SmartObject& message = event.smart_object();
+ ApplicationSharedPtr app = GetApplicationPtr();
+
+ if (!app) {
+ SDL_LOG_ERROR("NULL pointer.");
+ return;
+ }
+
+ const auto hmi_result = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ if (CommandImpl::IsHMIResultSuccess(hmi_result,
+ HmiInterfaces::HMI_INTERFACE_Buttons)) {
+ SDL_LOG_DEBUG("Subscription to "
+ << button_name_ << " was successful. Subscribing internally");
+ app->SubscribeToButton(
+ static_cast<mobile_apis::ButtonName::eType>(button_name_));
+ } else if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) {
+ // SDL should revert subscription in a specific case related to custom
+ // button because it was subscribed when the request is sent to HMI
+ SDL_LOG_ERROR(
+ "Subscription to custom button was failed. Revert the internal "
+ "subscription");
+ app->UnsubscribeFromButton(
+ static_cast<mobile_apis::ButtonName::eType>(button_name_));
+ }
+}
+
+void SubscribeButtonRequest::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+
+ application_manager_.AddExpiredButtonRequest(
+ application_id(), correlation_id(), button_name_);
+
+ if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) {
+ ApplicationSharedPtr app = GetApplicationPtr();
+
+ if (app) {
+ // SDL should revert subscription in a specific case related to custom
+ // button because it was subscribed when the request is sent to HMI
+ SDL_LOG_ERROR(
+ "Subscription to custom button was timed out. Revert the internal "
+ "subscription");
+ app->UnsubscribeFromButton(
+ static_cast<mobile_apis::ButtonName::eType>(button_name_));
+ }
+ }
+
+ auto& resume_ctrl = application_manager_.resume_controller();
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
+} // namespace hmi
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc
index d8de31cfbc..202cde29c6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,44 +29,69 @@
* 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_ui_reset_timeout_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/subscribe_button_response.h"
#include "application_manager/event_engine/event.h"
-#include "interfaces/HMI_API.h"
+#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
-
namespace commands {
-namespace hmi {
-
SDL_CREATE_LOG_VARIABLE("Commands")
-OnUIResetTimeoutNotification::OnUIResetTimeoutNotification(
+namespace hmi {
+SubscribeButtonResponse::SubscribeButtonResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
-OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {}
+SubscribeButtonResponse::~SubscribeButtonResponse() {}
-void OnUIResetTimeoutNotification::Run() {
+void SubscribeButtonResponse::Run() {
SDL_LOG_AUTO_TRACE();
- event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)
+ .getElement(strings::params)
+ .getElement(hmi_response::code)
+ .asInt());
+
+ const auto expired_request_data =
+ application_manager_.GetExpiredButtonRequestData(correlation_id());
+ if (expired_request_data) {
+ const uint32_t app_id = (*expired_request_data).app_id_;
+ const auto button_name = (*expired_request_data).button_name_;
+ application_manager_.DeleteExpiredButtonRequest(correlation_id());
+
+ if (!CommandImpl::IsHMIResultSuccess(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons)) {
+ return;
+ }
+
+ smart_objects::SmartObjectSPtr msg =
+ MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ app_id,
+ button_name,
+ hmi_apis::FunctionID::Buttons_UnsubscribeButton,
+ application_manager_);
+
+ rpc_service_.SendMessageToHMI(msg);
+ return;
+ }
+
+ event_engine::Event event(hmi_apis::FunctionID::Buttons_SubscribeButton);
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
}
} // namespace hmi
-
} // namespace commands
-
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
index 3bca6c05c1..9b5eb6f14b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
@@ -59,7 +59,7 @@ void TTSGetCapabilitiesRequest::Run() {
SendRequest();
}
-void TTSGetCapabilitiesRequest::onTimeOut() {
+void TTSGetCapabilitiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetCapabilities);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
index 167966e55b..10709bf94d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
@@ -57,11 +57,10 @@ void TTSGetCapabilitiesResponse::Run() {
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::TTS_GetCapabilities);
-
if (hmi_apis::Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities);
return;
}
@@ -80,6 +79,9 @@ void TTSGetCapabilitiesResponse::Run() {
[hmi_response::prerecorded_speech_capabilities]);
}
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
SDL_LOG_ERROR("Failed to save TTS.GetCapabilities response to cache");
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
index 2b409c68de..42de944da3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
@@ -59,7 +59,7 @@ void TTSGetLanguageRequest::Run() {
SendRequest();
}
-void TTSGetLanguageRequest::onTimeOut() {
+void TTSGetLanguageRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetLanguage);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
index 2b14bea681..8b708dda01 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
@@ -61,11 +61,10 @@ void TTSGetLanguageResponse::Run() {
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::TTS_GetLanguage);
-
if (Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage);
return;
}
@@ -79,6 +78,9 @@ void TTSGetLanguageResponse::Run() {
hmi_capabilities_.set_active_tts_language(language);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage);
+
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
index 87df2402bb..2fb74fbb46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
@@ -59,7 +59,7 @@ void TTSGetSupportedLanguagesRequest::Run() {
SendRequest();
}
-void TTSGetSupportedLanguagesRequest::onTimeOut() {
+void TTSGetSupportedLanguagesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::TTS_GetSupportedLanguages);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
index 6b074005b2..71ecd9d4da 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
@@ -61,17 +61,19 @@ void TTSGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::TTS_GetSupportedLanguages);
-
if (hmi_apis::Common_Result::SUCCESS != code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages);
return;
}
hmi_capabilities_.set_tts_supported_languages(
(*message_)[strings::msg_params][hmi_response::languages]);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages);
+
std::vector<std::string> sections_to_update{hmi_response::languages};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::tts, sections_to_update, message_->getSchema())) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
index 1f1f3e7eab..6a09616926 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
@@ -50,8 +50,7 @@ TTSIsReadyRequest::TTSIsReadyRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handler)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handler) {}
TTSIsReadyRequest::~TTSIsReadyRequest() {}
@@ -73,6 +72,8 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
application_manager_, message, HmiInterfaces::HMI_INTERFACE_TTS);
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_is_tts_cooperating(is_available);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_IsReady);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_TTS)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::tts);
@@ -90,8 +91,10 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
-void TTSIsReadyRequest::onTimeOut() {
+void TTSIsReadyRequest::OnTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_IsReady);
RequestInterfaceCapabilities(hmi_interface::tts);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
index 35059bf48d..574230ee11 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
@@ -60,7 +60,7 @@ void TTSSetGlobalPropertiesRequest::Run() {
SendRequest();
}
-void TTSSetGlobalPropertiesRequest::onTimeOut() {
+void TTSSetGlobalPropertiesRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
correlation_id(),
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
index 067ada3153..2cd40b1705 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
@@ -60,7 +60,7 @@ void UIAddCommandRequest::Run() {
SendRequest();
}
-void UIAddCommandRequest::onTimeOut() {
+void UIAddCommandRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
index 275c411eae..8b9ecf4932 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
@@ -60,7 +60,7 @@ void UIAddSubmenuRequest::Run() {
SendRequest();
}
-void UIAddSubmenuRequest::onTimeOut() {
+void UIAddSubmenuRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
correlation_id(),
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
index e98ad5c45e..1acbb9e682 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
@@ -60,7 +60,7 @@ void UICreateWindowRequest::Run() {
SendRequest();
}
-void UICreateWindowRequest::onTimeOut() {
+void UICreateWindowRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
index 00a8ad761e..604f293c4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
@@ -59,7 +59,7 @@ void UIGetCapabilitiesRequest::Run() {
SendRequest();
}
-void UIGetCapabilitiesRequest::onTimeOut() {
+void UIGetCapabilitiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetCapabilities);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
index 31dda22709..128f41e01f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
@@ -58,11 +58,10 @@ void UIGetCapabilitiesResponse::Run() {
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::UI_GetCapabilities);
-
if (hmi_apis::Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities);
return;
}
@@ -152,11 +151,6 @@ void UIGetCapabilitiesResponse::Run() {
hmi_capabilities_.set_driver_distraction_supported(true);
}
}
- if (system_capabilities_so.keyExists(strings::display_capabilities)) {
- sections_to_update.push_back(strings::display_capabilities);
- hmi_capabilities_.set_system_display_capabilities(
- system_capabilities_so[strings::display_capabilities]);
- }
}
if (msg_params.keyExists(strings::pcm_stream_capabilities)) {
@@ -165,6 +159,9 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[strings::pcm_stream_capabilities]);
}
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
SDL_LOG_ERROR("Failed to save UI.GetCapabilities response to cache");
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
index bf91b7e294..597452a471 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
@@ -59,7 +59,7 @@ void UIGetLanguageRequest::Run() {
SendRequest();
}
-void UIGetLanguageRequest::onTimeOut() {
+void UIGetLanguageRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetLanguage);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
index ffeec025be..9bae80f48e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
@@ -61,11 +61,10 @@ void UIGetLanguageResponse::Run() {
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::UI_GetLanguage);
-
if (Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage);
return;
}
@@ -79,6 +78,9 @@ void UIGetLanguageResponse::Run() {
hmi_capabilities_.set_active_ui_language(language);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage);
+
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
index 480fa2499f..c67f552fe2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
@@ -59,7 +59,7 @@ void UIGetSupportedLanguagesRequest::Run() {
SendRequest();
}
-void UIGetSupportedLanguagesRequest::onTimeOut() {
+void UIGetSupportedLanguagesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::UI_GetSupportedLanguages);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
index 20606294ae..e3d6a979ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
@@ -61,17 +61,19 @@ void UIGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::UI_GetSupportedLanguages);
-
if (hmi_apis::Common_Result::SUCCESS != code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages);
return;
}
hmi_capabilities_.set_ui_supported_languages(
(*message_)[strings::msg_params][hmi_response::languages]);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages);
+
std::vector<std::string> sections_to_update{hmi_response::languages};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::ui, sections_to_update, message_->getSchema())) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
index d020972ce6..630a54e3cc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
@@ -50,8 +50,7 @@ UIIsReadyRequest::UIIsReadyRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handle) {}
UIIsReadyRequest::~UIIsReadyRequest() {}
@@ -72,6 +71,8 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
application_manager_, message, HmiInterfaces::HMI_INTERFACE_UI);
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_is_ui_cooperating(is_available);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_IsReady);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_UI)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::ui);
@@ -89,8 +90,10 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
-void UIIsReadyRequest::onTimeOut() {
+void UIIsReadyRequest::OnTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_IsReady);
RequestInterfaceCapabilities(hmi_interface::ui);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
index c82a4d2131..9b664bb81c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
@@ -60,7 +60,7 @@ void UISetGlobalPropertiesRequest::Run() {
SendRequest();
}
-void UISetGlobalPropertiesRequest::onTimeOut() {
+void UISetGlobalPropertiesRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
correlation_id(),
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc
new file mode 100644
index 0000000000..e2cbb4e467
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2021, 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 "sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+namespace hmi {
+
+UnsubscribeButtonRequest::UnsubscribeButtonRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {
+ hmi_apis::Common_ButtonName::eType button_name =
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [app_mngr::strings::button_name]
+ .asInt());
+
+ button_name_ = button_name;
+}
+
+UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {}
+
+void UnsubscribeButtonRequest::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ subscribe_on_event(hmi_apis::FunctionID::Buttons_UnsubscribeButton,
+ correlation_id());
+ SendRequest();
+}
+
+void UnsubscribeButtonRequest::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+
+ application_manager_.AddExpiredButtonRequest(
+ application_id(), correlation_id(), button_name_);
+
+ auto& resume_ctrl = application_manager_.resume_controller();
+ resume_ctrl.HandleOnTimeOut(
+ correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()));
+}
+
+void UnsubscribeButtonRequest::on_event(const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (hmi_apis::FunctionID::Buttons_UnsubscribeButton != event.id()) {
+ SDL_LOG_ERROR("Unexpected event id received: " << event.id());
+ return;
+ }
+
+ unsubscribe_from_event(hmi_apis::FunctionID::Buttons_UnsubscribeButton);
+
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
+
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ if (!app) {
+ SDL_LOG_ERROR("NULL pointer.");
+ return;
+ }
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ if (CommandImpl::IsHMIResultSuccess(hmi_result,
+ HmiInterfaces::HMI_INTERFACE_Buttons)) {
+ const mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][strings::button_name].asInt());
+ app->UnsubscribeFromButton(
+ static_cast<mobile_apis::ButtonName::eType>(btn_id));
+ }
+}
+
+} // namespace hmi
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc
index 62bec16546..68b3663ca7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2021, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,41 +29,70 @@
* 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_vi_device_status_notification.h"
-#include "interfaces/MOBILE_API.h"
+#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
-
namespace commands {
SDL_CREATE_LOG_VARIABLE("Commands")
-OnVIDeviceStatusNotification::OnVIDeviceStatusNotification(
+namespace hmi {
+
+UnsubscribeButtonResponse::UnsubscribeButtonResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
-OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {}
+UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {}
-void OnVIDeviceStatusNotification::Run() {
+void UnsubscribeButtonResponse::Run() {
SDL_LOG_AUTO_TRACE();
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)
+ .getElement(strings::params)
+ .getElement(hmi_response::code)
+ .asInt());
+
+ const auto expired_request_data =
+ application_manager_.GetExpiredButtonRequestData(correlation_id());
+ if (expired_request_data) {
+ const uint32_t app_id = (*expired_request_data).app_id_;
+ const auto button_name = (*expired_request_data).button_name_;
+ application_manager_.DeleteExpiredButtonRequest(correlation_id());
- SendNotificationToMobile(message_);
+ if (!CommandImpl::IsHMIResultSuccess(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons)) {
+ return;
+ }
+
+ smart_objects::SmartObjectSPtr msg =
+ MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ app_id,
+ button_name,
+ hmi_apis::FunctionID::Buttons_SubscribeButton,
+ application_manager_);
+
+ rpc_service_.SendMessageToHMI(msg);
+ return;
+ }
+
+ event_engine::Event event(hmi_apis::FunctionID::Buttons_UnsubscribeButton);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
}
+} // namespace hmi
} // namespace commands
-
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
index c8aa295645..4d055564de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
@@ -53,51 +53,27 @@ UpdateDeviceListRequest::UpdateDeviceListRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager_.event_dispatcher()) {}
+ policy_handle) {}
UpdateDeviceListRequest::~UpdateDeviceListRequest() {}
void UpdateDeviceListRequest::Run() {
SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
// Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
// Flag conditional compilation for specific customer is used in order to
// exclude
// hit code to RTC
- if (true == application_manager_.get_settings().launch_hmi()) {
- if (!application_manager_.IsHMICooperating()) {
- SDL_LOG_INFO("Wait for HMI Cooperation");
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
- termination_condition_.Wait(auto_lock);
- SDL_LOG_DEBUG("HMI Cooperation OK");
+ if (application_manager_.get_settings().launch_hmi()) {
+ SDL_LOG_INFO("Wait for HMI Cooperation");
+ if (!application_manager_.WaitForHmiIsReady()) {
+ SDL_LOG_ERROR("HMI is not ready");
+ return;
}
- }
-
- SendRequest();
-}
-void UpdateDeviceListRequest::on_event(const event_engine::Event& event) {
- SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- switch (event.id()) {
- case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- SDL_LOG_INFO("received OnReady");
- unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
- termination_condition_.Broadcast();
- break;
- };
- default: {
- SDL_LOG_ERROR("Unknown event " << event.id());
- break;
- };
+ SDL_LOG_DEBUG("HMI Cooperation is OK");
}
-}
-bool UpdateDeviceListRequest::CleanUp() {
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- termination_condition_.Broadcast();
- return true;
+ SendRequest();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
index c8979ca62b..69bc299c7e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
@@ -60,7 +60,7 @@ void VRAddCommandRequest::Run() {
SendRequest();
}
-void VRAddCommandRequest::onTimeOut() {
+void VRAddCommandRequest::OnTimeOut() {
auto& resume_ctrl = application_manager_.resume_controller();
resume_ctrl.HandleOnTimeOut(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
index 3f528f2f58..d26d91f701 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
@@ -59,7 +59,7 @@ void VRGetCapabilitiesRequest::Run() {
SendRequest();
}
-void VRGetCapabilitiesRequest::onTimeOut() {
+void VRGetCapabilitiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetCapabilities);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
index 315107d94a..60cb39f987 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
@@ -57,11 +57,10 @@ void VRGetCapabilitiesResponse::Run() {
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::VR_GetCapabilities);
-
if (hmi_apis::Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities);
return;
}
@@ -74,6 +73,9 @@ void VRGetCapabilitiesResponse::Run() {
hmi_capabilities_.set_vr_capabilities(msg_params[strings::vr_capabilities]);
}
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
SDL_LOG_ERROR("Failed to save VR.GetCapabilities response to cache");
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
index f5e9b0e848..f15ed3017b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
@@ -59,7 +59,7 @@ void VRGetLanguageRequest::Run() {
SendRequest();
}
-void VRGetLanguageRequest::onTimeOut() {
+void VRGetLanguageRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetLanguage);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
index e8c881f6f8..3529d9fcde 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
@@ -61,11 +61,10 @@ void VRGetLanguageResponse::Run() {
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::VR_GetLanguage);
-
if (Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage);
return;
}
@@ -79,6 +78,9 @@ void VRGetLanguageResponse::Run() {
hmi_capabilities_.set_active_vr_language(language);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage);
+
std::vector<std::string> sections_to_update{hmi_response::language};
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vr, sections_to_update, message_->getSchema())) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
index 73e68e8503..3f6a268e70 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
@@ -59,7 +59,7 @@ void VRGetSupportedLanguagesRequest::Run() {
SendRequest();
}
-void VRGetSupportedLanguagesRequest::onTimeOut() {
+void VRGetSupportedLanguagesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetSupportedLanguages);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
index 72278fcddd..7b234befbe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
@@ -62,20 +62,24 @@ void VRGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
+ if (hmi_apis::Common_Result::SUCCESS != code) {
+ SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages);
+ return;
+ }
+
+ HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ hmi_capabilities.set_vr_supported_languages(
+ (*message_)[strings::msg_params][hmi_response::languages]);
+
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VR_GetSupportedLanguages);
- if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
- hmi_capabilities.set_vr_supported_languages(
- (*message_)[strings::msg_params][hmi_response::languages]);
-
- std::vector<std::string> sections_to_update{hmi_response::languages};
- if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
- hmi_interface::vr, sections_to_update, message_->getSchema())) {
- SDL_LOG_ERROR(
- "Failed to save VR.GetSupportedLanguages response to cache");
- }
+ std::vector<std::string> sections_to_update{hmi_response::languages};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vr, sections_to_update, message_->getSchema())) {
+ SDL_LOG_ERROR("Failed to save VR.GetSupportedLanguages response to cache");
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
index 303e7a6843..3e8fd0b4e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
@@ -50,8 +50,7 @@ VRIsReadyRequest::VRIsReadyRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ policy_handle) {}
VRIsReadyRequest::~VRIsReadyRequest() {}
@@ -73,6 +72,8 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_is_vr_cooperating(is_available);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_IsReady);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_VR)) {
UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::vr);
@@ -90,8 +91,10 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
-void VRIsReadyRequest::onTimeOut() {
+void VRIsReadyRequest::OnTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_IsReady);
RequestInterfaceCapabilities(hmi_interface::vr);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index 6717f332f8..ddd2c9db35 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/add_command_request.h"
+
#include <string>
#include "application_manager/application.h"
@@ -56,24 +57,22 @@ AddCommandRequest::AddCommandRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
- , send_ui_(false)
- , send_vr_(false)
- , is_ui_received_(false)
- , is_vr_received_(false)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
- , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
+ , vr_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , ui_is_sent_(false)
+ , vr_is_sent_(false) {}
AddCommandRequest::~AddCommandRequest() {}
-void AddCommandRequest::onTimeOut() {
+void AddCommandRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
RemoveCommand();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
}
bool AddCommandRequest::Init() {
@@ -107,6 +106,20 @@ void AddCommandRequest::Run() {
}
}
+ if ((*message_)[strings::msg_params].keyExists(strings::secondary_image)) {
+ mobile_apis::Result::eType verification_result = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::secondary_image],
+ app,
+ application_manager_);
+
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return "
+ << verification_result);
+ SendResponse(false, verification_result);
+ return;
+ }
+ }
+
if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) {
SDL_LOG_ERROR("INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -127,10 +140,6 @@ void AddCommandRequest::Run() {
bool data_exist = false;
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
- if (!CheckCommandName(app)) {
- SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
- return;
- }
if (((*message_)[strings::msg_params][strings::menu_params].keyExists(
hmi_request::parent_id)) &&
(0 != (*message_)[strings::msg_params][strings::menu_params]
@@ -174,6 +183,7 @@ void AddCommandRequest::Run() {
smart_objects::SmartObject ui_msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
ui_msg_params[strings::cmd_id] =
(*message_)[strings::msg_params][strings::cmd_id];
@@ -191,7 +201,19 @@ void AddCommandRequest::Run() {
(*message_)[strings::msg_params][strings::cmd_icon];
}
- send_ui_ = true;
+ ui_is_sent_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ if (((*message_)[strings::msg_params].keyExists(
+ strings::secondary_image)) &&
+ ((*message_)[strings::msg_params][strings::secondary_image].keyExists(
+ strings::value)) &&
+ (0 < (*message_)[strings::msg_params][strings::secondary_image]
+ [strings::value]
+ .length())) {
+ ui_msg_params[strings::secondary_image] =
+ (*message_)[strings::msg_params][strings::secondary_image];
+ }
}
smart_objects::SmartObject vr_msg_params =
@@ -206,61 +228,19 @@ void AddCommandRequest::Run() {
vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
vr_msg_params[strings::grammar_id] = app->get_grammar_id();
- send_vr_ = true;
+ vr_is_sent_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
}
- if (send_ui_) {
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) {
SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true);
}
- if (send_vr_) {
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true);
}
}
-bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
- if (!app) {
- return false;
- }
-
- const DataAccessor<CommandsMap> accessor = app->commands_map();
- const CommandsMap& commands = accessor.GetData();
- CommandsMap::const_iterator i = commands.begin();
- uint32_t saved_parent_id = 0;
- uint32_t parent_id = 0;
- if ((*message_)[strings::msg_params][strings::menu_params].keyExists(
- hmi_request::parent_id)) {
- parent_id = (*message_)[strings::msg_params][strings::menu_params]
- [hmi_request::parent_id]
- .asUInt();
- }
-
- for (; commands.end() != i; ++i) {
- if (!(*i->second).keyExists(strings::menu_params)) {
- continue;
- }
-
- saved_parent_id = 0;
- if ((*i->second)[strings::menu_params].keyExists(hmi_request::parent_id)) {
- saved_parent_id =
- (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt();
- }
- if (((*i->second)[strings::menu_params][strings::menu_name].asString() ==
- (*message_)[strings::msg_params][strings::menu_params]
- [strings::menu_name]
- .asString()) &&
- (saved_parent_id == parent_id)) {
- SDL_LOG_INFO(
- "AddCommandRequest::CheckCommandName received"
- " command name already exist in same level menu");
- return false;
- }
- }
- return true;
-}
-
bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) {
if (!app) {
return false;
@@ -342,7 +322,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::UI_AddCommand: {
SDL_LOG_INFO("Received UI_AddCommand event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, ui_info_);
@@ -354,7 +333,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::VR_AddCommand: {
SDL_LOG_INFO("Received VR_AddCommand event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
- is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, vr_info_);
@@ -370,6 +348,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
}
if (IsPendingResponseExist()) {
+ SDL_LOG_DEBUG("Command still wating for HMI response");
return;
}
@@ -525,10 +504,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
&(message[strings::msg_params]));
}
-bool AddCommandRequest::IsPendingResponseExist() {
- return send_ui_ != is_ui_received_ || send_vr_ != is_vr_received_;
-}
-
bool AddCommandRequest::IsWhiteSpaceExist() {
SDL_LOG_AUTO_TRACE();
const char* str = NULL;
@@ -565,11 +540,21 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
return true;
}
}
+
+ if ((*message_)[strings::msg_params].keyExists(strings::secondary_image)) {
+ str = (*message_)[strings::msg_params][strings::secondary_image]
+ [strings::value]
+ .asCharArray();
+ if (!CheckSyntax(str)) {
+ SDL_LOG_ERROR("Invalid secondaryImage value syntax check failed");
+ return true;
+ }
+ }
return false;
}
bool AddCommandRequest::BothSend() const {
- return send_vr_ && send_ui_;
+ return ui_is_sent_ && vr_is_sent_;
}
const std::string AddCommandRequest::GenerateMobileResponseInfo() {
@@ -617,17 +602,18 @@ void AddCommandRequest::RemoveCommand() {
app->RemoveCommand(cmd_id);
- if (BothSend() && !(is_vr_received_ || is_ui_received_)) {
+ if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) &&
+ IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) {
// in case we have send bth UI and VR and no one respond
// we have nothing to remove from HMI so no DeleteCommand expected
return;
}
- if (BothSend() && !is_vr_received_) {
+ if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
}
- if (BothSend() && !is_ui_received_) {
+ if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) {
msg_params[strings::grammar_id] = app->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
index e2a37f17bd..635734a74d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
@@ -50,11 +50,11 @@ AddSubMenuRequest::AddSubMenuRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
AddSubMenuRequest::~AddSubMenuRequest() {}
@@ -86,6 +86,20 @@ void AddSubMenuRequest::Run() {
}
}
+ if (received_msg_params.keyExists(strings::secondary_image)) {
+ verification_result = MessageHelper::VerifyImage(
+ received_msg_params[strings::secondary_image],
+ app,
+ application_manager_);
+
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
+ SDL_LOG_ERROR("MessageHelper::VerifyImage return "
+ << verification_result);
+ SendResponse(false, verification_result);
+ return;
+ }
+ }
+
const int32_t menu_id = received_msg_params[strings::menu_id].asInt();
const auto sub_menu = app->FindSubMenu(menu_id);
@@ -114,12 +128,6 @@ void AddSubMenuRequest::Run() {
const std::string& menu_name =
received_msg_params[strings::menu_name].asString();
- if (app->IsSubMenuNameAlreadyExist(menu_name, parent_id)) {
- SDL_LOG_ERROR("Menu name " << menu_name << " is duplicated.");
- SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
- return;
- }
-
if (!CheckSubMenuName()) {
SDL_LOG_ERROR("Sub-menu name is not valid.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -148,11 +156,23 @@ void AddSubMenuRequest::Run() {
if (received_msg_params.keyExists(strings::menu_icon)) {
msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon];
}
+ if (received_msg_params.keyExists(strings::secondary_image)) {
+ msg_params[strings::secondary_image] =
+ received_msg_params[strings::secondary_image];
+ }
msg_params[strings::menu_params][strings::menu_name] =
received_msg_params[strings::menu_name];
if (received_msg_params.keyExists(strings::parent_id)) {
msg_params[strings::menu_params][strings::parent_id] = parent_id;
}
+ if (received_msg_params.keyExists(strings::secondary_text)) {
+ msg_params[strings::menu_params][strings::secondary_text] =
+ received_msg_params[strings::secondary_text];
+ }
+ if (received_msg_params.keyExists(strings::tertiary_text)) {
+ msg_params[strings::menu_params][strings::tertiary_text] =
+ received_msg_params[strings::tertiary_text];
+ }
msg_params[strings::app_id] = app->app_id();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
index 47b3a87d52..89b305ae9d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
@@ -26,8 +26,10 @@
*/
#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h"
+
#include <cstring>
#include <string>
+
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler.h"
@@ -45,15 +47,13 @@ AlertManeuverRequest::AlertManeuverRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, tts_speak_result_code_(hmi_apis::Common_Result::INVALID_ENUM)
- , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {
- subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-}
+ , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {}
AlertManeuverRequest::~AlertManeuverRequest() {}
@@ -144,6 +144,7 @@ void AlertManeuverRequest::Run() {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::app_id] = app->app_id();
msg_params[hmi_request::tts_chunks] =
(*message_)[strings::msg_params][strings::tts_chunks];
msg_params[hmi_request::speak_type] =
@@ -172,19 +173,14 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::TTS_Speak: {
SDL_LOG_INFO("Received TTS_Speak event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
+
pending_requests_.Remove(event_id);
tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, info_tts_);
break;
}
- case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- SDL_LOG_INFO("Received TTS_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
default: {
SDL_LOG_ERROR("Received unknown event " << event.id());
SendResponse(
@@ -193,12 +189,11 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
}
}
- if (!pending_requests_.IsFinal(event_id)) {
- SDL_LOG_DEBUG(
- "There are some pending responses from HMI. "
- "AlertManeuverRequest still waiting.");
+ if (IsPendingResponseExist()) {
+ SDL_LOG_DEBUG("Command still wating for HMI response");
return;
}
+
std::string return_info;
mobile_apis::Result::eType result_code;
const bool result = PrepareResponseParameters(result_code, return_info);
@@ -236,7 +231,8 @@ bool AlertManeuverRequest::PrepareResponseParameters(
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_TTS)))) {
result_code = mobile_apis::Result::WARNINGS;
- return_info = std::string("Unsupported phoneme type sent in a prompt");
+ return_info = app_mngr::commands::MergeInfos(
+ navigation_alert_info, info_navi_, tts_alert_info, info_tts_);
return result;
}
result_code =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
index 993dc75548..5661b1df9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
@@ -59,6 +59,8 @@ AlertManeuverResponse::~AlertManeuverResponse() {}
void AlertManeuverResponse::Run() {
SDL_LOG_AUTO_TRACE();
+ application_manager_.UnsubscribeAppFromSoftButtons(message_);
+
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index ff374c890e..3bc7aad387 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -37,7 +37,6 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-
#include "application_manager/policies/policy_handler.h"
#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
@@ -55,20 +54,17 @@ AlertRequest::AlertRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, awaiting_ui_alert_response_(false)
, awaiting_tts_speak_response_(false)
, awaiting_tts_stop_speaking_response_(false)
, is_ui_alert_sent_(false)
, alert_result_(hmi_apis::Common_Result::INVALID_ENUM)
- , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
- subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-}
+ , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
AlertRequest::~AlertRequest() {}
@@ -124,23 +120,22 @@ void AlertRequest::Run() {
}
}
+void AlertRequest::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ if (!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ RequestFromMobileImpl::OnTimeOut();
+ return;
+ }
+ SDL_LOG_INFO(
+ "Default timeout ignored. "
+ "AlertRequest with soft buttons wait timeout on HMI side");
+}
+
void AlertRequest::on_event(const event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::TTS_OnResetTimeout:
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- SDL_LOG_INFO(
- "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event "
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_alert_response_);
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
case hmi_apis::FunctionID::UI_Alert: {
SDL_LOG_INFO("Received UI_Alert event");
// Unsubscribe from event to avoid unwanted messages
@@ -190,9 +185,11 @@ void AlertRequest::on_event(const event_engine::Event& event) {
}
}
- if (HasHmiResponsesToWait()) {
+ if (IsPendingResponseExist()) {
+ SDL_LOG_DEBUG("Command is still waiting for HMI response");
return;
}
+
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
std::string info;
const bool result = PrepareResponseParameters(result_code, info);
@@ -213,19 +210,10 @@ bool AlertRequest::PrepareResponseParameters(
bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive responce for
- * TTS.IsReady.
- */
- if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
return result;
@@ -234,7 +222,10 @@ bool AlertRequest::PrepareResponseParameters(
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
// Mobile Alert request is successful when UI_Alert is successful
- if (is_ui_alert_sent_ && !ui_alert_info.is_ok) {
+ bool has_unsupported_data =
+ ui_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE != ui_alert_info.interface_state;
+ if (is_ui_alert_sent_ && !ui_alert_info.is_ok && !has_unsupported_data) {
return false;
}
return result;
@@ -331,14 +322,14 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
hmi_apis::Common_TextFieldName::alertText1;
msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::alert_text1];
- index++;
+ ++index;
}
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
hmi_apis::Common_TextFieldName::alertText2;
msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::alert_text2];
- index++;
+ ++index;
}
if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
@@ -464,7 +455,7 @@ bool AlertRequest::CheckStrings() {
return true;
}
-bool AlertRequest::HasHmiResponsesToWait() {
+bool AlertRequest::IsPendingResponseExist() {
SDL_LOG_AUTO_TRACE();
return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ ||
awaiting_tts_stop_speaking_response_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
index 1b8eebe7d7..84d23bec46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
@@ -61,6 +61,8 @@ AlertResponse::~AlertResponse() {}
void AlertResponse::Run() {
SDL_LOG_AUTO_TRACE();
+ application_manager_.UnsubscribeAppFromSoftButtons(message_);
+
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
index 27020f2719..53511cb83f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
@@ -49,11 +49,11 @@ CancelInteractionRequest::CancelInteractionRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
CancelInteractionRequest::~CancelInteractionRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
index 13a57cf9a8..f7fc7d2284 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
@@ -32,8 +32,11 @@
*/
#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
+
#include <string.h>
+
#include <algorithm>
+
#include "application_manager/application_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -44,14 +47,14 @@
namespace {
namespace custom_str = utils::custom_string;
struct IsSameNickname {
- explicit IsSameNickname(const custom_str::CustomString& app_id)
- : app_id_(app_id) {}
+ explicit IsSameNickname(const custom_str::CustomString& app_name)
+ : app_name(app_name) {}
bool operator()(const policy::StringArray::value_type& nickname) const {
- return app_id_.CompareIgnoreCase(nickname.c_str());
+ return app_name.CompareIgnoreCase(nickname.c_str());
}
private:
- const custom_str::CustomString app_id_;
+ const custom_str::CustomString& app_name;
};
} // namespace
@@ -68,11 +71,11 @@ ChangeRegistrationRequest::ChangeRegistrationRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
, vr_result_(hmi_apis::Common_Result::INVALID_ENUM)
, tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
@@ -83,7 +86,6 @@ void ChangeRegistrationRequest::SendVRRequest(
ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
auto function = hmi_apis::FunctionID::VR_ChangeRegistration;
- pending_requests_.Add(function);
smart_objects::SmartObject vr_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -102,7 +104,6 @@ void ChangeRegistrationRequest::SendTTSRequest(
ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
auto function = hmi_apis::FunctionID::TTS_ChangeRegistration;
- pending_requests_.Add(function);
smart_objects::SmartObject tts_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -124,7 +125,6 @@ void ChangeRegistrationRequest::SendUIRequest(
const int32_t hmi_language) {
const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
auto function = hmi_apis::FunctionID::UI_ChangeRegistration;
- pending_requests_.Add(function);
// UI processing
smart_objects::SmartObject ui_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -230,18 +230,30 @@ void ChangeRegistrationRequest::Run() {
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
+
if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) {
- // VR processing
- SendVRRequest(app, msg_params);
+ StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_VR);
}
+
if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) {
- // TTS processing
- SendTTSRequest(app, msg_params);
+ StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS);
}
if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) {
+ StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_UI);
+ }
+
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) {
SendUIRequest(app, msg_params, hmi_language);
}
+
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) {
+ SendTTSRequest(app, msg_params);
+ }
+
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
+ SendVRRequest(app, msg_params);
+ }
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
@@ -254,7 +266,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::UI_ChangeRegistration: {
SDL_LOG_INFO("Received UI_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- pending_requests_.Remove(event_id);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, ui_response_info_);
@@ -263,7 +274,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::VR_ChangeRegistration: {
SDL_LOG_INFO("Received VR_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
- pending_requests_.Remove(event_id);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, vr_response_info_);
@@ -272,7 +282,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
SDL_LOG_INFO("Received TTS_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
- pending_requests_.Remove(event_id);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, tts_response_info_);
@@ -284,43 +293,39 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
}
}
- if (pending_requests_.IsFinal(event_id)) {
- ApplicationSharedPtr application =
- application_manager_.application(connection_key());
-
- if (!application) {
- SDL_LOG_ERROR("NULL pointer");
- return;
- }
+ if (IsPendingResponseExist()) {
+ SDL_LOG_DEBUG("Command still wating for HMI response");
+ return;
+ }
- if (hmi_apis::Common_Result::SUCCESS == ui_result_) {
- application->set_ui_language(static_cast<mobile_api::Language::eType>(
- (*message_)[strings::msg_params][strings::hmi_display_language]
- .asInt()));
- }
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
- if (hmi_apis::Common_Result::SUCCESS == vr_result_ ||
- hmi_apis::Common_Result::SUCCESS == tts_result_) {
- application->set_language(static_cast<mobile_api::Language::eType>(
- (*message_)[strings::msg_params][strings::language].asInt()));
- }
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
- std::string response_info;
- const bool result = PrepareResponseParameters(result_code, response_info);
+ if (!application) {
+ SDL_LOG_ERROR("NULL pointer");
+ return;
+ }
- (*message_)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::eType::ChangeRegistrationID;
+ if (hmi_apis::Common_Result::SUCCESS == ui_result_) {
+ application->set_ui_language(static_cast<mobile_api::Language::eType>(
+ (*message_)[strings::msg_params][strings::hmi_display_language]
+ .asInt()));
+ }
- SendResponse(result,
- result_code,
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
- } else {
- SDL_LOG_INFO(
- "There are some pending responses from HMI."
- "ChangeRegistrationRequest still waiting.");
+ if (hmi_apis::Common_Result::SUCCESS == vr_result_ ||
+ hmi_apis::Common_Result::SUCCESS == tts_result_) {
+ application->set_language(static_cast<mobile_api::Language::eType>(
+ (*message_)[strings::msg_params][strings::language].asInt()));
}
-}
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ std::string response_info;
+ const bool result = PrepareResponseParameters(result_code, response_info);
+ SendResponse(result,
+ result_code,
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
+} // namespace commands
namespace {
void CheckInfo(std::string& str) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
index b4a09844f2..5154ace4ee 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -47,11 +47,11 @@ CloseApplicationRequest::CloseApplicationRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
CloseApplicationRequest::~CloseApplicationRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index 0d1d876497..98e26e1aa9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
+
#include <algorithm>
#include <cstring>
#include <string>
@@ -58,17 +59,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, choice_set_id_(0)
, expected_chs_count_(0)
, received_chs_count_(0)
, should_send_warnings_(false)
- , error_from_hmi_(false)
- , is_timed_out_(false) {}
+ , error_from_hmi_(false) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
SDL_LOG_AUTO_TRACE();
@@ -364,12 +364,12 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse(
}
void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() {
- received_chs_count_++;
+ ++received_chs_count_;
SDL_LOG_DEBUG("Got VR.AddCommand response, there are "
<< expected_chs_count_ - received_chs_count_
<< " more to wait.");
if (received_chs_count_ < expected_chs_count_) {
- application_manager_.updateRequestTimeout(
+ application_manager_.UpdateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
SDL_LOG_DEBUG("Timeout for request was updated");
} else {
@@ -406,13 +406,13 @@ void CreateInteractionChoiceSetRequest::on_event(
}
}
-void CreateInteractionChoiceSetRequest::onTimeOut() {
+void CreateInteractionChoiceSetRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
if (!error_from_hmi_) {
- SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
+ RequestFromMobileImpl::OnTimeOut();
}
- CommandRequestImpl::onTimeOut();
+
DeleteChoices();
auto& resume_ctrl = application_manager_.resume_controller();
@@ -421,10 +421,6 @@ void CreateInteractionChoiceSetRequest::onTimeOut() {
correlation_id(),
static_cast<hmi_apis::FunctionID::eType>(function_id()));
- // We have to keep request alive until receive all responses from HMI
- // according to SDLAQ-CRS-2976
- sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_);
- is_timed_out_ = true;
application_manager_.TerminateRequest(
connection_key(), correlation_id(), function_id());
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
index 2a0ca4ddb3..81b8985cd5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
@@ -53,11 +53,11 @@ CreateWindowRequest::CreateWindowRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
CreateWindowRequest::~CreateWindowRequest() {}
@@ -214,11 +214,12 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const smart_objects::SmartObject& response_message = event.smart_object();
- const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ const auto result_code = RequestFromMobileImpl::GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
response_message[strings::params][hmi_response::code].asInt()));
- const bool is_success = IsMobileResultSuccess(result_code);
+ const bool is_success =
+ app_mngr::commands::IsMobileResultSuccess(result_code);
std::string response_info;
GetInfo(response_message, response_info);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
index 358a002606..dead764811 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
@@ -52,15 +52,11 @@ DeleteCommandRequest::DeleteCommandRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
- , is_ui_send_(false)
- , is_vr_send_(false)
- , is_ui_received_(false)
- , is_vr_received_(false)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
, vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
@@ -99,17 +95,11 @@ void DeleteCommandRequest::Run() {
/* Need to set all flags before sending request to HMI
* for correct processing this flags in method on_event */
if (command.keyExists(strings::menu_params)) {
- is_ui_send_ = true;
- }
- // check vr params
- if (command.keyExists(strings::vr_commands)) {
- is_vr_send_ = true;
- }
- if (is_ui_send_) {
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true);
}
- if (is_vr_send_) {
+ // check vr params
+ if (command.keyExists(strings::vr_commands)) {
// VR params
msg_params[strings::grammar_id] = application->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
@@ -151,7 +141,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_DeleteCommand: {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
SDL_LOG_DEBUG("Received UI_DeleteCommand event with result "
@@ -161,7 +150,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::VR_DeleteCommand: {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
- is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
SDL_LOG_DEBUG("Received VR_DeleteCommand event with result "
@@ -216,11 +204,6 @@ bool DeleteCommandRequest::Init() {
return true;
}
-bool DeleteCommandRequest::IsPendingResponseExist() {
- SDL_LOG_AUTO_TRACE();
- return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_;
-}
-
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
index 127843813c..268d1fa0cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
@@ -50,11 +50,11 @@ DeleteFileRequest::DeleteFileRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
DeleteFileRequest::~DeleteFileRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
index 3ff95a6f41..eac43bb22b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -51,11 +51,12 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , response_result_codes_() {}
DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {}
@@ -89,18 +90,6 @@ void DeleteInteractionChoiceSetRequest::Run() {
return;
}
SendVrDeleteCommand(app);
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- msg_params[strings::interaction_choice_set_id] = choice_set_id;
- msg_params[strings::app_id] = app->app_id();
-
- app->RemoveChoiceSet(choice_set_id);
-
- // Checking of HMI responses will be implemented with APPLINK-14600
- const bool result = true;
- SendResponse(result, mobile_apis::Result::SUCCESS);
}
bool DeleteInteractionChoiceSetRequest::Init() {
@@ -108,6 +97,39 @@ bool DeleteInteractionChoiceSetRequest::Init() {
return true;
}
+void DeleteInteractionChoiceSetRequest::on_event(
+ const event_engine::Event& event) {
+ using namespace helpers;
+ SDL_LOG_AUTO_TRACE();
+
+ if (event.id() == hmi_apis::FunctionID::VR_DeleteCommand) {
+ const smart_objects::SmartObject& message = event.smart_object();
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ response_result_codes_.push_back(result_code);
+ const std::uint32_t correlation_id = static_cast<uint32_t>(
+ message[strings::params][strings::correlation_id].asUInt());
+
+ bool should_send_response = false;
+ {
+ sync_primitives::AutoLock auto_lock(requests_lock_);
+ auto found_request = sent_requests_.find(correlation_id);
+ if (sent_requests_.end() == found_request) {
+ SDL_LOG_WARN("Request with " << correlation_id
+ << " correlation_id is not found.");
+ return;
+ }
+
+ sent_requests_.erase(found_request);
+ should_send_response = sent_requests_.empty();
+ }
+
+ if (should_send_response) {
+ SendDeleteInteractionChoiceSetResponse();
+ }
+ }
+}
+
bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(
ApplicationConstSharedPtr app) {
SDL_LOG_AUTO_TRACE();
@@ -157,10 +179,52 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand(
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
msg_params[strings::grammar_id] = choice_set[strings::grammar_id];
choice_set = choice_set[strings::choice_set];
+
+ sync_primitives::AutoLock auto_lock(requests_lock_);
for (uint32_t i = 0; i < choice_set.length(); ++i) {
msg_params[strings::cmd_id] = choice_set[i][strings::choice_id];
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ const uint32_t delte_cmd_hmi_corr_id = SendHMIRequest(
+ hmi_apis::FunctionID::VR_DeleteCommand, &msg_params, true);
+ sent_requests_.insert(delte_cmd_hmi_corr_id);
+ }
+}
+
+void DeleteInteractionChoiceSetRequest::
+ SendDeleteInteractionChoiceSetResponse() {
+ hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ for (const auto& code : response_result_codes_) {
+ if (result_code == hmi_apis::Common_Result::INVALID_ENUM) {
+ result_code = code;
+ continue;
+ }
+
+ if (!application_manager::commands::IsHMIResultSuccess(code)) {
+ result_code = code;
+ }
}
+
+ const bool response_result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::InterfaceID::HMI_INTERFACE_VR);
+
+ if (response_result) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ if (!app) {
+ SDL_LOG_ERROR("Application with connection key " << connection_key()
+ << " did not find.");
+ return;
+ }
+ const uint32_t choice_set_id =
+ (*message_)[strings::msg_params][strings::interaction_choice_set_id]
+ .asUInt();
+ app->RemoveChoiceSet(choice_set_id);
+ }
+
+ SDL_LOG_DEBUG("Response sent. Result code: " << result_code
+ << " sussess: " << std::boolalpha
+ << result_code);
+ SendResponse(response_result, MessageHelper::HMIToMobileResult(result_code));
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
index 19ec2dfb27..aa16c9b218 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
@@ -52,11 +52,13 @@ DeleteSubMenuRequest::DeleteSubMenuRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , requests_list_()
+ , pending_request_corr_id_(0) {}
DeleteSubMenuRequest::~DeleteSubMenuRequest() {}
@@ -82,19 +84,42 @@ void DeleteSubMenuRequest::Run() {
return;
}
+ {
+ const DataAccessor<SubMenuMap> accessor = app->sub_menu_map();
+ const SubMenuMap& sub_menus = accessor.GetData();
+ DeleteNestedSubMenus(app, menu_id, sub_menus);
+ }
+
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
-
msg_params[strings::menu_id] =
(*message_)[strings::msg_params][strings::menu_id];
msg_params[strings::app_id] = app->app_id();
+ requests_list_.push_back(msg_params);
+
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendNextRequest();
+}
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true);
+void DeleteSubMenuRequest::SendNextRequest() {
+ SDL_LOG_AUTO_TRACE();
+
+ const auto request_params = requests_list_.front();
+ auto function_id = hmi_apis::FunctionID::UI_DeleteSubMenu;
+
+ if (request_params.keyExists(strings::cmd_id)) {
+ function_id = request_params.keyExists(strings::grammar_id)
+ ? hmi_apis::FunctionID::VR_DeleteCommand
+ : hmi_apis::FunctionID::UI_DeleteCommand;
+ }
+
+ pending_request_corr_id_ = SendHMIRequest(function_id, &request_params, true);
+ SDL_LOG_DEBUG(
+ "Waiting for response for corr_id = " << pending_request_corr_id_);
}
void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
- uint32_t parentID,
+ const uint32_t parentID,
const SubMenuMap& subMenus) {
SDL_LOG_AUTO_TRACE();
@@ -108,26 +133,26 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
}
if (parentID == (*it->second)[strings::parent_id].asUInt()) {
- uint32_t menuID = (*it->second)[strings::menu_id].asUInt();
+ const uint32_t menuID = (*it->second)[strings::menu_id].asUInt();
DeleteNestedSubMenus(app, menuID, subMenus);
- DeleteSubMenuVRCommands(app, menuID);
- DeleteSubMenuUICommands(app, menuID);
+
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::menu_id] = menuID;
msg_params[strings::app_id] = app->app_id();
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params);
- ++it;
- SDL_LOG_DEBUG("Removing submenuID: " << menuID);
- app->RemoveSubMenu(menuID);
- } else {
- ++it;
+ requests_list_.push_back(msg_params);
}
+
+ ++it;
}
+
+ SDL_LOG_DEBUG("Delete commands with Parent ID: " << parentID);
+ DeleteSubMenuVRCommands(app, parentID);
+ DeleteSubMenuUICommands(app, parentID);
}
void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
- ApplicationConstSharedPtr app, uint32_t parentID) {
+ ApplicationConstSharedPtr app, const uint32_t parentID) {
SDL_LOG_AUTO_TRACE();
const DataAccessor<CommandsMap> accessor = app->commands_map();
@@ -148,7 +173,7 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
msg_params[strings::grammar_id] = app->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ requests_list_.push_back(msg_params);
}
}
}
@@ -175,16 +200,11 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(
const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt();
msg_params[strings::app_id] = app->app_id();
msg_params[strings::cmd_id] = cmd_id;
- SDL_LOG_DEBUG("Removing UI Command: " << cmd_id);
- app->RemoveCommand(cmd_id);
- app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
- it = commands.begin(); // Can not relay on
- // iterators after erase was called
-
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
- } else {
- ++it;
+
+ requests_list_.push_back(msg_params);
}
+
+ ++it;
}
}
@@ -193,48 +213,110 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::UI_DeleteSubMenu: {
- EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- hmi_apis::Common_Result::eType result_code =
- static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- std::string response_info;
- GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
- result_code, HmiInterfaces::HMI_INTERFACE_UI);
-
- ApplicationSharedPtr application =
- application_manager_.application(connection_key());
-
- if (!application) {
- SDL_LOG_ERROR("NULL pointer");
- return;
+ case hmi_apis::FunctionID::UI_DeleteCommand: {
+ SDL_LOG_DEBUG("Received UI_DeleteCommand response");
+
+ const auto corr_id =
+ message[strings::params][strings::correlation_id].asUInt();
+ if (pending_request_corr_id_ == corr_id) {
+ auto msg_params = requests_list_.front();
+
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ auto app = application_manager_.application(connection_key());
+ if (!app) {
+ SDL_LOG_ERROR("Application not found");
+ return;
+ }
+
+ if (application_manager::commands::IsHMIResultSuccess(result_code)) {
+ const auto cmd_id = msg_params[strings::cmd_id].asUInt();
+ SDL_LOG_DEBUG("Removing UI Command: " << cmd_id);
+ app->RemoveCommand(cmd_id);
+ app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
+ }
+
+ requests_list_.pop_front();
}
- if (result) {
- // delete sub menu items from SDL and HMI
- uint32_t parentID =
- (*message_)[strings::msg_params][strings::menu_id].asUInt();
- const DataAccessor<SubMenuMap> accessor = application->sub_menu_map();
- const SubMenuMap& subMenus = accessor.GetData();
- DeleteNestedSubMenus(application, parentID, subMenus);
- DeleteSubMenuVRCommands(application, parentID);
- DeleteSubMenuUICommands(application, parentID);
- application->RemoveSubMenu(
- (*message_)[strings::msg_params][strings::menu_id].asInt());
+ break;
+ }
+
+ case hmi_apis::FunctionID::VR_DeleteCommand: {
+ SDL_LOG_DEBUG("Received VR_DeleteCommand response");
+
+ const auto corr_id =
+ message[strings::params][strings::correlation_id].asUInt();
+
+ if (corr_id == pending_request_corr_id_) {
+ auto app = application_manager_.application(connection_key());
+ if (!app) {
+ SDL_LOG_ERROR("Application not found");
+ return;
+ }
+
+ requests_list_.pop_front();
}
- SendResponse(result,
- MessageHelper::HMIToMobileResult(result_code),
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
break;
}
+
+ case hmi_apis::FunctionID::UI_DeleteSubMenu: {
+ SDL_LOG_DEBUG("Received UI_DeleteSubMenu response");
+
+ const auto corr_id =
+ message[strings::params][strings::correlation_id].asUInt();
+ if (corr_id == pending_request_corr_id_) {
+ auto msg_params = requests_list_.front();
+
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ auto app = application_manager_.application(connection_key());
+ if (!app) {
+ SDL_LOG_ERROR("Application not found");
+ return;
+ }
+
+ if (application_manager::commands::IsHMIResultSuccess(result_code)) {
+ const auto menu_id = msg_params[strings::menu_id].asUInt();
+ SDL_LOG_DEBUG("Removing submenuID: " << menu_id);
+ app->RemoveSubMenu(menu_id);
+ }
+
+ requests_list_.pop_front();
+ }
+
+ break;
+ }
+
default: {
SDL_LOG_ERROR("Received unknown event" << event.id());
return;
}
}
+
+ if (!requests_list_.empty()) {
+ SDL_LOG_DEBUG("Still waiting for another requests");
+ SendNextRequest();
+ return;
+ }
+
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(message, response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_UI);
+
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
}
bool DeleteSubMenuRequest::Init() {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
index 214a9c2bab..73fa7f4774 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
@@ -47,11 +47,11 @@ DeleteWindowRequest::DeleteWindowRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
DeleteWindowRequest::~DeleteWindowRequest() {}
@@ -130,11 +130,12 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const smart_objects::SmartObject& response_message = event.smart_object();
- const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ const auto result_code = RequestFromMobileImpl::GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
response_message[strings::params][hmi_response::code].asInt()));
- const bool is_success = IsMobileResultSuccess(result_code);
+ const bool is_success =
+ app_mngr::commands::IsMobileResultSuccess(result_code);
std::string response_info;
GetInfo(response_message, response_info);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
index f0ef2e0028..c14eb02dae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
@@ -49,11 +49,11 @@ DialNumberRequest::DialNumberRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
DialNumberRequest::~DialNumberRequest() {}
@@ -118,7 +118,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
SDL_LOG_INFO("Received DialNumber event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
- result_code = CommandRequestImpl::GetMobileResultCode(
+ result_code = RequestFromMobileImpl::GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt()));
break;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
index f5506503e9..00e75b0c26 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -47,11 +47,11 @@ EndAudioPassThruRequest::EndAudioPassThruRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
EndAudioPassThruRequest::~EndAudioPassThruRequest() {}
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
index 585636bfa8..93da86f2be 100644
--- 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
@@ -14,11 +14,11 @@ GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {}
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
index 620d901f3c..d9a592adfd 100644
--- 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
@@ -67,11 +67,11 @@ GetFileRequest::GetFileRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, file_name_("")
, file_type_(mobile_apis::FileType::INVALID_ENUM)
, length_(0)
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 1cd4806f7e..b044556f64 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
@@ -50,11 +50,11 @@ GetSystemCapabilityRequest::GetSystemCapabilityRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {}
@@ -204,10 +204,12 @@ void GetSystemCapabilityRequest::Run() {
auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
.asBool() == true) {
- SDL_LOG_DEBUG("Subscribe to system capability: " << response_type);
+ SDL_LOG_DEBUG("Subscribe to system capability: "
+ << response_type << " for app_id: " << app->app_id());
ext.SubscribeTo(response_type);
} else {
- SDL_LOG_DEBUG("Unsubscribe from system capability: " << response_type);
+ SDL_LOG_DEBUG("Unsubscribe from system capability: "
+ << response_type << " for app_id: " << app->app_id());
ext.UnsubscribeFrom(response_type);
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
index 54b542d245..e371889574 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h"
+
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -47,13 +48,11 @@ GetWayPointsRequest::GetWayPointsRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
-}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
GetWayPointsRequest::~GetWayPointsRequest() {}
@@ -81,12 +80,6 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- SDL_LOG_INFO("Received UI_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
case hmi_apis::FunctionID::Navigation_GetWayPoints: {
SDL_LOG_INFO("Received Navigation_GetWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
index 9262466e34..9ab636aaf5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
@@ -52,11 +52,11 @@ ListFilesRequest::ListFilesRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
ListFilesRequest::~ListFilesRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_capability_updated_notification.cc
index e04eaab3b4..c04b10cbd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_capability_updated_notification.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,40 +30,46 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h"
-#include "interfaces/MOBILE_API.h"
+#include "sdl_rpc_plugin/commands/mobile/on_app_capability_updated_notification.h"
namespace sdl_rpc_plugin {
-using namespace application_manager;
namespace commands {
+namespace mobile {
SDL_CREATE_LOG_VARIABLE("Commands")
-OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification(
+OnAppCapabilityUpdatedNotification::OnAppCapabilityUpdatedNotification(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handle)
- : NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ : CommandNotificationFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
-OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {}
+OnAppCapabilityUpdatedNotification::~OnAppCapabilityUpdatedNotification() {}
-void OnVISteeringWheelAngleNotification::Run() {
+void OnAppCapabilityUpdatedNotification::Run() {
SDL_LOG_AUTO_TRACE();
+ app_mngr::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
- // prepare SmartObject for mobile factory
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID);
+ if (!app) {
+ SDL_LOG_ERROR("No application associated with session key");
+ return;
+ }
- SendNotificationToMobile(message_);
+ (*message_)[app_mngr::strings::msg_params][app_mngr::strings::app_id] =
+ app->app_id();
+
+ SendNotificationToHMI(
+ hmi_apis::FunctionID::BasicCommunication_OnAppCapabilityUpdated);
}
+} // namespace mobile
} // namespace commands
-
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
index 14787d0a08..234c33214c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
@@ -34,6 +34,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_button_event_notification.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
@@ -51,146 +52,23 @@ OnButtonEventNotification::OnButtonEventNotification(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandNotificationImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : ButtonNotificationToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
OnButtonEventNotification::~OnButtonEventNotification() {}
-void OnButtonEventNotification::Run() {
+void OnButtonEventNotification::SendButtonNotification(
+ ApplicationSharedPtr app) {
SDL_LOG_AUTO_TRACE();
- const uint32_t btn_id = static_cast<uint32_t>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
-
- const bool is_app_id_exists =
- (*message_)[strings::msg_params].keyExists(strings::app_id);
- ApplicationSharedPtr app;
-
- // CUSTOM_BUTTON notification
- if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
- // app_id is mandatory for CUSTOM_BUTTON notification
- if (!is_app_id_exists) {
- SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without app_id.");
- return;
- }
-
- app = application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
- // custom_button_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
- SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
- return;
- }
-
- if (!app) {
- SDL_LOG_ERROR("Application doesn't exist.");
- return;
- }
-
- uint32_t custom_btn_id = 0;
- custom_btn_id =
- (*message_)[strings::msg_params][hmi_response::custom_button_id]
- .asUInt();
-
- if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id.");
- return;
- }
-
- const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
- (*message_)[strings::msg_params][strings::window_id] = window_id;
- const auto window_hmi_level = app->hmi_level(window_id);
- if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
- SDL_LOG_WARN(
- "CUSTOM_BUTTON OnButtonEvent notification is not allowed in "
- "NONE hmi level");
- return;
- }
-
- SendButtonEvent(app);
- return;
- }
-
- const std::vector<ApplicationSharedPtr>& subscribed_apps =
- application_manager_.applications_by_button(btn_id);
-
- std::vector<ApplicationSharedPtr>::const_iterator it =
- subscribed_apps.begin();
- for (; subscribed_apps.end() != it; ++it) {
- ApplicationSharedPtr subscribed_app = *it;
- if (!subscribed_app) {
- SDL_LOG_WARN("Null pointer to subscribed app.");
- continue;
- }
-
- // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
- const mobile_apis::HMILevel::eType app_hmi_level =
- subscribed_app->hmi_level(
- mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
- if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
- (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
- SDL_LOG_WARN("OnButtonEvent notification is allowed only"
- << "in FULL or LIMITED hmi level");
- continue;
- }
- // if OK button and "app_id" absent send notification only in HMI_FULL mode
- // otherwise send to subscribed apps in limited
- if (is_app_id_exists || hmi_apis::Common_ButtonName::OK != btn_id ||
- subscribed_app->IsFullscreen()) {
- SendButtonEvent(subscribed_app);
- }
- }
-}
-
-void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
- if (!app) {
- SDL_LOG_ERROR("OnButtonEvent NULL pointer");
- return;
- }
-
- smart_objects::SmartObjectSPtr on_btn_event =
- std::make_shared<smart_objects::SmartObject>();
-
- if (!on_btn_event) {
- SDL_LOG_ERROR("OnButtonEvent NULL pointer");
- return;
- }
-
- (*on_btn_event)[strings::params][strings::connection_key] = app->app_id();
-
- (*on_btn_event)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonEventID);
-
- mobile_apis::ButtonName::eType btn_id =
- static_cast<mobile_apis::ButtonName::eType>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
-
- if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
- app->msg_version() < utils::rpc_version_5) {
- btn_id = mobile_apis::ButtonName::OK;
- }
-
- (*on_btn_event)[strings::msg_params][strings::button_name] = btn_id;
- (*on_btn_event)[strings::msg_params][strings::button_event_mode] =
- (*message_)[strings::msg_params][hmi_response::button_mode];
-
- if ((*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
- (*on_btn_event)[strings::msg_params][strings::custom_button_id] =
- (*message_)[strings::msg_params][strings::custom_button_id];
- }
+ (*message_)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::eType::OnButtonEventID;
- if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
- (*on_btn_event)[strings::msg_params][strings::window_id] =
- (*message_)[strings::msg_params][strings::window_id];
- }
+ message_ = MessageHelper::CreateButtonNotificationToMobile(app, *message_);
- message_ = on_btn_event;
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
index 4444f0d156..90bf618c35 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
@@ -34,6 +34,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_button_press_notification.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "utils/semantic_version.h"
@@ -52,155 +53,23 @@ OnButtonPressNotification::OnButtonPressNotification(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandNotificationImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : ButtonNotificationToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
OnButtonPressNotification::~OnButtonPressNotification() {}
-void OnButtonPressNotification::Run() {
+void OnButtonPressNotification::SendButtonNotification(
+ ApplicationSharedPtr app) {
SDL_LOG_AUTO_TRACE();
- const uint32_t btn_id = static_cast<uint32_t>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
-
- const bool is_app_id_exists =
- (*message_)[strings::msg_params].keyExists(strings::app_id);
- ApplicationSharedPtr app;
- if (is_app_id_exists) {
- app = application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
- }
-
- // CUSTOM_BUTTON notification
- if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
- // app_id is mandatory for CUSTOM_BUTTON notification
- if (!is_app_id_exists) {
- SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without app_id.");
- return;
- }
-
- // custom_button_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
- SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without custom_button_id.");
- return;
- }
-
- if (!app) {
- SDL_LOG_ERROR("Application doesn't exist.");
- return;
- }
-
- uint32_t custom_btn_id = 0;
- custom_btn_id =
- (*message_)[strings::msg_params][hmi_response::custom_button_id]
- .asUInt();
-
- if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id.");
- return;
- }
-
- // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
- app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
- (*message_)[strings::msg_params][strings::window_id] = window_id;
- const auto window_hmi_level = app->hmi_level(window_id);
- if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
- SDL_LOG_WARN(
- "CUSTOM_BUTTON OnButtonPress notification is not allowed in "
- "NONE hmi level");
- return;
- }
-
- SendButtonPress(app);
- return;
- }
-
- const std::vector<ApplicationSharedPtr>& subscribed_apps =
- application_manager_.applications_by_button(btn_id);
-
- std::vector<ApplicationSharedPtr>::const_iterator it =
- subscribed_apps.begin();
- for (; subscribed_apps.end() != it; ++it) {
- ApplicationSharedPtr subscribed_app = *it;
- if (!subscribed_app) {
- SDL_LOG_WARN("Null pointer to subscribed app.");
- continue;
- }
-
- // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- const mobile_apis::HMILevel::eType app_hmi_level =
- subscribed_app->hmi_level(
- mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
- if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
- (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
- SDL_LOG_WARN("OnButtonPress notification is allowed only "
- << "in FULL or LIMITED hmi level");
- continue;
- }
- // if "appID" is present, send it to named app only if its FULL or
- // LIMITED
- if (app.use_count() != 0) {
- if (app->app_id() == subscribed_app->app_id()) {
- SendButtonPress(subscribed_app);
- }
- } else if (hmi_apis::Common_ButtonName::OK != btn_id ||
- subscribed_app->IsFullscreen()) {
- // if No "appID" and OK button - send it FULL apps only.
- // if not OK button, send to LIMITED subscribed apps
- SendButtonPress(subscribed_app);
- }
- }
-}
-
-void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
- if (!app) {
- SDL_LOG_ERROR("OnButtonPress NULL pointer");
- return;
- }
-
- smart_objects::SmartObjectSPtr on_btn_press =
- std::make_shared<smart_objects::SmartObject>();
-
- if (!on_btn_press) {
- SDL_LOG_ERROR("OnButtonPress NULL pointer");
- return;
- }
-
- (*on_btn_press)[strings::params][strings::connection_key] = app->app_id();
-
- (*on_btn_press)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonPressID);
-
- mobile_apis::ButtonName::eType btn_id =
- static_cast<mobile_apis::ButtonName::eType>(
- (*message_)[strings::msg_params][hmi_response::button_name].asInt());
-
- if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
- app->msg_version() < utils::rpc_version_5) {
- btn_id = mobile_apis::ButtonName::OK;
- }
-
- (*on_btn_press)[strings::msg_params][strings::button_name] = btn_id;
- (*on_btn_press)[strings::msg_params][strings::button_press_mode] =
- (*message_)[strings::msg_params][hmi_response::button_mode];
-
- if ((*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
- (*on_btn_press)[strings::msg_params][strings::custom_button_id] =
- (*message_)[strings::msg_params][strings::custom_button_id];
- }
+ (*message_)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::eType::OnButtonPressID;
- if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
- (*on_btn_press)[strings::msg_params][strings::window_id] =
- (*message_)[strings::msg_params][strings::window_id];
- }
+ message_ = MessageHelper::CreateButtonNotificationToMobile(app, *message_);
- message_ = on_btn_press;
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
index 850aa64b5f..4a28d262dc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -81,15 +81,10 @@ void OnSystemCapabilityUpdatedNotification::Run() {
}
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::VIDEO_STREAMING: {
+ SendNotification();
+ return;
+ }
case mobile_apis::SystemCapabilityType::APP_SERVICES: {
auto all_services =
application_manager_.GetAppServiceManager().GetAllServiceRecords();
@@ -101,7 +96,7 @@ void OnSystemCapabilityUpdatedNotification::Run() {
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++) {
+ 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]
@@ -200,48 +195,53 @@ void OnSystemCapabilityUpdatedNotification::Run() {
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()) {
- SDL_LOG_WARN(
- "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;
- }
- if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) {
- SDL_LOG_DEBUG("Using common display capabilities");
- auto capabilities = hmi_capabilities_.system_display_capabilities();
-
- auto& builder = app->display_capabilities_builder();
- if (app->is_resuming() && builder.IsWindowResumptionNeeded()) {
- SDL_LOG_DEBUG("Application "
- << app->app_id()
- << " is resuming. Providing cached capabilities");
- auto display_caps = builder.display_capabilities();
- capabilities = display_caps;
- } else if (app->display_capabilities()) {
- SDL_LOG_DEBUG("Application " << app->app_id()
- << " has specific display capabilities");
- const WindowID window_id =
- msg_params[strings::system_capability]
- [strings::display_capabilities][0]
- [strings::window_capabilities][0][strings::window_id]
- .asInt();
- capabilities = app->display_capabilities(window_id);
- }
+ switch (system_capability_type) {
+ case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: {
+ if (!app->is_remote_control_supported()) {
+ SDL_LOG_WARN("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);
+ }
+ } break;
+
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ SDL_LOG_DEBUG("Using common display capabilities");
+ auto capabilities = hmi_capabilities_.system_display_capabilities();
+ auto& builder = app->display_capabilities_builder();
+ if (app->is_resuming() && builder.IsWindowResumptionNeeded()) {
+ SDL_LOG_DEBUG("Application "
+ << app->app_id()
+ << " is resuming. Providing cached capabilities");
+ auto display_caps = builder.display_capabilities();
+ capabilities = display_caps;
+ } else if (app->display_capabilities()) {
+ SDL_LOG_DEBUG("Application " << app->app_id()
+ << " has specific display capabilities");
+ const WindowID window_id =
+ msg_params[strings::system_capability]
+ [strings::display_capabilities][0]
+ [strings::window_capabilities][0][strings::window_id]
+ .asInt();
+ capabilities = app->display_capabilities(window_id);
+ }
- if (!capabilities) {
- SDL_LOG_WARN("No available display capabilities for sending. Skipping");
- continue;
- }
+ if (!capabilities) {
+ SDL_LOG_WARN(
+ "No available display capabilities for sending. Skipping");
+ continue;
+ }
- msg_params[strings::system_capability][strings::display_capabilities] =
- *capabilities;
+ msg_params[strings::system_capability][strings::display_capabilities] =
+ *capabilities;
+ } break;
+ default: {
+ SDL_LOG_ERROR("Unknown system capability type");
+ }
}
SDL_LOG_INFO("Sending OnSystemCapabilityUpdated " << capability_type_string
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index 4a97d5b970..af0a5a6539 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -109,15 +109,8 @@ void OnSystemRequestNotification::Run() {
SDL_LOG_DEBUG("Processing Request type : " << stringified_request_type);
- const bool binary_data_is_required =
- Compare<mobile_apis::RequestType::eType, EQ, ONE>(
- request_type,
- mobile_apis::RequestType::PROPRIETARY,
- mobile_apis::RequestType::OEM_SPECIFIC);
-
BinaryMessage binary_data;
- if (binary_data_is_required &&
- (*message_)[strings::msg_params].keyExists(strings::file_name)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::file_name)) {
const std::string filename =
(*message_)[strings::msg_params][strings::file_name].asString();
file_system::ReadBinaryFile(filename, binary_data);
@@ -126,22 +119,15 @@ void OnSystemRequestNotification::Run() {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
}
- if (mobile_apis::RequestType::OEM_SPECIFIC == request_type) {
- (*message_)[strings::params][strings::binary_data] = binary_data;
- } else if (mobile_apis::RequestType::PROPRIETARY == request_type) {
+ if (mobile_apis::RequestType::PROPRIETARY == request_type) {
/* According to requirements:
"If the requestType = PROPRIETARY, add to mobile API fileType = JSON
- If the requestType = HTTP, add to mobile API fileType = BINARY"
- Also we don't save the PT to file - we put it directly in binary_data */
+ If the requestType = HTTP, add to mobile API fileType = BINARY" */
#if defined(PROPRIETARY_MODE)
AddHeader(binary_data);
#endif // PROPRIETARY_MODE
-#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
- (*message_)[strings::params][strings::binary_data] = binary_data;
-#endif // PROPRIETARY_MODE
-
(*message_)[strings::msg_params][strings::file_type] = FileType::JSON;
} else if (mobile_apis::RequestType::HTTP == request_type) {
(*message_)[strings::msg_params][strings::file_type] = FileType::BINARY;
@@ -150,13 +136,21 @@ void OnSystemRequestNotification::Run() {
policy_handler.TimeoutExchangeSec();
}
} else if (mobile_apis::RequestType::LOCK_SCREEN_ICON_URL == request_type) {
- if (!(*message_)[strings::msg_params].keyExists(strings::url) ||
- (*message_)[strings::msg_params][strings::url].empty()) {
- SDL_LOG_ERROR("discarding LOCK_SCREEN_ICON_URL request without URL");
+ if (binary_data.empty() &&
+ (!(*message_)[strings::msg_params].keyExists(strings::url) ||
+ (*message_)[strings::msg_params][strings::url].empty())) {
+ SDL_LOG_ERROR(
+ "discarding LOCK_SCREEN_ICON_URL request with no URL or data");
return;
}
}
+#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
+ if (!binary_data.empty()) {
+ (*message_)[strings::params][strings::binary_data] = binary_data;
+ }
+#endif // PROPRIETARY_MODE
+
SendNotification();
}
@@ -234,7 +228,7 @@ size_t OnSystemRequestNotification::ParsePTString(
if (pt_string[i] == '\"' || pt_string[i] == '\\') {
result += '\\';
} else if (pt_string[i] == '\n') {
- result_length--; // contentLength is adjusted when this character is
+ --result_length; // contentLength is adjusted when this character is
// not copied to result.
continue;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
index 33413f805d..4aa0d9c630 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
@@ -67,7 +67,6 @@ void OnWayPointChangeNotification::Run() {
(*message_)[strings::params][strings::connection_key] = *app_id;
SendNotification();
}
- application_manager_.SaveWayPointsMessage(message_);
}
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc
new file mode 100644
index 0000000000..ad1b0c7ef7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification_from_mobile.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2020, 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 "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message.h"
+#include "application_manager/message_helper.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+OnWayPointChangeNotificationFromMobile::OnWayPointChangeNotificationFromMobile(
+ 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) {}
+
+OnWayPointChangeNotificationFromMobile::
+ ~OnWayPointChangeNotificationFromMobile() {}
+
+void OnWayPointChangeNotificationFromMobile::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ SDL_LOG_ERROR(
+ "OnWayPointChangeNotificationFromMobile application doesn't exist");
+ return;
+ }
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindWayPointsHandler();
+ if (!service || !service->mobile_service ||
+ service->connection_key != connection_key()) {
+ SDL_LOG_ERROR("Application is not active NAVIGATION ASP");
+ return;
+ }
+
+ application_manager_.SaveWayPointsMessage(message_, connection_key());
+
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index f7429aa2fd..690623528f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
+
#include <cstring>
#include "application_manager/application_impl.h"
@@ -53,23 +54,21 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM)
- , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {
- subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-}
+ , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {}
PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {}
-void PerformAudioPassThruRequest::onTimeOut() {
+void PerformAudioPassThruRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
FinishTTSSpeak();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
}
bool PerformAudioPassThruRequest::Init() {
@@ -183,24 +182,19 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
StartMicrophoneRecording();
// update request timeout to get time for perform audio recording
- application_manager_.updateRequestTimeout(
+ application_manager_.UpdateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
}
break;
}
- case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- SDL_LOG_INFO("Received TTS_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
default: {
SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
- if (IsWaitingHMIResponse()) {
+ if (IsPendingResponseExist()) {
+ SDL_LOG_DEBUG("Command still wating for HMI response");
return;
}
@@ -224,20 +218,17 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
HmiInterfaces::HMI_INTERFACE_TTS,
application_manager_);
- // Note(dtrunov): According to requirment "WARNINGS, success:true on getting
- // UNSUPPORTED_RESOURCE for "ttsChunks"
+ response_params_.success =
+ PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) {
response_params_.result_code = mobile_apis::Result::WARNINGS;
- tts_info_ = "Unsupported phoneme type sent in a prompt";
response_params_.info = app_mngr::commands::MergeInfos(
ui_perform_info, ui_info_, tts_perform_info, tts_info_);
response_params_.success = true;
return response_params_;
}
- response_params_.success =
- PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) {
response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index a3269847a1..bf0f05ba32 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -68,22 +68,19 @@ PerformInteractionRequest::PerformInteractionRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM)
, ui_choice_id_received_(INVALID_CHOICE_ID)
, vr_choice_id_received_(INVALID_CHOICE_ID)
- , ui_response_received_(false)
- , vr_response_received_(false)
, app_pi_was_active_before_(false)
, vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM)
, ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {
response_msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand);
subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress);
}
@@ -195,8 +192,7 @@ void PerformInteractionRequest::Run() {
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
SDL_LOG_DEBUG("Interaction Mode: BOTH");
- if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
- !CheckVrHelpItemPositions(app) ||
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app) ||
!CheckChoiceSetListVRCommands(app)) {
return;
}
@@ -204,8 +200,7 @@ void PerformInteractionRequest::Run() {
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
SDL_LOG_DEBUG("Interaction Mode: MANUAL_ONLY");
- if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
- !CheckVrHelpItemPositions(app)) {
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) {
return;
}
break;
@@ -229,6 +224,10 @@ void PerformInteractionRequest::Run() {
app->set_perform_interaction_layout(interaction_layout);
// increment amount of active requests
++pi_requests_count_;
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
SendVRPerformInteractionRequest(app);
SendUIPerformInteractionRequest(app);
}
@@ -238,34 +237,26 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- SDL_LOG_DEBUG("Received UI_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
case hmi_apis::FunctionID::UI_PerformInteraction: {
SDL_LOG_DEBUG("Received UI_PerformInteraction event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- ui_response_received_ = true;
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, ui_info_);
- ProcessUIResponse(event.smart_object(), response_msg_params);
+ ProcessUIResponse(event.smart_object());
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
SDL_LOG_DEBUG("Received VR_PerformInteraction");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
- vr_response_received_ = true;
unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction);
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, vr_info_);
- if (ProcessVRResponse(event.smart_object(), response_msg_params)) {
+ if (ProcessVRResponse(event.smart_object())) {
return;
}
break;
@@ -290,19 +281,20 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
}
-void PerformInteractionRequest::onTimeOut() {
+void PerformInteractionRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
SDL_LOG_DEBUG("Interaction Mode: BOTH");
- if (true == vr_response_received_) {
+ if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
} else {
- application_manager_.updateRequestTimeout(
+ application_manager_.UpdateRequestTimeout(
connection_key(), correlation_id(), default_timeout_);
+ set_current_state(RequestState::kAwaitingResponse);
}
break;
}
@@ -310,14 +302,14 @@ void PerformInteractionRequest::onTimeOut() {
SDL_LOG_DEBUG("Interaction Mode: VR_ONLY");
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
SDL_LOG_DEBUG("InteractionMode: MANUAL_ONLY");
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
DisablePerformInteraction();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
break;
}
default: {
@@ -328,8 +320,7 @@ void PerformInteractionRequest::onTimeOut() {
}
bool PerformInteractionRequest::ProcessVRResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace mobile_apis;
@@ -343,9 +334,6 @@ bool PerformInteractionRequest::ProcessVRResponse(
return false;
}
- msg_params[strings::trigger_source] =
- static_cast<int32_t>(TriggerSource::TS_VR);
-
const bool is_vr_aborted_timeout = Compare<Common_Result::eType, EQ, ONE>(
vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT);
@@ -357,13 +345,15 @@ bool PerformInteractionRequest::ProcessVRResponse(
SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_));
return true;
}
+
SDL_LOG_DEBUG("Update timeout for UI");
- application_manager_.updateRequestTimeout(
+ application_manager_.UpdateRequestTimeout(
+
connection_key(), correlation_id(), default_timeout_);
return false;
}
- if (!ui_response_received_ &&
+ if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) &&
InteractionMode::MANUAL_ONLY != interaction_mode_) {
SendClosePopupRequestToHMI();
}
@@ -384,7 +374,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
SDL_LOG_DEBUG("Update timeout for UI");
- application_manager_.updateRequestTimeout(
+ application_manager_.UpdateRequestTimeout(
connection_key(), correlation_id(), default_timeout_);
}
@@ -403,8 +393,7 @@ bool PerformInteractionRequest::ProcessVRResponse(
}
void PerformInteractionRequest::ProcessUIResponse(
- const smart_objects::SmartObject& message,
- smart_objects::SmartObject& msg_params) {
+ const smart_objects::SmartObject& message) {
SDL_LOG_AUTO_TRACE();
using namespace helpers;
using namespace smart_objects;
@@ -436,38 +425,30 @@ void PerformInteractionRequest::ProcessUIResponse(
ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
if (result) {
+ const smart_objects::SmartObject& hmi_msg_params =
+ message[strings::msg_params];
if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
ui_info_ = message[strings::msg_params][strings::info].asString();
- } else {
- if (message.keyExists(strings::msg_params)) {
- msg_params = message[strings::msg_params];
- }
- if (is_pi_warning) {
- ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = message[strings::msg_params][strings::info].asString();
- }
+ } else if (is_pi_warning) {
+ ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
+ ui_info_ = message[strings::msg_params][strings::info].asString();
}
// result code must be GENERIC_ERROR in case wrong choice_id
- if (msg_params.keyExists(strings::choice_id)) {
+ if (hmi_msg_params.keyExists(strings::choice_id)) {
const std::int32_t ui_choice_id =
- static_cast<std::int32_t>(msg_params[strings::choice_id].asInt());
+ static_cast<std::int32_t>(hmi_msg_params[strings::choice_id].asInt());
if (!CheckChoiceIDFromResponse(app, ui_choice_id)) {
ui_result_code_ = hmi_apis::Common_Result::GENERIC_ERROR;
ui_info_ = "Wrong choiceID was received from HMI";
} else {
ui_choice_id_received_ = ui_choice_id;
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_MENU;
- }
- } else if (msg_params.keyExists(strings::manual_text_entry)) {
- msg_params[strings::trigger_source] =
- mobile_apis::TriggerSource::TS_KEYBOARD;
- if (msg_params[strings::manual_text_entry].empty()) {
- msg_params.erase(strings::manual_text_entry);
}
+ } else if (hmi_msg_params.keyExists(strings::manual_text_entry)) {
+ ui_text_entry_received_ =
+ hmi_msg_params[strings::manual_text_entry].asString();
}
}
}
@@ -696,60 +677,6 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true);
}
-bool PerformInteractionRequest::CheckChoiceSetMenuNames(
- application_manager::ApplicationSharedPtr const app) {
- SDL_LOG_AUTO_TRACE();
-
- smart_objects::SmartObject& choice_list =
- (*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
-
- for (size_t i = 0; i < choice_list.length(); ++i) {
- // choice_set contains SmartObject msg_params
- smart_objects::SmartObject i_choice_set =
- app->FindChoiceSet(choice_list[i].asInt());
-
- for (size_t j = 0; j < choice_list.length(); ++j) {
- smart_objects::SmartObject j_choice_set =
- app->FindChoiceSet(choice_list[j].asInt());
-
- if (i == j) {
- // skip check the same element
- continue;
- }
-
- if ((smart_objects::SmartType_Null == i_choice_set.getType()) ||
- (smart_objects::SmartType_Null == j_choice_set.getType())) {
- SDL_LOG_ERROR("Invalid ID");
- SendResponse(false, mobile_apis::Result::INVALID_ID);
- return false;
- }
-
- size_t ii = 0;
- size_t jj = 0;
- for (; ii < i_choice_set[strings::choice_set].length(); ++ii) {
- for (; jj < j_choice_set[strings::choice_set].length(); ++jj) {
- const std::string& ii_menu_name =
- i_choice_set[strings::choice_set][ii][strings::menu_name]
- .asString();
- const std::string& jj_menu_name =
- j_choice_set[strings::choice_set][jj][strings::menu_name]
- .asString();
-
- if (ii_menu_name == jj_menu_name) {
- SDL_LOG_ERROR("Choice set has duplicated menu name");
- SendResponse(false,
- mobile_apis::Result::DUPLICATE_NAME,
- "Choice set has duplicated menu name");
- return false;
- }
- }
- }
- }
- }
-
- return true;
-}
-
bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
application_manager::ApplicationSharedPtr const app) {
SDL_LOG_AUTO_TRACE();
@@ -1064,7 +991,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
const bool PerformInteractionRequest::HasHMIResponsesToWait() const {
SDL_LOG_AUTO_TRACE();
- return !ui_response_received_ || !vr_response_received_;
+ return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) ||
+ IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR);
}
void PerformInteractionRequest::SendBothModeResponse(
@@ -1124,25 +1052,41 @@ PerformInteractionRequest::PrepareResultCodeForResponse(
if (INVALID_CHOICE_ID != vr_choice_id_received_) {
return mobile_vr_result_code;
}
- if (INVALID_CHOICE_ID != ui_choice_id_received_) {
+ if (INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty()) {
return mobile_ui_result_code;
}
- return CommandRequestImpl::PrepareResultCodeForResponse(ui_response,
- vr_response);
+ return RequestFromMobileImpl::PrepareResultCodeForResponse(ui_response,
+ vr_response);
}
bool PerformInteractionRequest::PrepareResultForMobileResponse(
app_mngr::commands::ResponseInfo& ui_response,
app_mngr::commands::ResponseInfo& vr_response) const {
+ bool vr_choice_received = INVALID_CHOICE_ID != vr_choice_id_received_;
+ bool ui_choice_received = INVALID_CHOICE_ID != ui_choice_id_received_ ||
+ !ui_text_entry_received_.empty();
+
+ bool vr_response_success =
+ vr_response.is_ok ||
+ (vr_response.is_unsupported_resource &&
+ vr_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ vr_choice_received);
+ bool ui_response_success =
+ ui_response.is_ok ||
+ (ui_response.is_unsupported_resource &&
+ ui_response.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE &&
+ ui_choice_received);
+
if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
- return vr_response.is_ok;
+ return vr_response_success;
}
if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- return ui_response.is_ok;
+ return ui_response_success;
}
- return (vr_response.is_ok || ui_response.is_ok);
+ return (vr_response_success || ui_response_success);
}
bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
@@ -1151,27 +1095,27 @@ bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_;
const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_;
-
if (ui_choice_id_valid && vr_choice_id_valid &&
ui_choice_id_received_ != vr_choice_id_received_) {
return false;
}
- switch (interaction_mode_) {
- case mobile_apis::InteractionMode::eType::MANUAL_ONLY:
- if (ui_choice_id_valid) {
- msg_param[strings::choice_id] = ui_choice_id_received_;
- }
- case mobile_apis::InteractionMode::eType::VR_ONLY:
- if (vr_choice_id_valid) {
- msg_param[strings::choice_id] = vr_choice_id_received_;
- }
- default:
- if (ui_choice_id_valid) {
- msg_param[strings::choice_id] = ui_choice_id_received_;
- } else if (vr_choice_id_valid) {
- msg_param[strings::choice_id] = vr_choice_id_received_;
- }
+ if (!ui_text_entry_received_.empty()) {
+ msg_param[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_KEYBOARD;
+ msg_param[strings::manual_text_entry] = ui_text_entry_received_;
+ return true;
+ }
+
+ if (ui_choice_id_valid &&
+ interaction_mode_ != mobile_apis::InteractionMode::eType::VR_ONLY) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_MENU;
+ msg_param[strings::choice_id] = ui_choice_id_received_;
+ } else if (vr_choice_id_valid &&
+ interaction_mode_ !=
+ mobile_apis::InteractionMode::eType::MANUAL_ONLY) {
+ msg_param[strings::trigger_source] = mobile_apis::TriggerSource::TS_VR;
+ msg_param[strings::choice_id] = vr_choice_id_received_;
}
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
index 5263991716..1db62f0669 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -69,11 +69,11 @@ PutFileRequest::PutFileRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, offset_(0)
, sync_file_name_()
, length_(0)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 6ac830c378..9a9aa0c533 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
@@ -134,11 +134,11 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, are_tts_chunks_invalid_(false)
, are_hmi_types_invalid_(false)
, is_resumption_failed_(false)
@@ -159,18 +159,6 @@ uint32_t RegisterAppInterfaceRequest::default_timeout() const {
return 0;
}
-void RegisterAppInterfaceRequest::WaitForHMIIsReady() {
- while (!application_manager_.IsStopping() &&
- !application_manager_.IsHMICooperating()) {
- SDL_LOG_DEBUG("Waiting for the HMI... conn_key="
- << connection_key() << ", correlation_id=" << correlation_id()
- << ", default_timeout=" << default_timeout()
- << ", thread=" << pthread_self());
- sleep(1);
- // TODO(DK): timer_->StartWait(1);
- }
-}
-
void RegisterAppInterfaceRequest::FillApplicationParams(
ApplicationSharedPtr application) {
SDL_LOG_AUTO_TRACE();
@@ -236,7 +224,8 @@ void RegisterAppInterfaceRequest::FillApplicationParams(
application->set_webengine_projection_enabled(true);
break;
}
- default: {}
+ default: {
+ }
}
}
}
@@ -451,6 +440,8 @@ void FinishSendingResponseToMobile(const smart_objects::SmartObject& msg_params,
&(msg_params[strings::app_hmi_type]));
}
+ application->MarkRegistered();
+
// Default HMI level should be set before any permissions validation, since
// it relies on HMI level.
app_manager.OnApplicationRegistered(application);
@@ -488,10 +479,8 @@ void RegisterAppInterfaceRequest::Run() {
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG("Connection key is " << connection_key());
- WaitForHMIIsReady();
-
- if (application_manager_.IsStopping()) {
- SDL_LOG_WARN("The ApplicationManager is stopping!");
+ if (!application_manager_.WaitForHmiIsReady()) {
+ SDL_LOG_WARN("Failed to wait for HMI readiness");
return;
}
@@ -716,8 +705,11 @@ void RegisterAppInterfaceRequest::Run() {
SendOnAppRegisteredNotificationToHMI(
application, is_resumption_required && !is_resumption_failed_);
- // By default app subscribed to CUSTOM_BUTTON
- SendSubscribeCustomButtonNotification();
+ if (CheckHMICapabilities(mobile_apis::ButtonName::CUSTOM_BUTTON)) {
+ SDL_LOG_DEBUG("CUSTOM_BUTTON available");
+ SendSubscribeCustomButtonRequest();
+ }
+
SendChangeRegistrationOnHMI(application);
if (is_resumption_required) {
@@ -742,7 +734,6 @@ void RegisterAppInterfaceRequest::Run() {
}
CheckLanguage();
-
SendRegisterAppInterfaceResponseToMobile(
ApplicationType::kNewApplication, status_notifier, add_info);
}
@@ -997,12 +988,13 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
file_system::FileExists(application->app_icon_path());
smart_objects::SmartObject msg_params_copy = msg_params;
+ ApplicationManager& app_manager = application_manager_;
const auto result_code = CalculateFinalResultCode();
SendResponse(true, result_code, response_info_.c_str(), &response_params);
FinishSendingResponseToMobile(
- msg_params_copy, application_manager_, key, status_notifier);
+ msg_params_copy, app_manager, key, status_notifier);
}
void RegisterAppInterfaceRequest::SendChangeRegistration(
@@ -1473,14 +1465,14 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
}
}
-void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
+void RegisterAppInterfaceRequest::SendSubscribeCustomButtonRequest() {
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
SmartObject msg_params = SmartObject(SmartType_Map);
msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
- msg_params[strings::is_suscribed] = true;
- CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
- msg_params);
+ msg_params[strings::button_name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
+ SendHMIRequest(
+ hmi_apis::FunctionID::Buttons_SubscribeButton, &msg_params, false);
}
bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index 40302e51d5..92c5d19a05 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -35,7 +35,6 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
@@ -52,13 +51,14 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
- , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
+ , tts_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {}
@@ -89,6 +89,10 @@ void ResetGlobalPropertiesRequest::Run() {
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
}
+ if (reset_global_props_result.HasRCPropertiesReset()) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
+ }
+
app->set_reset_global_properties_active(true);
if (reset_global_props_result.HasUIPropertiesReset()) {
@@ -110,6 +114,15 @@ void ResetGlobalPropertiesRequest::Run() {
SendHMIRequest(
hmi_apis::FunctionID::TTS_SetGlobalProperties, msg_params.get(), true);
}
+
+ if (reset_global_props_result.HasRCPropertiesReset()) {
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateRCResetGlobalPropertiesRequest(
+ reset_global_props_result, app);
+
+ SendHMIRequest(
+ hmi_apis::FunctionID::RC_SetGlobalProperties, msg_params.get(), true);
+ }
}
void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
@@ -133,6 +146,14 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
GetInfo(message, tts_response_info_);
break;
}
+ case hmi_apis::FunctionID::RC_SetGlobalProperties: {
+ SDL_LOG_INFO("Received RC_SetGlobalProperties event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
+ rc_result_ = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ GetInfo(message, rc_response_info_);
+ break;
+ }
default: {
SDL_LOG_ERROR("Received unknown event " << event.id());
return;
@@ -170,6 +191,8 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
app_mngr::commands::ResponseInfo tts_properties_info(
tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_);
+ app_mngr::commands::ResponseInfo rc_properties_info(
+ rc_result_, HmiInterfaces::HMI_INTERFACE_RC, application_manager_);
HmiInterfaces::InterfaceState tts_interface_state =
application_manager_.hmi_interfaces().GetInterfaceState(
@@ -182,24 +205,18 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
out_result_code = mobile_apis::Result::WARNINGS;
out_response_info = "Unsupported phoneme type sent in a prompt";
} else {
- result =
- PrepareResultForMobileResponse(ui_properties_info, tts_properties_info);
- out_result_code =
- PrepareResultCodeForResponse(ui_properties_info, tts_properties_info);
- out_response_info = app_mngr::commands::MergeInfos(tts_properties_info,
- tts_response_info_,
- ui_properties_info,
- ui_response_info_);
+ result = PrepareResultForMobileResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+ out_result_code = PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ out_response_info = app_mngr::commands::MergeInfos(
+ tts_response_info_, ui_response_info_, rc_response_info_);
}
return result;
}
-bool ResetGlobalPropertiesRequest::IsPendingResponseExist() {
- return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) ||
- IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI);
-}
-
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
index 89e77d9d19..573c340201 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
@@ -54,13 +54,11 @@ ScrollableMessageRequest::ScrollableMessageRequest(
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) {
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
-}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
ScrollableMessageRequest::~ScrollableMessageRequest() {}
@@ -131,12 +129,6 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- SDL_LOG_INFO("Received UI_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
case hmi_apis::FunctionID::UI_ScrollableMessage: {
SDL_LOG_INFO("Received UI_ScrollableMessage event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
index a6f980b9ba..b7cf0e15ac 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
@@ -57,15 +57,7 @@ ScrollableMessageResponse::ScrollableMessageResponse(
void ScrollableMessageResponse::Run() {
SDL_LOG_AUTO_TRACE();
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
- (*message_)[strings::msg_params][strings::result_code].asInt());
- ApplicationSharedPtr application = application_manager_.application(
- (*message_)[strings::params][strings::connection_key].asInt());
- if ((mobile_apis::Result::REJECTED != result_code) && application) {
- application->UnsubscribeFromSoftButtons(
- (*message_)[strings::params][strings::function_id].asInt());
- }
+ application_manager_.UnsubscribeAppFromSoftButtons(message_);
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
index aa5e1077ca..b5e629320a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
@@ -48,11 +48,11 @@ SendHapticDataRequest::SendHapticDataRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SendHapticDataRequest::~SendHapticDataRequest() {}
@@ -70,6 +70,7 @@ void SendHapticDataRequest::Run() {
}
if (app->is_navi() || app->mobile_projection_enabled()) {
+ msg_params[strings::app_id] = connection_key();
SendHMIRequest(hmi_apis::FunctionID::UI_SendHapticData, &msg_params, true);
} else {
SendResponse(false,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
index fcc898b348..7cf226c968 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
@@ -48,11 +48,11 @@ SendLocationRequest::SendLocationRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SendLocationRequest::~SendLocationRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
index 9f30478111..8eb3b9e1ec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
@@ -54,11 +54,11 @@ SetAppIconRequest::SetAppIconRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, is_icons_saving_enabled_(false) {
const std::string path =
application_manager_.get_settings().app_icons_folder();
@@ -116,8 +116,8 @@ void SetAppIconRequest::Run() {
msg_params[strings::sync_file_name] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- // For further use in on_event function
- full_file_path_for_hmi_ = file_system::ConvertPathForURL(full_file_path);
+ // for further use in on_event function
+ full_file_path_for_hmi_ = full_file_path;
msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi_;
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
index 45ff0078fb..98cae4856f 100644
--- 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
@@ -15,11 +15,11 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
index b2ca3e6cfa..ba0a20b459 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
@@ -49,11 +49,11 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index 396763ff98..b8f1e3d70f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -73,11 +73,11 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, is_ui_send_(false)
, is_tts_send_(false)
, is_rc_send_(false)
@@ -151,6 +151,17 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
+ if (!ValidateCustomKeys()) {
+ SDL_LOG_ERROR(
+ "Number of customizable keys exceeds the maximum number for this "
+ "layout");
+ SendResponse(
+ false,
+ mobile_apis::Result::INVALID_DATA,
+ "customKeys exceeds the number of customizable keys in this Layout");
+ return;
+ }
+
// if application waits for sending ttsGlobalProperties need to remove this
// application from tts_global_properties_app_list_
application_manager_.RemoveAppFromTTSGlobalPropertiesList(connection_key());
@@ -175,6 +186,7 @@ void SetGlobalPropertiesRequest::Run() {
msg_params[strings::menu_layout].asUInt());
if (app->menu_layout_supported(menu_layout)) {
params[strings::menu_layout] = msg_params[strings::menu_layout];
+ app->set_menu_layout(msg_params[strings::menu_layout]);
} else {
is_menu_layout_available_ = false;
}
@@ -414,10 +426,10 @@ bool SetGlobalPropertiesRequest::Init() {
return true;
}
-void SetGlobalPropertiesRequest::onTimeOut() {
+void SetGlobalPropertiesRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
- CommandRequestImpl::onTimeOut();
+ RequestFromMobileImpl::OnTimeOut();
auto& resume_ctrl = application_manager_.resume_controller();
@@ -443,7 +455,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters(
bool result = false;
if (!is_rc_send_) {
- result = CommandRequestImpl::PrepareResultForMobileResponse(
+ result = RequestFromMobileImpl::PrepareResultForMobileResponse(
ui_properties_info, tts_properties_info);
} else {
result = PrepareResultForMobileResponse(
@@ -464,7 +476,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters(
}
if (!is_rc_send_) {
- result_code = CommandRequestImpl::PrepareResultCodeForResponse(
+ result_code = RequestFromMobileImpl::PrepareResultCodeForResponse(
ui_properties_info, tts_properties_info);
} else {
result_code = PrepareResultCodeForResponse(
@@ -505,8 +517,9 @@ bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse(
(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code) ||
(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code);
- const bool final_result = CommandRequestImpl::CheckResult(both_info, third) ||
- CommandRequestImpl::CheckResult(third, both_info);
+ const bool final_result =
+ RequestFromMobileImpl::CheckResultCode(both_info, third) ||
+ RequestFromMobileImpl::CheckResultCode(third, both_info);
return final_result;
}
@@ -642,7 +655,53 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
if (is_keyboard_props_present) {
out_params[hmi_request::keyboard_properties] =
msg_params[hmi_request::keyboard_properties];
- app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]);
+ smart_objects::SmartObject cached_keyboard_props(
+ msg_params[hmi_request::keyboard_properties]);
+
+ if (cached_keyboard_props.keyExists(hmi_request::auto_complete_list)) {
+ auto auto_complete_list =
+ cached_keyboard_props[hmi_request::auto_complete_list].asArray();
+ if (auto_complete_list && auto_complete_list->empty()) {
+ cached_keyboard_props.erase(hmi_request::auto_complete_list);
+ }
+ }
+
+ auto saved_keyboard_props = app->keyboard_props();
+ if (!saved_keyboard_props) {
+ app->set_keyboard_props(cached_keyboard_props);
+ return;
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::keyboard_layout) &&
+ saved_keyboard_props->keyExists(hmi_request::keyboard_layout)) {
+ cached_keyboard_props[hmi_request::keyboard_layout] =
+ static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ (*saved_keyboard_props)[hmi_request::keyboard_layout].asInt());
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_response::language) &&
+ saved_keyboard_props->keyExists(hmi_response::language)) {
+ cached_keyboard_props[hmi_response::language] =
+ static_cast<hmi_apis::Common_Language::eType>(
+ (*saved_keyboard_props)[hmi_response::language].asInt());
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::auto_complete_list) &&
+ saved_keyboard_props->keyExists(hmi_request::auto_complete_list)) {
+ cached_keyboard_props[hmi_request::auto_complete_list] =
+ (*saved_keyboard_props)[hmi_request::auto_complete_list];
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::mask_input_characters) &&
+ saved_keyboard_props->keyExists(hmi_request::mask_input_characters)) {
+ cached_keyboard_props[hmi_request::mask_input_characters] =
+ (*saved_keyboard_props)[hmi_request::mask_input_characters];
+ }
+ app->set_keyboard_props(cached_keyboard_props);
}
}
@@ -820,9 +879,130 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
}
}
+
+ if (msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::custom_keys)) {
+ const smart_objects::SmartArray* custom_keys_array =
+ msg_params[strings::keyboard_properties][hmi_request::custom_keys]
+ .asArray();
+
+ for (auto keys : (*custom_keys_array)) {
+ if (!CheckSyntax(keys.asCharArray())) {
+ SDL_LOG_ERROR(
+ "Invalid keyboard_properties "
+ "custom_keys syntax check failed");
+ return true;
+ }
+ }
+ }
}
+
return false;
}
+hmi_apis::Common_KeyboardLayout::eType
+SetGlobalPropertiesRequest::GetKeyboardLayout() const {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+ if (msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::keyboard_layout)) {
+ return static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ msg_params[strings::keyboard_properties][hmi_request::keyboard_layout]
+ .asInt());
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ auto saved_keyboard_props = app->keyboard_props();
+ if (saved_keyboard_props) {
+ if (saved_keyboard_props->keyExists(hmi_request::keyboard_layout)) {
+ return static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ (*saved_keyboard_props)[hmi_request::keyboard_layout].asInt());
+ }
+ }
+
+ return hmi_apis::Common_KeyboardLayout::QWERTY;
+}
+
+uint32_t SetGlobalPropertiesRequest::GetAllowedNumberOfConfigurableKeys()
+ const {
+ SDL_LOG_AUTO_TRACE();
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ auto display_capabilities = app->display_capabilities();
+ if (!display_capabilities) {
+ SDL_LOG_WARN("Display capabilities are not available");
+ return 0;
+ }
+
+ auto* window_capabilities =
+ (*display_capabilities)[0][strings::window_capabilities].asArray();
+
+ if (!window_capabilities) {
+ SDL_LOG_WARN("Window capabilities are not available");
+ return 0;
+ }
+
+ if (!(*window_capabilities)[0].keyExists(
+ hmi_response::keyboard_capabilities)) {
+ SDL_LOG_WARN("Keyboard capabilities are not available");
+ return 0;
+ }
+
+ if (!(*window_capabilities)[0][hmi_response::keyboard_capabilities].keyExists(
+ hmi_response::supported_keyboards)) {
+ SDL_LOG_WARN("Data about supported keyboards is not available");
+ return 0;
+ }
+
+ auto supported_keyboards =
+ (*window_capabilities)[0][hmi_response::keyboard_capabilities]
+ [hmi_response::supported_keyboards]
+ .asArray();
+
+ const auto requested_layout = GetKeyboardLayout();
+ for (auto keyboard : (*supported_keyboards)) {
+ if (requested_layout ==
+ static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ keyboard[hmi_request::keyboard_layout].asInt())) {
+ return keyboard[hmi_response::num_configurable_keys].asUInt();
+ }
+ }
+
+ return 0;
+}
+
+bool SetGlobalPropertiesRequest::ValidateCustomKeys() const {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ if (!msg_params.keyExists(strings::keyboard_properties)) {
+ SDL_LOG_WARN("Keyboard properties are not available");
+ return true;
+ }
+
+ if (!msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::custom_keys)) {
+ SDL_LOG_WARN("Customizable keys are not available");
+ return true;
+ }
+
+ auto custom_keys_array =
+ msg_params[strings::keyboard_properties][hmi_request::custom_keys]
+ .asArray();
+ if (custom_keys_array) {
+ uint32_t requested_key_count = custom_keys_array->size();
+ uint32_t allowed_key_count = GetAllowedNumberOfConfigurableKeys();
+
+ if (requested_key_count > allowed_key_count) {
+ return false;
+ }
+ }
+
+ return true;
+}
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
index cf5d80ecc0..b2c9f46940 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
@@ -37,6 +37,7 @@
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -51,11 +52,11 @@ SetMediaClockRequest::SetMediaClockRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SetMediaClockRequest::~SetMediaClockRequest() {}
@@ -76,7 +77,8 @@ void SetMediaClockRequest::Run() {
return;
}
- if (isDataValid()) {
+ std::string info;
+ if (isDataValid(info)) {
// copy entirely msg
smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = app->app_id();
@@ -85,7 +87,9 @@ void SetMediaClockRequest::Run() {
SendHMIRequest(
hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true);
} else {
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ info.empty() ? NULL : info.c_str());
}
}
@@ -117,7 +121,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) {
}
}
-bool SetMediaClockRequest::isDataValid() {
+bool SetMediaClockRequest::isDataValid(std::string& info) {
smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
mobile_apis::UpdateMode::eType update_mode =
static_cast<mobile_apis::UpdateMode::eType>(
@@ -126,7 +130,10 @@ bool SetMediaClockRequest::isDataValid() {
if (update_mode == mobile_apis::UpdateMode::COUNTUP ||
update_mode == mobile_apis::UpdateMode::COUNTDOWN) {
if (!msg_params.keyExists(strings::start_time)) {
- SDL_LOG_INFO("Invalid data");
+ info =
+ "Start time must be provided for \"COUNTUP\" and \"COUNTDOWN\" "
+ "update modes";
+ SDL_LOG_INFO("Invalid data: " << info);
return false;
}
@@ -151,7 +158,33 @@ bool SetMediaClockRequest::isDataValid() {
(update_mode == mobile_apis::UpdateMode::COUNTDOWN)) ||
((end_time_in_seconds < start_time_in_seconds) &&
(update_mode == mobile_apis::UpdateMode::COUNTUP))) {
- SDL_LOG_INFO("Invalid data");
+ std::string update_mode_name;
+ smart_objects::EnumConversionHelper<
+ mobile_apis::UpdateMode::eType>::EnumToString(update_mode,
+ &update_mode_name);
+ info = "Start time must be " +
+ std::string((update_mode == mobile_apis::UpdateMode::COUNTUP)
+ ? "before"
+ : "after") +
+ " the end time for update mode " + update_mode_name;
+ SDL_LOG_INFO("Invalid data: " << info);
+ return false;
+ }
+ }
+ }
+
+ std::vector<std::string> indicator_keys{strings::forward_seek_indicator,
+ strings::back_seek_indicator};
+ for (auto& key : indicator_keys) {
+ if (msg_params.keyExists(key)) {
+ mobile_apis::SeekIndicatorType::eType seek_indicator_type =
+ static_cast<mobile_apis::SeekIndicatorType::eType>(
+ msg_params[key][strings::type].asUInt());
+ if (seek_indicator_type == mobile_apis::SeekIndicatorType::TRACK &&
+ msg_params[key].keyExists(strings::seek_time)) {
+ info =
+ "The seekTime parameter is not applicable for indicator type TRACK";
+ SDL_LOG_INFO("Invalid data: " << info);
return false;
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
index fdcf9d2434..4f7a46d1e7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
@@ -47,11 +47,11 @@ ShowAppMenuRequest::ShowAppMenuRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
ShowAppMenuRequest::~ShowAppMenuRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
index cfb9d5896e..6e21861e0a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
@@ -54,11 +54,11 @@ ShowConstantTBTRequest::ShowConstantTBTRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
ShowConstantTBTRequest::~ShowConstantTBTRequest() {}
@@ -132,8 +132,9 @@ void ShowConstantTBTRequest::Run() {
msg_params.erase(strings::navigation_text_1);
msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::navigationText1);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::navigation_text_1];
+ ++index;
}
if (msg_params.keyExists(strings::navigation_text_2)) {
@@ -141,8 +142,9 @@ void ShowConstantTBTRequest::Run() {
msg_params.erase(strings::navigation_text_2);
msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::navigationText2);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::navigation_text_2];
+ ++index;
}
if (msg_params.keyExists(strings::eta)) {
@@ -150,8 +152,9 @@ void ShowConstantTBTRequest::Run() {
msg_params.erase(strings::eta);
msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::ETA);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::eta];
+ ++index;
}
if (msg_params.keyExists(strings::total_distance)) {
@@ -159,8 +162,9 @@ void ShowConstantTBTRequest::Run() {
msg_params.erase(strings::total_distance);
msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::totalDistance);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::total_distance];
+ ++index;
}
if (msg_params.keyExists(strings::time_to_destination)) {
@@ -168,8 +172,9 @@ void ShowConstantTBTRequest::Run() {
msg_params.erase(strings::time_to_destination);
msg_params[hmi_request::navi_texts][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination);
- msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] =
+ msg_params[hmi_request::navi_texts][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::time_to_destination];
+ ++index;
}
if (msg_params.keyExists(strings::soft_buttons)) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
index 7d546079e8..a2362a74bc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
@@ -60,6 +60,8 @@ ShowConstantTBTResponse::~ShowConstantTBTResponse() {}
void ShowConstantTBTResponse::Run() {
SDL_LOG_AUTO_TRACE();
+ application_manager_.UnsubscribeAppFromSoftButtons(message_);
+
rpc_service_.SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index 910ab9ef23..7b7518f4d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
@@ -52,11 +52,11 @@ ShowRequest::ShowRequest(
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)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, core_result_code_(mobile_apis::Result::INVALID_ENUM)
, current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
, template_config_(smart_objects::SmartType::SmartType_Null)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
index cbc0ca6258..f87a209c48 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
@@ -51,13 +51,11 @@ SliderRequest::SliderRequest(
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) {
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
-}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SliderRequest::~SliderRequest() {}
@@ -65,8 +63,7 @@ bool SliderRequest::Init() {
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ =
- application_manager_.get_settings().default_timeout() +
+ default_timeout_ +=
(*message_)[strings::msg_params][strings::timeout].asUInt();
}
@@ -134,12 +131,6 @@ void SliderRequest::on_event(const event_engine::Event& event) {
const SmartObject& message = event.smart_object();
const event_engine::Event::EventID event_id = event.id();
- if (event_id == hmi_apis::FunctionID::UI_OnResetTimeout) {
- SDL_LOG_INFO("Received UI_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- return;
- }
if (event_id != hmi_apis::FunctionID::UI_Slider) {
SDL_LOG_ERROR("Received unknown event " << event.id());
@@ -153,21 +144,6 @@ void SliderRequest::on_event(const event_engine::Event& event) {
SmartObject response_msg_params = message[strings::msg_params];
- const bool is_timeout_aborted = Compare<Common_Result::eType, EQ, ONE>(
- response_code, Common_Result::TIMED_OUT, Common_Result::ABORTED);
-
- if (is_timeout_aborted) {
- if (message[strings::params][strings::data].keyExists(
- strings::slider_position)) {
- // Copy slider_position info to msg_params section
- response_msg_params[strings::slider_position] =
- message[strings::params][strings::data][strings::slider_position];
- } else {
- SDL_LOG_ERROR(strings::slider_position << " field is absent"
- " in response.");
- response_msg_params[strings::slider_position] = 0;
- }
- }
std::string response_info;
GetInfo(message, response_info);
const bool is_response_success = PrepareResultForMobileResponse(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
index b8de053853..593faf795e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
@@ -36,6 +36,7 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
#include "utils/helpers.h"
namespace sdl_rpc_plugin {
@@ -51,13 +52,11 @@ SpeakRequest::SpeakRequest(
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) {
- subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SpeakRequest::~SpeakRequest() {}
@@ -112,13 +111,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
ProcessTTSSpeakResponse(event.smart_object());
break;
}
- case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- SDL_LOG_INFO("Received TTS_OnResetTimeout event");
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
default: {
SDL_LOG_ERROR("Received unknown event " << event.id());
break;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 42cb3c60c9..da48f193e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/subscribe_button_request.h"
+#include "application_manager/message_helper.h"
#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
@@ -49,11 +50,11 @@ SubscribeButtonRequest::SubscribeButtonRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SubscribeButtonRequest::~SubscribeButtonRequest() {}
@@ -104,11 +105,11 @@ void SubscribeButtonRequest::Run() {
return;
}
- app->SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(btn_id));
- SendSubscribeButtonNotification();
-
- const bool is_succeeded = true;
- SendResponse(is_succeeded, mobile_apis::Result::SUCCESS);
+ (*message_)[str::msg_params][str::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons);
+ SendHMIRequest(hmi_apis::FunctionID::Buttons_SubscribeButton,
+ &(*message_)[app_mngr::strings::msg_params],
+ true);
}
bool SubscribeButtonRequest::Init() {
@@ -116,6 +117,59 @@ bool SubscribeButtonRequest::Init() {
return true;
}
+void SubscribeButtonRequest::on_event(const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ if (hmi_apis::FunctionID::Buttons_SubscribeButton != event.id()) {
+ SDL_LOG_ERROR("Received unknown event.");
+ return;
+ }
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons);
+ ApplicationSharedPtr app =
+ application_manager_.application(CommandRequestImpl::connection_key());
+
+ if (!app) {
+ SDL_LOG_ERROR("NULL pointer.");
+ return;
+ }
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(message, response_info);
+ const bool result = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons);
+
+ if (result) {
+ const auto btn_id = static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[str::msg_params][str::button_name].asInt());
+ app->SubscribeToButton(btn_id);
+ }
+ mobile_apis::Result::eType result_code =
+ MessageHelper::HMIToMobileResult(hmi_result);
+
+ SendResponse(result,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str(),
+ &(message[strings::msg_params]));
+}
+
+bool IsPresetButton(const mobile_apis::ButtonName::eType btn_id) {
+ return (mobile_apis::ButtonName::PRESET_0 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_1 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_2 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_3 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_4 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_5 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_6 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_7 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_8 == btn_id) ||
+ (mobile_apis::ButtonName::PRESET_9 == btn_id);
+}
+
bool SubscribeButtonRequest::IsSubscriptionAllowed(
ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) {
if (!app->is_media_application() &&
@@ -123,7 +177,8 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
(mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
(mobile_apis::ButtonName::SEEKRIGHT == btn_id) ||
(mobile_apis::ButtonName::TUNEUP == btn_id) ||
- (mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
+ (mobile_apis::ButtonName::TUNEDOWN == btn_id) ||
+ IsPresetButton(btn_id))) {
return false;
}
@@ -149,19 +204,6 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
return true;
}
-void SubscribeButtonRequest::SendSubscribeButtonNotification() {
- using namespace smart_objects;
- using namespace hmi_apis;
-
- // send OnButtonSubscription notification
- SmartObject msg_params = SmartObject(SmartType_Map);
- msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = static_cast<Common_ButtonName::eType>(
- (*message_)[strings::msg_params][strings::button_name].asUInt());
- msg_params[strings::is_suscribed] = true;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
-}
-
} // namespace commands
} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
index 6e8ad05a74..da9a6e2adc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
@@ -31,6 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -47,11 +49,11 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {}
@@ -72,8 +74,8 @@ void SubscribeWayPointsRequest::Run() {
return;
}
- if (application_manager_.IsAnyAppSubscribedForWayPoints()) {
- application_manager_.SubscribeAppForWayPoints(app);
+ if (application_manager_.IsSubscribedToHMIWayPoints()) {
+ application_manager_.SubscribeAppForWayPoints(app, false);
SendResponse(true, mobile_apis::Result::SUCCESS);
return;
}
@@ -91,15 +93,20 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
SDL_LOG_INFO("Received Navigation_SubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
+ bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, true);
+ } else if (application_manager_.GetAppServiceManager()
+ .FindWayPointsHandler() != nullptr) {
+ application_manager_.SubscribeAppForWayPoints(app, false);
+ result = true;
+ result_code = hmi_apis::Common_Result::WARNINGS;
}
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
@@ -114,6 +121,23 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
}
}
+void SubscribeWayPointsRequest::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() !=
+ nullptr) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ application_manager_.SubscribeAppForWayPoints(app, false);
+ SendResponse(true,
+ mobile_apis::Result::WARNINGS,
+ "HMI request timeout expired, waypoints are available through "
+ "NAVIGATION service");
+ } else {
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired");
+ }
+}
+
bool SubscribeWayPointsRequest::Init() {
hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
index e36b6af109..9cd2d33ab3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc
@@ -48,21 +48,18 @@ SubtleAlertRequest::SubtleAlertRequest(
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
, awaiting_ui_subtle_alert_response_(false)
, awaiting_tts_speak_response_(false)
, awaiting_tts_stop_speaking_response_(false)
, is_ui_subtle_alert_sent_(false)
, is_tts_stop_speaking_sent_(false)
, subtle_alert_result_(hmi_apis::Common_Result::INVALID_ENUM)
- , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {
- subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
- subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-}
+ , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
SubtleAlertRequest::~SubtleAlertRequest() {}
@@ -118,18 +115,6 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
- case hmi_apis::FunctionID::TTS_OnResetTimeout:
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- SDL_LOG_INFO(
- "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event"
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_subtle_alert_response_);
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- break;
- }
case hmi_apis::FunctionID::UI_SubtleAlert: {
SDL_LOG_INFO("Received UI_SubtleAlert event");
// Unsubscribe from event to avoid unwanted messages
@@ -206,20 +191,10 @@ bool SubtleAlertRequest::PrepareResponseParameters(
bool result =
PrepareResultForMobileResponse(ui_subtle_alert_info, tts_alert_info);
- /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
- * and sdl receive TTS.IsReady=true or SDL doesn't receive response for
- * TTS.IsReady.
- */
- if (result && ui_subtle_alert_info.is_ok &&
- tts_alert_info.is_unsupported_resource &&
- HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
- result = false;
- }
result_code = mobile_apis::Result::WARNINGS;
if ((ui_subtle_alert_info.is_ok || ui_subtle_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
- tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(ui_subtle_alert_info,
ui_response_info_,
tts_alert_info,
@@ -244,7 +219,11 @@ bool SubtleAlertRequest::PrepareResponseParameters(
tts_alert_info,
tts_response_info_);
// Mobile Alert request is successful when UI_SubtleAlert is successful
- if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok) {
+ bool has_unsupported_data = ui_subtle_alert_info.is_unsupported_resource &&
+ HmiInterfaces::STATE_NOT_AVAILABLE !=
+ ui_subtle_alert_info.interface_state;
+ if (is_ui_subtle_alert_sent_ && !ui_subtle_alert_info.is_ok &&
+ !has_unsupported_data) {
return false;
}
return result;
@@ -342,7 +321,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) {
hmi_apis::Common_TextFieldName::subtleAlertText1;
msg_params[hmi_request::alert_strings][index][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::alert_text1];
- index++;
+ ++index;
}
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
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 cca088ed2d..10be518409 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
@@ -411,11 +411,11 @@ SystemRequest::SystemRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
SystemRequest::~SystemRequest() {}
@@ -430,7 +430,6 @@ void SystemRequest::Run() {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
-
const mobile_apis::RequestType::eType request_type =
static_cast<mobile_apis::RequestType::eType>(
(*message_)[strings::msg_params][strings::request_type].asInt());
@@ -479,6 +478,15 @@ void SystemRequest::Run() {
return;
}
+ const uint16_t query_apps_min_version = 4;
+
+ if (mobile_apis::RequestType::QUERY_APPS == request_type &&
+ application_manager_.get_settings().max_supported_protocol_version() <
+ query_apps_min_version) {
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ return;
+ }
+
if (!file_system::IsFileNameValid(file_name) &&
mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
index 69f85568eb..74eec08c46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2021, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,6 +33,8 @@
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
@@ -51,11 +52,11 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {}
@@ -93,15 +94,59 @@ void UnsubscribeButtonRequest::Run() {
return;
}
- if (!app->UnsubscribeFromButton(
- static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
- SDL_LOG_ERROR("App doesn't subscribe to button " << btn_id);
+ if (!app->IsSubscribedToButton(btn_id)) {
+ SDL_LOG_ERROR("App is not subscribed to button " << btn_id);
+ SendResponse(false, mobile_apis::Result::IGNORED);
+ return;
+ }
+
+ if (mobile_apis::ButtonName::CUSTOM_BUTTON == btn_id) {
+ SDL_LOG_ERROR("App cannot unsubscribe from CUSTOM_BUTTON");
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
- SendUnsubscribeButtonNotification();
- SendResponse(true, mobile_apis::Result::SUCCESS);
+ (*message_)[str::msg_params][str::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons);
+ SendHMIRequest(hmi_apis::FunctionID::Buttons_UnsubscribeButton,
+ &(*message_)[app_mngr::strings::msg_params],
+ true);
+}
+
+void UnsubscribeButtonRequest::on_event(const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace helpers;
+
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ if (hmi_apis::FunctionID::Buttons_UnsubscribeButton != event.id()) {
+ SDL_LOG_ERROR("Received unknown event.");
+ return;
+ }
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons);
+ ApplicationSharedPtr app =
+ application_manager_.application(CommandRequestImpl::connection_key());
+
+ if (!app) {
+ SDL_LOG_ERROR("NULL pointer.");
+ return;
+ }
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(message, response_info);
+ const bool result = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons);
+
+ mobile_apis::Result::eType result_code =
+ MessageHelper::HMIToMobileResult(hmi_result);
+
+ SendResponse(result,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str(),
+ &(message[strings::msg_params]));
}
bool UnsubscribeButtonRequest::Init() {
@@ -109,19 +154,6 @@ bool UnsubscribeButtonRequest::Init() {
return true;
}
-void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() {
- using namespace smart_objects;
- using namespace hmi_apis;
-
- // send OnButtonSubscription notification
- SmartObject msg_params = SmartObject(SmartType_Map);
- msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = static_cast<Common_ButtonName::eType>(
- (*message_)[strings::msg_params][strings::button_name].asInt());
- msg_params[strings::is_suscribed] = false;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
-}
-
} // namespace commands
} // namespace sdl_rpc_plugin
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 545a36def8..c715612ba5 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
@@ -31,6 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -47,11 +49,11 @@ UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {}
@@ -75,9 +77,10 @@ void UnsubscribeWayPointsRequest::Run() {
std::set<uint32_t> subscribed_apps =
application_manager_.GetAppsSubscribedForWayPoints();
- if (subscribed_apps.size() > 1) {
+ if (subscribed_apps.size() > 1 ||
+ !application_manager_.IsSubscribedToHMIWayPoints()) {
// More than 1 subscribed app, don't send HMI unsubscribe request
- application_manager_.UnsubscribeAppFromWayPoints(app);
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
SendResponse(true, mobile_apis::Result::SUCCESS, NULL);
return;
} else {
@@ -96,15 +99,20 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
SDL_LOG_INFO("Received Navigation_UnsubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- const hmi_apis::Common_Result::eType result_code =
+ hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
+ bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
- application_manager_.UnsubscribeAppFromWayPoints(app);
+ application_manager_.UnsubscribeAppFromWayPoints(app, true);
+ } else if (application_manager_.GetAppServiceManager()
+ .FindWayPointsHandler() != nullptr) {
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
+ result = true;
+ result_code = hmi_apis::Common_Result::WARNINGS;
}
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
@@ -119,6 +127,23 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
}
}
+void UnsubscribeWayPointsRequest::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ if (application_manager_.GetAppServiceManager().FindWayPointsHandler() !=
+ nullptr) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ application_manager_.UnsubscribeAppFromWayPoints(app, false);
+ SendResponse(true,
+ mobile_apis::Result::WARNINGS,
+ "HMI request timeout expired, waypoints are available through "
+ "NAVIGATION service");
+ } else {
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired");
+ }
+}
+
bool UnsubscribeWayPointsRequest::Init() {
hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
return true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
index 3da9206184..3fbaad77b0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
@@ -56,11 +56,11 @@ UpdateTurnListRequest::UpdateTurnListRequest(
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) {}
+ : RequestFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
UpdateTurnListRequest::~UpdateTurnListRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
index bedf91b45c..bf2658128d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
@@ -59,6 +59,8 @@ UpdateTurnListResponse::~UpdateTurnListResponse() {}
void UpdateTurnListResponse::Run() {
SDL_LOG_AUTO_TRACE();
+ application_manager_.UnsubscribeAppFromSoftButtons(message_);
+
rpc_service_.SendMessageToMobile(message_);
}
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
index 311ba5d4aa..0217c6f6a5 100644
--- 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
@@ -7,9 +7,6 @@ SDL_CREATE_LOG_VARIABLE("GetSystemCapabilitiesAppExtension")
namespace app_mngr_ = application_manager;
namespace strings = app_mngr::strings;
-const app_mngr_::AppExtensionUID
- SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200;
-
SystemCapabilityAppExtension::SystemCapabilityAppExtension(
sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app)
: app_mngr_::AppExtension(
@@ -63,7 +60,7 @@ void SystemCapabilityAppExtension::SaveResumptionData(
int i = 0;
for (const auto& subscription : subscribed_data_) {
resumption_data[strings::system_capability][i] = subscription;
- i++;
+ ++i;
}
}
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 570a4ce12e..c66e0b6950 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
@@ -77,6 +77,8 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h"
+#include "sdl_rpc_plugin/commands/hmi/subscribe_button_request.h"
+#include "sdl_rpc_plugin/commands/hmi/subscribe_button_response.h"
#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h"
#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
@@ -137,6 +139,8 @@
#include "sdl_rpc_plugin/commands/hmi/ui_slider_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_subtle_alert_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_subtle_alert_response.h"
+#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h"
+#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h"
#include "sdl_rpc_plugin/commands/hmi/update_app_list_request.h"
#include "sdl_rpc_plugin/commands/hmi/update_app_list_response.h"
#include "sdl_rpc_plugin/commands/hmi/update_device_list_request.h"
@@ -173,6 +177,7 @@
#include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_on_app_capability_updated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
#include "sdl_rpc_plugin/commands/hmi/dial_number_response.h"
#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h"
@@ -206,7 +211,6 @@
#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
@@ -217,6 +221,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
@@ -224,13 +229,11 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_subtle_alert_pressed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h"
@@ -680,6 +683,19 @@ CommandCreator& HMICommandFactory::get_creator_factory(
: factory
.GetCreator<commands::ButtonGetCapabilitiesResponse>();
}
+ case hmi_apis::FunctionID::Buttons_SubscribeButton: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::hmi::SubscribeButtonRequest>()
+ : factory.GetCreator<commands::hmi::SubscribeButtonResponse>();
+ }
+
+ case hmi_apis::FunctionID::Buttons_UnsubscribeButton: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::hmi::UnsubscribeButtonRequest>()
+ : factory
+ .GetCreator<commands::hmi::UnsubscribeButtonResponse>();
+ }
+
case hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality: {
return factory
.GetCreator<commands::OnAllowSDLFunctionalityNotification>();
@@ -761,10 +777,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::Buttons_OnButtonPress: {
return factory.GetCreator<commands::hmi::OnButtonPressNotification>();
}
- case hmi_apis::FunctionID::Buttons_OnButtonSubscription: {
- return factory
- .GetCreator<commands::hmi::OnButtonSubscriptionNotification>();
- }
case hmi_apis::FunctionID::Navigation_OnTBTClientState: {
return factory.GetCreator<commands::OnNaviTBTClientStateNotification>();
}
@@ -774,8 +786,8 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::UI_OnTouchEvent: {
return factory.GetCreator<commands::hmi::OnUITouchEventNotification>();
}
- case hmi_apis::FunctionID::UI_OnResetTimeout: {
- return factory.GetCreator<commands::hmi::OnUIResetTimeoutNotification>();
+ case hmi_apis::FunctionID::BasicCommunication_OnResetTimeout: {
+ return factory.GetCreator<commands::hmi::OnResetTimeoutNotification>();
}
case hmi_apis::FunctionID::Navigation_SetVideoConfig: {
return hmi_apis::messageType::request == message_type
@@ -874,9 +886,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::SDL_OnDeviceStateChanged: {
return factory.GetCreator<commands::OnDeviceStateChangedNotification>();
}
- case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- return factory.GetCreator<commands::hmi::OnTTSResetTimeoutNotification>();
- }
case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: {
return factory.GetCreator<commands::OnEventChangedNotification>();
}
@@ -942,7 +951,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::UI_OnSubtleAlertPressed: {
return factory.GetCreator<commands::OnUISubtleAlertPressedNotification>();
}
- default: { return factory.GetCreator<InvalidCommand>(); }
+ case hmi_apis::FunctionID::BasicCommunication_OnAppCapabilityUpdated: {
+ return factory
+ .GetCreator<commands::BCOnAppCapabilityUpdatedNotification>();
+ }
+ 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 d2f1325c82..c70962dc4a 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
@@ -76,6 +76,7 @@
#include "sdl_rpc_plugin/commands/mobile/get_way_points_response.h"
#include "sdl_rpc_plugin/commands/mobile/list_files_request.h"
#include "sdl_rpc_plugin/commands/mobile/list_files_response.h"
+#include "sdl_rpc_plugin/commands/mobile/on_app_capability_updated_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_button_event_notification.h"
@@ -96,6 +97,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_update_file_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_update_sub_menu_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification_from_mobile.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"
@@ -406,7 +408,8 @@ CommandCreator& MobileCommandFactory::get_command_creator(
using app_mngr::commands::Command;
return factory.GetCreator<commands::GenericResponse>();
}
- default: {}
+ default: {
+ }
}
return factory.GetCreator<InvalidCommand>();
}
@@ -478,7 +481,8 @@ CommandCreator& MobileCommandFactory::get_notification_creator(
case mobile_apis::FunctionID::OnSubtleAlertPressedID: {
return factory.GetCreator<commands::OnSubtleAlertPressedNotification>();
}
- default: {}
+ default: {
+ }
}
return factory.GetCreator<InvalidCommand>();
}
@@ -491,7 +495,16 @@ CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator(
case mobile_apis::FunctionID::OnHMIStatusID: {
return factory.GetCreator<commands::OnHMIStatusNotificationFromMobile>();
}
- default: {}
+ case mobile_apis::FunctionID::OnWayPointChangeID: {
+ return factory
+ .GetCreator<commands::OnWayPointChangeNotificationFromMobile>();
+ }
+ case mobile_apis::FunctionID::OnAppCapabilityUpdatedID: {
+ return factory
+ .GetCreator<commands::mobile::OnAppCapabilityUpdatedNotification>();
+ }
+ default: {
+ }
}
return factory.GetCreator<InvalidCommand>();
}
@@ -522,7 +535,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
break;
}
- default: {}
+ default: {
+ }
}
CommandCreatorFactory factory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
@@ -543,10 +557,12 @@ bool MobileCommandFactory::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource message_source)
const {
+ SDL_LOG_AUTO_TRACE();
auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
return get_command_creator(id, mobile_apis::messageType::INVALID_ENUM)
.CanBeCreated() ||
- get_notification_creator(id).CanBeCreated();
+ get_notification_creator(id).CanBeCreated() ||
+ get_notification_from_mobile_creator(id).CanBeCreated();
}
CommandSharedPtr MobileCommandFactory::CreateCommand(
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 4756c8b9a2..a0ad320cac 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
@@ -61,18 +61,6 @@ bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
return true;
}
-bool SDLRPCPlugin::Init(
- application_manager::ApplicationManager& app_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
- UNUSED(last_state);
- command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
- app_manager, rpc_service, hmi_capabilities, policy_handler));
- return true;
-}
-
bool SDLRPCPlugin::IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource message_source) {
@@ -93,21 +81,32 @@ void SDLRPCPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
SDL_LOG_AUTO_TRACE();
- if (plugins::ApplicationEvent::kApplicationRegistered == event) {
- application->AddExtension(
- std::make_shared<WayPointsAppExtension>(*this, *application));
-
- auto sys_cap_ext_ptr =
- std::make_shared<SystemCapabilityAppExtension>(*this, *application);
- application->AddExtension(sys_cap_ext_ptr);
- // Processing automatic subscription to SystemCapabilities for DISPLAY type
- const auto capability_type =
- mobile_apis::SystemCapabilityType::eType::DISPLAYS;
- SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled");
- sys_cap_ext_ptr->SubscribeTo(capability_type);
-
- } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
- ClearSubscriptions(application);
+ switch (event) {
+ case plugins::ApplicationEvent::kApplicationRegistered: {
+ application->AddExtension(
+ std::make_shared<WayPointsAppExtension>(*this, *application));
+
+ auto sys_cap_ext_ptr =
+ std::make_shared<SystemCapabilityAppExtension>(*this, *application);
+ application->AddExtension(sys_cap_ext_ptr);
+ // Processing automatic subscription to SystemCapabilities for DISPLAY
+ // type
+ const auto capability_type =
+ mobile_apis::SystemCapabilityType::eType::DISPLAYS;
+ SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled");
+ sys_cap_ext_ptr->SubscribeTo(capability_type);
+ break;
+ }
+
+ case plugins::ApplicationEvent::kApplicationUnregistered:
+ case plugins::ApplicationEvent::kDeleteApplicationData: {
+ ClearSubscriptions(application);
+ break;
+ }
+
+ default: {
+ break;
+ }
}
}
@@ -131,14 +130,20 @@ void SDLRPCPlugin::RevertResumption(application_manager::Application& app) {
pending_resumption_handler_->OnResumptionRevert();
if (application_manager_->IsAppSubscribedForWayPoints(app)) {
- application_manager_->UnsubscribeAppFromWayPoints(app.app_id());
- if (!application_manager_->IsAnyAppSubscribedForWayPoints()) {
+ const auto subscribed_apps =
+ application_manager_->GetAppsSubscribedForWayPoints();
+ const bool send_unsubscribe =
+ subscribed_apps.size() <= 1 &&
+ application_manager_->IsSubscribedToHMIWayPoints();
+ if (send_unsubscribe) {
SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
auto request =
application_manager::MessageHelper::CreateUnsubscribeWayPointsRequest(
application_manager_->GetNextHMICorrelationID());
application_manager_->GetRPCService().ManageHMICommand(request);
}
+ application_manager_->UnsubscribeAppFromWayPoints(app.app_id(),
+ send_unsubscribe);
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc
index ed8283e1f9..3c73a61f1b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc
@@ -32,7 +32,6 @@ SDL_CREATE_LOG_VARIABLE("WayPointsAppExtension")
namespace sdl_rpc_plugin {
namespace strings = application_manager::strings;
-unsigned WayPointsAppExtension::WayPointsAppExtensionUID = 138;
WayPointsAppExtension::WayPointsAppExtension(
SDLRPCPlugin& plugin, application_manager::Application& app)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
index 7aa6dd5273..5c0a0d746b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc
@@ -86,7 +86,7 @@ void WayPointsPendingResumptionHandler::HandleResumptionSubscriptionRequest(
SDL_LOG_DEBUG(
"Subscription to waypoint already exist, no need to send "
"request to HMI");
- application_manager_.SubscribeAppForWayPoints(app.app_id());
+ application_manager_.SubscribeAppForWayPoints(app.app_id(), false);
return;
}
@@ -140,7 +140,7 @@ void WayPointsPendingResumptionHandler::RaiseFakeSuccessfulResponse(
event.raise(application_manager_.event_dispatcher());
}
-void WayPointsPendingResumptionHandler::on_event(
+void WayPointsPendingResumptionHandler::HandleOnEvent(
const application_manager::event_engine::Event& event) {
using namespace application_manager;
SDL_LOG_AUTO_TRACE();
@@ -154,10 +154,10 @@ void WayPointsPendingResumptionHandler::on_event(
}
const smart_objects::SmartObject& response = event.smart_object();
- const uint32_t corr_id = event.smart_object_correlation_id();
SDL_LOG_TRACE("Received event with function id: "
- << event.id() << " and correlation id: " << corr_id);
+ << event.id() << " and correlation id: "
+ << event.smart_object_correlation_id());
auto current_pending = pending_requests_.front();
pending_requests_.pop_front();
@@ -170,7 +170,7 @@ void WayPointsPendingResumptionHandler::on_event(
if (resumption::IsResponseSuccessful(response)) {
SDL_LOG_DEBUG("Resumption of waypoints is successful");
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, true);
}
ProcessNextPendingResumption();
}
@@ -195,7 +195,7 @@ void WayPointsPendingResumptionHandler::ProcessNextPendingResumption() {
auto pending_copy = pending;
pending_requests_.pop_front();
auto app = application_manager_.application(pending_copy.app_id_);
- application_manager_.SubscribeAppForWayPoints(app);
+ application_manager_.SubscribeAppForWayPoints(app, false);
RaiseFakeSuccessfulResponse(pending_copy.corr_id_);
ProcessNextPendingResumption();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
index b21ab9dca8..b5bb139377 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
@@ -24,6 +24,7 @@ file(GLOB SOURCES
set(LIBRARIES
sdl_rpc_plugin_static
+ Resumption
gmock
)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
index 7dadad59fe..e841b4ae81 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
@@ -97,6 +97,8 @@ TEST_F(ActivateAppRequestTest, Run_SUCCESS) {
(*msg)[strings::msg_params][strings::activate_app_hmi_level] =
mobile_apis::HMILevel::HMI_FULL;
#endif
+ InitEventDispatcher();
+
ActivateAppRequestPtr command(CreateCommand<ActivateAppRequest>(msg));
EXPECT_CALL(app_mngr_, set_application_id(kCorrelationId, kAppId));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
index 9cd87b053d..751eb84e53 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
@@ -62,7 +62,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) {
.WillByDefault(ReturnRef(mock_protocol_handler));
EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed());
- command->onTimeOut();
+ command->OnTimeOut();
}
} // namespace basic_communication_get_system_time_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_on_app_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_on_app_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..2d875a2680
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_on_app_capability_updated_notification_test.cc
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2020, 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 "hmi/bc_on_app_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace bc_on_app_capability_updated_notification_test {
+
+using sdl_rpc_plugin::commands::BCOnAppCapabilityUpdatedNotification;
+using ::testing::_;
+
+typedef std::shared_ptr<BCOnAppCapabilityUpdatedNotification>
+ BCOnAppCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+} // namespace
+
+MATCHER_P(CheckAppCapability, app_capability, "") {
+ return app_capability == (*arg)[strings::msg_params][strings::app_capability];
+}
+
+class BCOnAppCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+ command_ = CreateCommand<BCOnAppCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ BCOnAppCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(BCOnAppCapabilityUpdatedNotificationTest, Run_SendMessageToHMI_SUCCESS) {
+ smart_objects::SmartObject app_capability =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ app_capability[strings::app_capability_type] =
+ mobile_apis::AppCapabilityType::VIDEO_STREAMING;
+ app_capability[strings::video_streaming_capability] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ FillVideoStreamingCapability(
+ app_capability[strings::video_streaming_capability]);
+
+ (*message_)[strings::msg_params][strings::app_capability] = app_capability;
+
+ ASSERT_TRUE(command_->Init());
+
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToHMI(CheckAppCapability(app_capability)));
+ command_->Run();
+}
+
+} // namespace bc_on_app_capability_updated_notification_test
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc
index f3d8dd4f93..81a105f8e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc
@@ -75,6 +75,9 @@ class ButtonGetCapabilitiesRequestTest
TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+
+ InitEventDispatcher();
+
RequestToHMIPtr command(
CreateCommand<ButtonGetCapabilitiesRequest>(command_msg));
@@ -92,6 +95,9 @@ TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(ButtonGetCapabilitiesRequestTest,
onTimeOut_ButtonsGetCapabilitiesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+
+ InitEventDispatcher();
+
RequestToHMIPtr command(
CreateCommand<ButtonGetCapabilitiesRequest>(command_msg));
@@ -101,7 +107,7 @@ TEST_F(ButtonGetCapabilitiesRequestTest,
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
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 5fa910b2d9..2a0eda2b10 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
@@ -97,7 +97,6 @@
#include "hmi/on_audio_data_streaming_notification.h"
#include "hmi/on_button_event_notification.h"
#include "hmi/on_button_press_notification.h"
-#include "hmi/on_button_subscription_notification.h"
#include "hmi/on_device_chosen_notification.h"
#include "hmi/on_device_state_changed_notification.h"
#include "hmi/on_driver_distraction_notification.h"
@@ -114,6 +113,7 @@
#include "hmi/on_ready_notification.h"
#include "hmi/on_received_policy_update.h"
#include "hmi/on_record_start_notification.h"
+#include "hmi/on_reset_timeout_notification.h"
#include "hmi/on_resume_audio_source_notification.h"
#include "hmi/on_sdl_close_notification.h"
#include "hmi/on_sdl_consent_needed_notification.h"
@@ -125,13 +125,11 @@
#include "hmi/on_system_info_changed_notification.h"
#include "hmi/on_system_request_notification.h"
#include "hmi/on_tts_language_change_notification.h"
-#include "hmi/on_tts_reset_timeout_notification.h"
#include "hmi/on_tts_started_notification.h"
#include "hmi/on_tts_stopped_notification.h"
#include "hmi/on_ui_command_notification.h"
#include "hmi/on_ui_keyboard_input_notification.h"
#include "hmi/on_ui_language_change_notification.h"
-#include "hmi/on_ui_reset_timeout_notification.h"
#include "hmi/on_ui_touch_event_notification.h"
#include "hmi/on_update_device_list.h"
#include "hmi/on_video_data_streaming_notification.h"
@@ -149,6 +147,8 @@
#include "hmi/sdl_get_user_friendly_message_response.h"
#include "hmi/sdl_policy_update.h"
#include "hmi/sdl_policy_update_response.h"
+#include "hmi/subscribe_button_request.h"
+#include "hmi/subscribe_button_response.h"
#include "hmi/tts_change_registration_request.h"
#include "hmi/tts_change_registration_response.h"
#include "hmi/tts_get_capabilities_request.h"
@@ -207,6 +207,8 @@
#include "hmi/ui_slider_response.h"
#include "hmi/ui_subtle_alert_request.h"
#include "hmi/ui_subtle_alert_response.h"
+#include "hmi/unsubscribe_button_request.h"
+#include "hmi/unsubscribe_button_response.h"
#include "hmi/update_app_list_request.h"
#include "hmi/update_app_list_response.h"
#include "hmi/update_device_list_request.h"
@@ -258,14 +260,10 @@ class HMICommandsTest : public components::commands_test::CommandRequestTest<
typedef Command CommandType;
void InitCommand(const uint32_t& timeout) OVERRIDE {
+ CommandRequestTest<kIsNice>::InitCommand(timeout);
+
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_));
}
@@ -450,11 +448,9 @@ typedef Types<commands::NaviIsReadyResponse,
typedef Types<commands::hmi::OnButtonEventNotification,
commands::hmi::OnButtonPressNotification,
- commands::hmi::OnButtonSubscriptionNotification,
commands::OnNaviTBTClientStateNotification,
commands::hmi::OnUIKeyBoardInputNotification,
commands::hmi::OnUITouchEventNotification,
- commands::hmi::OnUIResetTimeoutNotification,
commands::NaviStartStreamResponse,
commands::NaviStartStreamRequest,
commands::NaviStopStreamResponse,
@@ -485,7 +481,7 @@ typedef Types<commands::hmi::OnButtonEventNotification,
commands::OnReceivedPolicyUpdate,
commands::OnPolicyUpdate,
commands::OnDeviceStateChangedNotification,
- commands::hmi::OnTTSResetTimeoutNotification,
+ commands::hmi::OnResetTimeoutNotification,
commands::hmi::DialNumberResponse,
commands::hmi::DialNumberRequest,
commands::OnEventChangedNotification,
@@ -501,8 +497,12 @@ typedef Types<commands::AllowAllAppsRequest,
commands::AllowAppResponse,
commands::BCGetFilePathRequest,
commands::BCGetFilePathResponse,
+ commands::hmi::SubscribeButtonRequest,
+ commands::hmi::SubscribeButtonResponse,
commands::UISubtleAlertResponse,
- commands::UISubtleAlertRequest>
+ commands::UISubtleAlertRequest,
+ commands::hmi::UnsubscribeButtonRequest,
+ commands::hmi::UnsubscribeButtonResponse>
HMICommandsListFifth;
TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
index 5b860499dd..0fa2edd9c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
@@ -71,6 +71,8 @@ TEST_F(GetSystemInfoRequestTest, RUN_SendRequest_SUCCESS) {
(*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
(*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ InitEventDispatcher();
+
RequestToHMIPtr command(CreateCommand<GetSystemInfoRequest>(command_msg));
const uint32_t kAppId = command->application_id();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
index 8cdce4fa74..3e01849807 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
@@ -68,6 +68,7 @@ typedef NiceMock<
namespace {
const uint32_t kConnectionKey = 2u;
const std::string ccpu_version("4.1.3.B_EB355B");
+const std::string kHardwareVersion("1.1.1.1");
const std::string wers_country_code("WAEGB");
const std::string lang_code("EN-US");
} // namespace
@@ -82,14 +83,36 @@ class GetSystemInfoResponseTest
(*command_msg)[strings::msg_params]["ccpu_version"] = ccpu_version;
(*command_msg)[strings::msg_params]["wersCountryCode"] = wers_country_code;
(*command_msg)[strings::msg_params]["language"] = lang_code;
-
return command_msg;
}
+ void SetHardwareVersionFromPT() {
+ const std::string hardware_version_from_pt = "1.1.1.0";
+ ON_CALL(mock_policy_handler_, GetHardwareVersionFromPT())
+ .WillByDefault(Return(hardware_version_from_pt));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_hardware_version(hardware_version_from_pt));
+ }
+
SmartObject capabilities_;
};
-TEST_F(GetSystemInfoResponseTest, GetSystemInfo_SUCCESS) {
+TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::WRONG_LANGUAGE;
+ (*command_msg)[strings::msg_params][hmi_response::capabilities] =
+ (capabilities_);
+
+ ResponseFromHMIPtr command(CreateCommand<GetSystemInfoResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_, UpdateCachedCapabilities());
+ EXPECT_CALL(mock_policy_handler_, SetPreloadedPtFlag(false));
+
+ command->Run();
+}
+
+TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UpdateCapabilities_Called) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::params][hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
@@ -98,28 +121,35 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_SUCCESS) {
ResponseFromHMIPtr command(CreateCommand<GetSystemInfoResponse>(command_msg));
- EXPECT_CALL(mock_policy_handler_,
- OnGetSystemInfo(ccpu_version, wers_country_code, lang_code));
+ EXPECT_CALL(mock_hmi_capabilities_, OnSoftwareVersionReceived(ccpu_version));
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) {
+TEST_F(GetSystemInfoResponseTest,
+ GetSystemInfo_SaveHardwareVersionToHMICapabilitiesIfPresentInResponse) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::WRONG_LANGUAGE;
+ hmi_apis::Common_Result::SUCCESS;
(*command_msg)[strings::msg_params][hmi_response::capabilities] =
(capabilities_);
+ (*command_msg)[strings::msg_params][strings::system_hardware_version] =
+ kHardwareVersion;
ResponseFromHMIPtr command(CreateCommand<GetSystemInfoResponse>(command_msg));
- EXPECT_CALL(mock_hmi_capabilities_, UpdateCachedCapabilities());
- EXPECT_CALL(mock_policy_handler_, SetPreloadedPtFlag(false));
+ SetHardwareVersionFromPT();
+ EXPECT_CALL(mock_policy_handler_, OnHardwareVersionReceived(_));
+ EXPECT_CALL(mock_hmi_capabilities_, set_hardware_version(kHardwareVersion));
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UpdateCapabilities_Called) {
+TEST_F(
+ GetSystemInfoResponseTest,
+ GetSystemInfo_DontSaveHardwareVersionToHMICapabilitiesIfAbsentInResponse) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::params][hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
@@ -128,7 +158,10 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UpdateCapabilities_Called) {
ResponseFromHMIPtr command(CreateCommand<GetSystemInfoResponse>(command_msg));
- EXPECT_CALL(mock_hmi_capabilities_, OnSoftwareVersionReceived(ccpu_version));
+ SetHardwareVersionFromPT();
+ EXPECT_CALL(mock_policy_handler_, OnHardwareVersionReceived(_)).Times(0);
+ EXPECT_CALL(mock_hmi_capabilities_, set_hardware_version(kHardwareVersion))
+ .Times(0);
ASSERT_TRUE(command->Init());
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 400481f506..53b1fdfc67 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
@@ -45,7 +45,6 @@
#include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
@@ -61,6 +60,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h"
@@ -72,13 +72,11 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_subtle_alert_pressed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
@@ -92,6 +90,7 @@
#include "utils/signals.h"
#include "application_manager/hmi_capabilities_impl.h"
+#include "application_manager/mock_app_service_manager.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
@@ -106,6 +105,8 @@
#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
#include "protocol_handler/mock_session_observer.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
#include "smart_objects/smart_object.h"
#include "test/application_manager/mock_application_manager_settings.h"
#include "transport_manager/mock_transport_manager.h"
@@ -127,6 +128,7 @@ using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
+using ::test::components::application_manager_test::MockAppServiceManager;
using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
using ::testing::InSequence;
@@ -216,7 +218,11 @@ class HMICommandsNotificationsTest
HMICommandsNotificationsTest()
: applications_lock_(std::make_shared<sync_primitives::Lock>())
, applications_(application_set_, applications_lock_)
- , app_ptr_(NULL) {}
+ , app_ptr_(NULL)
+ , mock_last_state_(std::make_shared<resumption_test::MockLastState>())
+ , last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_))
+ , mock_app_service_manager_(app_mngr_, last_state_wrapper_) {}
~HMICommandsNotificationsTest() {
// Fix DataAccessor release and WinQt crash
@@ -244,18 +250,19 @@ class HMICommandsNotificationsTest
MockConnectionHandler mock_connection_handler_;
MockSessionObserver mock_session_observer_;
+ std::shared_ptr<resumption_test::MockLastState> mock_last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ MockAppServiceManager mock_app_service_manager_;
void InitCommand(const uint32_t& default_timeout) OVERRIDE {
+ CommandsTest<kIsNice>::InitCommand(default_timeout);
+
app_ = ConfigureApp(&app_ptr_, kAppId_, NOT_MEDIA, NOT_NAVI, NOT_VC);
- EXPECT_CALL(app_mngr_, get_settings())
- .WillOnce(ReturnRef(app_mngr_settings_));
- EXPECT_CALL(app_mngr_settings_, default_timeout())
- .WillOnce(ReturnRef(default_timeout));
- ON_CALL(app_mngr_, event_dispatcher())
- .WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, GetAppServiceManager())
+ .WillByDefault(ReturnRef(mock_app_service_manager_));
ON_CALL(app_mngr_, connection_handler())
.WillByDefault(ReturnRef(mock_connection_handler_));
}
@@ -330,7 +337,6 @@ class HMIOnNotificationsEventDispatcher
typedef Types<OnAppPermissionChangedNotification,
OnAudioDataStreamingNotification,
- hmi::OnButtonSubscriptionNotification,
OnFileRemovedNotification,
OnPutFileNotification,
OnResumeAudioSourceNotification,
@@ -349,12 +355,10 @@ typedef Types<
hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated>,
CommandPair<OnEventChangedNotification,
hmi_apis::FunctionID::BasicCommunication_OnEventChanged>,
- CommandPair<hmi::OnTTSResetTimeoutNotification,
- hmi_apis::FunctionID::TTS_OnResetTimeout>,
+ CommandPair<hmi::OnResetTimeoutNotification,
+ hmi_apis::FunctionID::BasicCommunication_OnResetTimeout>,
CommandPair<OnTTSStartedNotification, hmi_apis::FunctionID::TTS_Started>,
CommandPair<OnTTSStoppedNotification, hmi_apis::FunctionID::TTS_Stopped>,
- CommandPair<hmi::OnUIResetTimeoutNotification,
- hmi_apis::FunctionID::UI_OnResetTimeout>,
CommandPair<OnVRStartedNotification, hmi_apis::FunctionID::VR_Started>,
CommandPair<OnVRStoppedNotification, hmi_apis::FunctionID::VR_Stopped> >
HMIOnNotificationsEventDispatcherTypes;
@@ -428,6 +432,8 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
std::shared_ptr<Command> command =
CreateCommand<OnNaviWayPointChangeNotification>(message);
+ EXPECT_CALL(mock_app_service_manager_, FindWayPointsHandler())
+ .WillOnce(Return(nullptr));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
command->Run();
@@ -502,7 +508,8 @@ TEST_F(HMICommandsNotificationsTest,
std::shared_ptr<Command> command =
CreateCommand<OnAppRegisteredNotification>(message);
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_));
- EXPECT_CALL(app_mngr_, event_dispatcher());
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher_));
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
command->Run();
@@ -524,7 +531,8 @@ TEST_F(HMICommandsNotificationsTest,
std::shared_ptr<Command> command =
CreateCommand<OnAppUnregisteredNotification>(message);
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_));
- EXPECT_CALL(app_mngr_, event_dispatcher());
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher_));
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
command->Run();
@@ -546,7 +554,8 @@ TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) {
CreateCommand<hmi::OnButtonPressNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
- EXPECT_CALL(app_mngr_, event_dispatcher());
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher_));
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
command->Run();
@@ -563,7 +572,8 @@ TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) {
CreateCommand<OnReadyNotification>(message);
EXPECT_CALL(app_mngr_, OnHMIReady());
- EXPECT_CALL(app_mngr_, event_dispatcher());
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher_));
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
command->Run();
@@ -1283,11 +1293,10 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_settings_, max_cmd_id()).WillOnce(ReturnRef(kMaxCmdId));
- EXPECT_CALL(app_mngr_, get_settings())
- .WillOnce(ReturnRef(app_mngr_settings_));
EXPECT_CALL(*app_ptr_, is_perform_interaction_active())
.WillOnce(Return(kIsPerformInteractionActive));
- EXPECT_CALL(app_mngr_, event_dispatcher());
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher_));
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -1359,6 +1368,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(_));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*app_ptr_, app_id()).WillOnce(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
@@ -1403,6 +1413,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(_));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
EXPECT_CALL(app_mngr_, state_controller())
@@ -1688,6 +1699,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*app_ptr_, app_id()).WillOnce(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
@@ -1733,6 +1745,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
EXPECT_CALL(mock_message_helper_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
index 64bf167f83..babfb71756 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
@@ -70,6 +70,8 @@ TEST_F(MixingAudioSupportedRequestTest, RUN_SendRequest_SUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
+ InitEventDispatcher();
+
RequestToHMIPtr command(
CreateCommand<MixingAudioSupportedRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
index 7ce3a353e9..9bf5257676 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
@@ -199,7 +199,7 @@ TEST_F(NaviSetVideoConfigRequestTest, OnTimeout) {
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(1);
- command->onTimeOut();
+ command->OnTimeOut();
}
} // namespace navi_set_video_config_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
index ae2a544cc9..1316952a92 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
@@ -33,6 +33,8 @@
#include "hmi/on_bc_system_capability_updated_notification_from_hmi.h"
#include "application_manager/commands/commands_test.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+
#include "gtest/gtest.h"
namespace test {
@@ -47,8 +49,10 @@ using ::testing::Return;
typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotificationFromHMI>
OnBCSystemCapabilityUpdatedNotificationFromHMIPtr;
+typedef mobile_apis::SystemCapabilityType::eType SystemCapabilityType;
namespace strings = application_manager::strings;
+
namespace {
const uint32_t kAppId = 1u;
} // namespace
@@ -61,11 +65,30 @@ MATCHER(CheckMessageToMobile, "") {
(*arg)[strings::params][strings::function_id].asInt());
const bool app_id_exist =
(*arg)[strings::msg_params].keyExists(strings::app_id);
- bool is_connection_key_correct = true;
- if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
- is_connection_key_correct =
- (*arg)[strings::params][strings::connection_key] == kAppId;
- }
+ const bool is_connection_key_correct = [](arg_type arg) {
+ if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
+ return (*arg)[strings::params][strings::connection_key] == kAppId;
+ }
+ return false;
+ };
+
+ return is_function_id_matched && app_id_exist && is_connection_key_correct;
+}
+
+MATCHER(CheckMessageToMobileWithoutAppId, "") {
+ const auto function_id = mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+
+ const bool is_function_id_matched =
+ function_id == static_cast<am::mobile_api::FunctionID::eType>(
+ (*arg)[strings::params][strings::function_id].asInt());
+ const bool app_id_exist =
+ (*arg)[strings::msg_params].keyExists(strings::app_id);
+ const bool is_connection_key_correct = [](arg_type arg) {
+ if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
+ return (*arg)[strings::params][strings::connection_key] == kAppId;
+ }
+ return false;
+ };
return is_function_id_matched && !app_id_exist && is_connection_key_correct;
}
@@ -73,6 +96,27 @@ MATCHER_P(CheckDisplayCapabilitiesNotChanged, display_capability, "") {
return display_capability == arg;
}
+MATCHER_P2(CheckVideoStreamingCapability,
+ system_capability_type,
+ video_streaming_capability,
+ "") {
+ const mobile_apis::SystemCapabilityType::eType received_sys_cap_type =
+ static_cast<mobile_apis::SystemCapabilityType::eType>(
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
+
+ const bool system_capability_type_matched =
+ received_sys_cap_type == system_capability_type;
+
+ const bool video_capability_matched =
+ video_streaming_capability ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability];
+
+ return system_capability_type_matched && video_capability_matched;
+}
+
class OnBCSystemCapabilityUpdatedNotificationFromHMITest
: public CommandsTest<CommandsTestMocks::kIsNice> {
protected:
@@ -105,7 +149,7 @@ TEST_F(
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(
- CheckMessageToMobile(),
+ CheckMessageToMobileWithoutAppId(),
::application_manager::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(Return(true));
@@ -130,7 +174,7 @@ TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
TEST_F(
OnBCSystemCapabilityUpdatedNotificationFromHMITest,
- Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToApp_SendMessageToMobile) {
+ Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToAppAndAppIdIsErasedFromMessage_SendMessageToMobile) {
(*message_)[am::strings::msg_params][strings::system_capability]
[am::strings::system_capability_type] =
mobile_apis::SystemCapabilityType::DISPLAYS;
@@ -147,7 +191,7 @@ TEST_F(
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(
- CheckMessageToMobile(),
+ CheckMessageToMobileWithoutAppId(),
::application_manager::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(Return(true));
@@ -155,6 +199,149 @@ TEST_F(
command_->Run();
}
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_SysCapTypeVideoStreaming_CapabilityIsAbsent_DoesntSetInHMICapabilities) {
+ smart_objects::SmartObject system_capability =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ system_capability[strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ ASSERT_TRUE(command_->Init());
+ EXPECT_CALL(mock_hmi_capabilities_, set_video_streaming_capability(_))
+ .Times(0);
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_VideoStreamingCapability_AppIdIsAbsent_NotificationIgnored) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_VideoStreamingCapability_AppNotRegistered_NotificationIgnored) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+ (*message_)[am::strings::msg_params][strings::app_id] = kAppId;
+
+ ApplicationSharedPtr app; // Empty application shared pointer
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(app));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_VideoStreamingCapability_AppNotSubsribed_NotificationIgnored) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+ (*message_)[am::strings::msg_params][strings::app_id] = kAppId;
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ // By default system capability extension is not subsribed to the
+ // VIDEO_STREAMING
+ auto system_capability_app_extension =
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_);
+
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_VideoStreamingCapability_AppIsSubsribed_VideoCapabilityIsAbsent_NotificationIgnored) {
+ const mobile_apis::SystemCapabilityType::eType system_capability_type =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] = system_capability_type;
+ (*message_)[am::strings::msg_params][strings::app_id] = kAppId;
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(system_capability_type);
+
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_VideoStreamingCapability_AppIsSubsribed_VideoCapabilityExists_NotificationForwarded) {
+ const mobile_apis::SystemCapabilityType::eType system_capability_type =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] = system_capability_type;
+ (*message_)[am::strings::msg_params][strings::app_id] = kAppId;
+
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability] =
+ new smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Map);
+
+ auto& video_streaming_capability =
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability];
+
+ FillVideoStreamingCapability(video_streaming_capability);
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(system_capability_type);
+
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckVideoStreamingCapability(system_capability_type,
+ video_streaming_capability),
+ _));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
} // namespace on_bc_system_capability_updated_notification_from_hmi
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc
index f7da89df0b..56a6cd2e2f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc
@@ -73,6 +73,8 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
+ InitEventDispatcher();
+
RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
ASSERT_TRUE(command->Init());
@@ -88,6 +90,7 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(RCGetCapabilitiesRequestTest,
onTimeOut_OnCapabilityInitialized_RemoveRCGetCapabilities) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -96,7 +99,7 @@ TEST_F(RCGetCapabilitiesRequestTest,
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
}
} // namespace rc_get_capabilities_request
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 cb90859018..f4e3784642 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
@@ -217,7 +217,7 @@ TEST_F(RCIsReadyRequestTest, Run_ErrorMessage_StateNotAvailable) {
TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace rc_is_ready_request
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 31285f5b17..44bd7f4a80 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
@@ -59,6 +59,7 @@ namespace hmi_response = am::hmi_response;
using am::ApplicationSet;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using application_manager::event_engine::EventObserver;
using connection_handler_test::MockConnectionHandler;
using policy_test::MockPolicyHandlerInterface;
using sdl_rpc_plugin::commands::SDLActivateAppRequest;
@@ -113,8 +114,9 @@ class SDLActivateAppRequestTest
}
void InitCommand(const uint32_t& timeout) OVERRIDE {
- MockAppPtr mock_app = CreateMockApp();
CommandRequestTest<CommandsTestMocks::kIsNice>::InitCommand(timeout);
+
+ MockAppPtr mock_app = CreateMockApp();
ON_CALL((*mock_app), app_id()).WillByDefault(Return(kAppID));
ON_CALL(app_mngr_, application_by_hmi_app(kAppID))
.WillByDefault(Return(mock_app));
@@ -155,6 +157,8 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) {
CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
.WillOnce(Return(state));
+ EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true));
+
EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID));
command->Run();
@@ -200,8 +204,14 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(false));
- EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
- EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
+ ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false));
+ ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
MockAppPtr mock_app_first(CreateMockApp());
@@ -262,8 +272,14 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) {
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(false));
- EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
- EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
+ ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false));
+ ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
@@ -289,6 +305,12 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
.WillOnce(Return(false));
EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
@@ -325,14 +347,15 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActiveNONE_SUCCESS) {
EXPECT_CALL(mock_state_controller_,
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(false));
- EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true));
+
am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
-
EXPECT_CALL(*mock_app,
CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
.WillOnce(Return(state));
+ EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true));
+
EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID));
command->Run();
@@ -354,9 +377,16 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app));
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
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));
+ ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false));
+ ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false));
+
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
@@ -395,6 +425,12 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(false));
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
MockAppPtr mock_app_first(CreateMockApp());
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
ON_CALL(*mock_app_first, is_foreground()).WillByDefault(Return(false));
@@ -427,6 +463,13 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
EXPECT_CALL(mock_state_controller_,
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(false));
+
+ am::HmiStatePtr state = std::make_shared<am::HmiState>(mock_app, app_mngr_);
+ state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ EXPECT_CALL(*mock_app,
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillOnce(Return(state));
+
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
@@ -458,8 +501,8 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) {
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));
+ ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false));
+ ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(true));
#ifndef EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(app_mngr_, application(kAppID))
@@ -486,7 +529,7 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) {
EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings));
EXPECT_CALL(app_mngr_,
- updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout)));
+ UpdateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout)));
MockConnectionHandler connection_handler;
EXPECT_CALL(connection_handler, ConnectToDevice(kHandle));
@@ -503,10 +546,11 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) {
std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
- ON_CALL(mock_event_dispatcher_, remove_observer(_, _));
+ ON_CALL(mock_event_dispatcher_,
+ remove_observer(_, testing::Matcher<EventObserver&>(_)));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
- command->onTimeOut();
+ command->OnTimeOut();
}
TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
index 21260250ae..482ca93f3e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
@@ -114,6 +114,7 @@ using event_engine_test::MockEventDispatcher;
class RequestToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) {
+ InitEventDispatcher();
std::shared_ptr<am_commands::RequestToHMI> command(
CreateCommand<am_commands::RequestToHMI>());
@@ -124,6 +125,8 @@ TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) {
}
TEST_F(RequestToHMITest, SendRequest_SUCCESS) {
+ InitEventDispatcher();
+
std::shared_ptr<am_commands::RequestToHMI> command(
CreateCommand<am_commands::RequestToHMI>());
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull()));
@@ -222,6 +225,8 @@ TYPED_TEST_CASE(RequestToHMICommandsTest3, RequestCommandsList3);
TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
+ this->InitEventDispatcher();
+
std::shared_ptr<CommandType> command =
this->template CreateCommand<CommandType>();
@@ -233,6 +238,8 @@ TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
+ this->InitEventDispatcher();
+
std::shared_ptr<CommandType> command =
this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
@@ -243,6 +250,8 @@ TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) {
TYPED_TEST(RequestToHMICommandsTest3, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
+ EXPECT_CALL(this->event_dispatcher_, remove_observer(_));
+
std::shared_ptr<CommandType> command =
this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc
new file mode 100644
index 0000000000..c518bdf9b2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2021, 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 "hmi/subscribe_button_request.h"
+#include <memory>
+#include <string>
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace subscribe_button_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = am::strings;
+using am::commands::RequestToHMI;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::hmi::SubscribeButtonRequest;
+using ::test::components::application_manager_test::MockApplication;
+using ::test::components::event_engine_test::MockEventDispatcher;
+
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+typedef std::shared_ptr<SubscribeButtonRequest> SubscribeButtonRequestPtr;
+
+namespace {
+const uint32_t kCorrelationId = 2u;
+const uint32_t kAppId = 1u;
+const hmi_apis::Common_ButtonName::eType kCustomButtonName =
+ hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
+const hmi_apis::Common_ButtonName::eType kHmiButtonName =
+ hmi_apis::Common_ButtonName::SEEKLEFT;
+const mobile_apis::ButtonName::eType kMobileButtonName =
+ mobile_apis::ButtonName::SEEKLEFT;
+const mobile_apis::ButtonName::eType kMobileCustomButtonName =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+const hmi_apis::FunctionID::eType kFunctionID =
+ hmi_apis::FunctionID::Buttons_SubscribeButton;
+} // namespace
+
+class HMISubscribeButtonRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::app_id] = kAppId;
+ (*command_msg)[strings::msg_params][strings::button_name] = kHmiButtonName;
+ (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*command_msg)[strings::params][strings::function_id] = kFunctionID;
+
+ return command_msg;
+ }
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ mock_app_ = CreateMockApp();
+ CommandRequestTest<CommandsTestMocks::kIsNice>::InitCommand(timeout);
+ ON_CALL((*mock_app_), hmi_app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(app_mngr_, application_by_hmi_app(kAppId))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+ }
+
+ MockAppPtr mock_app_;
+};
+
+TEST_F(HMISubscribeButtonRequestTest, Run_SendRequest_SUCCESS) {
+ MockEventDispatcher mock_event_dispatcher;
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher));
+
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<SubscribeButtonRequest>(command_msg));
+
+ EXPECT_CALL(mock_event_dispatcher,
+ add_observer(kFunctionID, kCorrelationId, _))
+ .Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(HMISubscribeButtonRequestTest, Run_SendRequest_CUSTOM_BUTTON_SUCCESS) {
+ MockEventDispatcher mock_event_dispatcher;
+ EXPECT_CALL(app_mngr_, event_dispatcher())
+ .WillOnce(ReturnRef(mock_event_dispatcher));
+
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName;
+ RequestToHMIPtr command(CreateCommand<SubscribeButtonRequest>(command_msg));
+
+ EXPECT_CALL(mock_event_dispatcher,
+ add_observer(kFunctionID, kCorrelationId, _));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(HMISubscribeButtonRequestTest,
+ onTimeOut_RequestIsExpired_HandleOnTimeout) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<SubscribeButtonRequest>(command_msg));
+
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ ON_CALL(app_mngr_, resume_controller())
+ .WillByDefault(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(kCorrelationId, kFunctionID));
+
+ command->OnTimeOut();
+}
+
+TEST_F(HMISubscribeButtonRequestTest,
+ OnEvent_SuccessfulResponse_ButtonSubscribed) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName;
+
+ SubscribeButtonRequestPtr command =
+ CreateCommand<SubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileCustomButtonName))
+ .WillOnce(Return(true));
+
+ command->on_event(event);
+}
+
+TEST_F(HMISubscribeButtonRequestTest,
+ OnEvent_UnsuccessfulResponse_ButtonNotSubscribed) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName;
+
+ SubscribeButtonRequestPtr command =
+ CreateCommand<SubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileCustomButtonName)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(HMISubscribeButtonRequestTest, onEvent_App_NULL) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ SubscribeButtonRequestPtr command =
+ CreateCommand<SubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ MockAppPtr mock_app = NULL;
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileButtonName)).Times(0);
+
+ command->on_event(event);
+}
+
+} // namespace subscribe_button_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc
new file mode 100644
index 0000000000..490a3bc2e5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2021, 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 <string>
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "hmi/subscribe_button_response.h"
+
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace subscribe_button_response {
+
+namespace am = ::application_manager;
+using application_manager::ExpiredButtonRequestData;
+using application_manager::commands::ResponseFromHMI;
+using sdl_rpc_plugin::commands::hmi::SubscribeButtonResponse;
+using ::test::components::event_engine_test::MockEventDispatcher;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
+
+namespace {
+const uint32_t kCorrelationId = 2u;
+const uint32_t kAppId = 1u;
+const hmi_apis::Common_ButtonName::eType kButtonName =
+ hmi_apis::Common_ButtonName::SEEKLEFT;
+const hmi_apis::FunctionID::eType kFunctionID =
+ hmi_apis::FunctionID::Buttons_UnsubscribeButton;
+} // namespace
+
+class HMISubscribeButtonResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ HMISubscribeButtonResponseTest() {
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ }
+
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ return command_msg;
+ }
+
+ MockEventDispatcher event_dispatcher_;
+};
+
+TEST_F(HMISubscribeButtonResponseTest,
+ RUN_ProcessExpiredRequest_SendUnsubscribeRequestToHMI) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ ResponseFromHMIPtr command(
+ CreateCommand<SubscribeButtonResponse>(command_msg));
+
+ ExpiredButtonRequestData expired_data;
+ expired_data.app_id_ = kAppId;
+ expired_data.button_name_ = kButtonName;
+ utils::Optional<ExpiredButtonRequestData> expired_data_opt = expired_data;
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(expired_data_opt));
+ ON_CALL(mock_message_helper_,
+ CreateButtonSubscriptionHandlingRequestToHmi(
+ kAppId, kButtonName, kFunctionID, _))
+ .WillByDefault(Return(command_msg));
+ EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+
+ command->Run();
+}
+
+TEST_F(
+ HMISubscribeButtonResponseTest,
+ RUN_ProcessUnsuccessfulExpiredRequest_EventNotRaisedUnsubscribeRequestNotSent) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<SubscribeButtonResponse>(command_msg));
+
+ ExpiredButtonRequestData expired_data;
+ expired_data.app_id_ = kAppId;
+ expired_data.button_name_ = kButtonName;
+ utils::Optional<ExpiredButtonRequestData> expired_data_opt = expired_data;
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(expired_data_opt));
+ EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ command->Run();
+}
+
+TEST_F(HMISubscribeButtonResponseTest, RUN_NoExpiredRequests_EventRaised) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ ResponseFromHMIPtr command(
+ CreateCommand<SubscribeButtonResponse>(command_msg));
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(utils::Optional<ExpiredButtonRequestData>::EMPTY));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+ EXPECT_CALL(event_dispatcher_, raise_event(_));
+
+ command->Run();
+}
+
+} // namespace subscribe_button_response
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc
index bae6b6082e..b3ba2d30a9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc
@@ -77,6 +77,7 @@ class TTSGetCapabilitiesRequestTest
TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<TTSGetCapabilitiesRequest>(command_msg));
@@ -93,6 +94,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<TTSGetCapabilitiesRequest>(command_msg));
@@ -102,7 +104,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc
index a0bf0887db..275f4a18ff 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc
@@ -77,6 +77,7 @@ class TTSGetLanguageRequestTest
TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -92,6 +93,7 @@ TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -100,7 +102,7 @@ TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc
index 1561e1def5..373d217ee6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc
@@ -77,6 +77,7 @@ class TTSGetSupportedLanguagesRequestTest
TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg));
@@ -94,6 +95,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(TTSGetSupportedLanguagesRequestTest,
onTimeOut_TTSGetSupportedLanguagesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg));
@@ -103,7 +105,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest,
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc
index e758bfca1f..3428cc8923 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc
@@ -242,7 +242,7 @@ TEST_F(TTSIsReadyRequestTest,
ASSERT_TRUE(command_->Init());
command_->Run();
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace tts_is_ready_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc
index 1057a89cc6..ca568ba630 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc
@@ -77,6 +77,7 @@ class UIGetCapabilitiesRequestTest
TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -92,6 +93,7 @@ TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -100,7 +102,7 @@ TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
index cf701caf51..37531b469a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
@@ -344,6 +344,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::pixel_per_inch] = 117.f;
video_streaming_capability[strings::scale] = 1.f;
+ video_streaming_capability[strings::preferred_fps] = 30;
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
@@ -355,25 +356,6 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
command->Run();
}
-TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) {
- MessageSharedPtr command_msg = CreateCommandMsg();
- (*command_msg)[strings::msg_params][strings::system_capabilities] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- ResponseFromHMIPtr command(
- CreateCommand<UIGetCapabilitiesResponse>(command_msg));
-
- const auto& display_capability_so =
- (*command_msg)[strings::msg_params][strings::system_capabilities]
- [strings::display_capabilities];
-
- EXPECT_CALL(mock_hmi_capabilities_,
- set_system_display_capabilities(display_capability_so));
-
- ASSERT_TRUE(command->Init());
- command->Run();
-}
-
TEST_F(UIGetCapabilitiesResponseTest,
SaveCachedCapabilitiesToFileCall_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc
index c944f1b49b..6cdcd6eb00 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc
@@ -77,6 +77,7 @@ class UIGetLanguageRequestTest
TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -92,6 +93,7 @@ TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -100,7 +102,7 @@ TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc
index 251b6b7d58..69d0f6d117 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc
@@ -77,6 +77,7 @@ class UIGetSupportedLanguagesRequestTest
TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<UIGetSupportedLanguagesRequest>(command_msg));
@@ -94,6 +95,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(UIGetSupportedLanguagesRequestTest,
onTimeOut_UIGetSupportedLanguagesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<UIGetSupportedLanguagesRequest>(command_msg));
@@ -103,7 +105,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest,
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
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 a82ad39d83..4db9f5cf62 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
@@ -208,7 +208,7 @@ TEST_F(UIIsReadyRequestTest,
TEST_F(UIIsReadyRequestTest, OnTimeout_SUCCESS_CacheIsAbsent) {
HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace ui_is_ready_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc
new file mode 100644
index 0000000000..5a0790a5e0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2021, 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 "hmi/unsubscribe_button_request.h"
+
+#include <memory>
+#include <string>
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/resumption/resumption_data_processor.h"
+
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace unsubscribe_button_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = am::strings;
+using am::commands::RequestToHMI;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::hmi::UnsubscribeButtonRequest;
+using ::test::components::application_manager_test::MockApplication;
+
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+typedef std::shared_ptr<UnsubscribeButtonRequest> UnsubscribeButtonRequestPtr;
+
+namespace {
+const uint32_t kCorrelationId = 2u;
+const uint32_t kAppId = 1u;
+const hmi_apis::Common_ButtonName::eType kButtonName =
+ hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
+const hmi_apis::FunctionID::eType kFunctionID =
+ hmi_apis::FunctionID::Buttons_UnsubscribeButton;
+const mobile_apis::ButtonName::eType kMobileCustomButtonName =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+} // namespace
+
+class HMIUnsubscribeButtonRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::app_id] = kAppId;
+ (*command_msg)[strings::msg_params][strings::button_name] = kButtonName;
+ (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*command_msg)[strings::params][strings::function_id] = kFunctionID;
+
+ return command_msg;
+ }
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ mock_app_ = CreateMockApp();
+ CommandRequestTest<CommandsTestMocks::kIsNice>::InitCommand(timeout);
+ ON_CALL((*mock_app_), hmi_app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(app_mngr_, application_by_hmi_app(kAppId))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+ }
+
+ MockAppPtr mock_app_;
+};
+
+TEST_F(HMIUnsubscribeButtonRequestTest, Run_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(HMIUnsubscribeButtonRequestTest,
+ onTimeOut_RequestIsExpired_HandleOnTimeout) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+
+ resumption_test::MockResumeCtrl mock_resume_ctrl;
+ ON_CALL(app_mngr_, resume_controller())
+ .WillByDefault(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
+
+ command->OnTimeOut();
+}
+
+TEST_F(HMIUnsubscribeButtonRequestTest,
+ OnEvent_SuccessfulResponse_ButtonUnsubscribed) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ UnsubscribeButtonRequestPtr command =
+ CreateCommand<UnsubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName))
+ .WillOnce(Return(true));
+
+ command->on_event(event);
+}
+
+TEST_F(HMIUnsubscribeButtonRequestTest,
+ OnEvent_UnsuccessfulResponse_ButtonNotUnsubscribed) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ UnsubscribeButtonRequestPtr command =
+ CreateCommand<UnsubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName))
+ .Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(HMIUnsubscribeButtonRequestTest, onEvent_App_NULL) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ UnsubscribeButtonRequestPtr command =
+ CreateCommand<UnsubscribeButtonRequest>(command_msg);
+
+ MessageSharedPtr event_msg = CreateCommandMsg();
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ Event event(kFunctionID);
+ event.set_smart_object(*event_msg);
+
+ MockAppPtr mock_app = NULL;
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName))
+ .Times(0);
+
+ command->on_event(event);
+}
+
+} // namespace unsubscribe_button_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc
new file mode 100644
index 0000000000..1659081e69
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2021, 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 <string>
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "hmi/unsubscribe_button_response.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace unsubscribe_button_response {
+
+namespace am = ::application_manager;
+using application_manager::ExpiredButtonRequestData;
+using application_manager::commands::ResponseFromHMI;
+using sdl_rpc_plugin::commands::hmi::UnsubscribeButtonResponse;
+using ::test::components::event_engine_test::MockEventDispatcher;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
+
+namespace {
+const uint32_t kCorrelationId = 2u;
+const uint32_t kAppId = 1u;
+const hmi_apis::Common_ButtonName::eType kButtonName =
+ hmi_apis::Common_ButtonName::SEEKLEFT;
+const hmi_apis::FunctionID::eType kFunctionID =
+ hmi_apis::FunctionID::Buttons_SubscribeButton;
+} // namespace
+
+class HMIUnsubscribeButtonResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ HMIUnsubscribeButtonResponseTest() {
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ }
+
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ return command_msg;
+ }
+
+ MockEventDispatcher event_dispatcher_;
+};
+
+TEST_F(HMIUnsubscribeButtonResponseTest,
+ RUN_ProcessExpiredRequest_SendSubscribeRequestToHMI) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UnsubscribeButtonResponse>(command_msg));
+
+ ExpiredButtonRequestData expired_data;
+ expired_data.app_id_ = kAppId;
+ expired_data.button_name_ = kButtonName;
+ utils::Optional<ExpiredButtonRequestData> expired_data_opt = expired_data;
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(expired_data_opt));
+ ON_CALL(mock_message_helper_,
+ CreateButtonSubscriptionHandlingRequestToHmi(
+ kAppId, kButtonName, kFunctionID, _))
+ .WillByDefault(Return(command_msg));
+ EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+
+ command->Run();
+}
+
+TEST_F(
+ HMIUnsubscribeButtonResponseTest,
+ RUN_ProcessUnsuccessfulExpiredRequest_EventNotRaisedSubscribeRequestNotSent) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UnsubscribeButtonResponse>(command_msg));
+
+ ExpiredButtonRequestData expired_data;
+ expired_data.app_id_ = kAppId;
+ expired_data.button_name_ = kButtonName;
+ utils::Optional<ExpiredButtonRequestData> expired_data_opt = expired_data;
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(expired_data_opt));
+ EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ command->Run();
+}
+
+TEST_F(HMIUnsubscribeButtonResponseTest, RUN_NoExpiredRequests_EventRaised) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ ResponseFromHMIPtr command(
+ CreateCommand<UnsubscribeButtonResponse>(command_msg));
+
+ ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId))
+ .WillByDefault(Return(utils::Optional<ExpiredButtonRequestData>::EMPTY));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+ EXPECT_CALL(event_dispatcher_, raise_event(_));
+ command->Run();
+}
+
+} // namespace unsubscribe_button_response
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
index 31c03a7ed5..0c95013964 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
@@ -64,6 +64,7 @@ namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
using am::commands::CommandImpl;
using am::event_engine::Event;
+using application_manager::event_engine::EventObserver;
using sdl_rpc_plugin::commands::UpdateDeviceListRequest;
typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr;
@@ -90,11 +91,9 @@ class UpdateDeviceListRequestTest
};
TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) {
- MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
- EXPECT_CALL(app_mngr_, event_dispatcher())
- .WillOnce(ReturnRef(mock_event_dispatcher_));
- EXPECT_CALL(mock_event_dispatcher_, remove_observer(_));
+ MessageSharedPtr command_msg = CreateCommandMsg();
UpdateDeviceListRequestPtr command(
CreateCommand<UpdateDeviceListRequest>(command_msg));
@@ -103,7 +102,7 @@ TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) {
EXPECT_CALL(settings_, launch_hmi()).WillOnce(Return(false));
- EXPECT_CALL(app_mngr_, IsHMICooperating()).Times(0);
+ EXPECT_CALL(app_mngr_, WaitForHmiIsReady()).Times(0);
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
command->Run();
@@ -114,12 +113,10 @@ TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) {
CommandImpl::protocol_version_);
}
-TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESSS) {
- MessageSharedPtr command_msg = CreateCommandMsg();
+TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESS) {
+ InitEventDispatcher();
- EXPECT_CALL(app_mngr_, event_dispatcher())
- .WillOnce(ReturnRef(mock_event_dispatcher_));
- EXPECT_CALL(mock_event_dispatcher_, remove_observer(_));
+ MessageSharedPtr command_msg = CreateCommandMsg();
UpdateDeviceListRequestPtr command(
CreateCommand<UpdateDeviceListRequest>(command_msg));
@@ -128,7 +125,7 @@ TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESSS) {
EXPECT_CALL(settings_, launch_hmi()).WillOnce(Return(true));
- EXPECT_CALL(app_mngr_, IsHMICooperating()).WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, WaitForHmiIsReady()).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
command->Run();
@@ -139,29 +136,22 @@ TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESSS) {
CommandImpl::protocol_version_);
}
-TEST_F(UpdateDeviceListRequestTest, OnEvent_WrongEventId_UNSUCCESS) {
- Event event(Event::EventID::INVALID_ENUM);
-
- EXPECT_CALL(app_mngr_, event_dispatcher())
- .WillOnce(ReturnRef(mock_event_dispatcher_));
- EXPECT_CALL(mock_event_dispatcher_, remove_observer(_));
+TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsFalse_UNSUCCESS) {
+ InitEventDispatcher();
- UpdateDeviceListRequestPtr command(CreateCommand<UpdateDeviceListRequest>());
+ MessageSharedPtr command_msg = CreateCommandMsg();
- command->on_event(event);
-}
+ UpdateDeviceListRequestPtr command(
+ CreateCommand<UpdateDeviceListRequest>(command_msg));
-TEST_F(UpdateDeviceListRequestTest, OnEvent_SUCCESS) {
- Event event(Event::EventID::BasicCommunication_OnReady);
+ EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings_));
- EXPECT_CALL(app_mngr_, event_dispatcher())
- .WillOnce(ReturnRef(mock_event_dispatcher_));
- EXPECT_CALL(mock_event_dispatcher_, remove_observer(_, _));
- EXPECT_CALL(mock_event_dispatcher_, remove_observer(_));
+ EXPECT_CALL(settings_, launch_hmi()).WillOnce(Return(true));
- UpdateDeviceListRequestPtr command(CreateCommand<UpdateDeviceListRequest>());
+ EXPECT_CALL(app_mngr_, WaitForHmiIsReady()).WillOnce(Return(false));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
- command->on_event(event);
+ command->Run();
}
} // namespace update_device_list_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
index 92e3fa1187..b6aa134dfc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
@@ -69,6 +69,8 @@ TEST_F(UpdateSDLRequestTest, RUN_SUCCESS) {
(*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
(*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ InitEventDispatcher();
+
UpdateSDLRequestPtr command(CreateCommand<UpdateSDLRequest>(command_msg));
EXPECT_CALL(mock_policy_handler_, PTExchangeAtUserRequest(kCorrelationId));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc
index cef87f06b4..2933b6aa44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc
@@ -77,6 +77,7 @@ class VRGetCapabilitiesRequestTest
TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -92,6 +93,7 @@ TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -100,7 +102,7 @@ TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc
index 6235b41691..fffc56b979 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc
@@ -77,6 +77,7 @@ class VRGetLanguageRequestTest
TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -92,6 +93,7 @@ TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
@@ -100,7 +102,7 @@ TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) {
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc
index 73657528e9..af2faa12e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc
@@ -77,7 +77,7 @@ class VRGetSupportedLanguagesRequestTest
TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
-
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<VRGetSupportedLanguagesRequest>(command_msg));
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
@@ -94,6 +94,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
TEST_F(VRGetSupportedLanguagesRequestTest,
onTimeOut_VRGetSupportedLanguagesUpdated) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ InitEventDispatcher();
RequestToHMIPtr command(
CreateCommand<VRGetSupportedLanguagesRequest>(command_msg));
@@ -103,7 +104,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest,
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(CommandImpl::hmi_protocol_type_,
(*command_msg)[strings::params][strings::protocol_type].asInt());
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 3d2a46707e..ea1b90598e 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
@@ -192,7 +192,7 @@ TEST_F(VRIsReadyRequestTest,
Run_HMIDoestRespond_SendMessageToHMIByTimeout_CacheIsAbsent) {
HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace vr_is_ready_request
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 aa199bd112..b4795dae21 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
@@ -74,6 +74,7 @@ using ::testing::_;
using ::testing::InSequence;
using ::testing::Return;
using namespace smart_objects;
+using app_mngr::commands::RequestFromMobileImpl;
namespace custom_str = utils::custom_string;
namespace strings = ::application_manager::strings;
@@ -222,10 +223,9 @@ class AddCommandRequestTest
mock_rpc_service_,
ManageMobileCommand(response,
am::commands::Command::CommandSource::SOURCE_SDL));
-
- std::shared_ptr<CommandRequestImpl> base_class_request =
- static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
- base_class_request->onTimeOut();
+ std::shared_ptr<RequestFromMobileImpl> base_class_request =
+ static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr);
+ base_class_request->OnTimeOut();
}
MessageSharedPtr msg_;
@@ -373,26 +373,27 @@ TEST_F(AddCommandRequestTest, Run_CommandIDAlreadyExists_EXPECT_INVALID_ID) {
request_ptr->Run();
}
-TEST_F(AddCommandRequestTest,
- Run_CommandNameAlreadyExists_EXPECT_DUPLICATE_NAME) {
+TEST_F(AddCommandRequestTest, Run_CommandNameAlreadyExists_EXPECT_Forwarded) {
CreateBasicParamsUIRequest();
- SmartObject& msg_params = (*msg_)[strings::msg_params];
- msg_params[menu_params][hmi_request::parent_id] = kFirstParentId;
- SmartObject& image = msg_params[cmd_icon];
+ (*msg_)[msg_params][menu_name] = kMenuName;
+ SmartObject& image = (*msg_)[msg_params][cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(smart_obj_));
+ EXPECT_CALL(*mock_app_, AddCommand(_, (*msg_)[msg_params]));
+
SmartObject first_command = SmartObject(SmartType_Map);
SmartObject second_command = SmartObject(SmartType_Map);
- const am::CommandsMap commands_map =
+ am::CommandsMap commands_map =
CreateCommandsMap(first_command, second_command);
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- EXPECT_CALL(mock_rpc_service_,
- ManageMobileCommand(
- MobileResultCodeIs(mobile_apis::Result::DUPLICATE_NAME), _));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
+ .WillOnce(Return(true));
std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -607,22 +608,41 @@ TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_UI_DeleteCommand) {
}
TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
- MessageSharedPtr command_msg = CreateMessage(SmartType_Map);
- (*command_msg)[params][connection_key] = kConnectionKey;
- MessageSharedPtr event_msg = CreateMessage(SmartType_Map);
- (*event_msg)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
- (*event_msg)[msg_params][cmd_id] = kCmdId;
+ CreateBasicParamsVRRequest();
+ CreateBasicParamsUIRequest();
+ SmartObject& params = (*msg_)[strings::params];
+ params[hmi_response::code] = hmi_apis::Common_Result::WARNINGS;
+ SmartObject& image = (*msg_)[msg_params][cmd_icon];
+ EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
- event_ui.set_smart_object(*event_msg);
-
+ event_ui.set_smart_object(*msg_);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
- event_vr.set_smart_object(*event_msg);
+ event_vr.set_smart_object(*msg_);
+
+ am::CommandsMap commands_map;
+ EXPECT_CALL(*mock_app_, commands_map())
+ .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
+ commands_map, lock_ptr_)));
+
+ 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), _))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0);
std::shared_ptr<AddCommandRequest> request_ptr =
- CreateCommand<AddCommandRequest>(command_msg);
+ CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
request_ptr->on_event(event_ui);
request_ptr->on_event(event_vr);
@@ -1096,11 +1116,10 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
-
- std::shared_ptr<CommandRequestImpl> base_class_request =
- static_cast<std::shared_ptr<CommandRequestImpl> >(
+ std::shared_ptr<RequestFromMobileImpl> base_class_request =
+ static_cast<std::shared_ptr<RequestFromMobileImpl> >(
CreateCommand<AddCommandRequest>(msg_));
- base_class_request->onTimeOut();
+ base_class_request->OnTimeOut();
}
TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
@@ -1147,10 +1166,9 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
-
- std::shared_ptr<CommandRequestImpl> base_class_request =
- static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
- base_class_request->onTimeOut();
+ std::shared_ptr<RequestFromMobileImpl> base_class_request =
+ static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr);
+ base_class_request->OnTimeOut();
}
} // namespace add_command_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
index e726616345..e7a6c43fe4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
@@ -215,7 +215,7 @@ TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) {
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event)));
- EXPECT_EQ(mobile_apis::Result::INVALID_ENUM,
+ EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR,
static_cast<mobile_apis::Result::eType>(
(*result_msg)[am::strings::msg_params][am::strings::result_code]
.asInt()));
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 dc7731bfc8..233a99a8cd 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
@@ -56,6 +56,7 @@ using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using app_mngr::commands::RequestFromMobileImpl;
using policy_test::MockPolicyHandlerInterface;
using sdl_rpc_plugin::commands::AlertRequest;
using ::testing::_;
@@ -207,7 +208,7 @@ TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) {
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success]
.asBool(),
false);
@@ -259,13 +260,13 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
class CallOnTimeOut {
public:
- CallOnTimeOut(CommandRequestImpl& command) : command_(command) {}
+ CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {}
void operator()() {
- command_.onTimeOut();
+ command_.OnTimeOut();
}
- CommandRequestImpl& command_;
+ RequestFromMobileImpl& command_;
};
TEST_F(AlertRequestTest, Init_DurationExists_SUCCESS) {
@@ -335,7 +336,7 @@ TEST_F(AlertRequestTest, Run_FailToProcessSoftButtons_UNSUCCESS) {
CommandPtr command(CreateCommand<AlertRequest>(msg_));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- EXPECT_EQ(result_code,
+ EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR,
static_cast<mobile_apis::Result::eType>(
(*result_msg)[am::strings::msg_params][am::strings::result_code]
.asInt()));
@@ -403,27 +404,6 @@ TEST_F(AlertRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
command->on_event(event);
}
-TEST_F(AlertRequestTest, DISABLED_OnEvent_UI_OnResetTimeout_SUCCESS) {
- PreConditions();
- Expectations();
- AddAlertTextsToMsg();
-
- (*msg_)[am::strings::msg_params][am::strings::duration] = kDefaultTimeout;
-
- CommandPtr command(CreateCommand<AlertRequest>(msg_));
- EXPECT_TRUE(command->Init());
-
- EXPECT_CALL(
- app_mngr_,
- updateRequestTimeout(kConnectionKey, kCorrelationId, kDefaultTimeout));
-
- ExpectManageMobileCommandWithResultCode(mobile_apis::Result::INVALID_ENUM);
-
- Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
- event.set_smart_object(*msg_);
- command->on_event(event);
-}
-
TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) {
Expectations();
AddAlertTextsToMsg();
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 80abfec61d..3f8ac0028b 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
@@ -165,11 +165,6 @@ class CreateInteractionChoiceSetResponseTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) {
- MessageSharedPtr msg_vr = CreateMessage(smart_objects::SmartType_Map);
- (*msg_vr)[strings::msg_params][strings::result_code] =
- am::mobile_api::Result::GENERIC_ERROR;
- (*msg_vr)[strings::msg_params][strings::success] = false;
-
std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr =
CreateCommand<CreateInteractionChoiceSetRequest>();
@@ -179,6 +174,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) {
ON_CALL(*mock_app, get_grammar_id()).WillByDefault(Return(kConnectionKey));
ON_CALL(*mock_app, RemoveCommand(_)).WillByDefault(Return());
+ InitNegativeResponse();
+
MessageSharedPtr vr_command_result;
EXPECT_CALL(
@@ -191,7 +188,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) {
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
- req_vr->onTimeOut();
+ req_vr->OnTimeOut();
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::success].asBool(),
false);
@@ -619,7 +616,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
command_->Run();
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(0);
event.set_smart_object(*message_);
@@ -655,7 +652,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillByDefault(Return(kCorrelationId));
command_->Run();
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(0);
event.set_smart_object(*message_);
@@ -696,7 +693,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
event.set_smart_object(*message_);
command_->on_event(event);
@@ -706,6 +703,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
OnTimeOut_InvalidErrorFromHMI_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
+ InitNegativeResponse();
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR),
@@ -716,8 +715,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
-
- command_->onTimeOut();
+ command_->OnTimeOut();
}
TEST_F(CreateInteractionChoiceSetRequestTest,
@@ -751,7 +749,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
command_->Run();
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
@@ -766,7 +764,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
- command_->onTimeOut();
+ command_->OnTimeOut();
}
TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
@@ -801,7 +799,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
command_->Run();
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(2);
Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
@@ -811,12 +809,13 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(invalid_app));
EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0);
+
resumption_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(app_mngr_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _));
- command_->onTimeOut();
+ command_->OnTimeOut();
}
TEST_F(CreateInteractionChoiceSetRequestTest,
@@ -854,7 +853,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
resumption_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(app_mngr_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
@@ -871,7 +870,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, RemoveChoiceSet(_));
- command_->onTimeOut();
+ InitNegativeResponse();
+
+ command_->OnTimeOut();
}
TEST_F(CreateInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) {
@@ -935,7 +936,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR),
am::commands::Command::SOURCE_SDL));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
event.set_smart_object(*message_);
command_->on_event(event);
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 dd4c6fd526..bd4c5c1ec6 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
@@ -209,9 +209,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(invalid_choice_set_id));
- EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
- EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId));
- EXPECT_CALL(*app_, UpdateHash());
+ EXPECT_CALL(*app_, app_id()).Times(0);
}
DeleteInteractionChoiceSetRequestPtr command =
@@ -222,8 +220,13 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
}
TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
+ using namespace application_manager;
+ using namespace event_engine;
+
(*message_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
+ (*message_)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
(*message_)[am::strings::msg_params][am::strings::grammar_id] = kGrammarId;
@@ -232,6 +235,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
smart_objects::SmartObject choice_set_id =
(*message_)[am::strings::msg_params];
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::VR_DeleteCommand);
+ event.set_smart_object(*message_);
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(app_));
@@ -246,21 +253,27 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
- EXPECT_CALL(*app_, app_id())
- .WillOnce(Return(kConnectionKey))
- .WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
+ }
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+
+ {
+ InSequence seq;
EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId));
EXPECT_CALL(*app_, UpdateHash());
}
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(Return(true));
DeleteInteractionChoiceSetRequestPtr command =
CreateCommand<DeleteInteractionChoiceSetRequest>(message_);
command->Init();
command->Run();
+
+ command->on_event(event);
}
TEST_F(DeleteInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) {
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 f5856a8eda..975cba89a1 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
@@ -67,6 +67,7 @@ using sdl_rpc_plugin::commands::DeleteSubMenuResponse;
typedef std::shared_ptr<DeleteSubMenuRequest> DeleteSubMenuRequestPtr;
typedef std::shared_ptr<DeleteSubMenuResponse> DeleteSubMenuResponsePtr;
+typedef std::shared_ptr<Event> EventPtr;
MATCHER_P(CheckMessageResultCode, result_code, "") {
return (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
@@ -89,8 +90,9 @@ namespace {
const uint32_t kConnectionKey = 2u;
const uint32_t kCorrelationId = 10u;
const uint32_t kMenuId = 100u;
+const uint32_t kMenuIdChild = 101u;
const uint32_t kGrammarId = 101u;
-const int32_t kCmdId = 102;
+const int32_t kCmdId = 102u;
} // namespace
class DeleteSubMenuRequestTest
@@ -107,6 +109,224 @@ class DeleteSubMenuRequestTest
std::make_shared<am_test::MockHelpPromptManager>())
, app_(CreateMockApp()) {}
+ /**
+ * @brief Generates submenu smart object with specified params
+ * @param menu_id id of the menu
+ * @param parent_id id of parent menu
+ * @return generated smart object
+ */
+ smart_objects::SmartObjectSPtr GenerateSubMenuMap(const uint32_t menu_id,
+ const uint32_t parent_id) {
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ std::make_shared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& object = *smartObjectPtr;
+
+ object[am::strings::position] = 1;
+ object[am::strings::menu_name] = "SubMenu " + std::to_string(menu_id);
+ object[am::strings::menu_id] = menu_id;
+ object[am::strings::parent_id] = parent_id;
+
+ return smartObjectPtr;
+ }
+
+ /**
+ * @brief Generates UI & VR commands smart object with specified params
+ * @param cmd_id id of the command
+ * @param parent_id id of parent command
+ * @return generated smart object
+ */
+ smart_objects::SmartObjectSPtr GenerateUiVrCommandMapChild(
+ const uint32_t cmd_id, const uint32_t parent_id) {
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ std::make_shared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& object = *smartObjectPtr;
+
+ object[am::strings::cmd_id] = cmd_id;
+ object[am::strings::grammar_id] = kGrammarId;
+ object[am::strings::vr_commands] = "VR commands";
+ object[am::strings::type] = hmi_apis::Common_VRCommandType::Command;
+ object[am::strings::menu_params][am::hmi_request::parent_id] = parent_id;
+
+ return smartObjectPtr;
+ }
+
+ /**
+ * @brief Sets up expectations for a successful execution of submenu request
+ * @param next_function_id function id of the next request
+ */
+ void SetUpSubMenuRequestExpectations(
+ const hmi_apis::FunctionID::eType next_function_id) {
+ (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
+ (*message_)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*message_)[am::strings::params][am::strings::function_id] =
+ next_function_id;
+
+ smart_objects::SmartObject sub_menu =
+ (*message_)[am::strings::msg_params][am::strings::menu_id];
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
+ EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(sub_menu));
+
+ ON_CALL(*app_, sub_menu_map()).WillByDefault(Return(sub_menu_accessor_));
+ ON_CALL(*app_, commands_map()).WillByDefault(Return(accessor_));
+
+ EXPECT_CALL(*app_, app_id()).WillRepeatedly(Return(kConnectionKey));
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(kCorrelationId));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(next_function_id), _))
+ .WillOnce(Return(true));
+ }
+
+ /**
+ * @brief Prepares submenu response event with the specified params
+ * @param correlation_id correlation id
+ * @param menu_id id of the menu
+ * @return pointer to prepared event
+ */
+ EventPtr PrepareSubMenuResponseEvent(const uint32_t correlation_id,
+ const uint32_t menu_id) {
+ EventPtr menu_event =
+ std::make_shared<Event>(hmi_apis::FunctionID::UI_DeleteSubMenu);
+ (*message_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
+ (*message_)[am::strings::params][am::strings::correlation_id] =
+ correlation_id;
+ (*message_)[am::strings::msg_params][am::strings::menu_id] = menu_id;
+ menu_event->set_smart_object(*message_);
+
+ return menu_event;
+ }
+
+ /**
+ * @brief Sets up expectations for a successful execution of submenu
+ * subsequent response
+ * @param event pointer to event representing the response message
+ * @param next_function_id function id of the next request
+ */
+ void SetUpSubMenuSubsequentResponseExpectations(
+ EventPtr event, hmi_apis::FunctionID::eType next_function_id) {
+ const auto& event_so_ref = event->smart_object();
+ const auto correlation_id = event->smart_object_correlation_id();
+ const auto menu_id =
+ event_so_ref[am::strings::msg_params][am::strings::menu_id].asUInt();
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
+ EXPECT_CALL(*app_, RemoveSubMenu(menu_id));
+
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(correlation_id + 1));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(next_function_id), _))
+ .WillOnce(Return(true));
+ }
+
+ /**
+ * @brief Prepares VR command response event with the specified params
+ * @param correlation_id correlation id
+ * @return pointer to prepared event
+ */
+ EventPtr PrepareVrCommandResponseEvent(const uint32_t correlation_id) {
+ EventPtr vr_event =
+ std::make_shared<Event>(hmi_apis::FunctionID::VR_DeleteCommand);
+ (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
+ (*message_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*message_)[am::strings::params][am::strings::correlation_id] =
+ correlation_id;
+ vr_event->set_smart_object(*message_);
+
+ return vr_event;
+ }
+
+ /**
+ * @brief Sets up expectations for a successful execution of VR command
+ * subsequent response
+ * @param event pointer to event representing the response message
+ * @param next_function_id function id of the next request
+ */
+ void SetUpVrCommandSubsequentResponseExpectations(
+ EventPtr event, hmi_apis::FunctionID::eType next_function_id) {
+ const auto correlation_id = event->smart_object_correlation_id();
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(correlation_id + 1));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(next_function_id), _))
+ .WillOnce(Return(true));
+ }
+
+ /**
+ * @brief Prepares UI command response event with the specified params
+ * @param correlation_id correlation id
+ * @param cmd_id id of the command
+ * @return pointer to prepared event
+ */
+ EventPtr PrepareUiCommandResponseEvent(const uint32_t correlation_id,
+ const uint32_t cmd_id) {
+ EventPtr ui_event =
+ std::make_shared<Event>(hmi_apis::FunctionID::UI_DeleteCommand);
+ (*message_)[am::strings::params][am::strings::correlation_id] =
+ correlation_id;
+ (*message_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
+ (*message_)[am::strings::msg_params][am::strings::cmd_id] = cmd_id;
+ ui_event->set_smart_object(*message_);
+
+ return ui_event;
+ }
+
+ /**
+ * @brief Sets up expectations for a successful execution of UI command
+ * subsequent response
+ * @param event pointer to event representing the response message
+ * @param next_function_id function id of the next request
+ */
+ void SetUpUiCommandSubsequentResponseExpectations(
+ EventPtr event, hmi_apis::FunctionID::eType next_function_id) {
+ const auto correlation_id = event->smart_object_correlation_id();
+ const auto& event_so_ref = event->smart_object();
+ const auto cmd_id =
+ event_so_ref[am::strings::msg_params][am::strings::cmd_id].asUInt();
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
+ EXPECT_CALL(*app_, RemoveCommand(cmd_id))
+ .WillOnce(DeleteCommand(&commands_map_));
+ EXPECT_CALL(*app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(cmd_id, false));
+
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(correlation_id + 1));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(next_function_id), _))
+ .WillOnce(Return(true));
+ }
+
+ /**
+ * @brief Sets up expectations for a successful execution of submenu final
+ * response
+ * @param event pointer to event representing the response message
+ */
+ void SetUpSubMenuFinalResponseExpectations(EventPtr event) {
+ const auto& event_so_ref = event->smart_object();
+ const auto menu_id =
+ event_so_ref[am::strings::msg_params][am::strings::menu_id].asUInt();
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
+ EXPECT_CALL(*app_, RemoveSubMenu(menu_id));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ am::commands::Command::SOURCE_SDL));
+ }
+
am::CommandsMap commands_map_;
am::SubMenuMap sub_menu_map_;
mutable std::shared_ptr<sync_primitives::Lock> commands_lock_;
@@ -215,175 +435,187 @@ TEST_F(DeleteSubMenuRequestTest, Run_FindSubMenuFalse_UNSUCCESS) {
command_->Run();
}
-TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) {
- (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
- (*message_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
-
- smart_objects::SmartObject sub_menu =
- (*message_)[am::strings::msg_params][am::strings::menu_id];
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
- EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(sub_menu));
-
- EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
- EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
- .WillOnce(Return(kCorrelationId));
-
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _))
- .WillOnce(Return(true));
- command_->Run();
-}
-
TEST_F(DeleteSubMenuRequestTest, OnEvent_UnknownEventId_UNSUCCESS) {
Event event(hmi_apis::FunctionID::INVALID_ENUM);
- EXPECT_CALL(app_mngr_, application(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(0);
command_->on_event(event);
}
TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
- Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
- (*message_)[am::strings::params][am::hmi_response::code] =
- hmi_apis::Common_Result::eType::SUCCESS;
- event.set_smart_object(*message_);
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
+
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->Run();
+
MockAppPtr invalid_app;
+ EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuId);
+
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app));
EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0);
- command_->on_event(event);
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(0);
+
+ command_->on_event(*event);
}
-TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
- Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
- (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
- (*message_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*message_)[am::strings::msg_params][am::strings::vr_commands] =
- "vr_commands";
- (*message_)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
- (*message_)[am::strings::msg_params][am::strings::menu_params]
- [am::hmi_request::parent_id] = kMenuId;
- const hmi_apis::Common_Result::eType result_code =
- hmi_apis::Common_Result::SUCCESS;
- (*message_)[am::strings::params][am::hmi_response::code] = result_code;
- event.set_smart_object(*message_);
+TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuOnly_SUCCESS) {
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
- commands_map_.insert(
- std::make_pair(0, &((*message_)[am::strings::msg_params])));
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->Run();
- smart_objects::SmartObjectSPtr smartObjectPtr =
- std::make_shared<smart_objects::SmartObject>();
+ EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuId);
+ SetUpSubMenuFinalResponseExpectations(event);
+ command_->on_event(*event);
+}
- smart_objects::SmartObject& object = *smartObjectPtr;
+TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuWithChildMenu_SUCCESS) {
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
- object[am::strings::position] = 1;
- object[am::strings::menu_name] = "SubMenu";
+ auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuIdChild, sub_menu_child_ptr.get()));
- sub_menu_map_.insert(
- std::pair<uint32_t, smart_objects::SmartObject*>(5, &object));
- EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_));
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->Run();
- InSequence seq;
- EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_));
- EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
- EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId));
+ EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuIdChild);
+ SetUpSubMenuSubsequentResponseExpectations(
+ event, hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->on_event(*event);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
- .WillOnce(Return(true));
-
- EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_));
- EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
- EXPECT_CALL(*app_, RemoveCommand(_)).WillOnce(DeleteCommand(&commands_map_));
- 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), _))
- .WillOnce(Return(true));
+ EventPtr event_final =
+ PrepareSubMenuResponseEvent(kCorrelationId + 1, kMenuId);
+ SetUpSubMenuFinalResponseExpectations(event_final);
+ command_->on_event(*event_final);
+}
- EXPECT_CALL(*app_, RemoveSubMenu(_));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
- am::commands::Command::SOURCE_SDL));
- EXPECT_CALL(*app_, UpdateHash());
+TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuWithVrAndUi_SUCCESS) {
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
- DeleteSubMenuRequestPtr command =
- CreateCommand<DeleteSubMenuRequest>(message_);
+ auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuId);
+ commands_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kCmdId, command_ptr.get()));
- command->Init();
- command->on_event(event);
-}
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::VR_DeleteCommand);
+ command_->Run();
-TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) {
- MessageSharedPtr message(CreateMessage());
- (*message)[am::strings::msg_params][am::strings::connection_key] =
- kConnectionKey;
- DeleteSubMenuResponsePtr command(
- CreateCommand<DeleteSubMenuResponse>(message));
+ EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId);
+ SetUpVrCommandSubsequentResponseExpectations(
+ event_vr, hmi_apis::FunctionID::UI_DeleteCommand);
+ command_->on_event(*event_vr);
- EXPECT_CALL(
- mock_rpc_service_,
- SendMessageToMobile(CheckMessageConnectionKey(kConnectionKey), _));
- command->Run();
+ EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 1, kCmdId);
+ SetUpUiCommandSubsequentResponseExpectations(
+ event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->on_event(*event_ui);
+
+ EventPtr event_final =
+ PrepareSubMenuResponseEvent(kCorrelationId + 2, kMenuId);
+ SetUpSubMenuFinalResponseExpectations(event_final);
+ command_->on_event(*event_final);
}
TEST_F(DeleteSubMenuRequestTest,
- DeleteSubmenu_CommandhaventVrCommadsAndMenuParams_DontSendHMIRequest) {
- Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
- (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
- (*message_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*message_)[am::strings::params][am::hmi_response::code] =
- am::mobile_api::Result::SUCCESS;
- event.set_smart_object(*message_);
+ OnEvent_DeleteSubmenuWithChildVrAndUi_SUCCESS) {
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
- commands_map_.insert(
- std::make_pair(0, &((*message_)[am::strings::msg_params])));
+ auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuIdChild, sub_menu_child_ptr.get()));
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
- EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
+ auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuIdChild);
+ commands_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kCmdId, command_ptr.get()));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
- am::commands::Command::SOURCE_SDL));
- command_->on_event(event);
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::VR_DeleteCommand);
+ command_->Run();
+
+ EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId);
+ SetUpVrCommandSubsequentResponseExpectations(
+ event_vr, hmi_apis::FunctionID::UI_DeleteCommand);
+ command_->on_event(*event_vr);
+
+ EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 1, kCmdId);
+ SetUpUiCommandSubsequentResponseExpectations(
+ event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->on_event(*event_ui);
+
+ EventPtr event_submenu =
+ PrepareSubMenuResponseEvent(kCorrelationId + 2, kMenuIdChild);
+ SetUpSubMenuSubsequentResponseExpectations(
+ event_submenu, hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->on_event(*event_submenu);
+
+ EventPtr event_final =
+ PrepareSubMenuResponseEvent(kCorrelationId + 3, kMenuId);
+ SetUpSubMenuFinalResponseExpectations(event_final);
+ command_->on_event(*event_final);
}
TEST_F(DeleteSubMenuRequestTest,
- DeleteSubmenu_NotAChildOfMenupartam_DontSendHMIRequest) {
- Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
- (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
- (*message_)[am::strings::msg_params][am::strings::menu_params]
- [am::hmi_request::parent_id] = kMenuId + 1;
- (*message_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*message_)[am::strings::params][am::hmi_response::code] =
- am::mobile_api::Result::SUCCESS;
- event.set_smart_object(*message_);
+ OnEvent_DeleteSubmenuVrAndUiWithChild_SUCCESS) {
+ auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuId, sub_menu_ptr.get()));
- commands_map_.insert(
- std::make_pair(0, &((*message_)[am::strings::msg_params])));
+ auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuId);
+ commands_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kCmdId, command_ptr.get()));
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
- EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
+ auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId);
+ sub_menu_map_.insert(std::pair<uint32_t, smart_objects::SmartObject*>(
+ kMenuIdChild, sub_menu_child_ptr.get()));
+
+ SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->Run();
+
+ EventPtr event_submenu =
+ PrepareSubMenuResponseEvent(kCorrelationId, kMenuIdChild);
+ SetUpSubMenuSubsequentResponseExpectations(
+ event_submenu, hmi_apis::FunctionID::VR_DeleteCommand);
+ command_->on_event(*event_submenu);
+
+ EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId + 1);
+ SetUpVrCommandSubsequentResponseExpectations(
+ event_vr, hmi_apis::FunctionID::UI_DeleteCommand);
+ command_->on_event(*event_vr);
+
+ EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 2, kCmdId);
+ SetUpUiCommandSubsequentResponseExpectations(
+ event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu);
+ command_->on_event(*event_ui);
+
+ EventPtr event_final =
+ PrepareSubMenuResponseEvent(kCorrelationId + 3, kMenuId);
+ SetUpSubMenuFinalResponseExpectations(event_final);
+ command_->on_event(*event_final);
+}
+
+TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) {
+ MessageSharedPtr message(CreateMessage());
+ (*message)[am::strings::msg_params][am::strings::connection_key] =
+ kConnectionKey;
+ DeleteSubMenuResponsePtr command(
+ CreateCommand<DeleteSubMenuResponse>(message));
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
- am::commands::Command::SOURCE_SDL));
- command_->on_event(event);
+ SendMessageToMobile(CheckMessageConnectionKey(kConnectionKey), _));
+ command->Run();
}
} // namespace delete_sub_menu_request
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 8f83a2dd10..201118eec0 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
@@ -165,12 +165,8 @@ class MobileCommandsTest : public components::commands_test::CommandRequestTest<
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_));
+ CommandRequestTest<CommandsTestMocks::kIsNice>::InitCommand(timeout);
+
ON_CALL(app_mngr_settings_, app_icons_folder())
.WillByDefault(ReturnRef(kEmptyString_));
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
index 74c61410e8..f783df387a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
@@ -33,8 +33,12 @@
#include "mobile/get_system_capability_request.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/mock_app_service_manager.h"
#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "smart_objects/smart_object.h"
namespace test {
@@ -44,8 +48,11 @@ namespace mobile_commands_test {
namespace get_system_capability_request_test {
using sdl_rpc_plugin::commands::GetSystemCapabilityRequest;
+using ::test::components::application_manager_test::MockAppServiceManager;
using ::testing::_;
using ::testing::Return;
+using ::testing::ReturnPointee;
+
typedef std::shared_ptr<GetSystemCapabilityRequest>
GetSystemCapabilityRequestPtr;
@@ -64,6 +71,12 @@ class GetSystemCapabilityRequestTest
command_ = CreateCommand<GetSystemCapabilityRequest>(message_);
mock_app_ = CreateMockApp();
+ last_state_ = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage"));
+ mock_app_service_mngr_ =
+ std::make_shared<MockAppServiceManager>(app_mngr_, last_state_);
+
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
}
@@ -71,6 +84,8 @@ class GetSystemCapabilityRequestTest
GetSystemCapabilityRequestPtr command_;
MessageSharedPtr message_;
MockAppPtr mock_app_;
+ std::shared_ptr<MockAppServiceManager> mock_app_service_mngr_;
+ resumption::LastStateWrapperPtr last_state_;
};
TEST_F(
@@ -117,6 +132,186 @@ TEST_F(
command_->Run();
}
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_AppNotRegistered) {
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::APPLICATION_NOT_REGISTERED),
+ Command::CommandSource::SOURCE_SDL));
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_NAVIGATION_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::NAVIGATION;
+
+ smart_objects::SmartObjectSPtr system_navigation_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, navigation_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_navigation_capabilities));
+
+ ON_CALL(app_mngr_, GetAppServiceManager())
+ .WillByDefault(ReturnPointee(mock_app_service_mngr_));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_PHONECALL_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::PHONE_CALL;
+
+ smart_objects::SmartObjectSPtr system_phonecall_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, phone_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_phonecall_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_VIDEOSTREAMING_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ smart_objects::SmartObjectSPtr system_videostreaming_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, video_streaming_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_videostreaming_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_REMOTECONTROL_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::REMOTE_CONTROL;
+
+ EXPECT_CALL(*mock_app_, is_remote_control_supported()).WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_, is_rc_cooperating())
+ .WillOnce(Return(true));
+
+ smart_objects::SmartObjectSPtr system_remotecontrol_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_remotecontrol_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_REMOTECONTROL_DISALLOWEDResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::REMOTE_CONTROL;
+
+ EXPECT_CALL(*mock_app_, is_remote_control_supported())
+ .WillOnce(Return(false));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::DISALLOWED),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_APPSERVICES_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ ON_CALL(app_mngr_, GetAppServiceManager())
+ .WillByDefault(ReturnPointee(mock_app_service_mngr_));
+
+ std::vector<smart_objects::SmartObject> app_services;
+ EXPECT_CALL(*mock_app_service_mngr_, GetAllServiceRecords())
+ .WillOnce(Return(app_services));
+
+ ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateAppServiceCapabilities(app_services))
+ .WillByDefault(Return(smart_objects::SmartObject()));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_SEATLOCATION_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::SEAT_LOCATION;
+
+ smart_objects::SmartObjectSPtr system_seatlocation_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, seat_location_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_seatlocation_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_DRIVERDISTRACTION_SUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DRIVER_DISTRACTION;
+
+ smart_objects::SmartObjectSPtr system_driverdistraction_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+ EXPECT_CALL(mock_hmi_capabilities_, driver_distraction_capability())
+ .Times(2)
+ .WillRepeatedly(Return(system_driverdistraction_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
} // namespace get_system_capability_request_test
} // namespace mobile_commands_test
} // namespace 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 7f7a8b55bd..fd2bc2e51a 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
@@ -202,7 +202,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) {
event.set_smart_object(*message_);
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..41e734137b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_app_capability_updated_notification_test.cc
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2020, 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 "mobile/on_app_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace on_app_capability_updated_notification_test {
+
+using sdl_rpc_plugin::commands::mobile::OnAppCapabilityUpdatedNotification;
+using ::testing::_;
+
+typedef std::shared_ptr<OnAppCapabilityUpdatedNotification>
+ OnAppCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kAppId = 2u;
+} // namespace
+
+MATCHER_P(CheckAppCapability, app_capability, "") {
+ return app_capability == (*arg)[strings::msg_params][strings::app_capability];
+}
+
+class OnAppCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+ command_ = CreateCommand<OnAppCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnAppCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(OnAppCapabilityUpdatedNotificationTest, Run_ManageHMICommand_SUCCESS) {
+ smart_objects::SmartObject app_capability =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ app_capability[strings::app_capability_type] =
+ mobile_apis::AppCapabilityType::VIDEO_STREAMING;
+ app_capability[strings::video_streaming_capability] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ FillVideoStreamingCapability(
+ app_capability[strings::video_streaming_capability]);
+
+ (*message_)[strings::msg_params][strings::app_capability] = app_capability;
+
+ ASSERT_TRUE(command_->Init());
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(CheckAppCapability(app_capability),
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI));
+ command_->Run();
+}
+
+} // namespace on_app_capability_updated_notification_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
index e4536ddeea..dbab9e1833 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
@@ -197,6 +197,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app,
+ IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
+ .WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(false));
@@ -215,6 +218,13 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
(*notification_msg)[am::strings::msg_params]
[am::hmi_response::custom_button_id] = kCustomButtonId;
+ auto mock_message_helper = am::MockMessageHelper::message_helper_mock();
+ smart_objects::SmartObjectSPtr msg =
+ std::make_shared<smart_objects::SmartObject>();
+ (*msg)[strings::params][strings::function_id] = TestFixture::kFunctionId;
+ EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _))
+ .WillRepeatedly(Return(msg));
+
std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
@@ -222,6 +232,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app,
+ IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
+ .WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(true));
EXPECT_CALL(this->mock_rpc_service_,
@@ -244,18 +257,30 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
(*notification_msg)[am::strings::msg_params]
[am::hmi_response::custom_button_id] = kCustomButtonId;
+ auto mock_message_helper = am::MockMessageHelper::message_helper_mock();
+ smart_objects::SmartObjectSPtr msg =
+ std::make_shared<smart_objects::SmartObject>();
+ EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _))
+ .WillRepeatedly(Return(msg));
+
std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
- ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
- .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+
+ EXPECT_CALL(*mock_app, GetSoftButtonWindowID(kCustomButtonId))
+ .WillOnce(Return(kDefaultWindowId));
+
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app,
+ IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
+ .WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(true));
- EXPECT_CALL(this->mock_rpc_service_,
- SendMessageToMobile(
- CheckNotificationMessage(TestFixture::kFunctionId), _));
command->Run();
}
@@ -343,22 +368,27 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
- typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
- std::vector<ApplicationSharedPtr> subscribed_apps_list;
- subscribed_apps_list.push_back(mock_app);
+ auto mock_message_helper = am::MockMessageHelper::message_helper_mock();
+ smart_objects::SmartObjectSPtr msg =
+ std::make_shared<smart_objects::SmartObject>();
+ (*msg)[strings::params][strings::function_id] = TestFixture::kFunctionId;
+ EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _))
+ .WillRepeatedly(Return(msg));
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ EXPECT_CALL(*mock_app, IsSubscribedToButton(kButtonName))
+ .WillOnce(Return(true));
EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
ON_CALL(this->app_mngr_, application(kAppId)).WillByDefault(Return(mock_app));
- EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
- .WillOnce(Return(subscribed_apps_list));
EXPECT_CALL(this->mock_rpc_service_,
SendMessageToMobile(
CheckNotificationMessage(TestFixture::kFunctionId), _));
+ EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
index 7e7b16aa89..32a13f402c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
@@ -63,6 +63,12 @@ MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
[strings::display_capabilities];
}
+MATCHER_P(CheckVideoStreamCapability, video_streaming_capability, "") {
+ return video_streaming_capability ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability];
+}
+
class OnSystemCapabilityUpdatedNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
protected:
@@ -233,6 +239,43 @@ TEST_F(
command_->Run();
}
+TEST_F(OnSystemCapabilityUpdatedNotificationTest,
+ Run_VideoSteamingCapability_AppIdIsAbsent_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message_, false));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnSystemCapabilityUpdatedNotificationTest,
+ Run_VideoSteamingCapability_AppIdExistsInMessage_SendMessageToMobile) {
+ (*message_)[strings::msg_params][strings::system_capability]
+ [strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::VIDEO_STREAMING;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+ (*message_)[strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability] =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ auto& video_streaming_capability =
+ (*message_)[strings::msg_params][strings::system_capability]
+ [strings::video_streaming_capability];
+
+ FillVideoStreamingCapability(video_streaming_capability);
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(
+ CheckVideoStreamCapability(video_streaming_capability), false));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
} // namespace on_system_capability_updated_notification
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
index ec401ae2a8..dc6f07f525 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
@@ -139,7 +139,6 @@ TEST_F(OnWayPointChangeNotificationTest,
.WillOnce(Return(apps_subscribed_for_way_points));
EXPECT_CALL(mock_rpc_service_,
SendMessageToMobile(CheckMessageData(kApp1Id), _));
- EXPECT_CALL(app_mngr_, SaveWayPointsMessage(message_));
command_->Run();
}
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 2915418d43..b23e8eefeb 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
@@ -184,7 +184,7 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) {
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ((*vr_command_result)[am::strings::msg_params][am::strings::success]
.asBool(),
false);
@@ -626,7 +626,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id));
EXPECT_CALL(app_mngr_, StartAudioPassThruThread(_, _, _, _, _, _));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
@@ -654,7 +654,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// First call on_event for setting result_tts_speak_ to UNSUPPORTED_RESOURCE
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _));
CallOnEvent caller_speak(*command_sptr_, event_speak);
caller_speak();
@@ -691,31 +691,7 @@ TEST_F(PerformAudioPassThruRequestTest,
app_mngr_,
StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
- ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
- .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- CallOnEvent caller(*command_sptr_, event);
- caller();
-
- EXPECT_EQ(kConnectionKey, msg_params_[am::strings::connection_key].asUInt());
- EXPECT_EQ(kFunctionId, msg_params_[am::strings::function_id].asString());
-}
-
-TEST_F(PerformAudioPassThruRequestTest,
- DISABLED_OnEvent_TTSOnResetTimeout_UpdateTimeout) {
- am::event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout);
-
- msg_params_[am::strings::connection_key] = kConnectionKey;
- msg_params_[am::strings::function_id] = kFunctionId;
-
- uint32_t app_id = kConnectionKey;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
- EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true));
-
- EXPECT_CALL(
- app_mngr_,
- StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _));
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
CallOnEvent caller(*command_sptr_, event);
@@ -729,7 +705,7 @@ TEST_F(PerformAudioPassThruRequestTest, OnEvent_DefaultCase) {
am::event_engine::Event event(hmi_apis::FunctionID::INVALID_ENUM);
uint32_t app_id = kConnectionKey;
- EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).Times(0);
CallOnEvent caller(*command_sptr_, event);
@@ -756,10 +732,20 @@ TEST_F(PerformAudioPassThruRequestTest,
// For setting current_state_ -> kCompleted
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
- command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- command_sptr_->onTimeOut();
+ MessageSharedPtr timeout_response =
+ CreateMessage(smart_objects::SmartType_Map);
+ (*timeout_response)[am::strings::msg_params][am::strings::result_code] =
+ am::mobile_api::Result::GENERIC_ERROR;
+ (*timeout_response)[am::strings::msg_params][am::strings::success] = false;
+
+ EXPECT_CALL(
+ mock_message_helper_,
+ CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
+ .WillOnce(Return(timeout_response));
+
+ command_sptr_->OnTimeOut();
}
TEST_F(PerformAudioPassThruRequestTest,
@@ -830,7 +816,7 @@ TEST_F(PerformAudioPassThruRequestTest,
HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(false));
- command_sptr_->onTimeOut();
+ command_sptr_->OnTimeOut();
}
} // namespace perform_audio_pass_thru_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
index 193229eeb0..196c83d144 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
@@ -173,6 +173,26 @@ class PerformInteractionRequestTest
performinteraction_choice_set_lock_ptr_;
};
+class PerformInteractionRequestTestClass : public PerformInteractionRequest {
+ public:
+ PerformInteractionRequestTestClass(
+ 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)
+ : PerformInteractionRequest(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ void StartAwaitForInterfaces() {
+ StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_VR);
+ StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_UI);
+ }
+};
+
TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
MessageSharedPtr response_msg_vr =
CreateMessage(smart_objects::SmartType_Map);
@@ -182,8 +202,8 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map);
(*request_msg)[strings::msg_params][strings::interaction_mode] =
mobile_apis::InteractionMode::BOTH;
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(request_msg);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(request_msg);
MockAppPtr mock_app;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
@@ -192,6 +212,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
event.set_smart_object(*response_msg_vr);
command->Init();
+ command->StartAwaitForInterfaces();
command->on_event(event);
MessageSharedPtr response_to_mobile =
CreateMessage(smart_objects::SmartType_Map);
@@ -208,7 +229,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
- command->onTimeOut();
+ command->OnTimeOut();
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::success].asBool(),
@@ -222,8 +243,8 @@ TEST_F(PerformInteractionRequestTest,
OnEvent_BOTHMode_UIChoiceIdReceivedFirst) {
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
@@ -244,6 +265,8 @@ TEST_F(PerformInteractionRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ command->StartAwaitForInterfaces();
+
command->on_event(event_ui);
command->on_event(event_vr);
@@ -256,8 +279,8 @@ TEST_F(PerformInteractionRequestTest,
OnEvent_BOTHMode_VRChoiceIdReceivedFirst) {
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
@@ -278,6 +301,8 @@ TEST_F(PerformInteractionRequestTest,
_, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
.WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+ command->StartAwaitForInterfaces();
+
command->on_event(event_vr);
EXPECT_EQ(hmi_apis::FunctionID::UI_ClosePopUp,
(*request_to_hmi)[strings::params][strings::function_id].asInt());
@@ -298,11 +323,13 @@ TEST_F(PerformInteractionRequestTest,
OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
@@ -344,11 +371,13 @@ TEST_F(PerformInteractionRequestTest,
OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
@@ -387,11 +416,13 @@ TEST_F(
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
@@ -429,11 +460,13 @@ TEST_F(
auto msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MessageSharedPtr response_msg_vr =
CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
"VR is not supported by system");
@@ -478,11 +511,13 @@ TEST_F(
MessageSharedPtr msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID(
hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID);
MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
@@ -526,11 +561,13 @@ TEST_F(
auto msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
@@ -574,11 +611,13 @@ TEST_F(
auto msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MessageSharedPtr response_msg_vr =
CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
@@ -622,11 +661,13 @@ TEST_F(
auto msg_from_mobile =
CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
- std::shared_ptr<PerformInteractionRequest> command =
- CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+ std::shared_ptr<PerformInteractionRequestTestClass> command =
+ CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile);
ASSERT_TRUE(command->Init());
+ command->StartAwaitForInterfaces();
+
MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR error message");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
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 fab648fc95..0624c873fa 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
@@ -198,7 +198,7 @@ class RegisterAppInterfaceRequestTest
void InitGetters() {
ON_CALL(app_mngr_, GetCorrectMobileIDFromMessage(msg_))
.WillByDefault(Return(kAppId1));
- ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(true));
+ ON_CALL(app_mngr_, WaitForHmiIsReady()).WillByDefault(Return(true));
ON_CALL(app_mngr_, resume_controller())
.WillByDefault(ReturnRef(mock_resume_crt_));
ON_CALL(app_mngr_, connection_handler())
@@ -289,8 +289,7 @@ class RegisterAppInterfaceRequestTest
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _))
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _))
.Times(0);
EXPECT_CALL(
@@ -350,12 +349,6 @@ class RegisterAppInterfaceRequestTest
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
_))
.WillByDefault(Return(true));
- ON_CALL(
- mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _))
- .WillByDefault(Return(true));
}
void SetCommonPreconditionsToCheckWithPolicyData(MockAppPtr mock_app) {
@@ -416,11 +409,8 @@ TEST_F(RegisterAppInterfaceRequestTest, DefaultTimeout_CheckIfZero_SUCCESS) {
TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
InitBasicMessage();
(*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1;
- EXPECT_CALL(app_mngr_, IsStopping())
- .WillOnce(Return(false))
- .WillOnce(Return(true))
- .WillOnce(Return(false));
- ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+
+ EXPECT_CALL(app_mngr_, WaitForHmiIsReady()).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
ON_CALL(mock_connection_handler_,
@@ -459,11 +449,33 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
_))
.WillOnce(Return(true));
+
+ ON_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(
+ application_manager::HmiInterfaces::HMI_INTERFACE_Buttons))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ ON_CALL(
+ mock_hmi_interfaces_,
+ GetInterfaceFromFunction(hmi_apis::FunctionID::Buttons_SubscribeButton))
+ .WillByDefault(
+ Return(application_manager::HmiInterfaces::HMI_INTERFACE_Buttons));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr =
+ CreateMessage(smart_objects::SmartType_Map);
+ (*button_caps_ptr)[0][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr));
+
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _))
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _))
.WillOnce(Return(true));
application_manager::DisplayCapabilitiesBuilder builder(*mock_app);
@@ -504,11 +516,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
Run_HmiInterfacesStateAvailable_SUCCESS) {
InitBasicMessage();
- EXPECT_CALL(app_mngr_, IsStopping())
- .WillOnce(Return(false))
- .WillOnce(Return(true))
- .WillOnce(Return(false));
- ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+ ON_CALL(app_mngr_, WaitForHmiIsReady()).WillByDefault(Return(true));
+
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
ON_CALL(mock_connection_handler_,
@@ -589,12 +598,6 @@ TEST_F(RegisterAppInterfaceRequestTest,
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));
EXPECT_CALL(
@@ -808,11 +811,9 @@ TEST_F(RegisterAppInterfaceRequestTest,
InitBasicMessage();
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2;
- EXPECT_CALL(app_mngr_, IsStopping())
- .WillOnce(Return(false))
- .WillOnce(Return(true))
- .WillOnce(Return(false));
- ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+
+ ON_CALL(app_mngr_, WaitForHmiIsReady()).WillByDefault(Return(true));
+
EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1))
.WillOnce(Return(false));
@@ -856,12 +857,6 @@ TEST_F(RegisterAppInterfaceRequestTest,
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));
EXPECT_CALL(
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 8ca15f39fe..f1bb7b64ca 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
@@ -282,6 +282,42 @@ TEST_F(ResetGlobalPropertiesRequestTest,
command_->on_event(event);
}
+TEST_F(ResetGlobalPropertiesRequestTest,
+ OnEvent_RC_SetGlobalProperties_SUCCESS) {
+ am::ResetGlobalPropertiesResult result;
+ result.user_location = true;
+
+ EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result));
+
+ smart_objects::SmartObjectSPtr msg_params =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ EXPECT_CALL(mock_message_helper_, CreateRCResetGlobalPropertiesRequest(_, _))
+ .WillOnce(Return(msg_params));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_SetGlobalProperties), _))
+ .WillOnce(Return(true));
+
+ command_->Run();
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS),
+ am::commands::Command::SOURCE_SDL));
+
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ Event event(hmi_apis::FunctionID::RC_SetGlobalProperties);
+ event.set_smart_object(*msg_);
+
+ command_->on_event(event);
+}
+
TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) {
MessageSharedPtr message(CreateMessage());
ResetGlobalPropertiesResponsePtr command(
@@ -404,7 +440,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
ManageMobileCommand(
MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
am::commands::Command::SOURCE_SDL));
- command->onTimeOut();
+ command->OnTimeOut();
}
TEST_F(ResetGlobalPropertiesRequestTest,
@@ -471,7 +507,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
ManageMobileCommand(
MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
am::commands::Command::SOURCE_SDL));
- command_->onTimeOut();
+ command_->OnTimeOut();
}
TEST_F(ResetGlobalPropertiesRequestTest,
@@ -528,7 +564,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
ManageMobileCommand(
MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
am::commands::Command::SOURCE_SDL));
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace reset_global_properties
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
index 6b17aa238d..443868168d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
@@ -173,17 +173,21 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
(*msg_)[msg_params][timeout] = kTimeOut;
(*msg_)[msg_params][interaction_mode] =
mobile_apis::InteractionMode::MANUAL_ONLY;
- EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
+ const uint32_t initial_timeout =
+ kDefaultTimeout_ + kDefaultTimeoutCompensation_;
+ EXPECT_EQ(initial_timeout, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut + kDefaultTimeout_, command_->default_timeout());
+ EXPECT_EQ(kTimeOut + initial_timeout, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
(*msg_)[msg_params][interaction_mode] =
mobile_apis::InteractionMode::MANUAL_ONLY;
- EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
+ const uint32_t initial_timeout =
+ kDefaultTimeout_ + kDefaultTimeoutCompensation_;
+ EXPECT_EQ(initial_timeout, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
+ EXPECT_EQ(initial_timeout, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -241,18 +245,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) {
}
TEST_F(ScrollableMessageRequestTest,
- OnEvent_ReceivedUIOnResetTimeoutEvent_SUCCESS) {
- (*msg_)[params][connection_key] = kConnectionKey;
- (*msg_)[params][correlation_id] = kCorrelationId;
- EXPECT_CALL(
- app_mngr_,
- updateRequestTimeout(kConnectionKey, kCorrelationId, kDefaultTimeout_));
- Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
- event.set_smart_object(*msg_);
- command_->on_event(event);
-}
-
-TEST_F(ScrollableMessageRequestTest,
DISABLED_OnEvent_ReceivedUIScrollableMessage_SUCCESS) {
(*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
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 9b72d41f7e..4272005fba 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
@@ -397,6 +397,29 @@ class SetGlobalPropertiesRequestTest
ui_result, tts_result, rc_result, false);
}
+ void AddCustomizableKeys(MessageSharedPtr msg) {
+ SmartObject customizable_keys(smart_objects::SmartType_Array);
+ customizable_keys[0] = "%";
+ customizable_keys[1] = "@";
+ customizable_keys[2] = "&";
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::custom_keys] = customizable_keys;
+ }
+
+ std::shared_ptr<SmartObject> GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::eType layout, int num_allowed_keys) {
+ auto display_capabilities =
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
+ auto& supported_keyboards =
+ (*display_capabilities)[0][am::strings::window_capabilities][0]
+ [am::hmi_response::keyboard_capabilities]
+ [am::hmi_response::supported_keyboards];
+ supported_keyboards[0][am::hmi_request::keyboard_layout] = layout;
+ supported_keyboards[0][am::hmi_response::num_configurable_keys] =
+ num_allowed_keys;
+ return display_capabilities;
+ }
+
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
MockAppPtr mock_app_;
std::shared_ptr<application_manager_test::MockHelpPromptManager>
@@ -1262,6 +1285,371 @@ TEST_F(SetGlobalPropertiesRequestTest,
command->Run();
}
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_InvalidCustomizableKeys_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject customizable_keys(smart_objects::SmartType_Array);
+ customizable_keys[0] = "%";
+ customizable_keys[1] = "\\n";
+ customizable_keys[2] = " ";
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::custom_keys] = customizable_keys;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndLayoutFromRequest_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndSavedLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillOnce(Return(&saved_keyboard_props));
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndDefaultLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndNotSupportedLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeys_LayoutFromRequestCached) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTY;
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndSavedLayout_SavedLayoutCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto requested_keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ auto cached_keyboard_props(requested_keyboard_properties);
+ cached_keyboard_props[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndDefaultLayout_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto requested_keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ EXPECT_CALL(*mock_app_, set_keyboard_props(requested_keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_RequestContainsLanguageParam_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_NoLanguageInRequestButPresentInSaved_SavedLanguageCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto cached_keyboard_props =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ cached_keyboard_props[am::hmi_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_RequestContainsMaskInputCharactersParam_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::ENABLE_INPUT_KEY_MASK;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_NoMaskInputCharactersInRequestButPresentInSaved_SavedParamCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::USER_CHOICE_INPUT_KEY_MASK;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto cached_keyboard_props =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ cached_keyboard_props[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::USER_CHOICE_INPUT_KEY_MASK;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_NoAutocompleteListInRequestButPresentInSaved_SavedArrayCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+
+ SmartObject autocomplete_list(smart_objects::SmartType_Array);
+ autocomplete_list[0] = "first";
+ autocomplete_list[1] = "second";
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = autocomplete_list;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto cached_keyboard_props =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ cached_keyboard_props[am::hmi_request::auto_complete_list] =
+ autocomplete_list;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_NewAutocompleteListInRequestAndAlsoPresentInSaved_TransferAndSaveNewArray) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ SmartObject new_list(smart_objects::SmartType_Array);
+ new_list[0] = "first_new_value";
+ new_list[1] = "second_new_value";
+ keyboard_properties[am::hmi_request::auto_complete_list] = new_list;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ SmartObject old_list(smart_objects::SmartType_Array);
+ old_list[0] = "old_value";
+ old_list[1] = "another_old_value";
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = old_list;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_EmptyAutocompleteListInRequestAndAlsoPresentInSaved_TransferButNotSaveEmptyArray) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ SmartObject new_list(smart_objects::SmartType_Array);
+ keyboard_properties[am::hmi_request::auto_complete_list] = new_list;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ SmartObject old_list(smart_objects::SmartType_Array);
+ old_list[0] = "old_value";
+ old_list[1] = "another_old_value";
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = old_list;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto properties_without_empty_list(keyboard_properties);
+ properties_without_empty_list.erase(am::hmi_request::auto_complete_list);
+ EXPECT_CALL(*mock_app_, set_keyboard_props(properties_without_empty_list));
+
+ command->Run();
+}
+
TEST_F(SetGlobalPropertiesRequestTest, Run_NoData_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
index 0034dcf916..d091fdc8c5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
@@ -93,15 +93,12 @@ class MobileResponseCommandsTest
typedef Types<commands::ListFilesResponse,
commands::DeleteCommandResponse,
- commands::AlertManeuverResponse,
- commands::AlertResponse,
commands::SubscribeButtonResponse,
commands::AddSubMenuResponse,
commands::DialNumberResponse,
commands::EndAudioPassThruResponse,
commands::UnregisterAppInterfaceResponse,
commands::UnsubscribeWayPointsResponse,
- commands::UpdateTurnListResponse,
commands::UnsubscribeButtonResponse,
commands::SliderResponse,
commands::SpeakResponse,
@@ -112,7 +109,6 @@ typedef Types<commands::ListFilesResponse,
commands::PerformAudioPassThruResponse,
commands::SetGlobalPropertiesResponse,
commands::SetMediaClockTimerResponse,
- commands::ShowConstantTBTResponse,
commands::ShowResponse,
commands::SystemResponse,
commands::AddCommandResponse,
@@ -131,6 +127,35 @@ TYPED_TEST(MobileResponseCommandsTest, Run_SendResponseToMobile_SUCCESS) {
command->Run();
}
+template <class CommandWithUnsubscribe>
+class MobileResponseWithUnsubscribeCommandsTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef CommandWithUnsubscribe UnsubscribeCommand;
+};
+
+typedef Types<commands::AlertManeuverResponse,
+ commands::AlertResponse,
+ commands::UpdateTurnListResponse,
+ commands::ScrollableMessageResponse,
+ commands::ShowConstantTBTResponse>
+ ResponseWithUnsubscribeCommandList;
+
+TYPED_TEST_CASE(MobileResponseWithUnsubscribeCommandsTest,
+ ResponseWithUnsubscribeCommandList);
+
+TYPED_TEST(MobileResponseWithUnsubscribeCommandsTest,
+ RunWithUnsubscribe_SUCCESS) {
+ std::shared_ptr<typename TestFixture::UnsubscribeCommand> command =
+ this->template CreateCommand<typename TestFixture::UnsubscribeCommand>();
+
+ EXPECT_CALL(this->app_mngr_, UnsubscribeAppFromSoftButtons(_));
+ EXPECT_CALL(this->mock_rpc_service_, SendMessageToMobile(NotNull(), _));
+
+ command->Init();
+ command->Run();
+}
+
class GenericResponseFromHMICommandsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
@@ -145,7 +170,6 @@ MATCHER_P2(CheckMessageParams, success, result, "") {
result ==
static_cast<int32_t>(
(*arg)[am::strings::msg_params][am::strings::result_code].asInt());
-
using namespace helpers;
return Compare<bool, EQ, ALL>(
true, is_msg_type_correct, is_success_correct, is_result_code_correct);
@@ -164,24 +188,6 @@ TEST_F(GenericResponseFromHMICommandsTest, Run_SUCCESS) {
command->Run();
}
-
-class ScrollableMessageResponseTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {};
-
-TEST_F(ScrollableMessageResponseTest, Run_SUCCESS) {
- MessageSharedPtr message = CreateMessage();
- (*message)[am::strings::msg_params][am::strings::result_code] =
- mobile_apis::Result::SUCCESS;
-
- MockAppPtr app(CreateMockApp());
-
- std::shared_ptr<commands::ScrollableMessageResponse> command(
- CreateCommand<commands::ScrollableMessageResponse>(message));
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app));
- EXPECT_CALL(*app, UnsubscribeFromSoftButtons(_));
- command->Run();
-}
-
} // namespace simple_response_commands_test
} // namespace mobile_commands_test
} // namespace commands_test
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 0450f06ee1..e9077cb7f5 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
@@ -55,6 +55,7 @@ namespace am = application_manager;
using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
+using app_mngr::commands::RequestFromMobileImpl;
using policy_test::MockPolicyHandlerInterface;
using sdl_rpc_plugin::commands::SliderRequest;
using ::testing::_;
@@ -182,13 +183,13 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
class CallOnTimeOut {
public:
- CallOnTimeOut(CommandRequestImpl& command) : command_(command) {}
+ CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {}
void operator()() {
- command_.onTimeOut();
+ command_.OnTimeOut();
}
- CommandRequestImpl& command_;
+ RequestFromMobileImpl& command_;
};
TEST_F(SliderRequestTest, Init_SUCCESS) {
@@ -274,22 +275,6 @@ TEST_F(SliderRequestTest, Run_SUCCESS) {
command->Run();
}
-TEST_F(SliderRequestTest, OnEvent_UI_OnResetTimeout_UNSUCCESS) {
- PreConditions();
- (*msg_)[am::strings::msg_params][am::strings::timeout] = kDefaultTimeout;
- (*msg_)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
-
- CommandPtr command(CreateCommand<SliderRequest>(msg_));
- EXPECT_TRUE(command->Init());
-
- EXPECT_CALL(app_mngr_,
- updateRequestTimeout(kConnectionKey, kCorrelationId, _));
-
- Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
- event.set_smart_object(*msg_);
- command->on_event(event);
-}
-
TEST_F(SliderRequestTest, OnEvent_UI_UnknownEventId_UNSUCCESS) {
PreConditions();
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
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 87320d3a7a..dd082a52a7 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
@@ -366,18 +366,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_SpeakWithWarning_WarningWithSuccess) {
command->on_event(event);
}
-TEST_F(SpeakRequestTest, OnEvent_TTS_OnResetTimeout_UpdateTimeout) {
- Event event(Event::EventID::TTS_OnResetTimeout);
- (*request_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*request_)[am::strings::params][am::strings::correlation_id] = kAppId;
- CommandPtr command(CreateCommand<SpeakRequest>(request_));
-
- EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey, kAppId, _));
-
- command->on_event(event);
-}
-
TEST_F(SpeakRequestTest, OnEvent_ApplicationIsNotRegistered_UNSUCCESS) {
const hmi_apis::Common_Result::eType hmi_result =
hmi_apis::Common_Result::SUCCESS;
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 f3bfe12ab1..56e0766184 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
@@ -202,22 +202,19 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::eType::SEEKLEFT,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
@@ -249,30 +246,30 @@ TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::eType::NAV_CENTER_LOCATION,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
-TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
- const mobile_apis::ButtonName::eType kButtonName =
- mobile_apis::ButtonName::OK;
+TEST_F(SubscribeButtonRequestTest,
+ Run_App_Version_4_5_and_OK_btn_Expect_PlayPause_btn_sent_to_HMI) {
+ const mobile_apis::ButtonName::eType button_ok = mobile_apis::ButtonName::OK;
- MessageSharedPtr msg(CreateMessage());
- (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ const mobile_apis::ButtonName::eType button_play_pause =
+ mobile_apis::ButtonName::PLAY_PAUSE;
+
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::button_name] = button_ok;
CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
MockAppPtr app(CreateMockApp());
@@ -284,41 +281,33 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
.WillByDefault(Return(true));
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
- (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
- (*button_caps_ptr)[1][am::hmi_response::button_name] =
- mobile_apis::ButtonName::PLAY_PAUSE;
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = button_ok;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] = button_play_pause;
ON_CALL(mock_hmi_capabilities_, button_capabilities())
.WillByDefault(Return(button_caps_ptr));
- ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+ ON_CALL(*app, IsSubscribedToButton(button_play_pause))
+ .WillByDefault(Return(false));
MessageSharedPtr hmi_result_msg;
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(hmi_apis::Common_ButtonName::PLAY_PAUSE,
- static_cast<hmi_apis::Common_ButtonName::eType>(
- (*hmi_result_msg)[am::strings::msg_params][am::strings::name]
- .asInt()));
-
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::PLAY_PAUSE,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
} // namespace subscribe_button_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
index 528f8a0700..44c5a7a3dd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -73,13 +73,12 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*app)))
.WillByDefault(Return(false));
- ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
- .WillByDefault(Return(true));
+ ON_CALL(app_mngr_, IsSubscribedToHMIWayPoints()).WillByDefault(Return(true));
{
InSequence dummy;
EXPECT_CALL(app_mngr_,
- SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>(), false));
EXPECT_CALL(*app, UpdateHash());
}
@@ -112,7 +111,7 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
{
InSequence dummy;
EXPECT_CALL(app_mngr_,
- SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>(), true));
EXPECT_CALL(mock_message_helper_, HMIToMobileResult(result_code))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
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 5735610051..15795fa1e6 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
@@ -77,8 +77,6 @@ TEST_F(UnsubscribeButtonRequestTest,
.WillOnce(Return(mock_app));
ON_CALL(*mock_app, msg_version())
.WillByDefault(ReturnRef(mock_semantic_version));
- EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
- .WillOnce(Return(false));
EXPECT_CALL(
mock_rpc_service_,
@@ -137,18 +135,6 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
ON_CALL(*mock_app, msg_version())
.WillByDefault(ReturnRef(mock_semantic_version));
- 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_,
- ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
-
- EXPECT_CALL(*mock_app, UpdateHash());
command->Init();
command->Run();
}
@@ -181,19 +167,6 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) {
.WillByDefault(ReturnRef(mock_base_rpc_version));
ON_CALL(*mock_app, is_media_application()).WillByDefault(Return(true));
- 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_,
- ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
-
- EXPECT_CALL(*mock_app, UpdateHash());
command->Init();
command->Run();
}
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 ec4d2420d6..9a6ff4d14e 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
@@ -123,6 +123,8 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
.WillOnce(Return(subscribed_apps));
+ EXPECT_CALL(app_mngr_, IsSubscribedToHMIWayPoints()).WillOnce(Return(true));
+
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(
@@ -156,9 +158,10 @@ TEST_F(UnsubscribeWayPointsRequestTest,
Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
event.set_smart_object(*event_msg);
- EXPECT_CALL(app_mngr_,
- UnsubscribeAppFromWayPoints(
- ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)));
+ EXPECT_CALL(
+ app_mngr_,
+ UnsubscribeAppFromWayPoints(
+ ::testing::Matcher<am::ApplicationSharedPtr>(mock_app), true));
EXPECT_CALL(
mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
index 44628a8e89..8fbc37e0bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
@@ -148,7 +148,7 @@ TEST_F(UpdateTurnListRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- const mobile_result::eType kExpectedResult = mobile_result::INVALID_ENUM;
+ const mobile_result::eType kExpectedResult = mobile_result::GENERIC_ERROR;
EXPECT_CALL(mock_message_helper_,
ProcessSoftButtons((*command_msg_)[am::strings::msg_params],
Eq(mock_app),
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
index 28a930c0b4..2e07ef71f4 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
@@ -45,7 +45,6 @@ collect_sources(VEHICLE_INFO_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
HMI_API
MOBILE_API
- MessageHelper
ApplicationManager
v4_protocol_v1_2_no_extra
SmartObjects
@@ -55,7 +54,7 @@ set(LIBRARIES
crypto
)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
@@ -68,6 +67,7 @@ target_link_libraries("vehicle_info_plugin_static" ${LIBRARIES})
add_library(vehicle_info_plugin SHARED "src/vehicle_info_plugin.cc" )
target_link_libraries(vehicle_info_plugin vehicle_info_plugin_static)
+target_link_libraries(vehicle_info_plugin MessageHelper)
if (NOT ANDROID)
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
index 74f12c07d4..2edf9358c4 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
@@ -61,7 +61,7 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI {
void Run() OVERRIDE;
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VIGetVehicleTypeRequest);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
index 96f8c8ecb8..3a835caa5c 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
@@ -44,8 +44,7 @@ namespace commands {
/**
* @brief VIIsReadyRequest command class
**/
-class VIIsReadyRequest : public app_mngr::commands::RequestToHMI,
- public app_mngr::event_engine::EventObserver {
+class VIIsReadyRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief VIIsReadyRequest class constructor
@@ -73,7 +72,7 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI,
/**
* @brief onTimeOut from requrst Controller
*/
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(VIIsReadyRequest);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
index 7fc84b7986..b066fa9654 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
@@ -66,7 +66,7 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI {
**/
virtual void Run();
- void onTimeOut() OVERRIDE;
+ void OnTimeOut() OVERRIDE;
private:
CustomVehicleDataManager& custom_vehicle_data_manager_;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
index 56f0e39621..2c78086cfd 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/vehicle_info_command_params.h"
@@ -46,7 +46,8 @@ namespace commands {
/**
* @brief DiagnosticMessageRequest command class
**/
-class DiagnosticMessageRequest : public app_mngr::commands::CommandRequestImpl {
+class DiagnosticMessageRequest
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief DiagnosticMessageRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
index 562d7f236b..6643c1e158 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/vehicle_info_command_params.h"
@@ -46,7 +46,7 @@ namespace commands {
/**
* @brief GetDTCsRequest command class
**/
-class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl {
+class GetDTCsRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief GetDTCsRequest class constructor
@@ -71,7 +71,7 @@ class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(GetDTCsRequest);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
index 8a594b0647..5e6e4c0227 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/vehicle_info_command_params.h"
@@ -46,7 +46,7 @@ namespace commands {
/**
* @brief GetVehicleDataRequest command class
**/
-class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl {
+class GetVehicleDataRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief GetVehicleDataRequest class constructor
@@ -67,7 +67,7 @@ class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl {
virtual void Run();
protected:
- virtual void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
private:
/**
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
index 8566075504..0e27e7402d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
@@ -34,7 +34,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
@@ -45,7 +45,7 @@ namespace commands {
/**
* @brief ReadDIDRequest command class
**/
-class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl {
+class ReadDIDRequest : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief ReadDIDRequest class constructor
@@ -65,7 +65,7 @@ class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl {
*
* @param event The received event
*/
- void on_event(const app_mngr::event_engine::Event& event);
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
/**
* @brief Execute command
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
index 663e64f2a0..4a92d736a3 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
@@ -39,6 +39,7 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
@@ -53,7 +54,7 @@ namespace commands {
* @brief SubscribeVehicleDataRequest command class
**/
class SubscribeVehicleDataRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief SubscribeVehicleDataRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
index 4f2a01244f..f728c44753 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
@@ -36,6 +36,7 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "utils/macro.h"
#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
@@ -50,7 +51,7 @@ namespace commands {
* @brief UnsubscribeVehicleDataRequest command class
**/
class UnsubscribeVehicleDataRequest
- : public app_mngr::commands::CommandRequestImpl {
+ : public app_mngr::commands::RequestFromMobileImpl {
public:
/**
* @brief UnsubscribeVehicleDataRequest class constructor
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
index 7e3eabb6a1..1d3fcd1e74 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
@@ -152,7 +152,7 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
* @brief VehicleInfoAppExtensionUID unique identifier of VehicleInfo
* aplication extension
*/
- static unsigned VehicleInfoAppExtensionUID;
+ static const app_mngr::AppExtensionUID VehicleInfoAppExtensionUID = 146;
/**
* @brief ExtractVIExtension utility function to extract application extension
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h
index 78f8f685cc..271f950d03 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h
@@ -52,7 +52,7 @@ class VehicleInfoPendingResumptionHandler
app_mngr::ApplicationManager& application_manager,
CustomVehicleDataManager& custom_vehicle_data_manager);
- void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+ void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE;
void HandleResumptionSubscriptionRequest(app_mngr::AppExtension& extension,
app_mngr::Application& app) OVERRIDE;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index 1910a9efdf..8c67bc1d10 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -55,13 +55,6 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state) OVERRIDE;
- DEPRECATED
- bool Init(app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) OVERRIDE;
-
bool IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource source) OVERRIDE;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
index 26a9990079..808b8c85c2 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
@@ -56,7 +56,7 @@ void VIGetVehicleTypeRequest::Run() {
SendRequest();
}
-void VIGetVehicleTypeRequest::onTimeOut() {
+void VIGetVehicleTypeRequest::OnTimeOut() {
SDL_LOG_AUTO_TRACE();
hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
index dbd1b48033..19c1113cc6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
@@ -55,11 +55,10 @@ void VIGetVehicleTypeResponse::Run() {
const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
-
if (hmi_apis::Common_Result::SUCCESS != result_code) {
SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
return;
}
@@ -67,6 +66,9 @@ void VIGetVehicleTypeResponse::Run() {
hmi_capabilities_.set_vehicle_type(
(*message_)[strings::msg_params][hmi_response::vehicle_type]);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
+
if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
hmi_interface::vehicle_info,
sections_to_update,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
index 578f650e98..cbbf8a2a3f 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
@@ -51,8 +51,7 @@ VIIsReadyRequest::VIIsReadyRequest(
params.application_manager_,
params.rpc_service_,
params.hmi_capabilities_,
- params.policy_handler_)
- , EventObserver(application_manager_.event_dispatcher()) {}
+ params.policy_handler_) {}
VIIsReadyRequest::~VIIsReadyRequest() {}
@@ -78,6 +77,8 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_is_ivi_cooperating(is_available);
policy_handler_.OnVIIsReady();
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_IsReady);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_VehicleInfo)) {
SDL_LOG_INFO(
@@ -97,8 +98,10 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
}
}
-void VIIsReadyRequest::onTimeOut() {
+void VIIsReadyRequest::OnTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_IsReady);
RequestInterfaceCapabilities(hmi_interface ::vehicle_info);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
index da925e68e7..ee0fac65e7 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
@@ -77,7 +77,7 @@ void VISubscribeVehicleDataRequest::Run() {
SendRequest();
}
-void VISubscribeVehicleDataRequest::onTimeOut() {
+void VISubscribeVehicleDataRequest::OnTimeOut() {
event_engine::Event timeout_event(
hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
index 762528c51b..37f99857e2 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
@@ -49,11 +49,11 @@ SDL_CREATE_LOG_VARIABLE("Commands")
DiagnosticMessageRequest::DiagnosticMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_) {}
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
DiagnosticMessageRequest::~DiagnosticMessageRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
index 2f236dd8b2..9044e0a1aa 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
@@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands")
GetDTCsRequest::GetDTCsRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_) {}
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
GetDTCsRequest::~GetDTCsRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
index e5656d60c5..3cc1645825 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
@@ -54,11 +54,11 @@ namespace str = strings;
GetVehicleDataRequest::GetVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_)
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
, custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
GetVehicleDataRequest::~GetVehicleDataRequest() {}
@@ -91,7 +91,7 @@ void GetVehicleDataRequest::Run() {
continue;
}
hmi_msg_params[name] = msg_params[name];
- params_count++;
+ ++params_count;
}
const int minimal_params_count = 1;
@@ -126,6 +126,12 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
std::string response_info;
GetInfo(message, response_info);
+ if (message[strings::msg_params].keyExists(strings::tire_pressure)) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ MessageHelper::AddDefaultParamsToTireStatus(app, message);
+ }
+
auto data_not_available_with_params = [this, &result_code, &message]() {
if (hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) {
return false;
@@ -164,6 +170,13 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
}
}
+ if (MessageHelper::RemoveEmptyMessageParams(
+ message[strings::msg_params]) > 0) {
+ mobile_result_code = mobile_apis::Result::WARNINGS;
+ response_info = app_mngr::commands::MergeInfos(
+ response_info, "Some vehicle data items could not be retrieved");
+ }
+
if (message[strings::msg_params].empty() &&
hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) {
response_info = "Failed to retrieve data from vehicle";
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
index e336b778ff..71a6289d9c 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
@@ -70,6 +70,8 @@ void OnVehicleDataNotification::Run() {
custom_vehicle_data_manager_.CreateMobileMessageParams(
(*message_)[strings::msg_params]);
+ MessageHelper::RemoveEmptyMessageParams((*message_)[strings::msg_params]);
+
const auto& param_names = (*message_)[strings::msg_params].enumerate();
for (const auto& name : param_names) {
SDL_LOG_DEBUG("vehicle_data name: " << name);
@@ -89,24 +91,61 @@ void OnVehicleDataNotification::Run() {
SDL_LOG_ERROR("NULL pointer");
continue;
}
+
+ smart_objects::SmartObject output_message = *message_;
+ if (strings::tire_pressure == name) {
+ MessageHelper::AddDefaultParamsToTireStatus(app, output_message);
+ }
+
notified_app_it = find(notify_apps.begin(), notify_apps.end(), app);
if (notified_app_it == notify_apps.end()) {
notify_apps.push_back(app);
smart_objects::SmartObject msg_param =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_param[name] = (*message_)[strings::msg_params][name];
+ msg_param[name] = output_message[strings::msg_params][name];
appSO.push_back(msg_param);
} else {
size_t idx = std::distance(notify_apps.begin(), notified_app_it);
- appSO[idx][name] = (*message_)[strings::msg_params][name];
+ appSO[idx][name] = output_message[strings::msg_params][name];
}
}
}
- SDL_LOG_DEBUG("Number of Notifications to be send: " << notify_apps.size());
+ for (size_t idx = 0; idx < notify_apps.size(); ++idx) {
+ CommandParametersPermissions params_permissions;
+ application_manager_.CheckPolicyPermissions(
+ notify_apps[idx],
+ window_id(),
+ MessageHelper::StringifiedFunctionID(
+ mobile_api::FunctionID::OnVehicleDataID),
+ appSO[idx].enumerate(),
+ &params_permissions);
+ if (params_permissions.allowed_params.empty() &&
+ params_permissions.disallowed_params.empty() &&
+ params_permissions.undefined_params.empty()) {
+ SDL_LOG_DEBUG(
+ "No parameter permissions provided, all params are allowed");
+ } else {
+ for (const auto& param : appSO[idx].enumerate()) {
+ const auto& allowed_params = params_permissions.allowed_params;
+ auto param_allowed = allowed_params.find(param);
+ if (allowed_params.end() == param_allowed) {
+ SDL_LOG_DEBUG("Param " << param
+ << " is not allowed by policy for app "
+ << notify_apps[idx]->app_id()
+ << ". It will be ignored.");
+ appSO[idx].erase(param);
+ }
+ }
+ }
+
+ if (appSO[idx].empty()) {
+ SDL_LOG_DEBUG("App " << notify_apps[idx]->app_id()
+ << " will be skipped: there is nothing to notify.");
+ continue;
+ }
- for (size_t idx = 0; idx < notify_apps.size(); idx++) {
- SDL_LOG_INFO("Send OnVehicleData PRNDL notification to "
+ SDL_LOG_INFO("Send OnVehicleData notification to "
<< notify_apps[idx]->name().c_str() << " application id "
<< notify_apps[idx]->app_id());
(*message_)[strings::params][strings::connection_key] =
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
index c718d18965..443bcd3e8c 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
@@ -48,11 +48,11 @@ SDL_CREATE_LOG_VARIABLE("Commands")
ReadDIDRequest::ReadDIDRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_) {}
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
ReadDIDRequest::~ReadDIDRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
index 9e35e96ce3..db3922e1a2 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands")
SubscribeVehicleDataRequest::SubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
VehicleInfoCommandParams params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_)
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
, custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {}
@@ -103,7 +103,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
}
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
if (!app) {
SDL_LOG_ERROR("NULL pointer.");
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index 7d81701a64..e04e529a67 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -52,11 +52,11 @@ SDL_CREATE_LOG_VARIABLE("Commands")
UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
const VehicleInfoCommandParams& params)
- : CommandRequestImpl(message,
- params.application_manager_,
- params.rpc_service_,
- params.hmi_capabilities_,
- params.policy_handler_)
+ : RequestFromMobileImpl(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
, custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {}
@@ -189,7 +189,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
ApplicationSharedPtr app =
- application_manager_.application(CommandRequestImpl::connection_key());
+ application_manager_.application(RequestFromMobileImpl::connection_key());
if (!app) {
SDL_LOG_ERROR("NULL pointer.");
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
index af9d605ff0..39d20cf67d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
@@ -114,7 +114,7 @@ void CustomVehicleDataManagerImpl::CreateMobileMessageParams(
auto& input_param = input_params[key];
if (*schema->array &&
input_param.getType() == smart_objects::SmartType_Array) {
- for (size_t i = 0; i < input_param.length(); i++) {
+ for (size_t i = 0; i < input_param.length(); ++i) {
const auto param =
fill_mobile_msg(input_param[i], SearchMethod::RECURSIVE);
out_params[item_name][i] = param;
@@ -294,10 +294,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
case SMemberType::SMEMBER_VDR_MOBILE: {
// valid since struct_schema_items is not used in
// InitStructSchemaItem_VehicleDataResult
- mobile_apis::MOBILE_API::TStructsSchemaItems mobile_struct_schema_items;
auto member_schema =
- mobile_apis::MOBILE_API::InitStructSchemaItem_VehicleDataResult(
- mobile_struct_schema_items);
+ mobile_apis::MOBILE_API::InitStructSchemaItem_VehicleDataResult();
return SMember(
member_schema,
false, // root level items should not be mandatory
@@ -330,10 +328,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
case SMemberType::SMEMBER_VDR_HMI: {
// valid since struct_schema_items is not used in
// InitStructSchemaItem_Common_VehicleDataResult
- hmi_apis::HMI_API::TStructsSchemaItems hmi_struct_schema_items;
auto member_schema =
- hmi_apis::HMI_API::InitStructSchemaItem_Common_VehicleDataResult(
- hmi_struct_schema_items);
+ hmi_apis::HMI_API::InitStructSchemaItem_Common_VehicleDataResult();
return SMember(
member_schema, false // root level items should not be mandatory
);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
index dd6d797e39..cff5d294ad 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
@@ -38,8 +38,6 @@ SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin")
namespace vehicle_info_plugin {
namespace strings = application_manager::strings;
-unsigned VehicleInfoAppExtension::VehicleInfoAppExtensionUID = 146;
-
VehicleInfoAppExtension::VehicleInfoAppExtension(
VehicleInfoPlugin& plugin, application_manager::Application& app)
: app_mngr::AppExtension(
@@ -138,7 +136,8 @@ void VehicleInfoAppExtension::SaveResumptionData(
int i = 0;
sync_primitives::AutoLock lock(*subscribed_data_lock_);
for (const auto& subscription : subscribed_data_) {
- resumption_data[strings::application_vehicle_info][i++] = subscription;
+ resumption_data[strings::application_vehicle_info][i] = subscription;
+ ++i;
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
index 77cb5e71d7..7511cb7364 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
@@ -208,7 +208,8 @@ app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_command_creator(
? factory.GetCreator<commands::DiagnosticMessageRequest>()
: factory.GetCreator<commands::DiagnosticMessageResponse>();
}
- default: {}
+ default: {
+ }
}
return factory.GetCreator<VehicleInfoInvalidCommand>();
}
@@ -226,7 +227,8 @@ VehicleInfoMobileCommandFactory::get_notification_creator(
case mobile_apis::FunctionID::OnVehicleDataID: {
return factory.GetCreator<commands::OnVehicleDataNotification>();
}
- default: {}
+ default: {
+ }
}
return factory.GetCreator<VehicleInfoInvalidCommand>();
}
@@ -254,7 +256,8 @@ app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_creator_factory(
}
break;
}
- default: {}
+ default: {
+ }
}
VehicleInfoCommandParams params = {application_manager_,
rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc
index 6721d93658..c9affa5760 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc
@@ -205,7 +205,7 @@ void VehicleInfoPendingResumptionHandler::TriggerPendingResumption() {
}
}
-void VehicleInfoPendingResumptionHandler::on_event(
+void VehicleInfoPendingResumptionHandler::HandleOnEvent(
const application_manager::event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(pending_resumption_lock_);
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 1a357a86ee..84bd9f6b04 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
@@ -88,25 +88,6 @@ bool VehicleInfoPlugin::Init(
return true;
}
-bool VehicleInfoPlugin::Init(
- application_manager::ApplicationManager& application_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state) {
- UNUSED(last_state);
- application_manager_ = &application_manager;
- custom_vehicle_data_manager_.reset(
- new CustomVehicleDataManagerImpl(policy_handler, rpc_service));
- command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory(
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler,
- *(custom_vehicle_data_manager_.get())));
- return true;
-}
-
bool VehicleInfoPlugin::IsAbleToProcess(
const int32_t function_id, const commands::Command::CommandSource source) {
return command_factory_->IsAbleToProcess(function_id, source);
@@ -129,12 +110,22 @@ void VehicleInfoPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
SDL_LOG_AUTO_TRACE();
- if (plugins::ApplicationEvent::kApplicationRegistered == event) {
- application->AddExtension(
- std::make_shared<VehicleInfoAppExtension>(*this, *application));
- } else if ((plugins::ApplicationEvent::kDeleteApplicationData == event) ||
- (plugins::ApplicationEvent::kApplicationUnregistered == event)) {
- DeleteSubscriptions(application);
+ switch (event) {
+ case plugins::ApplicationEvent::kApplicationRegistered: {
+ application->AddExtension(
+ std::make_shared<VehicleInfoAppExtension>(*this, *application));
+ break;
+ }
+
+ case plugins::ApplicationEvent::kApplicationUnregistered:
+ case plugins::ApplicationEvent::kDeleteApplicationData: {
+ DeleteSubscriptions(application);
+ break;
+ }
+
+ default: {
+ break;
+ }
}
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
index c9697d71f2..1073974324 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
@@ -64,7 +64,7 @@ set(LIBRARIES
HMI_API
MOBILE_API
connectionHandler
- vehicle_info_plugin
+ vehicle_info_plugin_static
SmartObjects
formatters
jsoncpp
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc
index 20bf34f2ca..75f5ea3b83 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc
@@ -99,7 +99,7 @@ TEST_F(
ASSERT_TRUE(command->Init());
command->Run();
- command->onTimeOut();
+ command->OnTimeOut();
}
} // namespace vi_get_vehicle_type_request
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 f207faad77..5828630f24 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
@@ -210,7 +210,7 @@ TEST_F(VIIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
ASSERT_TRUE(command_->Init());
command_->Run();
- command_->onTimeOut();
+ command_->OnTimeOut();
}
} // namespace vi_is_ready_request
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
index 82eb19c45f..3f8dcbb488 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -56,8 +56,10 @@ namespace on_vehicle_data_notification {
namespace am = ::application_manager;
using ::testing::_;
+using ::testing::ContainerEq;
using ::testing::Return;
using ::testing::ReturnRef;
+using ::testing::SetArgPointee;
using am::commands::MessageSharedPtr;
using vehicle_info_plugin::commands::OnVehicleDataNotification;
@@ -119,6 +121,15 @@ TEST_F(OnVehicleDataNotificationTest, OnVehicleDataNotification_SUCCESS) {
VehicleInfoAppExtensionUID))
.WillByDefault(Return(vi_app_extention_ptr));
+ am::CommandParametersPermissions params_permissions;
+ params_permissions.allowed_params.insert(am::strings::gps);
+ params_permissions.allowed_params.insert(am::strings::speed);
+ EXPECT_CALL(app_mngr_,
+ CheckPolicyPermissions(
+ _, _, _, ContainerEq(params_permissions.allowed_params), _))
+ .WillOnce(DoAll(SetArgPointee<4>(params_permissions),
+ Return(mobile_apis::Result::SUCCESS)));
+
MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
smart_objects::SmartObject gps_data;
gps_data[am::strings::longitude_degrees] = 1.0;
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h
index ae25acea87..e7d73fc4f0 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h
@@ -66,7 +66,7 @@ using ::smart_objects::SmartObject;
template <const CommandsTestMocks kIsNice = CommandsTestMocks::kNotNice>
class VICommandsTest : public CommandsTest<kIsNice> {
public:
- enum { kDefaultTimeout_ = 100 };
+ enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 };
template <class Command>
std::shared_ptr<Command> CreateCommandVI() {
@@ -76,7 +76,7 @@ class VICommandsTest : public CommandsTest<kIsNice> {
template <class Command>
std::shared_ptr<Command> CreateCommandVI(MessageSharedPtr& msg) {
- InitCommandVI(kDefaultTimeout_);
+ InitCommandVI(kDefaultTimeout_, kDefaultTimeoutCompensation_);
vehicle_info_plugin::VehicleInfoCommandParams params = {
CommandsTest<kIsNice>::app_mngr_,
CommandsTest<kIsNice>::mock_rpc_service_,
@@ -90,11 +90,14 @@ class VICommandsTest : public CommandsTest<kIsNice> {
mock_custom_vehicle_data_manager_;
protected:
- void InitCommandVI(const uint32_t& timeout) {
+ void InitCommandVI(const uint32_t timeout, const uint32_t compensation) {
ON_CALL(CommandsTest<kIsNice>::app_mngr_, get_settings())
.WillByDefault(ReturnRef(CommandsTest<kIsNice>::app_mngr_settings_));
ON_CALL(CommandsTest<kIsNice>::app_mngr_settings_, default_timeout())
.WillByDefault(ReturnRef(timeout));
+ ON_CALL(CommandsTest<kIsNice>::app_mngr_settings_,
+ default_timeout_compensation())
+ .WillByDefault(ReturnRef(compensation));
}
};
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc
index 5b2f4d5e25..82c5aaeafa 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc
@@ -380,7 +380,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
raise_event(EventCheck(subscribed_correlation_id,
expected_data_in_event)));
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
@@ -427,7 +427,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
expected_data_in_event)));
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
@@ -469,7 +469,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
@@ -506,7 +506,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
@@ -550,7 +550,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, TwoAppsOneSharedDataSuccess) {
resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
@@ -599,7 +599,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed"));
EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
@@ -648,7 +648,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app);
resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2);
// TODO check that raized the same fid and cid as subscribed
- resumption_handler_->on_event(event);
+ resumption_handler_->HandleOnEvent(event);
const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType>
second_subscriptions_result = {
@@ -661,7 +661,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest,
VehicleInfo_SubscribeVehicleData);
second_event.set_smart_object(second_response);
- resumption_handler_->on_event(second_event);
+ resumption_handler_->HandleOnEvent(second_event);
EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps"));
EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps"));
EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u);
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
index d618e63e15..ed0fc37974 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
@@ -257,7 +257,7 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
// Copy in temporary vector Json list without oldest record
int32_t i = 0;
- for (auto it = apps_list.begin(); it != apps_list.end(); ++it, i++) {
+ for (auto it = apps_list.begin(); it != apps_list.end(); ++it, ++i) {
if ((*it).isMember(strings::device_id) &&
(*it).isMember(strings::bundle_id) && (*it).isMember(strings::app_id) &&
(*it).isMember(strings::app_launch_last_session)) {
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index 9b31d57ca0..4955c792c2 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -617,6 +617,25 @@ bool AppServiceManager::UpdateNavigationCapabilities(
return true;
}
+AppService* AppServiceManager::FindWayPointsHandler() {
+ auto service = ActiveServiceForType(
+ EnumToString(mobile_apis::AppServiceType::NAVIGATION));
+ if (!service || !service->mobile_service ||
+ !service->record[strings::service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ return nullptr;
+ }
+
+ 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::GetWayPointsID) {
+ return service;
+ }
+ }
+ return nullptr;
+}
+
void AppServiceManager::AppServiceUpdated(
const smart_objects::SmartObject& service_record,
const mobile_apis::ServiceUpdateReason::eType update_reason,
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index 8f7a1e2815..1d6ea8afe8 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -201,6 +201,7 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
, keyboard_props_(nullptr)
, menu_title_(nullptr)
, menu_icon_(nullptr)
+ , menu_layout_(nullptr)
, tbt_show_command_(nullptr)
, commands_()
, commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
@@ -349,6 +350,11 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon()
return menu_icon_;
}
+const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_layout()
+ const {
+ return menu_layout_;
+}
+
smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme()
const {
using namespace mobile_apis::PredefinedWindows;
@@ -467,6 +473,8 @@ void DynamicApplicationDataImpl::load_global_properties(
SetGlobalProperties(properties_so.getElement(strings::menu_icon),
&DynamicApplicationData::set_menu_icon);
+ SetGlobalProperties(properties_so.getElement(strings::menu_layout),
+ &DynamicApplicationData::set_menu_layout);
}
void DynamicApplicationDataImpl::set_help_prompt(
@@ -560,6 +568,14 @@ void DynamicApplicationDataImpl::set_menu_icon(
menu_icon_ = new smart_objects::SmartObject(menu_icon);
}
+void DynamicApplicationDataImpl::set_menu_layout(
+ const smart_objects::SmartObject& menu_layout) {
+ if (menu_layout_) {
+ delete menu_layout_;
+ }
+ menu_layout_ = new smart_objects::SmartObject(menu_layout);
+}
+
void DynamicApplicationDataImpl::set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) {
using namespace mobile_apis::PredefinedWindows;
@@ -611,7 +627,7 @@ void DynamicApplicationDataImpl::set_display_capabilities(
} else if (window_id == 0) {
return index;
}
- index++;
+ ++index;
}
return -1;
};
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 6b4500e394..42afd93459 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -159,8 +159,7 @@ ApplicationImpl::ApplicationImpl(
set_name(app_name);
MarkUnregistered();
- // subscribe application to custom button by default
- SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON);
+
// load persistent files
LoadPersistentFiles();
@@ -205,6 +204,7 @@ void ApplicationImpl::ChangeSupportingAppHMIType() {
set_voice_communication_supported(false);
set_mobile_projection_enabled(false);
set_webengine_projection_enabled(false);
+ set_remote_control_supported(false);
const smart_objects::SmartObject& array_app_types = *app_types_;
uint32_t lenght_app_types = array_app_types.length();
@@ -225,6 +225,9 @@ void ApplicationImpl::ChangeSupportingAppHMIType() {
case mobile_apis::AppHMIType::WEB_VIEW:
set_webengine_projection_enabled(true);
break;
+ case mobile_apis::AppHMIType::REMOTE_CONTROL:
+ set_remote_control_supported(true);
+ break;
default:
break;
}
@@ -613,9 +616,6 @@ void ApplicationImpl::StopStreaming(
void ApplicationImpl::StopNaviStreaming() {
SDL_LOG_AUTO_TRACE();
video_stream_suspend_timer_.Stop();
- application_manager_.OnAppStreaming(app_id(),
- protocol_handler::ServiceType::kMobileNav,
- StreamingState::kStopped);
MessageHelper::SendNaviStopStream(app_id(), application_manager_);
set_video_streaming_approved(false);
set_video_stream_retry_number(0);
@@ -624,9 +624,6 @@ void ApplicationImpl::StopNaviStreaming() {
void ApplicationImpl::StopAudioStreaming() {
SDL_LOG_AUTO_TRACE();
audio_stream_suspend_timer_.Stop();
- application_manager_.OnAppStreaming(app_id(),
- protocol_handler::ServiceType::kAudio,
- StreamingState::kStopped);
MessageHelper::SendAudioStopStream(app_id(), application_manager_);
set_audio_streaming_approved(false);
set_audio_stream_retry_number(0);
@@ -637,17 +634,14 @@ void ApplicationImpl::SuspendStreaming(
using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
- if (ServiceType::kMobileNav == service_type && !video_streaming_suspended_) {
+ if (ServiceType::kMobileNav == service_type) {
video_stream_suspend_timer_.Stop();
- application_manager_.OnAppStreaming(
- app_id(), service_type, StreamingState::kSuspended);
+ application_manager_.OnAppStreaming(app_id(), service_type, false);
sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
video_streaming_suspended_ = true;
- } else if (ServiceType::kAudio == service_type &&
- !audio_streaming_suspended_) {
+ } else if (ServiceType::kAudio == service_type) {
audio_stream_suspend_timer_.Stop();
- application_manager_.OnAppStreaming(
- app_id(), service_type, StreamingState::kSuspended);
+ application_manager_.OnAppStreaming(app_id(), service_type, false);
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
audio_streaming_suspended_ = true;
}
@@ -656,7 +650,7 @@ void ApplicationImpl::SuspendStreaming(
}
void ApplicationImpl::WakeUpStreaming(
- protocol_handler::ServiceType service_type) {
+ protocol_handler::ServiceType service_type, uint32_t timer_len) {
using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
@@ -668,29 +662,28 @@ void ApplicationImpl::WakeUpStreaming(
{ // reduce the range of video_streaming_suspended_lock_
sync_primitives::AutoLock auto_lock(video_streaming_suspended_lock_);
if (video_streaming_suspended_) {
- application_manager_.OnAppStreaming(
- app_id(), service_type, StreamingState::kStarted);
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
application_manager_.ProcessOnDataStreamingNotification(
service_type, app_id(), true);
video_streaming_suspended_ = false;
}
}
-
- video_stream_suspend_timer_.Start(video_stream_suspend_timeout_,
- timer::kPeriodic);
+ video_stream_suspend_timer_.Start(
+ timer_len == 0 ? video_stream_suspend_timeout_ : timer_len,
+ timer::kPeriodic);
} else if (ServiceType::kAudio == service_type) {
{ // reduce the range of audio_streaming_suspended_lock_
sync_primitives::AutoLock auto_lock(audio_streaming_suspended_lock_);
if (audio_streaming_suspended_) {
- application_manager_.OnAppStreaming(
- app_id(), service_type, StreamingState::kStarted);
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
application_manager_.ProcessOnDataStreamingNotification(
service_type, app_id(), true);
audio_streaming_suspended_ = false;
}
}
- audio_stream_suspend_timer_.Start(audio_stream_suspend_timeout_,
- timer::kPeriodic);
+ audio_stream_suspend_timer_.Start(
+ timer_len == 0 ? audio_stream_suspend_timeout_ : timer_len,
+ timer::kPeriodic);
}
}
@@ -1147,20 +1140,36 @@ uint32_t ApplicationImpl::GetAvailableDiskSpace() {
}
void ApplicationImpl::SubscribeToSoftButtons(
- int32_t cmd_id, const SoftButtonID& softbuttons_id) {
+ int32_t cmd_id, const WindowSoftButtons& window_softbuttons) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
- if (static_cast<int32_t>(mobile_apis::FunctionID::ScrollableMessageID) ==
- cmd_id) {
- CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
- if (cmd_softbuttonid_.end() == it) {
- cmd_softbuttonid_[cmd_id] = softbuttons_id;
- }
- } else {
- auto& soft_button_ids = cmd_softbuttonid_[cmd_id];
- for (auto& softbutton_item : softbuttons_id) {
- soft_button_ids.insert(softbutton_item);
- }
+ CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
+
+ if (cmd_softbuttonid_.end() == it) {
+ SoftButtonIDs soft_buttons{window_softbuttons};
+ cmd_softbuttonid_.insert({cmd_id, soft_buttons});
+ return;
}
+
+ auto& command_soft_buttons = cmd_softbuttonid_[cmd_id];
+
+ const auto window_id = window_softbuttons.first;
+ auto find_window_id = [window_id](const WindowSoftButtons& window_buttons) {
+ return window_id == window_buttons.first;
+ };
+
+ auto subscribed_window_buttons = std::find_if(
+ command_soft_buttons.begin(), command_soft_buttons.end(), find_window_id);
+
+ if (subscribed_window_buttons == command_soft_buttons.end()) {
+ command_soft_buttons.insert(window_softbuttons);
+ return;
+ }
+
+ WindowSoftButtons new_window_soft_buttons = *subscribed_window_buttons;
+ new_window_soft_buttons.second.insert(window_softbuttons.second.begin(),
+ window_softbuttons.second.end());
+ command_soft_buttons.erase(subscribed_window_buttons);
+ command_soft_buttons.insert(new_window_soft_buttons);
}
struct FindSoftButtonId {
@@ -1169,24 +1178,46 @@ struct FindSoftButtonId {
explicit FindSoftButtonId(const uint32_t soft_button_id)
: soft_button_id_(soft_button_id) {}
- bool operator()(const std::pair<uint32_t, WindowID>& element) const {
- return soft_button_id_ == element.first;
+ bool operator()(const uint32_t softbutton_id) {
+ return soft_button_id_ == softbutton_id;
}
};
+struct FindWindowSoftButtonId {
+ public:
+ FindWindowSoftButtonId(const uint32_t soft_button_id)
+ : find_softbutton_id_(soft_button_id) {}
+
+ bool operator()(const WindowSoftButtons& window_buttons) {
+ const auto softbuttons = window_buttons.second;
+ auto found_softbutton = std::find_if(
+ softbuttons.begin(), softbuttons.end(), find_softbutton_id_);
+
+ return found_softbutton != softbuttons.end();
+ }
+
+ private:
+ FindSoftButtonId find_softbutton_id_;
+};
+
bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
- CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
- for (; it != cmd_softbuttonid_.end(); ++it) {
- const auto& soft_button_ids = (*it).second;
- FindSoftButtonId finder(softbutton_id);
- const auto find_res =
- std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
- if ((soft_button_ids.end() != find_res)) {
+
+ for (const auto& command_soft_buttons : cmd_softbuttonid_) {
+ FindWindowSoftButtonId find_window_softbutton_id(softbutton_id);
+ const auto& window_softbuttons = command_soft_buttons.second;
+
+ const auto found_window_softbutton_id =
+ std::find_if(window_softbuttons.begin(),
+ window_softbuttons.end(),
+ find_window_softbutton_id);
+
+ if (found_window_softbutton_id != window_softbuttons.end()) {
return true;
}
}
+
return false;
}
@@ -1194,14 +1225,18 @@ WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
- CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
- for (; it != cmd_softbuttonid_.end(); ++it) {
- const auto& soft_button_ids = (*it).second;
- FindSoftButtonId finder(softbutton_id);
- const auto find_res =
- std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
- if ((soft_button_ids.end() != find_res)) {
- return find_res->second;
+
+ for (const auto& command_soft_buttons : cmd_softbuttonid_) {
+ FindWindowSoftButtonId find_window_softbutton_id(softbutton_id);
+ const auto& window_softbuttons = command_soft_buttons.second;
+
+ const auto found_window_softbutton_id =
+ std::find_if(window_softbuttons.begin(),
+ window_softbuttons.end(),
+ find_window_softbutton_id);
+
+ if (found_window_softbutton_id != window_softbuttons.end()) {
+ return found_window_softbutton_id->first;
}
}
@@ -1271,6 +1306,7 @@ AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) {
}
bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
+ SDL_LOG_AUTO_TRACE();
if (!QueryInterface(extension->uid())) {
SDL_LOG_TRACE("Add extenstion to add id" << app_id() << " with uid "
<< extension->uid());
@@ -1281,12 +1317,18 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
}
bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) {
+ SDL_LOG_AUTO_TRACE();
auto it = std::find_if(
extensions_.begin(), extensions_.end(), [uid](AppExtensionPtr extension) {
return extension->uid() == uid;
});
- return it != extensions_.end();
+ if (extensions_.end() != it) {
+ extensions_.erase(it);
+ return true;
+ }
+
+ return false;
}
const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 4b69008a6c..9da76250c1 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -51,6 +51,8 @@
#include "application_manager/mobile_message_handler.h"
#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
#include "application_manager/policies/policy_handler.h"
+#include "application_manager/request_controller_impl.h"
+#include "application_manager/request_timeout_handler_impl.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/rpc_handler_impl.h"
#include "application_manager/rpc_protection_manager_impl.h"
@@ -147,10 +149,6 @@ struct PolicyAppIdComparator {
const std::string& 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;
-
namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
namespace jhs = ns_smart_device_link::ns_json_handler::strings;
@@ -164,6 +162,7 @@ ApplicationManagerImpl::ApplicationManagerImpl(
std::make_shared<sync_primitives::RecursiveLock>())
, apps_to_register_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, reregister_wait_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , subscribed_to_hmi_way_points_(false)
, audio_pass_thru_active_(false)
, audio_pass_thru_app_id_(0)
, driver_distraction_state_(hmi_apis::Common_DriverDistractionState::DD_OFF)
@@ -175,9 +174,13 @@ ApplicationManagerImpl::ApplicationManagerImpl(
, connection_handler_(NULL)
, policy_handler_(new policy::PolicyHandler(policy_settings, *this))
, protocol_handler_(NULL)
- , request_ctrl_(am_settings)
- , hmi_so_factory_(NULL)
- , mobile_so_factory_(NULL)
+ , request_timeout_handler_(
+ new request_controller::RequestTimeoutHandlerImpl(*this))
+ , request_ctrl_(new request_controller::RequestControllerImpl(
+ am_settings, *request_timeout_handler_, event_dispatcher_))
+ , mobile_correlation_id_(0)
+ , correlation_id_(0)
+ , max_correlation_id_(UINT_MAX)
, hmi_capabilities_(new HMICapabilitiesImpl(*this))
, unregister_reason_(
mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM)
@@ -219,7 +222,7 @@ ApplicationManagerImpl::ApplicationManagerImpl(
std::make_shared<RPCProtectionManagerImpl>(*policy_handler_);
policy_handler_->add_listener(rpc_protection_manager.get());
rpc_service_.reset(new rpc_service::RPCServiceImpl(*this,
- request_ctrl_,
+ *request_ctrl_,
protocol_handler_,
hmi_handler_,
*commands_holder_,
@@ -231,40 +234,31 @@ ApplicationManagerImpl::ApplicationManagerImpl(
ApplicationManagerImpl::~ApplicationManagerImpl() {
SDL_LOG_AUTO_TRACE();
- is_stopping_.store(true);
+ InitiateStopping();
SendOnSDLClose();
media_manager_ = NULL;
hmi_handler_ = NULL;
connection_handler_ = NULL;
- if (hmi_so_factory_) {
- delete hmi_so_factory_;
- hmi_so_factory_ = NULL;
- }
- if (mobile_so_factory_) {
- delete mobile_so_factory_;
- mobile_so_factory_ = NULL;
- }
protocol_handler_ = NULL;
SDL_LOG_DEBUG("Destroying Policy Handler");
RemovePolicyObserver(this);
{
- sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
- close_app_timer_pool_.clear();
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ navi_app_to_stop_.clear();
}
{
- sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
- end_stream_timer_pool_.clear();
+ sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_);
+ navi_app_to_end_stream_.clear();
}
{
- sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- navi_app_to_stop_.clear();
+ sync_primitives::AutoLock lock(streaming_timer_pool_lock_);
+ streaming_timer_pool_.clear();
}
- navi_app_to_end_stream_.clear();
-
+ clear_pool_timer_.Stop();
secondary_transport_devices_cache_.clear();
}
@@ -316,13 +310,6 @@ ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id(
return FindPendingApp(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::reregister_application_by_policy_id(
const std::string& policy_app_id) const {
@@ -470,6 +457,7 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app);
state_ctrl_.OnApplicationRegistered(app, default_level);
+ commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand);
}
void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
@@ -626,7 +614,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
}
HmiStatePtr initial_state =
- CreateRegularState(std::shared_ptr<Application>(application),
+ CreateRegularState(ApplicationSharedPtr(application),
mobile_apis::WindowType::MAIN,
mobile_apis::HMILevel::INVALID_ENUM,
mobile_apis::AudioStreamingState::INVALID_ENUM,
@@ -675,17 +663,8 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
static_cast<protocol_handler::MajorProtocolVersion>(
message[strings::params][strings::protocol_version].asInt());
application->set_protocol_version(protocol_version);
-
- if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN !=
- protocol_version) {
- connection_handler().BindProtocolVersionWithSession(
- connection_key, static_cast<uint8_t>(protocol_version));
- }
- if ((protocol_version ==
- protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) &&
- (get_settings().heart_beat_timeout() != 0)) {
- connection_handler().StartSessionHeartBeat(connection_key);
- }
+ connection_handler_->BindProtocolVersionWithSession(connection_key,
+ protocol_version);
// Keep HMI add id in case app is present in "waiting for registration" list
apps_to_register_list_lock_ptr_->Acquire();
@@ -1140,7 +1119,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
}
// Delete the cloud device
connection_handler().RemoveCloudAppDevice(app->device());
- removed_app_count++;
+ ++removed_app_count;
}
// Update app list if disabled apps were removed
@@ -1384,23 +1363,23 @@ ApplicationManagerImpl::GetCloudAppConnectionStatus(
}
uint32_t ApplicationManagerImpl::GetNextMobileCorrelationID() {
- if (mobile_corelation_id_ < max_corelation_id_) {
- mobile_corelation_id_++;
+ if (mobile_correlation_id_ < max_correlation_id_) {
+ ++mobile_correlation_id_;
} else {
- mobile_corelation_id_ = 0;
+ mobile_correlation_id_ = 0;
}
- return mobile_corelation_id_;
+ return mobile_correlation_id_;
}
uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
- if (corelation_id_ < max_corelation_id_) {
- corelation_id_++;
+ if (correlation_id_ < max_correlation_id_) {
+ ++correlation_id_;
} else {
- corelation_id_ = 0;
+ correlation_id_ = 0;
}
- return corelation_id_;
+ return correlation_id_;
}
bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) {
@@ -1623,6 +1602,58 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
RefreshCloudAppInformation();
}
+bool ApplicationManagerImpl::WaitForHmiIsReady() {
+ sync_primitives::AutoLock lock(wait_for_hmi_lock_);
+ if (!IsStopping() && !IsHMICooperating()) {
+ SDL_LOG_DEBUG("Waiting for the HMI cooperation...");
+ wait_for_hmi_condvar_.Wait(lock);
+ }
+
+ if (IsStopping()) {
+ SDL_LOG_WARN("System is terminating...");
+ return false;
+ }
+
+ return IsHMICooperating();
+}
+
+bool ApplicationManagerImpl::GetProtocolVehicleData(
+ connection_handler::ProtocolVehicleData& data) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace protocol_handler::strings;
+
+ if (!WaitForHmiIsReady()) {
+ SDL_LOG_ERROR("Failed to wait for HMI readiness");
+ return false;
+ }
+
+ const auto vehicle_type_ptr = hmi_capabilities_->vehicle_type();
+ if (vehicle_type_ptr) {
+ if (vehicle_type_ptr->keyExists(vehicle_make)) {
+ data.vehicle_make = vehicle_type_ptr->getElement(vehicle_make).asString();
+ }
+
+ if (vehicle_type_ptr->keyExists(vehicle_model)) {
+ data.vehicle_model =
+ vehicle_type_ptr->getElement(vehicle_model).asString();
+ }
+
+ if (vehicle_type_ptr->keyExists(vehicle_model_year)) {
+ data.vehicle_year =
+ vehicle_type_ptr->getElement(vehicle_model_year).asString();
+ }
+
+ if (vehicle_type_ptr->keyExists(vehicle_trim)) {
+ data.vehicle_trim = vehicle_type_ptr->getElement(vehicle_trim).asString();
+ }
+ }
+
+ data.vehicle_system_software_version = hmi_capabilities_->ccpu_version();
+ data.vehicle_system_hardware_version = hmi_capabilities_->hardware_version();
+
+ return true;
+}
+
void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
connection_handler().ConnectToAllDevices();
SDL_LOG_DEBUG("Starting application list update timer");
@@ -1693,7 +1724,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart(
}
for (const auto& app : wait_list) {
- request_ctrl_.terminateAppRequests(app->app_id());
+ request_ctrl_->TerminateAppRequests(app->app_id());
resume_ctrl_->SaveApplication(app);
}
@@ -1737,11 +1768,11 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(*app);
if (is_subscribed_to_way_points) {
- UnsubscribeAppFromWayPoints(app);
+ UnsubscribeAppFromWayPoints(app, false);
}
SwitchApplicationParameters(app, connection_key, device_id, mac_address);
if (is_subscribed_to_way_points) {
- SubscribeAppForWayPoints(app);
+ SubscribeAppForWayPoints(app, false);
}
// Normally this is done during registration, however since switched apps are
@@ -1821,7 +1852,7 @@ bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable(
return false;
} else {
// check all AppHMITypes that the app has
- for (size_t i = 0; i < app_types_array->length(); i++) {
+ for (size_t i = 0; i < app_types_array->length(); ++i) {
std::string app_type_string =
EnumToString(static_cast<mobile_apis::AppHMIType::eType>(
app_types_array->getElement(i).asUInt()));
@@ -1888,10 +1919,11 @@ bool ApplicationManagerImpl::StartNaviService(
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
- std::pair<NaviServiceStatusMap::iterator, bool> res =
- navi_service_status_.insert(
- std::pair<uint32_t, std::pair<bool, bool> >(
- app_id, std::make_pair(false, false)));
+ NaviServiceStatusDescriptor descriptor({false, false});
+ auto res = navi_service_status_.insert(
+ std::pair<uint32_t, NaviServiceStatusDescriptor>(app_id,
+ descriptor));
+
if (!res.second) {
SDL_LOG_WARN("Navi service refused");
return false;
@@ -1980,19 +2012,27 @@ void ApplicationManagerImpl::OnStreamingConfigurationSuccessful(
// Fill NaviServices map. Set true to first value of pair if
// we've started video service or to second value if we've
// started audio service
- service_type == protocol_handler::ServiceType::kMobileNav
- ? it->second.first = true
- : it->second.second = true;
+ if (protocol_handler::ServiceType::kMobileNav == service_type) {
+ it->second.is_video_service_active_ = true;
+ }
+
+ if (protocol_handler::ServiceType::kAudio == service_type) {
+ it->second.is_audio_service_active_ = true;
+ }
{
sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- for (size_t i = 0; i < navi_app_to_stop_.size(); ++i) {
- if (app_id == navi_app_to_stop_[i]) {
- sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
- close_app_timer_pool_.erase(close_app_timer_pool_.begin() + i);
- navi_app_to_stop_.erase(navi_app_to_stop_.begin() + i);
- break;
- }
+ auto it = std::find_if(
+ navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ [&app_id, &service_type](const NaviServiceDescriptor& desc) {
+ return app_id == desc.app_id_ && service_type == desc.service_type_;
+ });
+
+ if (it != navi_app_to_stop_.end()) {
+ SDL_LOG_DEBUG("Removing app descriptor for service "
+ << service_type << " from map to stop");
+ navi_app_to_stop_.erase(it);
}
}
}
@@ -2002,10 +2042,18 @@ void ApplicationManagerImpl::OnStreamingConfigurationSuccessful(
// Fix: For wifi Secondary
// Should erase appid from deque of ForbidStreaming() push in the last time
- std::deque<uint32_t>::const_iterator iter = std::find(
- navi_app_to_end_stream_.begin(), navi_app_to_end_stream_.end(), app_id);
- if (navi_app_to_end_stream_.end() != iter) {
- navi_app_to_end_stream_.erase(iter);
+ {
+ sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_);
+ auto it = std::find_if(
+ navi_app_to_end_stream_.begin(),
+ navi_app_to_end_stream_.end(),
+ [&app_id, &service_type](const NaviServiceDescriptor& desc) {
+ return app_id == desc.app_id_ && service_type == desc.service_type_;
+ });
+
+ if (navi_app_to_end_stream_.end() != it) {
+ navi_app_to_end_stream_.erase(it);
+ }
}
}
@@ -2036,14 +2084,15 @@ void ApplicationManagerImpl::StopNaviService(
return;
} else {
// Fix: Repeated tests are not executed after they have stopped for Navi
- if (false == it->second.first &&
+ if (false == it->second.is_video_service_active_ &&
ServiceType::kMobileNav == service_type) {
SDL_LOG_DEBUG("appId: " << app_id << "Navi had stopped");
return;
}
// Fix: Repeated tests are not executed after they have stopped for Audio
- if (false == it->second.second && ServiceType::kAudio == service_type) {
+ if (false == it->second.is_audio_service_active_ &&
+ ServiceType::kAudio == service_type) {
SDL_LOG_DEBUG("appId: " << app_id << "Audio had stopped");
return;
}
@@ -2052,8 +2101,13 @@ void ApplicationManagerImpl::StopNaviService(
// stopped audio service
SDL_LOG_DEBUG("appId: " << app_id << " service_type: " << service_type
<< " to stopped");
- service_type == ServiceType::kMobileNav ? it->second.first = false
- : it->second.second = false;
+ if (service_type == ServiceType::kMobileNav) {
+ it->second.is_video_service_active_ = false;
+ }
+
+ if (service_type == ServiceType::kAudio) {
+ it->second.is_audio_service_active_ = false;
+ }
}
// Fix: For wifi Secondary
// undisposed data active the VPMService restart again,
@@ -2070,7 +2124,7 @@ void ApplicationManagerImpl::StopNaviService(
app->set_audio_streaming_allowed(false);
}
// push_back for judge in ForbidStreaming(),
- StartEndStreamTimer(app_id);
+ StartEndStreamTimer(app_id, service_type);
}
ApplicationSharedPtr app = application(app_id);
@@ -2262,12 +2316,32 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus(
sync_primitives::AutoLock lock(navi_service_status_lock_);
auto app_services = navi_service_status_.find(app->app_id());
if (navi_service_status_.end() != app_services) {
- navi_service_status_.erase(app_services);
+ if (hmi_apis::Common_ServiceType::VIDEO == service_type) {
+ app_services->second.is_video_service_active_ = false;
+ }
+
+ if (hmi_apis::Common_ServiceType::AUDIO == service_type) {
+ app_services->second.is_audio_service_active_ = false;
+ }
+
+ if (!app_services->second.is_audio_service_active_ &&
+ !app_services->second.is_video_service_active_) {
+ SDL_LOG_DEBUG("The start of service"
+ << service_type << " for appID: " << app
+ << " is failed. Service info has been removed");
+ navi_service_status_.erase(app_services);
+ return true;
+ } else {
+ SDL_LOG_WARN(
+ "Another streaming session is still active. Don't stop the "
+ "app");
+ return false;
+ }
}
}
- SDL_LOG_DEBUG("The start of service"
- << service_type << " for appID: " << app
- << " is failed. Service info has been removed");
+
+ SDL_LOG_DEBUG("The start of service" << service_type << " for appID: "
+ << app << " is failed. Rejecting");
return true;
}
case hmi_apis::Common_ServiceType::RPC: {
@@ -2379,7 +2453,6 @@ bool ApplicationManagerImpl::OnHandshakeDone(
SSLContext::Handshake_Result_CertExpired,
SSLContext::Handshake_Result_CertNotSigned,
SSLContext::Handshake_Result_AppIDMismatch,
- SSLContext::Handshake_Result_AppNameMismatch,
SSLContext::Handshake_Result_NotYetValid)) {
app->usage_report().RecordTLSError();
}
@@ -2455,7 +2528,7 @@ void ApplicationManagerImpl::StartDevicesDiscovery() {
void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key,
const uint32_t corr_id,
const int32_t function_id) {
- request_ctrl_.TerminateRequest(corr_id, connection_key, function_id, true);
+ request_ctrl_->TerminateRequest(corr_id, connection_key, function_id, true);
}
void ApplicationManagerImpl::RemoveHMIFakeParameters(
@@ -2475,11 +2548,6 @@ void ApplicationManagerImpl::RemoveHMIFakeParameters(
(*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = mobile_function_id;
}
-bool ApplicationManagerImpl::Init(resumption::LastState&,
- media_manager::MediaManager*) {
- return false;
-}
-
bool ApplicationManagerImpl::Init(
resumption::LastStateWrapperPtr last_state_wrapper,
media_manager::MediaManager* media_manager) {
@@ -2561,7 +2629,7 @@ bool ApplicationManagerImpl::Init(
bool ApplicationManagerImpl::Stop() {
SDL_LOG_AUTO_TRACE();
- is_stopping_.store(true);
+ InitiateStopping();
application_list_update_timer_.Stop();
try {
if (unregister_reason_ ==
@@ -2574,7 +2642,7 @@ bool ApplicationManagerImpl::Stop() {
} catch (...) {
SDL_LOG_ERROR("An error occurred during unregistering applications.");
}
- request_ctrl_.DestroyThreadpool();
+ request_ctrl_->Stop();
// for PASA customer policy backup should happen :AllApp(SUSPEND)
SDL_LOG_DEBUG("Unloading policy library.");
@@ -2687,25 +2755,16 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
}
hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() {
- if (!hmi_so_factory_) {
- hmi_so_factory_ = new hmi_apis::HMI_API;
- if (!hmi_so_factory_) {
- SDL_LOG_ERROR("Out of memory");
- NOTREACHED();
- }
- }
- return *hmi_so_factory_;
+ return hmi_so_factory_;
}
mobile_apis::MOBILE_API& ApplicationManagerImpl::mobile_so_factory() {
- if (!mobile_so_factory_) {
- mobile_so_factory_ = new mobile_apis::MOBILE_API;
- if (!mobile_so_factory_) {
- SDL_LOG_ERROR("Out of memory");
- NOTREACHED();
- }
- }
- return *mobile_so_factory_;
+ return mobile_so_factory_;
+}
+
+ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra&
+ApplicationManagerImpl::mobile_v4_protocol_so_factory() {
+ return mobile_v4_protocol_so_factory_;
}
HMICapabilities& ApplicationManagerImpl::hmi_capabilities() {
@@ -2754,8 +2813,16 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data,
if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists(
json::ttsName)) {
SDL_LOG_DEBUG("Get ttsName from " << cur_vr_lang << " language");
- ttsName =
+ ttsName = SmartObject(SmartType_Array);
+ ttsName[0] =
app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName];
+
+ } else if (app_data[json::languages][default_idx][json::default_].keyExists(
+ json::ttsName)) {
+ SDL_LOG_DEBUG("Get ttsName from default language");
+ ttsName = SmartObject(SmartType_Array);
+ ttsName[0] =
+ app_data[json::languages][default_idx][json::default_][json::ttsName];
} else {
SDL_LOG_DEBUG("No data for ttsName for " << cur_vr_lang << " language");
}
@@ -2765,6 +2832,11 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data,
SDL_LOG_DEBUG("Get vrSynonyms from " << cur_vr_lang << " language");
vrSynonym =
app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms];
+ } else if (app_data[json::languages][default_idx][json::default_].keyExists(
+ json::vrSynonyms)) {
+ SDL_LOG_DEBUG("Get vrSynonyms from default language");
+ vrSynonym = app_data[json::languages][default_idx][json::default_]
+ [json::vrSynonyms];
} else {
SDL_LOG_DEBUG("No data for vrSynonyms for " << cur_vr_lang << " language");
}
@@ -2910,21 +2982,21 @@ void ApplicationManagerImpl::SetTelemetryObserver(
}
#endif // TELEMETRY_MONITOR
-void ApplicationManagerImpl::addNotification(const CommandSharedPtr ptr) {
- request_ctrl_.addNotification(ptr);
+void ApplicationManagerImpl::AddNotification(const CommandSharedPtr ptr) {
+ request_ctrl_->AddNotification(ptr);
}
-void ApplicationManagerImpl::removeNotification(
+void ApplicationManagerImpl::RemoveNotification(
const commands::Command* notification) {
- request_ctrl_.removeNotification(notification);
+ request_ctrl_->RemoveNotification(notification);
}
-void ApplicationManagerImpl::updateRequestTimeout(
+void ApplicationManagerImpl::UpdateRequestTimeout(
uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) {
SDL_LOG_AUTO_TRACE();
- request_ctrl_.updateRequestTimeout(
+ request_ctrl_->UpdateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
@@ -2934,7 +3006,7 @@ void ApplicationManagerImpl::IncreaseForwardedRequestTimeout(
<< get_settings().rpc_pass_through_timeout());
uint32_t new_timeout_value = get_settings().default_timeout() +
get_settings().rpc_pass_through_timeout();
- request_ctrl_.updateRequestTimeout(
+ request_ctrl_->UpdateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
@@ -2985,7 +3057,7 @@ void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
void ApplicationManagerImpl::HeadUnitReset(
mobile_api::AppInterfaceUnregisteredReason::eType reason) {
SDL_LOG_AUTO_TRACE();
- is_stopping_.store(true);
+ InitiateStopping();
switch (reason) {
case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: {
SDL_LOG_TRACE("Performing MASTER_RESET");
@@ -3023,11 +3095,14 @@ void ApplicationManagerImpl::HeadUnitReset(
void ApplicationManagerImpl::ClearAppsPersistentData() {
SDL_LOG_AUTO_TRACE();
typedef std::vector<std::string> FilesList;
- const std::string apps_info_storage_file = get_settings().app_info_storage();
- file_system::DeleteFile(apps_info_storage_file);
-
const std::string storage_folder = get_settings().app_storage_folder();
+ const std::string apps_info_storage_file =
+ !storage_folder.empty()
+ ? storage_folder + "/" + get_settings().app_info_storage()
+ : get_settings().app_info_storage();
+ file_system::DeleteFile(apps_info_storage_file);
+
FilesList files = file_system::ListFiles(storage_folder);
FilesList::iterator element_to_skip =
std::find(files.begin(), files.end(), "policy.sqlite");
@@ -3153,7 +3228,12 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
if (is_ignition_off) {
resume_controller().OnIgnitionOff();
}
- request_ctrl_.terminateAllHMIRequests();
+ request_ctrl_->TerminateAllHMIRequests();
+
+ {
+ sync_primitives::AutoLock lock(expired_button_requests_lock_);
+ expired_button_requests_.clear();
+ }
}
void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
@@ -3237,6 +3317,7 @@ void ApplicationManagerImpl::UnregisterApplication(
}
ApplicationSharedPtr app_to_remove;
connection_handler::DeviceHandle handle = 0;
+
{
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
auto it_app = applications_.begin();
@@ -3249,64 +3330,64 @@ void ApplicationManagerImpl::UnregisterApplication(
++it_app;
}
}
- if (!app_to_remove) {
- SDL_LOG_ERROR("Cant find application with app_id = " << app_id);
+ }
+ if (!app_to_remove) {
+ SDL_LOG_ERROR("Cant find application with app_id = " << app_id);
+ // Just to terminate RAI in case of connection is dropped (rare case)
+ // App won't be unregistered since RAI has not been started yet
+ SDL_LOG_DEBUG("Trying to terminate possible RAI request.");
+ request_ctrl_->TerminateAppRequests(app_id);
- // Just to terminate RAI in case of connection is dropped (rare case)
- // App won't be unregistered since RAI has not been started yet
- SDL_LOG_DEBUG("Trying to terminate possible RAI request.");
- request_ctrl_.terminateAppRequests(app_id);
+ return;
+ }
- return;
- }
+ resume_controller().RemoveFromResumption(app_id);
- if (is_resuming) {
- resume_controller().SaveApplication(app_to_remove);
- } else {
- resume_controller().RemoveApplicationFromSaved(app_to_remove);
- }
+ if (is_resuming) {
+ resume_controller().SaveApplication(app_to_remove);
+ } else {
+ resume_controller().RemoveApplicationFromSaved(app_to_remove);
+ }
- if (IsAppSubscribedForWayPoints(app_id)) {
- UnsubscribeAppFromWayPoints(app_id);
- if (!IsAnyAppSubscribedForWayPoints()) {
- SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
- auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
- GetNextHMICorrelationID());
- rpc_service_->ManageHMICommand(request);
- }
+ if (IsAppSubscribedForWayPoints(app_id)) {
+ UnsubscribeAppFromWayPoints(app_id, true);
+ if (!IsAnyAppSubscribedForWayPoints()) {
+ SDL_LOG_DEBUG("Send UnsubscribeWayPoints");
+ auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
+ GetNextHMICorrelationID());
+ rpc_service_->ManageHMICommand(request);
}
+ }
- (hmi_capabilities_->get_hmi_language_handler())
- .OnUnregisterApplication(app_id);
+ (hmi_capabilities_->get_hmi_language_handler())
+ .OnUnregisterApplication(app_id);
- if (connection_handler().GetDeviceID(app_to_remove->mac_address(),
- &handle)) {
- AppV4DevicePredicate finder(handle);
- ApplicationSharedPtr app = FindApp(applications(), finder);
- if (!app) {
- SDL_LOG_DEBUG(
- "There is no more SDL4 apps with device handle: " << handle);
+ if (connection_handler().GetDeviceID(app_to_remove->mac_address(), &handle)) {
+ AppV4DevicePredicate finder(handle);
+ ApplicationSharedPtr app = FindApp(applications(), finder);
+ if (!app) {
+ SDL_LOG_DEBUG(
+ "There is no more SDL4 apps with device handle: " << handle);
- RemoveAppsWaitingForRegistration(handle);
- }
+ RemoveAppsWaitingForRegistration(handle);
}
+ }
- MessageHelper::SendOnAppUnregNotificationToHMI(
- app_to_remove, is_unexpected_disconnect, *this);
- commands_holder_->Clear(app_to_remove);
-
- const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
- if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) {
- SDL_LOG_DEBUG(
- "Enabled local app has been unregistered. Re-create "
- "pending application");
- CreatePendingLocalApplication(app_to_remove->policy_app_id());
- }
+ MessageHelper::SendOnAppUnregNotificationToHMI(
+ app_to_remove, is_unexpected_disconnect, *this);
+ commands_holder_->Clear(app_to_remove);
- RefreshCloudAppInformation();
- SendUpdateAppList();
+ const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
+ if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) {
+ SDL_LOG_DEBUG(
+ "Enabled local app has been unregistered. Re-create "
+ "pending application");
+ CreatePendingLocalApplication(app_to_remove->policy_app_id());
}
+ RefreshCloudAppInformation();
+ SendUpdateAppList();
+
if (EndAudioPassThru(app_id)) {
// May be better to put this code in MessageHelper?
StopAudioPassThru(app_id);
@@ -3319,7 +3400,8 @@ void ApplicationManagerImpl::UnregisterApplication(
};
plugin_manager_->ForEachPlugin(on_app_unregistered);
- request_ctrl_.terminateAppRequests(app_id);
+
+ request_ctrl_->TerminateAppRequests(app_id);
const bool is_applications_list_empty = applications().GetData().empty();
if (is_applications_list_empty) {
@@ -3404,7 +3486,7 @@ void ApplicationManagerImpl::OnLowVoltage() {
is_low_voltage_ = true;
resume_ctrl_->SaveLowVoltageTime();
resume_ctrl_->StopSavePersistentDataTimer();
- request_ctrl_.OnLowVoltage();
+ request_ctrl_->OnLowVoltage();
}
bool ApplicationManagerImpl::IsLowVoltage() const {
@@ -3416,7 +3498,7 @@ void ApplicationManagerImpl::OnWakeUp() {
SDL_LOG_AUTO_TRACE();
resume_ctrl_->SaveWakeUpTime();
resume_ctrl_->StartSavePersistentDataTimer();
- request_ctrl_.OnWakeUp();
+ request_ctrl_->OnWakeUp();
is_low_voltage_ = false;
}
@@ -3438,6 +3520,7 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming(
using namespace mobile_apis::HMILevel;
using namespace mobile_apis::PredefinedWindows;
using namespace mobile_apis::VideoStreamingState;
+ using namespace mobile_apis::AudioStreamingState;
using namespace helpers;
ApplicationSharedPtr app = application(app_id);
@@ -3451,7 +3534,10 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming(
Compare<mobile_apis::HMILevel::eType, EQ, ONE>(
hmi_state->hmi_level(), HMI_FULL, HMI_LIMITED);
const bool allow_streaming_by_streaming_state =
- hmi_state->video_streaming_state() == STREAMABLE;
+ (service_type == protocol_handler::SERVICE_TYPE_NAVI &&
+ hmi_state->video_streaming_state() == STREAMABLE) ||
+ (service_type == protocol_handler::SERVICE_TYPE_AUDIO &&
+ hmi_state->audio_streaming_state() != NOT_AUDIBLE);
return allow_streaming_by_hmi_level && allow_streaming_by_streaming_state;
}
@@ -3479,9 +3565,11 @@ bool ApplicationManagerImpl::CanAppStream(
return HMIStateAllowsStreaming(app_id, service_type) && is_allowed;
}
-void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
+void ApplicationManagerImpl::ForbidStreaming(
+ uint32_t app_id, protocol_handler::ServiceType service_type) {
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
+ using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
@@ -3492,67 +3580,37 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
return;
}
+ bool app_to_stop_found = false;
+ bool app_to_end_stream_found = false;
{
sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(),
- app_id) ||
- navi_app_to_end_stream_.end() !=
- std::find(navi_app_to_end_stream_.begin(),
- navi_app_to_end_stream_.end(),
- app_id)) {
- return;
- }
- }
- bool unregister = false;
- {
- sync_primitives::AutoLock lock(navi_service_status_lock_);
+ auto it = std::find_if(
+ navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ [&app_id, &service_type](const NaviServiceDescriptor& desc) {
+ return app_id == desc.app_id_ && service_type == desc.service_type_;
+ });
- NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
- if (navi_service_status_.end() == it ||
- (!it->second.first && !it->second.second)) {
- unregister = true;
- }
+ app_to_stop_found = navi_app_to_stop_.end() != it;
}
- if (unregister) {
- rpc_service_->ManageMobileCommand(
- MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
- app_id, PROTOCOL_VIOLATION),
- commands::Command::SOURCE_SDL);
- UnregisterApplication(app_id, ABORTED);
- return;
- }
- EndNaviServices(app_id);
-}
-
-void ApplicationManagerImpl::ForbidStreaming(
- uint32_t app_id, protocol_handler::ServiceType service_type) {
- using namespace mobile_apis::AppInterfaceUnregisteredReason;
- using namespace mobile_apis::Result;
- using namespace protocol_handler;
- SDL_LOG_AUTO_TRACE();
+ {
+ sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_);
+ auto it_stream = std::find_if(
+ navi_app_to_end_stream_.begin(),
+ navi_app_to_end_stream_.end(),
+ [&app_id, &service_type](const NaviServiceDescriptor& desc) {
+ return app_id == desc.app_id_ && service_type == desc.service_type_;
+ });
- ApplicationSharedPtr app = application(app_id);
- if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
- SDL_LOG_DEBUG(
- "There is no navi or projection application with id: " << app_id);
- return;
+ app_to_end_stream_found = navi_app_to_end_stream_.end() != it_stream;
}
- {
- sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
-
- if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(),
- app_id) ||
- navi_app_to_end_stream_.end() !=
- std::find(navi_app_to_end_stream_.begin(),
- navi_app_to_end_stream_.end(),
- app_id)) {
- return;
- }
+ if (app_to_stop_found || app_to_end_stream_found) {
+ SDL_LOG_DEBUG("App " << app_id << " service " << service_type
+ << " is about to stop. Ignored");
+ return;
}
bool unregister = false;
@@ -3560,8 +3618,12 @@ void ApplicationManagerImpl::ForbidStreaming(
sync_primitives::AutoLock lock(navi_service_status_lock_);
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
+
if (navi_service_status_.end() == it ||
- (!it->second.first && !it->second.second)) {
+ (protocol_handler::ServiceType::kAudio == service_type &&
+ !it->second.is_audio_service_active_) ||
+ (protocol_handler::ServiceType::kMobileNav == service_type &&
+ !it->second.is_video_service_active_)) {
unregister = true;
}
}
@@ -3585,13 +3647,11 @@ void ApplicationManagerImpl::ForbidStreaming(
return;
}
- EndNaviServices(app_id);
+ EndService(app_id, service_type);
}
void ApplicationManagerImpl::OnAppStreaming(
- uint32_t app_id,
- protocol_handler::ServiceType service_type,
- const Application::StreamingState new_state) {
+ uint32_t app_id, protocol_handler::ServiceType service_type, bool state) {
SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application(app_id);
@@ -3602,35 +3662,17 @@ void ApplicationManagerImpl::OnAppStreaming(
}
DCHECK_OR_RETURN_VOID(media_manager_);
- SDL_LOG_DEBUG("New state for service " << static_cast<int32_t>(service_type)
- << " is "
- << static_cast<int32_t>(new_state));
- switch (new_state) {
- case Application::StreamingState::kStopped: {
- // Stop activity in media_manager_ when service is stopped
- // State controller has been already notified by kSuspended event
- // received before
- media_manager_->StopStreaming(app_id, service_type);
- break;
- }
-
- case Application::StreamingState::kStarted: {
- // Apply temporary streaming state and start activity in media_manager_
- state_ctrl_.OnVideoStreamingStarted(app);
- media_manager_->StartStreaming(app_id, service_type);
- break;
- }
-
- case Application::StreamingState::kSuspended: {
- // Don't stop activity in media_manager_ in that case
- // Just cancel the temporary streaming state
- state_ctrl_.OnVideoStreamingStopped(app);
- break;
- }
+ if (state) {
+ state_ctrl_.OnVideoStreamingStarted(app);
+ media_manager_->StartStreaming(app_id, service_type);
+ } else {
+ media_manager_->StopStreaming(app_id, service_type);
+ state_ctrl_.OnVideoStreamingStopped(app);
}
}
-void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
+void ApplicationManagerImpl::EndService(
+ const uint32_t app_id, const protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
@@ -3643,6 +3685,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
bool end_video = false;
bool end_audio = false;
+
{
sync_primitives::AutoLock lock(navi_service_status_lock_);
@@ -3651,8 +3694,11 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
SDL_LOG_ERROR("No info about navi servicies for app");
return;
}
- end_video = it->second.first;
- end_audio = it->second.second;
+
+ end_video = service_type == ServiceType::kMobileNav &&
+ it->second.is_video_service_active_;
+ end_audio = service_type == ServiceType::kAudio &&
+ it->second.is_audio_service_active_;
}
if (connection_handler_) {
@@ -3666,25 +3712,41 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
connection_handler().SendEndService(app_id, ServiceType::kAudio);
app->StopStreamingForce(ServiceType::kAudio);
}
+ }
- DisallowStreaming(app_id);
+ DisallowStreaming(app_id, service_type);
- {
- sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- navi_app_to_stop_.push_back(app_id);
- }
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- TimerSPtr close_timer(std::make_shared<timer::Timer>(
- "CloseNaviAppTimer",
- new TimerTaskImpl<ApplicationManagerImpl>(
- this, &ApplicationManagerImpl::CloseNaviApp)));
- close_timer->Start(navi_close_app_timeout_, timer::kSingleShot);
+ auto it = std::find_if(
+ navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ [&app_id, &service_type](const NaviServiceDescriptor& desc) {
+ return app_id == desc.app_id_ && service_type == desc.service_type_;
+ });
- sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
- close_app_timer_pool_.push_back(close_timer);
+ if (navi_app_to_stop_.end() == it) {
+ TimerSPtr close_timer(std::make_shared<timer::Timer>(
+ "CloseNaviAppTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this, &ApplicationManagerImpl::CloseNaviApp)));
+ NaviServiceDescriptor descriptor({app_id, service_type, close_timer});
+ navi_app_to_stop_.push_back(descriptor);
+
+ close_timer->Start(navi_close_app_timeout_, timer::kSingleShot);
+ }
}
}
+void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
+ using namespace protocol_handler;
+ SDL_LOG_AUTO_TRACE();
+
+ EndService(app_id, ServiceType::kAudio);
+ EndService(app_id, ServiceType::kMobileNav);
+}
+
void ApplicationManagerImpl::OnHMIStateChanged(const uint32_t app_id,
const HmiStatePtr from,
const HmiStatePtr to) {
@@ -3817,7 +3879,8 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
<< std::boolalpha << end_streaming_by_streaming_state
<< "; by hmi level: " << std::boolalpha
<< start_timer_by_hmi_level);
- StartEndStreamTimer(app_id);
+ StartEndStreamTimer(app_id, protocol_handler::ServiceType::kAudio);
+ StartEndStreamTimer(app_id, protocol_handler::ServiceType::kMobileNav);
return;
}
@@ -3898,38 +3961,32 @@ bool ApplicationManagerImpl::ResetVrHelpTitleItems(
return true;
}
-void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) {
+void ApplicationManagerImpl::ClearTimerPool() {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(streaming_timer_pool_lock_);
+ streaming_timer_pool_.clear();
+}
+
+void ApplicationManagerImpl::StartEndStreamTimer(
+ const uint32_t app_id, const protocol_handler::ServiceType service_type) {
SDL_LOG_DEBUG("Start end stream timer for app " << app_id);
- navi_app_to_end_stream_.push_back(app_id);
- TimerSPtr end_stream_timer(std::make_shared<timer::Timer>(
- "DisallowAppStreamTimer",
- new TimerTaskImpl<ApplicationManagerImpl>(
- this, &ApplicationManagerImpl::EndNaviStreaming)));
- end_stream_timer->Start(navi_end_stream_timeout_, timer::kSingleShot);
- sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
- end_stream_timer_pool_.push_back(end_stream_timer);
-}
+ if (helpers::
+ Compare<protocol_handler::ServiceType, helpers::EQ, helpers::ONE>(
+ service_type,
+ protocol_handler::ServiceType::kAudio,
+ protocol_handler::ServiceType::kMobileNav)) {
+ TimerSPtr end_stream_timer = std::make_shared<timer::Timer>(
+ "DisallowAppStreamTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this, &ApplicationManagerImpl::EndStreaming));
-void ApplicationManagerImpl::ClearTimerPool() {
- SDL_LOG_AUTO_TRACE();
- {
- sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
+ sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_);
- close_app_timer_pool_.erase(
- std::remove_if(close_app_timer_pool_.begin(),
- close_app_timer_pool_.end(),
- [](TimerSPtr timer) { return !timer->is_running(); }),
- close_app_timer_pool_.end());
- }
+ NaviServiceDescriptor descriptor({app_id, service_type, end_stream_timer});
+ navi_app_to_end_stream_.push_back(descriptor);
- {
- sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
- end_stream_timer_pool_.erase(
- std::remove_if(end_stream_timer_pool_.begin(),
- end_stream_timer_pool_.end(),
- [](TimerSPtr timer) { return !timer->is_running(); }),
- end_stream_timer_pool_.end());
+ end_stream_timer->Start(navi_end_stream_timeout_, timer::kSingleShot);
}
}
@@ -3937,58 +3994,88 @@ void ApplicationManagerImpl::CloseNaviApp() {
SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
- uint32_t app_id;
+ NaviServiceDescriptor descriptor(
+ {0, protocol_handler::ServiceType::kInvalidServiceType, nullptr});
{
sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
DCHECK_OR_RETURN_VOID(!navi_app_to_stop_.empty());
- app_id = navi_app_to_stop_.front();
+ descriptor = navi_app_to_stop_.front();
navi_app_to_stop_.pop_front();
}
- bool unregister = false;
- {
- sync_primitives::AutoLock lock(navi_service_status_lock_);
+ if (descriptor.app_id_ > 0) {
+ {
+ sync_primitives::AutoLock lock(navi_service_status_lock_);
- NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
- if (navi_service_status_.end() != it) {
- if (it->second.first || it->second.second) {
- unregister = true;
- navi_service_status_.erase(it);
+ NaviServiceStatusMap::iterator it =
+ navi_service_status_.find(descriptor.app_id_);
+ if (navi_service_status_.end() != it) {
+ if (protocol_handler::ServiceType::kMobileNav ==
+ descriptor.service_type_ &&
+ it->second.is_video_service_active_) {
+ it->second.is_video_service_active_ = false;
+ }
+
+ if (protocol_handler::ServiceType::kAudio == descriptor.service_type_ &&
+ it->second.is_audio_service_active_) {
+ it->second.is_audio_service_active_ = false;
+ }
+
+ if (!it->second.is_audio_service_active_ &&
+ !it->second.is_video_service_active_) {
+ navi_service_status_.erase(it);
+ }
}
}
- }
- if (unregister) {
- SDL_LOG_INFO("App haven't answered for EndService. Unregister it.");
- rpc_service_->ManageMobileCommand(
- MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
- app_id, PROTOCOL_VIOLATION),
- commands::Command::SOURCE_SDL);
- UnregisterApplication(app_id, ABORTED);
+
+ {
+ sync_primitives::AutoLock lock(streaming_timer_pool_lock_);
+ streaming_timer_pool_.push_back(descriptor.timer_to_stop_service_);
+ }
}
}
-void ApplicationManagerImpl::EndNaviStreaming() {
+void ApplicationManagerImpl::EndStreaming() {
SDL_LOG_AUTO_TRACE();
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
+ using namespace protocol_handler;
- if (!navi_app_to_end_stream_.empty()) {
- const uint32_t app_id = navi_app_to_end_stream_.front();
+ NaviServiceDescriptor descriptor(
+ {0, protocol_handler::ServiceType::kInvalidServiceType, nullptr});
+ {
+ sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_);
+ DCHECK_OR_RETURN_VOID(!navi_app_to_end_stream_.empty());
+ descriptor = navi_app_to_end_stream_.front();
navi_app_to_end_stream_.pop_front();
+ }
+ if (descriptor.app_id_ > 0) {
{
sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
- if (navi_app_to_stop_.end() == std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(),
- app_id)) {
- DisallowStreaming(app_id);
+ auto it =
+ std::find_if(navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ [&descriptor](const NaviServiceDescriptor& desc) {
+ return descriptor.app_id_ == desc.app_id_ &&
+ descriptor.service_type_ == desc.service_type_;
+ });
+
+ if (navi_app_to_stop_.end() == it) {
+ DisallowStreaming(descriptor.app_id_, descriptor.service_type_);
}
}
+
+ {
+ sync_primitives::AutoLock lock(streaming_timer_pool_lock_);
+ streaming_timer_pool_.push_back(descriptor.timer_to_stop_service_);
+ }
}
}
-void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) {
+void ApplicationManagerImpl::DisallowStreaming(
+ const uint32_t app_id, const protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
SDL_LOG_AUTO_TRACE();
@@ -4003,10 +4090,12 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) {
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
- if (it->second.first) {
+ if (it->second.is_video_service_active_ &&
+ service_type == ServiceType::kMobileNav) {
app->set_video_streaming_allowed(false);
}
- if (it->second.second) {
+ if (it->second.is_audio_service_active_ &&
+ service_type == ServiceType::kAudio) {
app->set_audio_streaming_allowed(false);
}
}
@@ -4028,10 +4117,10 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) {
NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
- if (it->second.first) {
+ if (it->second.is_video_service_active_) {
app->set_video_streaming_allowed(true);
}
- if (it->second.second) {
+ if (it->second.is_audio_service_active_) {
app->set_audio_streaming_allowed(true);
}
}
@@ -4138,7 +4227,17 @@ bool ApplicationManagerImpl::IsHMICooperating() const {
}
void ApplicationManagerImpl::SetHMICooperating(const bool hmi_cooperating) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(wait_for_hmi_lock_);
hmi_cooperating_ = hmi_cooperating;
+ wait_for_hmi_condvar_.Broadcast();
+}
+
+void ApplicationManagerImpl::InitiateStopping() {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(wait_for_hmi_lock_);
+ is_stopping_.store(true);
+ wait_for_hmi_condvar_.Broadcast();
}
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
@@ -4272,6 +4371,10 @@ ResetGlobalPropertiesResult ApplicationManagerImpl::ResetGlobalProperties(
result.keyboard_properties = true;
break;
}
+ case mobile_apis::GlobalProperty::USER_LOCATION: {
+ result.user_location = true;
+ break;
+ }
default: {
SDL_LOG_TRACE("Unknown global property: " << global_property);
break;
@@ -4322,7 +4425,9 @@ ApplicationManagerImpl::CreateAllAppGlobalPropsIDList(
if (application->keyboard_props()) {
(*global_properties)[i++] = GlobalProperty::KEYBOARDPROPERTIES;
}
-
+ if (!application->get_user_location().empty()) {
+ (*global_properties)[i++] = GlobalProperty::USER_LOCATION;
+ }
return global_properties;
}
@@ -4394,8 +4499,17 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
}
if (flag_diffirence_app_hmi_type) {
- (*it)->set_app_types(transform_app_hmi_types);
- (*it)->ChangeSupportingAppHMIType();
+ ApplicationSharedPtr app = *it;
+
+ app->set_app_types(transform_app_hmi_types);
+ app->ChangeSupportingAppHMIType();
+
+ auto on_app_hmi_types_changed = [app](
+ plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kAppHmiTypesChanged, app);
+ };
+ ApplyFunctorForEachPlugin(on_app_hmi_types_changed);
+
const mobile_apis::HMILevel::eType app_hmi_level =
(*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) {
@@ -4636,9 +4750,6 @@ void ApplicationManagerImpl::AddAppToRegisteredAppList(
SDL_LOG_AUTO_TRACE();
DCHECK_OR_RETURN_VOID(application);
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
-
- // Add application to registered app list and set appropriate mark.
- application->MarkRegistered();
applications_.insert(application);
SDL_LOG_DEBUG("App with app_id: "
<< application->app_id()
@@ -4731,42 +4842,69 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
return IsAppSubscribedForWayPoints(app.app_id());
}
-void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id) {
+void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
SDL_LOG_DEBUG("Subscribing " << app_id);
subscribed_way_points_apps_list_.insert(app_id);
+ if (response_from_hmi) {
+ subscribed_to_hmi_way_points_ = true;
+ }
SDL_LOG_DEBUG("There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
- if (way_points_data_) {
- smart_objects::SmartObjectSPtr way_point_notification_ =
- std::make_shared<smart_objects::SmartObject>(*way_points_data_);
- (*way_point_notification_)[strings::params][strings::connection_key] =
+ if (GetAppServiceManager().FindWayPointsHandler() != nullptr) {
+ auto service = GetAppServiceManager().ActiveServiceForType(
+ EnumToString(mobile_apis::AppServiceType::NAVIGATION));
+ auto it = mobile_way_points_data_.find(service->connection_key);
+ if (mobile_way_points_data_.end() == it) {
+ SDL_LOG_DEBUG("No waypoint data provided by app service provider yet");
+ return;
+ }
+ smart_objects::SmartObjectSPtr way_point_notification =
+ std::make_shared<smart_objects::SmartObject>(it->second);
+ (*way_point_notification)[strings::params][strings::connection_key] =
+ app_id;
+ GetRPCService().SendMessageToMobile(way_point_notification);
+ } else if (hmi_way_points_data_) {
+ smart_objects::SmartObjectSPtr way_point_notification =
+ std::make_shared<smart_objects::SmartObject>(*hmi_way_points_data_);
+ (*way_point_notification)[strings::params][strings::connection_key] =
app_id;
- GetRPCService().SendMessageToMobile(way_point_notification_);
+ GetRPCService().SendMessageToMobile(way_point_notification);
}
}
-void ApplicationManagerImpl::SubscribeAppForWayPoints(
- ApplicationSharedPtr app) {
- SubscribeAppForWayPoints(app->app_id());
+void ApplicationManagerImpl::SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi) {
+ SubscribeAppForWayPoints(app->app_id(), response_from_hmi);
}
-void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(uint32_t app_id) {
+void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
+ uint32_t app_id, bool response_from_hmi) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
SDL_LOG_DEBUG("Unsubscribing " << app_id);
subscribed_way_points_apps_list_.erase(app_id);
+ if (response_from_hmi) {
+ subscribed_to_hmi_way_points_ = false;
+ }
SDL_LOG_DEBUG("There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
if (subscribed_way_points_apps_list_.empty()) {
- way_points_data_.reset();
+ hmi_way_points_data_.reset();
+ mobile_way_points_data_.clear();
}
}
void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
- ApplicationSharedPtr app) {
- UnsubscribeAppFromWayPoints(app->app_id());
+ ApplicationSharedPtr app, bool response_from_hmi) {
+ UnsubscribeAppFromWayPoints(app->app_id(), response_from_hmi);
+}
+
+bool ApplicationManagerImpl::IsSubscribedToHMIWayPoints() const {
+ SDL_LOG_AUTO_TRACE();
+ return subscribed_to_hmi_way_points_;
}
bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
@@ -4778,9 +4916,17 @@ bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
}
void ApplicationManagerImpl::SaveWayPointsMessage(
- std::shared_ptr<smart_objects::SmartObject> way_points_message) {
+ std::shared_ptr<smart_objects::SmartObject> way_points_message,
+ uint32_t app_id) {
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- way_points_data_ = way_points_message;
+ // Notification from HMI
+ if (0 == app_id) {
+ hmi_way_points_data_ = way_points_message;
+ }
+ // Notification from app service provider
+ else {
+ mobile_way_points_data_[app_id] = *way_points_message;
+ }
}
const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
@@ -4896,6 +5042,23 @@ bool ApplicationManagerImpl::IsSOStructValid(
return false;
}
+bool ApplicationManagerImpl::UnsubscribeAppFromSoftButtons(
+ const commands::MessageSharedPtr response) {
+ using namespace mobile_apis;
+
+ const uint32_t connection_key =
+ (*response)[strings::params][strings::connection_key].asUInt();
+ const auto function_id = static_cast<mobile_apis::FunctionID::eType>(
+ (*response)[strings::params][strings::function_id].asInt());
+
+ ApplicationSharedPtr app = application(connection_key);
+ DCHECK_OR_RETURN(app, false);
+ app->UnsubscribeFromSoftButtons(function_id);
+ SDL_LOG_DEBUG("Application has unsubscribed from softbuttons. FunctionID: "
+ << function_id << ", app_id:" << app->app_id());
+ return true;
+}
+
#ifdef BUILD_TESTS
void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) {
applications_list_lock_ptr_->Acquire();
@@ -4994,4 +5157,52 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
}
}
+bool ApplicationManagerImpl::RetainRequestInstance(
+ const uint32_t connection_key, const uint32_t correlation_id) {
+ return request_ctrl_->RetainRequestInstance(connection_key, correlation_id);
+}
+
+bool ApplicationManagerImpl::RemoveRetainedRequest(
+ const uint32_t connection_key, const uint32_t correlation_id) {
+ return request_ctrl_->RemoveRetainedRequest(connection_key, correlation_id);
+}
+
+bool ApplicationManagerImpl::IsStillWaitingForResponse(
+ const uint32_t connection_key, const uint32_t correlation_id) const {
+ return request_ctrl_->IsStillWaitingForResponse(connection_key,
+ correlation_id);
+}
+
+void ApplicationManagerImpl::AddExpiredButtonRequest(
+ const uint32_t app_id,
+ const int32_t corr_id,
+ const hmi_apis::Common_ButtonName::eType button_name) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoLock lock(expired_button_requests_lock_);
+ expired_button_requests_[corr_id] = {app_id, button_name};
+}
+
+utils::Optional<ExpiredButtonRequestData>
+ApplicationManagerImpl::GetExpiredButtonRequestData(
+ const int32_t corr_id) const {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(expired_button_requests_lock_);
+
+ auto found_subscription = expired_button_requests_.find(corr_id);
+ if (found_subscription == expired_button_requests_.end()) {
+ return utils::Optional<ExpiredButtonRequestData>::EMPTY;
+ }
+
+ return utils::Optional<ExpiredButtonRequestData>(found_subscription->second);
+}
+
+void ApplicationManagerImpl::DeleteExpiredButtonRequest(const int32_t corr_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ sync_primitives::AutoLock lock(expired_button_requests_lock_);
+ auto found_subscription = expired_button_requests_.find(corr_id);
+ expired_button_requests_.erase(found_subscription);
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index 1ec4abaed7..ee43d32b0a 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -127,7 +127,7 @@ HmiStatePtr ApplicationState::GetState(const WindowID window_id,
SDL_LOG_DEBUG("Getting postponed state for window " << window_id);
return PostponedHmiState(window_id);
default:
- SDL_LOG_DEBUG("Getting current state for window " << window_id);
+ SDL_LOG_TRACE("Getting current state for window " << window_id);
return CurrentHmiState(window_id);
}
}
@@ -205,7 +205,12 @@ void ApplicationState::RemoveHMIState(const WindowID window_id,
void ApplicationState::EraseHMIState(HmiStates& hmi_states,
HmiStates::iterator it) {
if (hmi_states.begin() == it) {
- (*it)->set_parent(nullptr);
+ HmiStates::iterator next = it;
+ ++next;
+ if (hmi_states.end() != next) {
+ HmiStatePtr next_state = *next;
+ next_state->set_parent(nullptr);
+ }
} else {
HmiStates::iterator next = it;
HmiStates::iterator prev = it;
diff --git a/src/components/application_manager/src/commands/button_notification_to_mobile.cc b/src/components/application_manager/src/commands/button_notification_to_mobile.cc
new file mode 100644
index 0000000000..a94f4ef6ab
--- /dev/null
+++ b/src/components/application_manager/src/commands/button_notification_to_mobile.cc
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2021, 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/button_notification_to_mobile.h"
+#include "interfaces/MOBILE_API.h"
+namespace application_manager {
+
+namespace commands {
+namespace app_mngr = application_manager;
+
+SDL_CREATE_LOG_VARIABLE("ButtonNotificationToMobile")
+
+ButtonNotificationToMobile::ButtonNotificationToMobile(
+ 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) {}
+
+ButtonNotificationToMobile::~ButtonNotificationToMobile() {}
+
+bool ButtonNotificationToMobile::DoesParamExist(
+ const std::string& param_name) const {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager::strings;
+ return (*message_)[msg_params].keyExists(param_name);
+}
+
+void ButtonNotificationToMobile::HandleCustomButton(
+ app_mngr::ApplicationSharedPtr app) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager::strings;
+
+ if (!app) {
+ SDL_LOG_ERROR("Application doesn't exist.");
+ return;
+ }
+
+ // custom_button_id is mandatory for CUSTOM_BUTTON notification
+ if (!DoesParamExist(hmi_response::custom_button_id)) {
+ SDL_LOG_ERROR(
+ "CUSTOM_BUTTON mobile notification without custom_button_id.");
+ return;
+ }
+
+ if (!app->IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON)) {
+ SDL_LOG_ERROR("Application " << app->app_id()
+ << " is not subscribed on custom buttons");
+ return;
+ }
+
+ const uint32_t custom_btn_id =
+ (*message_)[msg_params][hmi_response::custom_button_id].asUInt();
+
+ if (!app->IsSubscribedToSoftButton(custom_btn_id)) {
+ SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id.");
+ return;
+ }
+
+ const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
+ (*message_)[strings::msg_params][strings::window_id] = window_id;
+
+ if (mobile_api::HMILevel::HMI_NONE == app->hmi_level(window_id)) {
+ SDL_LOG_WARN("CUSTOM_BUTTON mobile notification is allowed only "
+ << "in FULL, LIMITED or BACKGROUND hmi level");
+ return;
+ }
+
+ SendButtonNotification(app);
+ return;
+}
+
+void ButtonNotificationToMobile::HandleOKButton(
+ app_mngr::ApplicationSharedPtr app) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+ SDL_LOG_DEBUG("OK button received");
+
+ if (app) {
+ const auto btn_id = static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (app->IsSubscribedToButton(btn_id)) {
+ SendButtonNotification(app);
+ } else {
+ SDL_LOG_ERROR("Application " << app->app_id()
+ << " is not subscribed to button "
+ << btn_id);
+ }
+
+ return;
+ }
+
+ const auto subscribed_apps = SubscribedApps();
+ const auto app_ptr =
+ std::find_if(subscribed_apps.begin(),
+ subscribed_apps.end(),
+ [](const ApplicationSharedPtr subscribed_app) {
+ return subscribed_app->IsFullscreen();
+ });
+
+ if (app_ptr != subscribed_apps.end()) {
+ SDL_LOG_DEBUG("Sending button press for app in FULL with app id: "
+ << (*app_ptr)->app_id());
+ SendButtonNotification(*app_ptr);
+ } else {
+ SDL_LOG_ERROR("No application found");
+ }
+}
+
+std::vector<ApplicationSharedPtr> ButtonNotificationToMobile::SubscribedApps()
+ const {
+ const uint32_t btn_id = static_cast<uint32_t>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+ return application_manager_.applications_by_button(btn_id);
+}
+
+void ButtonNotificationToMobile::HandleMediaButton(
+ app_mngr::ApplicationSharedPtr app) {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager;
+
+ if (app) {
+ const auto btn_id = static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (app->IsSubscribedToButton(btn_id)) {
+ SendButtonNotification(app);
+ } else {
+ SDL_LOG_ERROR("Application " << app->app_id()
+ << " is not subscribed to button "
+ << btn_id);
+ }
+
+ return;
+ }
+
+ const auto subscribed_apps = SubscribedApps();
+ const auto app_ptr =
+ std::find_if(subscribed_apps.begin(),
+ subscribed_apps.end(),
+ [](const ApplicationSharedPtr subscribed_app) {
+ return helpers::Compare<mobile_api::HMILevel::eType,
+ helpers::EQ,
+ helpers::ONE>(
+ subscribed_app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
+ mobile_api::HMILevel::HMI_FULL,
+ mobile_api::HMILevel::HMI_LIMITED);
+ });
+
+ if (app_ptr != subscribed_apps.end()) {
+ SendButtonNotification(*app_ptr);
+ } else {
+ SDL_LOG_ERROR("No application found");
+ }
+}
+
+void ButtonNotificationToMobile::Run() {
+ SDL_LOG_AUTO_TRACE();
+ using namespace application_manager::strings;
+
+ const uint32_t btn_id = static_cast<uint32_t>(
+ (*message_)[msg_params][hmi_response::button_name].asInt());
+
+ SDL_LOG_DEBUG("Received button id: " << btn_id);
+
+ ApplicationSharedPtr app;
+
+ if (DoesParamExist(strings::app_id)) {
+ app = application_manager_.application(
+ (*message_)[msg_params][app_id].asUInt());
+ }
+
+ if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
+ HandleCustomButton(app);
+ } else if (static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) {
+ HandleOKButton(app);
+ } else {
+ HandleMediaButton(app);
+ }
+}
+
+} // namespace commands
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 47659e52ca..8eb7171274 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -39,18 +39,56 @@
namespace application_manager {
namespace {
-struct AppExtensionPredicate {
- AppExtensionUID uid;
- bool operator()(const ApplicationSharedPtr app) {
- return app ? (app->QueryInterface(uid).use_count() != 0) : false;
+
+/**
+ * @brief Functor for build info string
+ */
+struct InfoAppender {
+ explicit InfoAppender(std::string& info) : info_(info) {}
+
+ void operator()(const RPCParams::value_type& parameter) {
+ if (info_.empty()) {
+ info_ = "\'" + parameter + "\'";
+ return;
+ }
+
+ info_ = info_ + ", \'" + parameter + "\'";
}
+
+ private:
+ std::string& info_;
};
+
} // namespace
namespace commands {
SDL_CREATE_LOG_VARIABLE("Commands")
+bool IsMobileResultSuccess(const mobile_apis::Result::eType result_code) {
+ 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,
+ mobile_apis::Result::TRUNCATED_DATA);
+}
+
+bool IsHMIResultSuccess(const hmi_apis::Common_Result::eType result_code) {
+ using namespace helpers;
+ return 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,
+ hmi_apis::Common_Result::TRUNCATED_DATA);
+}
+
const int32_t CommandImpl::hmi_protocol_type_ = 1;
const int32_t CommandImpl::mobile_protocol_type_ = 0;
const int32_t CommandImpl::protocol_version_ = 3;
@@ -61,7 +99,9 @@ CommandImpl::CommandImpl(const MessageSharedPtr& message,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
: message_(message)
- , default_timeout_(application_manager.get_settings().default_timeout())
+ , default_timeout_(
+ application_manager.get_settings().default_timeout() +
+ application_manager.get_settings().default_timeout_compensation())
, allowed_to_terminate_(true)
, application_manager_(application_manager)
, rpc_service_(rpc_service)
@@ -86,6 +126,8 @@ bool CommandImpl::CleanUp() {
void CommandImpl::Run() {}
+void CommandImpl::OnUpdateTimeOut() {}
+
uint32_t CommandImpl::default_timeout() const {
return default_timeout_;
}
@@ -111,6 +153,8 @@ uint32_t CommandImpl::connection_key() const {
return (*message_)[strings::params][strings::connection_key].asUInt();
}
+void CommandImpl::HandleTimeOut() {}
+
void CommandImpl::set_warning_info(const std::string info) {
warning_info_ = info;
}
@@ -119,8 +163,6 @@ std::string CommandImpl::warning_info() const {
return warning_info_;
}
-void CommandImpl::onTimeOut() {}
-
bool CommandImpl::AllowedToTerminate() {
return allowed_to_terminate_;
}
@@ -139,6 +181,12 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
"There is no registered application with "
"connection key '"
<< connection_key() << "'");
+
+ rpc_service_.SendMessageToMobile(MessageHelper::CreateNegativeResponse(
+ connection_key(),
+ function_id(),
+ correlation_id(),
+ mobile_apis::Result::APPLICATION_NOT_REGISTERED));
return false;
}
@@ -179,6 +227,25 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
check_result,
correlation_id(),
app->app_id());
+
+ if (!params.empty()) {
+ if (parameters_permissions_.AreDisallowedParamsIncluded(params)) {
+ const std::string info = "RPC is disallowed by the user";
+ SDL_LOG_DEBUG(info);
+ (*response)[strings::msg_params][strings::info] = info;
+ AddDisallowedParameters(*response);
+ } else if (parameters_permissions_.AreUndefinedParamsIncluded(params)) {
+ const std::string info =
+ "Requested parameters are disallowed by Policies";
+
+ SDL_LOG_DEBUG(info);
+ (*response)[strings::msg_params][strings::info] = info;
+ AddDisallowedParameters(*response);
+ } else {
+ FormatResponse(*response);
+ }
+ }
+
rpc_service_.SendMessageToMobile(response);
}
@@ -198,6 +265,143 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
return true;
}
+struct DisallowedParamsInserter {
+ DisallowedParamsInserter(smart_objects::SmartObject& response,
+ mobile_apis::VehicleDataResultCode::eType code)
+ : response_(response), code_(code) {}
+
+ bool operator()(const std::string& param) {
+ smart_objects::SmartObjectSPtr disallowed_param =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ auto rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto vehicle_data = rpc_spec_vehicle_data.find(param);
+ auto vehicle_data_type =
+ vehicle_data == rpc_spec_vehicle_data.end()
+ ? mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA
+ : vehicle_data->second;
+
+ (*disallowed_param)[strings::data_type] = vehicle_data_type;
+ (*disallowed_param)[strings::result_code] = code_;
+ response_[strings::msg_params][param.c_str()] = *disallowed_param;
+ return true;
+ }
+
+ private:
+ smart_objects::SmartObject& response_;
+ mobile_apis::VehicleDataResultCode::eType code_;
+};
+
+void CommandImpl::AddDisallowedParameters(
+ smart_objects::SmartObject& response) {
+ const mobile_apis::FunctionID::eType id =
+ static_cast<mobile_apis::FunctionID::eType>(function_id());
+
+ if (!helpers::
+ Compare<mobile_apis::FunctionID::eType, helpers::EQ, helpers::ONE>(
+ id,
+ mobile_apis::FunctionID::SubscribeVehicleDataID,
+ mobile_apis::FunctionID::UnsubscribeVehicleDataID)) {
+ SDL_LOG_INFO("The function id: " << id << " is not supported.");
+ return;
+ }
+
+ DisallowedParamsInserter disallowed_inserter(
+ response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
+ std::for_each(removed_parameters_permissions_.disallowed_params.begin(),
+ removed_parameters_permissions_.disallowed_params.end(),
+ disallowed_inserter);
+
+ DisallowedParamsInserter undefined_inserter(
+ response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
+ std::for_each(removed_parameters_permissions_.undefined_params.begin(),
+ removed_parameters_permissions_.undefined_params.end(),
+ undefined_inserter);
+}
+
+void CommandImpl::AddDisallowedParameterToInfoString(
+ std::string& info, const std::string& param) const {
+ // prepare disallowed params enumeration for response info string
+ if (info.empty()) {
+ info = "\'" + param + "\'";
+ } else {
+ info = info + "," + " " + "\'" + param + "\'";
+ }
+}
+
+void CommandImpl::AddDisallowedParametersToInfo(
+ smart_objects::SmartObject& response) const {
+ SDL_LOG_AUTO_TRACE();
+ const mobile_apis::FunctionID::eType id =
+ static_cast<mobile_apis::FunctionID::eType>(function_id());
+
+ if (!helpers::
+ Compare<mobile_apis::FunctionID::eType, helpers::EQ, helpers::ONE>(
+ id,
+ mobile_apis::FunctionID::SubscribeVehicleDataID,
+ mobile_apis::FunctionID::UnsubscribeVehicleDataID,
+ mobile_apis::FunctionID::GetVehicleDataID,
+ mobile_apis::FunctionID::SendLocationID)) {
+ SDL_LOG_INFO("The function id: " << id << " is not supported.");
+ return;
+ }
+
+ std::string disallowed_by_user_info;
+ InfoAppender user_info_appender(disallowed_by_user_info);
+
+ std::for_each(removed_parameters_permissions_.disallowed_params.begin(),
+ removed_parameters_permissions_.disallowed_params.end(),
+ user_info_appender);
+
+ const size_t min_number_of_disallowed_params = 1;
+ if (!disallowed_by_user_info.empty()) {
+ disallowed_by_user_info +=
+ min_number_of_disallowed_params <
+ removed_parameters_permissions_.disallowed_params.size()
+ ? " are"
+ : " is";
+ disallowed_by_user_info += " disallowed by user";
+ }
+
+ std::string disallowed_by_policy_info;
+ InfoAppender policy_info_appender(disallowed_by_policy_info);
+
+ std::for_each(removed_parameters_permissions_.undefined_params.begin(),
+ removed_parameters_permissions_.undefined_params.end(),
+ policy_info_appender);
+
+ const size_t min_number_of_undefined_params = 1;
+ if (!disallowed_by_policy_info.empty()) {
+ disallowed_by_policy_info +=
+ min_number_of_undefined_params <
+ removed_parameters_permissions_.undefined_params.size()
+ ? " are"
+ : " is";
+ disallowed_by_policy_info += " disallowed by policies";
+ }
+
+ if (disallowed_by_user_info.empty() && disallowed_by_policy_info.empty()) {
+ SDL_LOG_INFO("There are not disallowed by user or by policy parameters.");
+ return;
+ }
+
+ smart_objects::SmartObject& info =
+ response[strings::msg_params][strings::info];
+
+ std::string summary;
+ if (!disallowed_by_policy_info.empty()) {
+ summary += disallowed_by_policy_info;
+ }
+
+ if (!disallowed_by_user_info.empty()) {
+ summary = summary.empty() ? disallowed_by_user_info
+ : summary + ", " + disallowed_by_user_info;
+ }
+
+ info = info.asString().empty() ? summary : info.asString() + " " + summary;
+}
+
void CommandImpl::RemoveDisallowedParameters() {
SDL_LOG_AUTO_TRACE();
@@ -268,13 +472,20 @@ bool CommandImpl::ReplaceMobileWithHMIAppId(
}
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
return true;
}
+void CommandImpl::FormatResponse(smart_objects::SmartObject& response) {
+ AddDisallowedParametersToInfo(response);
+ AddDisallowedParameters(response);
+}
+
bool CommandImpl::ReplaceHMIWithMobileAppId(
ns_smart_device_link::ns_smart_objects::SmartObject& message) {
if (message.keyExists(strings::app_id)) {
@@ -312,7 +523,9 @@ bool CommandImpl::ReplaceHMIWithMobileAppId(
}
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
@@ -352,5 +565,19 @@ bool CommandImpl::CheckSyntax(const std::string& str,
return true;
}
+bool CommandImpl::IsHMIResultSuccess(
+ hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const {
+ SDL_LOG_AUTO_TRACE();
+ if (application_manager::commands::IsHMIResultSuccess(result_code)) {
+ return true;
+ }
+
+ const HmiInterfaces::InterfaceState state =
+ application_manager_.hmi_interfaces().GetInterfaceState(interface);
+ return hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code &&
+ HmiInterfaces::STATE_NOT_AVAILABLE != state;
+}
+
} // 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 08bf25de54..2929144883 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -30,171 +30,18 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
-#include <numeric>
-#include <string>
-#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/application_impl.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"
+#include "smart_objects/smart_object.h"
namespace application_manager {
-
namespace commands {
-SDL_CREATE_LOG_VARIABLE("Commands");
-
-std::string MergeInfos(const ResponseInfo& first_info,
- const std::string& first_str,
- const ResponseInfo& second_info,
- const std::string& second_str) {
- if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
- (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
- !second_str.empty()) {
- return second_str;
- }
-
- if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
- (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
- !first_str.empty()) {
- return first_str;
- }
-
- return MergeInfos(first_str, second_str);
-}
-
-std::string MergeInfos(const std::string& first, const std::string& second) {
- return first + ((!first.empty() && !second.empty()) ? ", " : "") + second;
-}
-
-std::string MergeInfos(const std::string& first,
- const std::string& second,
- const std::string& third) {
- std::string result = MergeInfos(first, second);
- return MergeInfos(result, third);
-}
-
-const std::string CreateInfoForUnsupportedResult(
- HmiInterfaces::InterfaceID interface) {
- switch (interface) {
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): {
- return "VR is not supported by system";
- }
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): {
- return "TTS is not supported by system";
- }
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): {
- return "UI is not supported by system";
- }
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): {
- return "Navigation is not supported by system";
- }
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): {
- return "VehicleInfo is not supported by system";
- }
- case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): {
- return "RC is not supported by system";
- }
- default:
- SDL_LOG_WARN(
- "Could not create info because"
- " interface isn't valid. Interface is:"
- << static_cast<int32_t>(interface));
- return "";
- }
-}
-
-bool CommandRequestImpl::CheckResult(const ResponseInfo& first,
- const ResponseInfo& second) const {
- if (first.is_ok && second.is_unsupported_resource) {
- return true;
- }
- if (first.is_ok && second.is_not_used) {
- return true;
- }
- if (first.is_ok && second.is_ok) {
- return true;
- }
- return false;
-}
-
-bool IsResultCodeWarning(const ResponseInfo& first,
- const ResponseInfo& second) {
- const bool first_is_ok_second_is_warn =
- (first.is_ok || first.is_not_used) &&
- hmi_apis::Common_Result::WARNINGS == second.result_code;
-
- const bool both_warnings =
- hmi_apis::Common_Result::WARNINGS == first.result_code &&
- hmi_apis::Common_Result::WARNINGS == second.result_code;
-
- return first_is_ok_second_is_warn || both_warnings;
-}
-
-struct DisallowedParamsInserter {
- DisallowedParamsInserter(smart_objects::SmartObject& response,
- mobile_apis::VehicleDataResultCode::eType code)
- : response_(response), code_(code) {}
-
- bool operator()(const std::string& param) {
- smart_objects::SmartObjectSPtr disallowed_param =
- std::make_shared<smart_objects::SmartObject>(
- smart_objects::SmartType_Map);
-
- auto rpc_spec_vehicle_data = MessageHelper::vehicle_data();
- auto vehicle_data = rpc_spec_vehicle_data.find(param);
- auto vehicle_data_type =
- vehicle_data == rpc_spec_vehicle_data.end()
- ? mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA
- : vehicle_data->second;
-
- (*disallowed_param)[strings::data_type] = vehicle_data_type;
- (*disallowed_param)[strings::result_code] = code_;
- response_[strings::msg_params][param.c_str()] = *disallowed_param;
- return true;
- }
-
- private:
- smart_objects::SmartObject& response_;
- mobile_apis::VehicleDataResultCode::eType code_;
-};
-
-ResponseInfo::ResponseInfo()
- : result_code(hmi_apis::Common_Result::INVALID_ENUM)
- , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM)
- , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
- , is_ok(false)
- , is_unsupported_resource(false)
- , is_not_used(false) {}
-
-ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result,
- const HmiInterfaces::InterfaceID hmi_interface,
- ApplicationManager& application_manager)
- : result_code(result)
- , interface(hmi_interface)
- , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
- , is_ok(false)
- , is_unsupported_resource(false)
- , is_not_used(false) {
- using namespace helpers;
-
- interface_state =
- application_manager.hmi_interfaces().GetInterfaceState(hmi_interface);
-
- is_ok = CommandRequestImpl::IsHMIResultSuccess(result_code);
-
- is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code;
-
- is_unsupported_resource =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code;
-}
+SDL_CREATE_LOG_VARIABLE("Commands")
CommandRequestImpl::CommandRequestImpl(
const MessageSharedPtr& message,
@@ -208,269 +55,25 @@ CommandRequestImpl::CommandRequestImpl(
hmi_capabilities,
policy_handler)
, EventObserver(application_manager.event_dispatcher())
- , current_state_(kAwaitingHMIResponse)
- , hash_update_mode_(kSkipHashUpdate)
- , is_success_result_(false) {}
+ , current_state_(RequestState::kAwaitingResponse) {}
CommandRequestImpl::~CommandRequestImpl() {
- UpdateHash();
-}
-
-bool CommandRequestImpl::Init() {
- return true;
-}
-
-bool CommandRequestImpl::CheckPermissions() {
- return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE);
-}
-
-bool CommandRequestImpl::CleanUp() {
- return true;
+ CleanUp();
}
void CommandRequestImpl::Run() {}
-void CommandRequestImpl::onTimeOut() {
- SDL_LOG_AUTO_TRACE();
-
- 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_);
- if (kCompleted == current_state_) {
- SDL_LOG_DEBUG("current_state_ = kCompleted");
- // don't send timeout if request completed
- return;
- }
-
- current_state_ = kTimedOut;
- }
-
- smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateNegativeResponse(connection_key(),
- function_id(),
- correlation_id(),
- mobile_api::Result::GENERIC_ERROR);
- AddTimeOutComponentInfoToMessage(*response);
- rpc_service_.ManageMobileCommand(response, SOURCE_SDL);
-}
-
-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 std::vector<uint8_t> binary_data) {
- SDL_LOG_AUTO_TRACE();
- {
- sync_primitives::AutoLock auto_lock(state_lock_);
- if (kTimedOut == current_state_) {
- // don't send response if request timeout expired
- return;
- }
-
- current_state_ = kCompleted;
- }
-
- smart_objects::SmartObjectSPtr result =
- std::make_shared<smart_objects::SmartObject>();
-
- smart_objects::SmartObject& response = *result;
-
- response[strings::params][strings::message_type] = MessageType::kResponse;
- response[strings::params][strings::correlation_id] = correlation_id();
- response[strings::params][strings::protocol_type] =
- CommandImpl::mobile_protocol_type_;
- response[strings::params][strings::protocol_version] =
- 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;
- }
-
- if (info && *info != '\0') {
- response[strings::msg_params][strings::info] = std::string(info);
- }
-
- // Add disallowed parameters and info from request back to response with
- // appropriate reasons (VehicleData result codes)
- if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED &&
- result_code != mobile_apis::Result::INVALID_DATA) {
- const mobile_apis::FunctionID::eType& id =
- static_cast<mobile_apis::FunctionID::eType>(function_id());
- if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) ||
- (id == mobile_apis::FunctionID::UnsubscribeVehicleDataID)) {
- AddDisallowedParameters(response);
- AddDisallowedParametersToInfo(response);
- } else if (id == mobile_apis::FunctionID::GetVehicleDataID) {
- AddDisallowedParametersToInfo(response);
- }
- }
-
- response[strings::msg_params][strings::success] = success;
- if ((result_code == mobile_apis::Result::SUCCESS ||
- result_code == mobile_apis::Result::WARNINGS) &&
- !warning_info().empty()) {
- response[strings::msg_params][strings::info] =
- (info && *info != '\0') ? std::string(info) + "\n" + warning_info()
- : warning_info();
- response[strings::msg_params][strings::result_code] =
- mobile_apis::Result::WARNINGS;
- } else {
- response[strings::msg_params][strings::result_code] = result_code;
- }
-
- is_success_result_ = success;
-
- rpc_service_.ManageMobileCommand(result, SOURCE_SDL);
-}
-
-smart_objects::SmartObject CreateUnsupportedResourceResponse(
- const hmi_apis::FunctionID::eType function_id,
- const uint32_t hmi_correlation_id,
- HmiInterfaces::InterfaceID interface) {
- smart_objects::SmartObject response(smart_objects::SmartType_Map);
- smart_objects::SmartObject& params = response[strings::params];
- params[strings::message_type] = MessageType::kResponse;
- params[strings::correlation_id] = hmi_correlation_id;
- params[strings::protocol_type] = CommandImpl::hmi_protocol_type_;
- params[strings::protocol_version] = CommandImpl::protocol_version_;
- params[strings::function_id] = function_id;
- params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- smart_objects::SmartObject& msg_params = response[strings::msg_params];
- msg_params[strings::info] = CreateInfoForUnsupportedResult(interface);
- return response;
-}
-
-bool CommandRequestImpl::ProcessHMIInterfacesAvailability(
- const uint32_t hmi_correlation_id,
- const hmi_apis::FunctionID::eType& function_id) {
- SDL_LOG_AUTO_TRACE();
- 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) {
- event_engine::Event event(function_id);
- event.set_smart_object(CreateUnsupportedResourceResponse(
- function_id, hmi_correlation_id, interface));
- event.raise(application_manager_.event_dispatcher());
- return false;
- }
- return true;
-}
-
-void CommandRequestImpl::UpdateHash() {
- SDL_LOG_AUTO_TRACE();
- if (hash_update_mode_ == kSkipHashUpdate) {
- SDL_LOG_DEBUG("Hash update is disabled for " << function_id());
- return;
- }
-
- if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE ==
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) {
- SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated.");
- return;
- }
-
- if (!is_success_result_) {
- SDL_LOG_WARN("Command is not succeeded. Hash won't be updated.");
- return;
- }
-
- ApplicationSharedPtr application =
- application_manager_.application(connection_key());
- if (!application) {
- SDL_LOG_ERROR("Application with connection key "
- << connection_key()
- << " not found. Not able to update hash.");
- return;
- }
-
- SDL_LOG_DEBUG(
- "Updating hash for application with connection key "
- << connection_key() << " while processing function id "
- << MessageHelper::StringifiedFunctionID(
- static_cast<mobile_api::FunctionID::eType>(function_id())));
-
- 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) {
+bool CommandRequestImpl::CheckAllowedParameters(
+ const Command::CommandSource source) {
SDL_LOG_AUTO_TRACE();
- 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) {
- SDL_LOG_DEBUG("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) {
- SDL_LOG_DEBUG("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;
+ // RegisterAppInterface should always be allowed
+ if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
+ static_cast<mobile_apis::FunctionID::eType>(function_id())) {
+ return true;
}
- 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);
+ return CommandImpl::CheckAllowedParameters(source);
}
void CommandRequestImpl::SendMobileRequest(
@@ -495,389 +98,91 @@ void CommandRequestImpl::SendMobileRequest(
}
}
-uint32_t CommandRequestImpl::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_version] =
- CommandImpl::protocol_version_;
- request[strings::params][strings::protocol_type] =
- CommandImpl::hmi_protocol_type_;
-
- if (msg_params) {
- request[strings::msg_params] = *msg_params;
- }
-
- if (use_events) {
- SDL_LOG_DEBUG("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, SOURCE_SDL_TO_HMI)) {
- SDL_LOG_ERROR("Unable to send request");
- SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
- }
- } else {
- SDL_LOG_DEBUG("Interface is not available");
- }
- return hmi_correlation_id;
-}
-
-void CommandRequestImpl::CreateHMINotification(
- const hmi_apis::FunctionID::eType& function_id,
- const ns_smart::SmartObject& msg_params) const {
- smart_objects::SmartObjectSPtr result =
- std::make_shared<smart_objects::SmartObject>();
- if (!result) {
- SDL_LOG_ERROR("Memory allocation failed.");
- return;
- }
- smart_objects::SmartObject& notify = *result;
-
- notify[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- notify[strings::params][strings::protocol_version] =
- CommandImpl::protocol_version_;
- notify[strings::params][strings::protocol_type] =
- CommandImpl::hmi_protocol_type_;
- notify[strings::params][strings::function_id] = function_id;
- notify[strings::msg_params] = msg_params;
-
- if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
- SDL_LOG_ERROR("Unable to send HMI notification");
- }
-}
-
-mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
- const hmi_apis::Common_Result::eType& hmi_code) const {
- mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR;
- switch (hmi_code) {
- case hmi_apis::Common_Result::SUCCESS: {
- mobile_result = mobile_apis::Result::SUCCESS;
- break;
- }
- case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: {
- mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST;
- break;
- }
- case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: {
- mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE;
- break;
- }
- case hmi_apis::Common_Result::DISALLOWED: {
- mobile_result = mobile_apis::Result::DISALLOWED;
- break;
- }
- case hmi_apis::Common_Result::REJECTED: {
- mobile_result = mobile_apis::Result::REJECTED;
- break;
- }
- case hmi_apis::Common_Result::ABORTED: {
- mobile_result = mobile_apis::Result::ABORTED;
- break;
- }
- case hmi_apis::Common_Result::IGNORED: {
- mobile_result = mobile_apis::Result::IGNORED;
- break;
- }
- case hmi_apis::Common_Result::RETRY: {
- mobile_result = mobile_apis::Result::RETRY;
- break;
- }
- case hmi_apis::Common_Result::IN_USE: {
- mobile_result = mobile_apis::Result::IN_USE;
- break;
- }
- case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: {
- mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE;
- break;
- }
- case hmi_apis::Common_Result::TIMED_OUT: {
- mobile_result = mobile_apis::Result::TIMED_OUT;
- break;
- }
- case hmi_apis::Common_Result::INVALID_DATA: {
- mobile_result = mobile_apis::Result::INVALID_DATA;
- break;
- }
- case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: {
- mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED;
- break;
- }
- case hmi_apis::Common_Result::INVALID_ID: {
- mobile_result = mobile_apis::Result::INVALID_ID;
- break;
- }
- case hmi_apis::Common_Result::DUPLICATE_NAME: {
- mobile_result = mobile_apis::Result::DUPLICATE_NAME;
- break;
- }
- case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: {
- mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
- break;
- }
- case hmi_apis::Common_Result::WRONG_LANGUAGE: {
- mobile_result = mobile_apis::Result::WRONG_LANGUAGE;
- break;
- }
- case hmi_apis::Common_Result::OUT_OF_MEMORY: {
- mobile_result = mobile_apis::Result::OUT_OF_MEMORY;
- break;
- }
- case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: {
- mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS;
- break;
- }
- case hmi_apis::Common_Result::NO_APPS_REGISTERED: {
- mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
- break;
- }
- case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: {
- mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
- break;
- }
- case hmi_apis::Common_Result::WARNINGS: {
- mobile_result = mobile_apis::Result::WARNINGS;
- break;
- }
- case hmi_apis::Common_Result::GENERIC_ERROR: {
- mobile_result = mobile_apis::Result::GENERIC_ERROR;
- break;
- }
- case hmi_apis::Common_Result::USER_DISALLOWED: {
- mobile_result = mobile_apis::Result::USER_DISALLOWED;
- break;
- }
- case hmi_apis::Common_Result::SAVED: {
- mobile_result = mobile_apis::Result::SAVED;
- break;
- }
- case hmi_apis::Common_Result::READ_ONLY: {
- mobile_result = mobile_apis::Result::READ_ONLY;
- break;
- }
- default: {
- SDL_LOG_ERROR("Unknown HMI result code " << hmi_code);
- break;
- }
- }
+void CommandRequestImpl::OnTimeOut() {}
- return mobile_result;
-}
+void CommandRequestImpl::on_event(const event_engine::Event&) {}
+void CommandRequestImpl::on_event(const event_engine::MobileEvent&) {}
-bool CommandRequestImpl::CheckAllowedParameters(
- const Command::CommandSource source) {
+void CommandRequestImpl::HandleTimeOut() {
SDL_LOG_AUTO_TRACE();
-
- // RegisterAppInterface should always be allowed
- if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
- static_cast<mobile_apis::FunctionID::eType>(function_id())) {
- return true;
+ {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ if (RequestState::kProcessEvent == current_state()) {
+ SDL_LOG_DEBUG("Current request state is: "
+ << current_state() << ". Timeout request ignored");
+ return;
+ }
+ set_current_state(RequestState::kTimedOut);
}
- return CommandImpl::CheckAllowedParameters(source);
+ OnTimeOut();
}
-bool CommandRequestImpl::CheckHMICapabilities(
- const mobile_apis::ButtonName::eType button) const {
+bool CommandRequestImpl::StartOnEventHandling() {
SDL_LOG_AUTO_TRACE();
- using namespace smart_objects;
- using namespace mobile_apis;
-
- if (!hmi_capabilities_.is_ui_cooperating()) {
- SDL_LOG_ERROR("UI is not supported by HMI");
- return false;
- }
-
- auto button_capabilities = hmi_capabilities_.button_capabilities();
- if (!button_capabilities) {
- SDL_LOG_ERROR("Invalid button capabilities object");
- return false;
- }
-
- for (size_t i = 0; i < button_capabilities->length(); ++i) {
- const SmartObject& capabilities = (*button_capabilities)[i];
- const ButtonName::eType current_button = static_cast<ButtonName::eType>(
- capabilities.getElement(hmi_response::button_name).asInt());
- if (current_button == button) {
- SDL_LOG_DEBUG("Button capabilities for " << button << " was found");
- return true;
+ {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ if (RequestState::kTimedOut == current_state()) {
+ SDL_LOG_DEBUG("current_state_ = kTimedOut");
+ return false;
}
+ set_current_state(RequestState::kProcessEvent);
}
- SDL_LOG_DEBUG("Button capabilities for " << button << " was not found");
- return false;
-}
-
-void CommandRequestImpl::AddDisallowedParameterToInfoString(
- std::string& info, const std::string& param) const {
- // prepare disallowed params enumeration for response info string
- if (info.empty()) {
- info = "\'" + param + "\'";
- } else {
- info = info + "," + " " + "\'" + param + "\'";
- }
+ return true;
}
-void CommandRequestImpl::AddDisallowedParametersToInfo(
- smart_objects::SmartObject& response) const {
- std::string info;
-
- RPCParams::const_iterator it =
- removed_parameters_permissions_.disallowed_params.begin();
- for (; it != removed_parameters_permissions_.disallowed_params.end(); ++it) {
- AddDisallowedParameterToInfoString(info, (*it));
- }
-
- it = removed_parameters_permissions_.undefined_params.begin();
- for (; it != removed_parameters_permissions_.undefined_params.end(); ++it) {
- AddDisallowedParameterToInfoString(info, (*it));
- }
-
- if (!info.empty()) {
- info += " disallowed by policies.";
+void CommandRequestImpl::FinalizeOnEventHandling() {
+ const auto conn_key = connection_key();
+ const auto corr_id = correlation_id();
- if (!response[strings::msg_params][strings::info].asString().empty()) {
- // If we already have info add info about disallowed params to it
- response[strings::msg_params][strings::info] =
- response[strings::msg_params][strings::info].asString() + " " + info;
- } else {
- response[strings::msg_params][strings::info] = info;
- }
+ if (application_manager_.IsStillWaitingForResponse(conn_key, corr_id)) {
+ SDL_LOG_DEBUG("Request (" << conn_key << ", " << corr_id
+ << ") is still waiting for repsonse");
+ set_current_state(RequestState::kAwaitingResponse);
}
}
-void CommandRequestImpl::AddDisallowedParameters(
- smart_objects::SmartObject& response) {
- DisallowedParamsInserter disallowed_inserter(
- response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
- std::for_each(removed_parameters_permissions_.disallowed_params.begin(),
- removed_parameters_permissions_.disallowed_params.end(),
- disallowed_inserter);
-
- DisallowedParamsInserter undefined_inserter(
- response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
- std::for_each(removed_parameters_permissions_.undefined_params.begin(),
- removed_parameters_permissions_.undefined_params.end(),
- undefined_inserter);
-}
-
-bool CommandRequestImpl::HasDisallowedParams() const {
- return ((!removed_parameters_permissions_.disallowed_params.empty()) ||
- (!removed_parameters_permissions_.undefined_params.empty()));
-}
-
-bool CommandRequestImpl::IsMobileResultSuccess(
- const mobile_apis::Result::eType result_code) {
+void CommandRequestImpl::HandleOnEvent(const event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
- 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,
- mobile_apis::Result::TRUNCATED_DATA);
-}
-bool CommandRequestImpl::IsHMIResultSuccess(
- const hmi_apis::Common_Result::eType result_code) {
- SDL_LOG_AUTO_TRACE();
- using namespace helpers;
- return 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,
- hmi_apis::Common_Result::TRUNCATED_DATA);
+ if (StartOnEventHandling()) {
+ on_event(event);
+ FinalizeOnEventHandling();
+ }
}
-bool CommandRequestImpl::PrepareResultForMobileResponse(
- hmi_apis::Common_Result::eType result_code,
- HmiInterfaces::InterfaceID interface) const {
+void CommandRequestImpl::HandleOnEvent(const event_engine::MobileEvent& event) {
SDL_LOG_AUTO_TRACE();
- if (IsHMIResultSuccess(result_code)) {
- 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;
+ if (StartOnEventHandling()) {
+ on_event(event);
+ FinalizeOnEventHandling();
}
- return false;
}
-bool CommandRequestImpl::PrepareResultForMobileResponse(
- ResponseInfo& out_first, ResponseInfo& out_second) const {
+bool CommandRequestImpl::IncrementReferenceCount() const {
SDL_LOG_AUTO_TRACE();
- bool result =
- CheckResult(out_first, out_second) || CheckResult(out_second, out_first);
- return result;
-}
-
-void CommandRequestImpl::GetInfo(
- const smart_objects::SmartObject& response_from_hmi,
- std::string& out_info) {
- if (response_from_hmi[strings::msg_params].keyExists(strings::info)) {
- if (!response_from_hmi[strings::msg_params][strings::info].empty()) {
- out_info =
- response_from_hmi[strings::msg_params][strings::info].asString();
- }
- }
+ const auto conn_key = connection_key();
+ const auto corr_id = correlation_id();
+ return application_manager_.RetainRequestInstance(conn_key, corr_id);
}
-mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse(
- const ResponseInfo& first, const ResponseInfo& second) {
+bool CommandRequestImpl::DecrementReferenceCount() const {
SDL_LOG_AUTO_TRACE();
- if (IsResultCodeUnsupported(first, second) ||
- IsResultCodeUnsupported(second, first)) {
- return mobile_apis::Result::UNSUPPORTED_RESOURCE;
- }
- if (IsResultCodeWarning(first, second) ||
- IsResultCodeWarning(second, first)) {
- return mobile_apis::Result::WARNINGS;
- }
- // If response contains erroneous result code SDL need return erroneus
- // result code.
- hmi_apis::Common_Result::eType first_result =
- hmi_apis::Common_Result::INVALID_ENUM;
- hmi_apis::Common_Result::eType second_result =
- hmi_apis::Common_Result::INVALID_ENUM;
- if (!first.is_unsupported_resource) {
- first_result = first.result_code;
- }
- if (!second.is_unsupported_resource) {
- second_result = second.result_code;
- }
- mobile_apis::Result::eType result_code =
- MessageHelper::HMIToMobileResult(std::max(first_result, second_result));
- return result_code;
+ const auto conn_key = connection_key();
+ const auto corr_id = correlation_id();
+ return application_manager_.RemoveRetainedRequest(conn_key, corr_id);
}
-const CommandParametersPermissions& CommandRequestImpl::parameters_permissions()
- const {
- return parameters_permissions_;
+void CommandRequestImpl::OnUpdateTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+ set_current_state(RequestState::kAwaitingResponse);
}
void CommandRequestImpl::StartAwaitForInterface(
- const HmiInterfaces::InterfaceID interface_id) {
+ const HmiInterfaces::InterfaceID& interface_id) {
sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
awaiting_response_interfaces_.insert(interface_id);
}
@@ -885,94 +190,31 @@ void CommandRequestImpl::StartAwaitForInterface(
bool CommandRequestImpl::IsInterfaceAwaited(
const HmiInterfaces::InterfaceID& interface_id) const {
sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
- std::set<HmiInterfaces::InterfaceID>::const_iterator it =
- awaiting_response_interfaces_.find(interface_id);
- return (it != awaiting_response_interfaces_.end());
+
+ return helpers::in_range(awaiting_response_interfaces_, interface_id);
}
void CommandRequestImpl::EndAwaitForInterface(
const HmiInterfaces::InterfaceID& interface_id) {
sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
- std::set<HmiInterfaces::InterfaceID>::const_iterator it =
- awaiting_response_interfaces_.find(interface_id);
- if (it != awaiting_response_interfaces_.end()) {
- awaiting_response_interfaces_.erase(it);
- } else {
- SDL_LOG_WARN(
- "EndAwaitForInterface called on interface \
- which was not put into await state: "
- << interface_id);
- }
+ awaiting_response_interfaces_.erase(interface_id);
}
-bool CommandRequestImpl::IsResultCodeUnsupported(
- const ResponseInfo& first, const ResponseInfo& second) const {
- const bool first_ok_second_unsupported =
- (first.is_ok || first.is_not_used) && second.is_unsupported_resource;
- const bool both_unsupported =
- first.is_unsupported_resource && second.is_unsupported_resource;
- return first_ok_second_unsupported || both_unsupported;
+bool CommandRequestImpl::IsPendingResponseExist() const {
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ return !awaiting_response_interfaces_.empty();
}
-std::string GetComponentNameFromInterface(
- const HmiInterfaces::InterfaceID& interface) {
- switch (interface) {
- case HmiInterfaces::HMI_INTERFACE_Buttons:
- return hmi_interface::buttons;
- case HmiInterfaces::HMI_INTERFACE_BasicCommunication:
- return hmi_interface::basic_communication;
- case HmiInterfaces::HMI_INTERFACE_VR:
- return hmi_interface::vr;
- case HmiInterfaces::HMI_INTERFACE_TTS:
- return hmi_interface::tts;
- case HmiInterfaces::HMI_INTERFACE_UI:
- return hmi_interface::ui;
- case HmiInterfaces::HMI_INTERFACE_Navigation:
- return hmi_interface::navigation;
- case HmiInterfaces::HMI_INTERFACE_VehicleInfo:
- return hmi_interface::vehicle_info;
- case HmiInterfaces::HMI_INTERFACE_SDL:
- return hmi_interface::sdl;
- case HmiInterfaces::HMI_INTERFACE_RC:
- return hmi_interface::rc;
- case HmiInterfaces::HMI_INTERFACE_AppService:
- return hmi_interface::app_service;
- default:
- return "Unknown type";
- }
+CommandRequestImpl::RequestState CommandRequestImpl::current_state() const {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ return current_state_;
}
-const std::string InfoInterfaceSeparator(
- const std::string& sum, const HmiInterfaces::InterfaceID container_value) {
- return sum.empty()
- ? GetComponentNameFromInterface(container_value)
- : sum + ", " + GetComponentNameFromInterface(container_value);
-}
-
-void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
- smart_objects::SmartObject& response) const {
- using ns_smart_device_link::ns_smart_objects::SmartObject;
- SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
- if (awaiting_response_interfaces_.empty()) {
- SDL_LOG_ERROR("No interfaces awaiting, info param is empty");
- return;
- }
-
- const std::string not_responding_interfaces_string =
- std::accumulate(awaiting_response_interfaces_.begin(),
- awaiting_response_interfaces_.end(),
- std::string(""),
- InfoInterfaceSeparator);
- SDL_LOG_DEBUG(
- "Not responding interfaces string: " << not_responding_interfaces_string);
- if (!not_responding_interfaces_string.empty()) {
- const std::string component_info =
- not_responding_interfaces_string + " component does not respond";
- response[strings::msg_params][strings::info] = component_info;
- }
+void CommandRequestImpl::set_current_state(
+ const CommandRequestImpl::RequestState state) {
+ sync_primitives::AutoLock auto_lock(state_lock_);
+ current_state_ = state;
}
} // 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 835df70202..5a2e9f0730 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -53,12 +53,11 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler)
- , EventObserver(application_manager.event_dispatcher()) {
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {
// Replace HMI app id with Mobile connection id
ReplaceHMIWithMobileAppId(*message);
}
@@ -79,6 +78,8 @@ void RequestFromHMI::on_event(const event_engine::Event& event) {}
void RequestFromHMI::on_event(const event_engine::MobileEvent& event) {}
+void RequestFromHMI::OnTimeOut() {}
+
void RequestFromHMI::SendResponse(
const bool success,
const uint32_t correlation_id,
@@ -143,43 +144,6 @@ void RequestFromHMI::FillCommonParametersOfSO(
(message)[strings::params][strings::correlation_id] = correlation_id;
}
-bool RequestFromHMI::IsMobileResultSuccess(
- mobile_apis::Result::eType result_code) const {
- SDL_LOG_AUTO_TRACE();
- 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 {
- SDL_LOG_AUTO_TRACE();
- 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,
@@ -214,7 +178,7 @@ void RequestFromHMI::SendProviderRequest(
if (hmi_destination) {
SDL_LOG_DEBUG("Sending Request to HMI Provider");
application_manager_.IncreaseForwardedRequestTimeout(
- application_manager::request_controller::RequestInfo::HmiConnectionKey,
+ application_manager::request_controller::RequestInfo::kHmiConnectionKey,
correlation_id());
SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
return;
@@ -232,7 +196,7 @@ void RequestFromHMI::SendProviderRequest(
SDL_LOG_DEBUG("Sending Request to Mobile Provider");
application_manager_.IncreaseForwardedRequestTimeout(
- application_manager::request_controller::RequestInfo::HmiConnectionKey,
+ application_manager::request_controller::RequestInfo::kHmiConnectionKey,
correlation_id());
SendMobileRequest(
mobile_function_id, app, &(*msg)[strings::msg_params], use_events);
diff --git a/src/components/application_manager/src/commands/request_from_mobile_impl.cc b/src/components/application_manager/src/commands/request_from_mobile_impl.cc
new file mode 100644
index 0000000000..42df13f034
--- /dev/null
+++ b/src/components/application_manager/src/commands/request_from_mobile_impl.cc
@@ -0,0 +1,906 @@
+/*
+ Copyright (c) 2020, 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/request_from_mobile_impl.h"
+
+#include <algorithm>
+#include <numeric>
+#include <string>
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "smart_objects/smart_object.h"
+#include "utils/helpers.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+SDL_CREATE_LOG_VARIABLE("Commands")
+
+namespace smart_objects = ns_smart_device_link::ns_smart_objects;
+
+std::string MergeInfos(const ResponseInfo& first_info,
+ const std::string& first_str,
+ const ResponseInfo& second_info,
+ const std::string& second_str) {
+ if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !second_str.empty()) {
+ return second_str;
+ }
+
+ if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !first_str.empty()) {
+ return first_str;
+ }
+
+ return MergeInfos(first_str, second_str);
+}
+
+std::string MergeInfos(const std::string& first, const std::string& second) {
+ return first + ((!first.empty() && !second.empty()) ? ", " : "") + second;
+}
+
+std::string MergeInfos(const std::string& first,
+ const std::string& second,
+ const std::string& third) {
+ std::string result = MergeInfos(first, second);
+ return MergeInfos(result, third);
+}
+
+const std::string CreateInfoForUnsupportedResult(
+ HmiInterfaces::InterfaceID interface) {
+ switch (interface) {
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): {
+ return "VR is not supported by system";
+ }
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): {
+ return "TTS is not supported by system";
+ }
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): {
+ return "UI is not supported by system";
+ }
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): {
+ return "Navigation is not supported by system";
+ }
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): {
+ return "VehicleInfo is not supported by system";
+ }
+ case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): {
+ return "Remote control is not supported by system";
+ }
+ default:
+ SDL_LOG_WARN(
+ "Could not create info because"
+ " interface isn't valid. Interface is:"
+ << static_cast<int32_t>(interface));
+ return "";
+ }
+}
+
+bool RequestFromMobileImpl::CheckResultCode(const ResponseInfo& first,
+ const ResponseInfo& second) const {
+ if (first.is_ok && second.is_unsupported_resource) {
+ return true;
+ }
+ if (first.is_ok && second.is_not_used) {
+ return true;
+ }
+ if (first.is_ok && second.is_ok) {
+ return true;
+ }
+ return false;
+}
+
+bool IsResultCodeWarning(const ResponseInfo& first,
+ const ResponseInfo& second) {
+ const bool first_is_ok_second_is_warn =
+ (first.is_ok || first.is_not_used) &&
+ hmi_apis::Common_Result::WARNINGS == second.result_code;
+
+ const bool both_warnings =
+ hmi_apis::Common_Result::WARNINGS == first.result_code &&
+ hmi_apis::Common_Result::WARNINGS == second.result_code;
+
+ return first_is_ok_second_is_warn || both_warnings;
+}
+
+ResponseInfo::ResponseInfo()
+ : result_code(hmi_apis::Common_Result::INVALID_ENUM)
+ , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM)
+ , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
+ , is_ok(false)
+ , is_unsupported_resource(false)
+ , is_not_used(false) {}
+
+ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result,
+ const HmiInterfaces::InterfaceID hmi_interface,
+ ApplicationManager& application_manager)
+ : result_code(result)
+ , interface(hmi_interface)
+ , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
+ , is_ok(false)
+ , is_unsupported_resource(false)
+ , is_not_used(false) {
+ using namespace helpers;
+
+ interface_state =
+ application_manager.hmi_interfaces().GetInterfaceState(hmi_interface);
+
+ is_ok = IsHMIResultSuccess(result_code);
+
+ is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code;
+
+ is_unsupported_resource =
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code;
+}
+
+RequestFromMobileImpl::RequestFromMobileImpl(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , hash_update_mode_(kSkipHashUpdate)
+ , is_success_result_(false) {}
+
+RequestFromMobileImpl::~RequestFromMobileImpl() {
+ UpdateHash();
+}
+
+bool RequestFromMobileImpl::Init() {
+ return true;
+}
+
+bool RequestFromMobileImpl::CheckPermissions() {
+ return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE);
+}
+
+bool RequestFromMobileImpl::CleanUp() {
+ unsubscribe_from_all_mobile_events();
+ unsubscribe_from_all_hmi_events(); // To prevent on_event calls
+
+ // Cleanup for mobile requests can be done only if OnEvent/OnTimeout events
+ // are not processed at that moment
+ return kAwaitingResponse == current_state();
+}
+
+void RequestFromMobileImpl::Run() {}
+
+void RequestFromMobileImpl::OnTimeOut() {
+ SDL_LOG_AUTO_TRACE();
+
+ unsubscribe_from_all_mobile_events();
+ unsubscribe_from_all_hmi_events();
+
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateNegativeResponse(connection_key(),
+ function_id(),
+ correlation_id(),
+ mobile_api::Result::GENERIC_ERROR);
+
+ AddTimeOutComponentInfoToMessage(*response);
+
+ rpc_service_.ManageMobileCommand(response, SOURCE_SDL);
+}
+
+void RequestFromMobileImpl::on_event(const event_engine::Event& event) {}
+
+void RequestFromMobileImpl::on_event(const event_engine::MobileEvent& event) {}
+
+void RequestFromMobileImpl::SendResponse(
+ const bool success,
+ const mobile_apis::Result::eType& result_code,
+ const char* info,
+ const smart_objects::SmartObject* response_params,
+ const std::vector<uint8_t> binary_data) {
+ SDL_LOG_AUTO_TRACE();
+
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& response = *result;
+
+ response[strings::params][strings::message_type] = MessageType::kResponse;
+ response[strings::params][strings::correlation_id] = correlation_id();
+ response[strings::params][strings::protocol_type] =
+ CommandImpl::mobile_protocol_type_;
+ response[strings::params][strings::protocol_version] =
+ 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;
+ }
+
+ if (info && *info != '\0') {
+ response[strings::msg_params][strings::info] = std::string(info);
+ }
+
+ // Add disallowed parameters and info from request back to response with
+ // appropriate reasons (VehicleData result codes)
+ if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED &&
+ result_code != mobile_apis::Result::INVALID_DATA) {
+ FormatResponse(response);
+ }
+
+ response[strings::msg_params][strings::success] = success;
+ if ((result_code == mobile_apis::Result::SUCCESS ||
+ result_code == mobile_apis::Result::WARNINGS) &&
+ !warning_info().empty()) {
+ response[strings::msg_params][strings::info] =
+ (info && *info != '\0') ? std::string(info) + "\n" + warning_info()
+ : warning_info();
+ response[strings::msg_params][strings::result_code] =
+ mobile_apis::Result::WARNINGS;
+ } else if (mobile_apis::Result::INVALID_ENUM == result_code) {
+ response[strings::msg_params][strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ response[strings::msg_params][strings::info] =
+ "Invalid result received from vehicle";
+ } else {
+ response[strings::msg_params][strings::result_code] = result_code;
+ }
+
+ is_success_result_ = success;
+
+ rpc_service_.ManageMobileCommand(result, SOURCE_SDL);
+}
+
+smart_objects::SmartObject CreateUnsupportedResourceResponse(
+ const hmi_apis::FunctionID::eType function_id,
+ const uint32_t hmi_correlation_id,
+ HmiInterfaces::InterfaceID interface) {
+ smart_objects::SmartObject response(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& params = response[strings::params];
+ params[strings::message_type] = MessageType::kResponse;
+ params[strings::correlation_id] = hmi_correlation_id;
+ params[strings::protocol_type] = CommandImpl::hmi_protocol_type_;
+ params[strings::protocol_version] = CommandImpl::protocol_version_;
+ params[strings::function_id] = function_id;
+ params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+ smart_objects::SmartObject& msg_params = response[strings::msg_params];
+ msg_params[strings::info] = CreateInfoForUnsupportedResult(interface);
+ return response;
+}
+
+bool RequestFromMobileImpl::ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id) {
+ SDL_LOG_AUTO_TRACE();
+ 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) {
+ event_engine::Event event(function_id);
+ event.set_smart_object(CreateUnsupportedResourceResponse(
+ function_id, hmi_correlation_id, interface));
+ event.raise(application_manager_.event_dispatcher());
+ return false;
+ }
+ return true;
+}
+
+void RequestFromMobileImpl::UpdateHash() {
+ SDL_LOG_AUTO_TRACE();
+ if (hash_update_mode_ == kSkipHashUpdate) {
+ SDL_LOG_DEBUG("Hash update is disabled for " << function_id());
+ return;
+ }
+
+ if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE ==
+ application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) {
+ SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated.");
+ return;
+ }
+
+ if (!is_success_result_) {
+ SDL_LOG_WARN("Command is not succeeded. Hash won't be updated.");
+ return;
+ }
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+ if (!application) {
+ SDL_LOG_ERROR("Application with connection key "
+ << connection_key()
+ << " not found. Not able to update hash.");
+ return;
+ }
+
+ SDL_LOG_DEBUG(
+ "Updating hash for application with connection key "
+ << connection_key() << " while processing function id "
+ << MessageHelper::StringifiedFunctionID(
+ static_cast<mobile_api::FunctionID::eType>(function_id())));
+
+ application->UpdateHash();
+}
+
+uint32_t RequestFromMobileImpl::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_version] =
+ CommandImpl::protocol_version_;
+ request[strings::params][strings::protocol_type] =
+ CommandImpl::hmi_protocol_type_;
+
+ if (msg_params) {
+ request[strings::msg_params] = *msg_params;
+ }
+
+ if (use_events) {
+ SDL_LOG_DEBUG("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, SOURCE_SDL_TO_HMI)) {
+ AddRequestToTimeoutHandler(request);
+ } else {
+ SDL_LOG_ERROR("Unable to send request");
+ SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
+ }
+ } else {
+ SDL_LOG_DEBUG("Interface is not available");
+ }
+ return hmi_correlation_id;
+}
+
+void RequestFromMobileImpl::CreateHMINotification(
+ const hmi_apis::FunctionID::eType& function_id,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params)
+ const {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+ if (!result) {
+ SDL_LOG_ERROR("Memory allocation failed.");
+ return;
+ }
+ smart_objects::SmartObject& notify = *result;
+
+ notify[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ notify[strings::params][strings::protocol_version] =
+ CommandImpl::protocol_version_;
+ notify[strings::params][strings::protocol_type] =
+ CommandImpl::hmi_protocol_type_;
+ notify[strings::params][strings::function_id] = function_id;
+ notify[strings::msg_params] = msg_params;
+
+ if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
+ SDL_LOG_ERROR("Unable to send HMI notification");
+ }
+}
+
+mobile_apis::Result::eType RequestFromMobileImpl::GetMobileResultCode(
+ const hmi_apis::Common_Result::eType& hmi_code) const {
+ mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR;
+ switch (hmi_code) {
+ case hmi_apis::Common_Result::SUCCESS: {
+ mobile_result = mobile_apis::Result::SUCCESS;
+ break;
+ }
+ case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: {
+ mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST;
+ break;
+ }
+ case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: {
+ mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ break;
+ }
+ case hmi_apis::Common_Result::DISALLOWED: {
+ mobile_result = mobile_apis::Result::DISALLOWED;
+ break;
+ }
+ case hmi_apis::Common_Result::REJECTED: {
+ mobile_result = mobile_apis::Result::REJECTED;
+ break;
+ }
+ case hmi_apis::Common_Result::ABORTED: {
+ mobile_result = mobile_apis::Result::ABORTED;
+ break;
+ }
+ case hmi_apis::Common_Result::IGNORED: {
+ mobile_result = mobile_apis::Result::IGNORED;
+ break;
+ }
+ case hmi_apis::Common_Result::RETRY: {
+ mobile_result = mobile_apis::Result::RETRY;
+ break;
+ }
+ case hmi_apis::Common_Result::IN_USE: {
+ mobile_result = mobile_apis::Result::IN_USE;
+ break;
+ }
+ case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: {
+ mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE;
+ break;
+ }
+ case hmi_apis::Common_Result::TIMED_OUT: {
+ mobile_result = mobile_apis::Result::TIMED_OUT;
+ break;
+ }
+ case hmi_apis::Common_Result::INVALID_DATA: {
+ mobile_result = mobile_apis::Result::INVALID_DATA;
+ break;
+ }
+ case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: {
+ mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED;
+ break;
+ }
+ case hmi_apis::Common_Result::INVALID_ID: {
+ mobile_result = mobile_apis::Result::INVALID_ID;
+ break;
+ }
+ case hmi_apis::Common_Result::DUPLICATE_NAME: {
+ mobile_result = mobile_apis::Result::DUPLICATE_NAME;
+ break;
+ }
+ case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: {
+ mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ break;
+ }
+ case hmi_apis::Common_Result::WRONG_LANGUAGE: {
+ mobile_result = mobile_apis::Result::WRONG_LANGUAGE;
+ break;
+ }
+ case hmi_apis::Common_Result::OUT_OF_MEMORY: {
+ mobile_result = mobile_apis::Result::OUT_OF_MEMORY;
+ break;
+ }
+ case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: {
+ mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS;
+ break;
+ }
+ case hmi_apis::Common_Result::NO_APPS_REGISTERED: {
+ mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ break;
+ }
+ case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: {
+ mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ break;
+ }
+ case hmi_apis::Common_Result::WARNINGS: {
+ mobile_result = mobile_apis::Result::WARNINGS;
+ break;
+ }
+ case hmi_apis::Common_Result::GENERIC_ERROR: {
+ mobile_result = mobile_apis::Result::GENERIC_ERROR;
+ break;
+ }
+ case hmi_apis::Common_Result::USER_DISALLOWED: {
+ mobile_result = mobile_apis::Result::USER_DISALLOWED;
+ break;
+ }
+ case hmi_apis::Common_Result::SAVED: {
+ mobile_result = mobile_apis::Result::SAVED;
+ break;
+ }
+ case hmi_apis::Common_Result::READ_ONLY: {
+ mobile_result = mobile_apis::Result::READ_ONLY;
+ break;
+ }
+ default: {
+ SDL_LOG_ERROR("Unknown HMI result code " << hmi_code);
+ break;
+ }
+ }
+
+ return mobile_result;
+}
+
+bool RequestFromMobileImpl::CheckHMICapabilities(
+ const mobile_apis::ButtonName::eType button) const {
+ SDL_LOG_AUTO_TRACE();
+
+ using namespace smart_objects;
+ using namespace mobile_apis;
+
+ if (!hmi_capabilities_.is_ui_cooperating()) {
+ SDL_LOG_ERROR("UI is not supported by HMI");
+ return false;
+ }
+
+ const auto button_capabilities_so = hmi_capabilities_.button_capabilities();
+ if (!button_capabilities_so) {
+ SDL_LOG_ERROR("Invalid button capabilities object");
+ return false;
+ }
+
+ const SmartObject& button_capabilities = *button_capabilities_so;
+ for (size_t i = 0; i < button_capabilities.length(); ++i) {
+ const SmartObject& capabilities = button_capabilities[i];
+ const ButtonName::eType current_button = static_cast<ButtonName::eType>(
+ capabilities.getElement(hmi_response::button_name).asInt());
+ if (current_button == button) {
+ SDL_LOG_DEBUG("Button capabilities for " << button << " was found");
+ return true;
+ }
+ }
+
+ SDL_LOG_DEBUG("Button capabilities for " << button << " was not found");
+ return false;
+}
+
+void RequestFromMobileImpl::RemoveDisallowedParameters() {
+ SDL_LOG_AUTO_TRACE();
+
+ smart_objects::SmartObject& params = (*message_)[strings::msg_params];
+
+ // Remove from request all disallowed parameters
+ RPCParams::const_iterator it_disallowed =
+ parameters_permissions_.disallowed_params.begin();
+ RPCParams::const_iterator it_disallowed_end =
+ parameters_permissions_.disallowed_params.end();
+ for (; it_disallowed != it_disallowed_end; ++it_disallowed) {
+ if (params.keyExists(*it_disallowed)) {
+ const std::string key = *it_disallowed;
+ params.erase(key);
+ removed_parameters_permissions_.disallowed_params.insert(key);
+ SDL_LOG_INFO("Following parameter is disallowed by user: " << key);
+ }
+ }
+
+ // Remove from request all undefined yet parameters
+ RPCParams::const_iterator it_undefined =
+ parameters_permissions_.undefined_params.begin();
+ RPCParams::const_iterator it_undefined_end =
+ parameters_permissions_.undefined_params.end();
+ for (; it_undefined != it_undefined_end; ++it_undefined) {
+ if (params.keyExists(*it_undefined)) {
+ const std::string key = *it_undefined;
+ params.erase(key);
+ removed_parameters_permissions_.undefined_params.insert(key);
+ SDL_LOG_INFO("Following parameter is disallowed by policy: " << key);
+ }
+ }
+
+ // Remove from request all parameters missed in allowed
+ const VehicleData& vehicle_data =
+ application_manager::MessageHelper::vehicle_data();
+
+ VehicleData::const_iterator it_vehicle_data = vehicle_data.begin();
+ VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end();
+ for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) {
+ const std::string key = it_vehicle_data->first;
+ if (params.keyExists(key) &&
+ parameters_permissions_.allowed_params.end() ==
+ std::find(parameters_permissions_.allowed_params.begin(),
+ parameters_permissions_.allowed_params.end(),
+ key)) {
+ params.erase(key);
+ removed_parameters_permissions_.undefined_params.insert(key);
+ SDL_LOG_INFO("Following parameter is not found among allowed parameters '"
+ << key << "' and will be treated as disallowed.");
+ }
+ }
+}
+
+bool RequestFromMobileImpl::HasDisallowedParams() const {
+ return ((!removed_parameters_permissions_.disallowed_params.empty()) ||
+ (!removed_parameters_permissions_.undefined_params.empty()));
+}
+
+bool RequestFromMobileImpl::PrepareResultForMobileResponse(
+ hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const {
+ SDL_LOG_AUTO_TRACE();
+
+ return IsHMIResultSuccess(result_code, interface);
+}
+
+bool RequestFromMobileImpl::PrepareResultForMobileResponse(
+ ResponseInfo& out_first, ResponseInfo& out_second) const {
+ SDL_LOG_AUTO_TRACE();
+ bool result = CheckResultCode(out_first, out_second) ||
+ CheckResultCode(out_second, out_first);
+ return result;
+}
+
+bool RequestFromMobileImpl::PrepareResultForMobileResponse(
+ ResponseInfo& out_first,
+ ResponseInfo& out_second,
+ ResponseInfo& out_third) const {
+ SDL_LOG_AUTO_TRACE();
+ bool result = (PrepareResultForMobileResponse(out_first, out_second) ||
+ PrepareResultForMobileResponse(out_second, out_third)) &&
+ PrepareResultForMobileResponse(out_first, out_third);
+ return result;
+}
+
+void RequestFromMobileImpl::GetInfo(
+ const smart_objects::SmartObject& response_from_hmi,
+ std::string& out_info) const {
+ if (response_from_hmi[strings::msg_params].keyExists(strings::info)) {
+ if (!response_from_hmi[strings::msg_params][strings::info].empty()) {
+ out_info =
+ response_from_hmi[strings::msg_params][strings::info].asString();
+ }
+ }
+}
+
+mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse(
+ const ResponseInfo& first, const ResponseInfo& second) {
+ SDL_LOG_AUTO_TRACE();
+ if (IsResultCodeUnsupported(first, second) ||
+ IsResultCodeUnsupported(second, first)) {
+ return mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ }
+ if (IsResultCodeWarning(first, second) ||
+ IsResultCodeWarning(second, first)) {
+ return mobile_apis::Result::WARNINGS;
+ }
+ // If response contains erroneous result code SDL need return erroneus
+ // result code.
+ hmi_apis::Common_Result::eType first_result =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ hmi_apis::Common_Result::eType second_result =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ if (!first.is_unsupported_resource) {
+ first_result = first.result_code;
+ }
+ if (!second.is_unsupported_resource) {
+ second_result = second.result_code;
+ }
+ mobile_apis::Result::eType result_code =
+ MessageHelper::HMIToMobileResult(std::max(first_result, second_result));
+ return result_code;
+}
+
+mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse(
+ const ResponseInfo& first,
+ const ResponseInfo& second,
+ const ResponseInfo& third) {
+ SDL_LOG_AUTO_TRACE();
+
+ const auto first_comparison = PrepareResultCodeForResponse(first, second);
+ const auto second_comparison = PrepareResultCodeForResponse(second, third);
+ const auto third_comparison = PrepareResultCodeForResponse(first, third);
+
+ return std::max({first_comparison, second_comparison, third_comparison});
+}
+
+const CommandParametersPermissions&
+RequestFromMobileImpl::parameters_permissions() const {
+ return parameters_permissions_;
+}
+
+void RequestFromMobileImpl::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) {
+ SDL_LOG_AUTO_TRACE();
+ 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) {
+ SDL_LOG_DEBUG("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) {
+ SDL_LOG_DEBUG("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);
+}
+
+bool RequestFromMobileImpl::IsResultCodeUnsupported(
+ const ResponseInfo& first, const ResponseInfo& second) const {
+ const bool first_ok_second_unsupported =
+ (first.is_ok || first.is_not_used) && second.is_unsupported_resource;
+ const bool both_unsupported =
+ first.is_unsupported_resource && second.is_unsupported_resource;
+ return first_ok_second_unsupported || both_unsupported;
+}
+
+std::string GetComponentNameFromInterface(
+ const HmiInterfaces::InterfaceID& interface) {
+ switch (interface) {
+ case HmiInterfaces::HMI_INTERFACE_Buttons:
+ return hmi_interface::buttons;
+ case HmiInterfaces::HMI_INTERFACE_BasicCommunication:
+ return hmi_interface::basic_communication;
+ case HmiInterfaces::HMI_INTERFACE_VR:
+ return hmi_interface::vr;
+ case HmiInterfaces::HMI_INTERFACE_TTS:
+ return hmi_interface::tts;
+ case HmiInterfaces::HMI_INTERFACE_UI:
+ return hmi_interface::ui;
+ case HmiInterfaces::HMI_INTERFACE_Navigation:
+ return hmi_interface::navigation;
+ case HmiInterfaces::HMI_INTERFACE_VehicleInfo:
+ return hmi_interface::vehicle_info;
+ case HmiInterfaces::HMI_INTERFACE_SDL:
+ return hmi_interface::sdl;
+ case HmiInterfaces::HMI_INTERFACE_RC:
+ return hmi_interface::rc;
+ case HmiInterfaces::HMI_INTERFACE_AppService:
+ return hmi_interface::app_service;
+ default:
+ return "Unknown type";
+ }
+}
+
+const std::string InfoInterfaceSeparator(
+ const std::string& sum, const HmiInterfaces::InterfaceID container_value) {
+ return sum.empty()
+ ? GetComponentNameFromInterface(container_value)
+ : sum + ", " + GetComponentNameFromInterface(container_value);
+}
+
+void RequestFromMobileImpl::AddTimeOutComponentInfoToMessage(
+ smart_objects::SmartObject& response) const {
+ using ns_smart_device_link::ns_smart_objects::SmartObject;
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ if (awaiting_response_interfaces_.empty()) {
+ SDL_LOG_ERROR("No interfaces awaiting, info param is empty");
+ return;
+ }
+
+ const std::string not_responding_interfaces_string =
+ std::accumulate(awaiting_response_interfaces_.begin(),
+ awaiting_response_interfaces_.end(),
+ std::string(""),
+ InfoInterfaceSeparator);
+ SDL_LOG_DEBUG(
+ "Not responding interfaces string: " << not_responding_interfaces_string);
+ if (!not_responding_interfaces_string.empty()) {
+ const std::string component_info =
+ not_responding_interfaces_string + " component does not respond";
+ response[strings::msg_params][strings::info] = component_info;
+ }
+}
+
+void RequestFromMobileImpl::AddRequestToTimeoutHandler(
+ const smart_objects::SmartObject& request_to_hmi) const {
+ auto function_id = static_cast<hmi_apis::FunctionID::eType>(
+ request_to_hmi[strings::params][strings::function_id].asUInt());
+ // SDL must not apply "default timeout for RPCs processing" for
+ // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI
+ // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR
+ // to mobile app), so the OnResetTimeout logic is not applicable for
+ // DialNumber RPC
+ if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>(
+ function_id,
+ hmi_apis::FunctionID::BasicCommunication_DialNumber,
+ hmi_apis::FunctionID::INVALID_ENUM)) {
+ SDL_LOG_DEBUG(
+ "Current RPC is DialNumber or Invalid, OnResetTimeout "
+ "logic is not applicable in this case");
+ return;
+ }
+
+ // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use
+ // timeout tracking for response, so the OnResetTimeout logic is not
+ // applicable in this case
+ if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>(
+ function_id,
+ hmi_apis::FunctionID::UI_Alert,
+ hmi_apis::FunctionID::UI_SubtleAlert)) {
+ if (request_to_hmi.keyExists(strings::msg_params)) {
+ if (request_to_hmi[strings::msg_params].keyExists(
+ strings::soft_buttons)) {
+ SDL_LOG_DEBUG("Soft buttons are present in "
+ << EnumToString(function_id)
+ << " RPC, OnResetTimeout "
+ "logic is not applicable in this case");
+ return;
+ }
+ }
+ }
+
+ const application_manager::request_controller::Request request{
+ correlation_id(), connection_key(), static_cast<uint32_t>(function_id)};
+ application_manager_.get_request_timeout_handler().AddRequest(
+ request_to_hmi[strings::params][strings::correlation_id].asUInt(),
+ request);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc
index 35ac71c8bd..86f25711da 100644
--- a/src/components/application_manager/src/commands/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/request_to_hmi.cc
@@ -80,26 +80,6 @@ bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
return HmiInterfaces::STATE_NOT_AVAILABLE != state;
}
-bool IsResponseCodeSuccess(
- const smart_objects::SmartObject& response_from_hmi) {
- auto response_code = static_cast<hmi_apis::Common_Result::eType>(
- response_from_hmi[strings::params][hmi_response::code].asInt());
-
- using helpers::Compare;
- using helpers::EQ;
- using helpers::ONE;
-
- const bool is_result_success =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- response_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 is_result_success;
-}
-
bool ChangeInterfaceState(ApplicationManager& application_manager,
const smart_objects::SmartObject& response_from_hmi,
HmiInterfaces::InterfaceID interface) {
@@ -113,12 +93,14 @@ bool ChangeInterfaceState(ApplicationManager& application_manager,
return false;
}
- // Process response with result
- if (response_from_hmi[strings::params].keyExists(hmi_response::code) &&
- !IsResponseCodeSuccess(response_from_hmi)) {
- application_manager.hmi_interfaces().SetInterfaceState(
- interface, HmiInterfaces::STATE_NOT_AVAILABLE);
- return false;
+ if (response_from_hmi[strings::params].keyExists(hmi_response::code)) {
+ auto response_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_from_hmi[strings::params][hmi_response::code].asInt());
+ if (!IsHMIResultSuccess(response_code)) {
+ application_manager.hmi_interfaces().SetInterfaceState(
+ interface, HmiInterfaces::STATE_NOT_AVAILABLE);
+ return false;
+ }
}
application_manager.hmi_interfaces().SetInterfaceState(
@@ -141,11 +123,11 @@ RequestToHMI::RequestToHMI(const MessageSharedPtr& message,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
RequestToHMI::~RequestToHMI() {}
@@ -155,6 +137,7 @@ bool RequestToHMI::Init() {
}
bool RequestToHMI::CleanUp() {
+ unsubscribe_from_all_hmi_events();
return true;
}
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 7392731d70..0d7dc9cfe0 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
@@ -66,7 +66,11 @@ void EventDispatcherImpl::raise_event(const Event& event) {
EventObserver* temp = *observers.begin();
observers.erase(observers.begin());
AutoUnlock unlock_observer(observer_lock);
- temp->on_event(event);
+
+ if (temp->IncrementReferenceCount()) {
+ temp->HandleOnEvent(event);
+ temp->DecrementReferenceCount();
+ }
}
}
@@ -89,6 +93,15 @@ struct IdCheckFunctor {
};
void EventDispatcherImpl::remove_observer(const Event::EventID& event_id,
+ const int32_t hmi_correlation_id) {
+ AutoLock auto_lock(state_lock_);
+ auto& observers = observers_event_[event_id][hmi_correlation_id];
+ for (auto observer : observers) {
+ remove_observer_from_vector(*observer);
+ }
+}
+
+void EventDispatcherImpl::remove_observer(const Event::EventID& event_id,
EventObserver& observer) {
remove_observer_from_vector(observer);
AutoLock auto_lock(state_lock_);
@@ -148,7 +161,11 @@ void EventDispatcherImpl::raise_mobile_event(const MobileEvent& event) {
EventObserver* temp = *mobile_observers_.begin();
mobile_observers_.erase(mobile_observers_.begin());
AutoUnlock unlock_observer(observer_lock);
- temp->on_event(event);
+
+ if (temp->IncrementReferenceCount()) {
+ temp->HandleOnEvent(event);
+ temp->DecrementReferenceCount();
+ }
}
}
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 e17203f2f2..6b6d6def35 100644
--- a/src/components/application_manager/src/event_engine/event_observer.cc
+++ b/src/components/application_manager/src/event_engine/event_observer.cc
@@ -75,7 +75,15 @@ void EventObserver::unsubscribe_from_all_mobile_events() {
event_dispatcher_.remove_mobile_observer(*this);
}
-void EventObserver::on_event(const event_engine::MobileEvent& event) {}
+void EventObserver::HandleOnEvent(const event_engine::MobileEvent& event) {}
+
+bool EventObserver::IncrementReferenceCount() const {
+ return true;
+}
+
+bool EventObserver::DecrementReferenceCount() const {
+ return true;
+}
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc
index 8d43ff2d9f..30a1139deb 100644
--- a/src/components/application_manager/src/help_prompt_manager_impl.cc
+++ b/src/components/application_manager/src/help_prompt_manager_impl.cc
@@ -369,7 +369,9 @@ void HelpPromptManagerImpl::SetSendingType(
}
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
SDL_LOG_DEBUG(
"Sending type set to:" << static_cast<uint32_t>(sending_type_));
diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc
index 6bfefcb786..09b8eed6fe 100644
--- a/src/components/application_manager/src/helpers/application_helper.cc
+++ b/src/components/application_manager/src/helpers/application_helper.cc
@@ -9,19 +9,23 @@ namespace {
using namespace application_manager;
void DeleteWayPoints(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
- app_manager.UnsubscribeAppFromWayPoints(app);
- if (!app_manager.IsAnyAppSubscribedForWayPoints()) {
+ std::set<uint32_t> subscribed_apps =
+ app_manager.GetAppsSubscribedForWayPoints();
+ bool send_unsubscribe =
+ subscribed_apps.size() <= 1 && app_manager.IsSubscribedToHMIWayPoints();
+ if (send_unsubscribe) {
auto request = MessageHelper::CreateUnsubscribeWayPointsRequest(
app_manager.GetNextHMICorrelationID());
app_manager.GetRPCService().ManageHMICommand(request);
}
+ app_manager.UnsubscribeAppFromWayPoints(app, send_unsubscribe);
}
void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) {
auto accessor = app->commands_map();
const auto commands_map = accessor.GetData();
- for (const auto& cmd : commands_map) {
+ for (const auto cmd : commands_map) {
auto delete_UI_msg = MessageHelper::CreateDeleteUICommandRequest(
cmd.second, app->app_id(), app_manager.GetNextHMICorrelationID());
app_manager.GetRPCService().ManageHMICommand(delete_UI_msg);
@@ -39,7 +43,7 @@ void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) {
auto accessor = app->sub_menu_map();
const auto sub_menu_map = accessor.GetData();
- for (const auto& smenu : sub_menu_map) {
+ for (const auto smenu : sub_menu_map) {
MessageHelper::SendDeleteSubmenuRequest(smenu.second, app, app_manager);
app->RemoveSubMenu(smenu.first);
}
@@ -50,7 +54,7 @@ void DeleteChoiceSets(ApplicationSharedPtr app,
auto accessor = app->choice_set_map();
const auto choices = accessor.GetData();
- for (const auto& choice : choices) {
+ for (const auto choice : choices) {
MessageHelper::SendDeleteChoiceSetRequest(choice.second, app, app_manager);
app->RemoveChoiceSet(choice.first);
}
@@ -83,6 +87,7 @@ void DeleteGlobalProperties(ApplicationSharedPtr app,
app->set_keyboard_props(empty_so);
app->set_menu_icon(empty_so);
app->set_menu_title(empty_so);
+ app->set_menu_layout(empty_so);
MessageHelper::SendResetPropertiesRequest(app, app_manager);
}
@@ -90,13 +95,19 @@ void DeleteGlobalProperties(ApplicationSharedPtr app,
void DeleteButtonSubscriptions(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
ButtonSubscriptions buttons = app->SubscribedButtons().GetData();
-
for (auto button : buttons) {
- if (mobile_apis::ButtonName::CUSTOM_BUTTON == button) {
+ const auto hmi_button =
+ static_cast<hmi_apis::Common_ButtonName::eType>(button);
+ if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_button) {
continue;
}
- MessageHelper::SendUnsubscribeButtonNotification(button, app, app_manager);
- app->UnsubscribeFromButton(button);
+ smart_objects::SmartObjectSPtr unsubscribe_request =
+ MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ app->app_id(),
+ hmi_button,
+ hmi_apis::FunctionID::Buttons_UnsubscribeButton,
+ app_manager);
+ app_manager.GetRPCService().ManageHMICommand(unsubscribe_request);
}
}
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 1390a3ae2c..a8001eba91 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -126,6 +126,13 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
is_ivi_cooperating_ = true;
is_rc_cooperating_ = true;
}
+ requests_required_for_capabilities_ = {
+ hmi_apis::FunctionID::VehicleInfo_IsReady,
+ hmi_apis::FunctionID::VR_IsReady,
+ hmi_apis::FunctionID::TTS_IsReady,
+ hmi_apis::FunctionID::UI_IsReady,
+ hmi_apis::FunctionID::RC_IsReady,
+ hmi_apis::FunctionID::Navigation_IsReady};
}
HMICapabilitiesImpl::~HMICapabilitiesImpl() {}
@@ -424,8 +431,6 @@ void HMICapabilitiesImpl::Init(
ui_language_, vr_language_, tts_language_);
}
-void HMICapabilitiesImpl::Init(resumption::LastState*) {}
-
bool HMICapabilitiesImpl::is_ui_cooperating() const {
return is_ui_cooperating_;
}
@@ -1860,6 +1865,15 @@ const std::string& HMICapabilitiesImpl::ccpu_version() const {
return ccpu_version_;
}
+void HMICapabilitiesImpl::set_hardware_version(
+ const std::string& hardware_version) {
+ hardware_version_ = hardware_version;
+}
+
+const std::string& HMICapabilitiesImpl::hardware_version() const {
+ return hardware_version_;
+}
+
void HMICapabilitiesImpl::convert_json_languages_to_obj(
const Json::Value& json_languages,
smart_objects::SmartObject& languages) const {
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index e4fa4c936c..205585959b 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -43,8 +43,8 @@ generate_function_to_interface_convert_map() {
convert_map[Buttons_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_OnButtonEvent] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_OnButtonPress] = HmiInterfaces::HMI_INTERFACE_Buttons;
- convert_map[Buttons_OnButtonSubscription] =
- HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[Buttons_SubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[Buttons_UnsubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[BasicCommunication_OnReady] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnStartDeviceDiscovery] =
@@ -132,7 +132,8 @@ generate_function_to_interface_convert_map() {
convert_map[TTS_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_TTS;
convert_map[TTS_GetLanguage] = HmiInterfaces::HMI_INTERFACE_TTS;
convert_map[TTS_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_TTS;
- convert_map[TTS_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[BasicCommunication_OnResetTimeout] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[UI_Alert] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SubtleAlert] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_Show] = HmiInterfaces::HMI_INTERFACE_UI;
@@ -165,7 +166,6 @@ generate_function_to_interface_convert_map() {
convert_map[UI_EndAudioPassThru] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_IsReady] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_ClosePopUp] = HmiInterfaces::HMI_INTERFACE_UI;
- convert_map[UI_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SendHapticData] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[Navigation_IsReady] = HmiInterfaces::HMI_INTERFACE_Navigation;
convert_map[Navigation_SendLocation] =
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc
index 750755478e..776595a040 100644
--- a/src/components/application_manager/src/hmi_language_handler.cc
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -31,6 +31,7 @@
*/
#include "application_manager/hmi_language_handler.h"
+
#include "application_manager/application_manager.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/message_helper.h"
@@ -119,7 +120,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
return Common_Language::INVALID_ENUM;
}
-void HMILanguageHandler::on_event(const event_engine::Event& event) {
+void HMILanguageHandler::HandleOnEvent(const event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg = event.smart_object();
switch (event.id()) {
@@ -263,10 +264,11 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
const ApplicationSet& accessor =
application_manager_.applications().GetData();
+
ApplicationSetIt it = accessor.begin();
for (; accessor.end() != it;) {
- ApplicationConstSharedPtr app = *it++;
-
+ ApplicationConstSharedPtr app = *it;
+ ++it;
SDL_LOG_INFO("Application with app_id "
<< app->app_id()
<< " will be unregistered because of "
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 3487116baf..07200af6cd 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -241,32 +241,6 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {}
-mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
- using namespace mobile_apis;
- if (HMILevel::INVALID_ENUM == parent_hmi_level()) {
- return parent_hmi_level();
- }
- return std::max(parent_hmi_level(), max_hmi_level());
-}
-
-mobile_apis::HMILevel::eType PhoneCallHmiState::max_hmi_level() const {
- using namespace helpers;
- using namespace mobile_apis;
-
- if (WindowType::WIDGET == window_type()) {
- return std::max(HMILevel::HMI_FULL, parent_max_hmi_level());
- }
-
- auto expected = HMILevel::HMI_FULL;
- if (is_navi_app() || is_mobile_projection_app()) {
- expected = HMILevel::HMI_LIMITED;
- } else if (is_media_app()) {
- expected = HMILevel::HMI_BACKGROUND;
- }
-
- return std::max(expected, parent_max_hmi_level());
-}
-
SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {}
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 158a994e1c..273792cf86 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -53,6 +53,7 @@
#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
#include "application_manager/rpc_service.h"
#include "connection_handler/connection_handler_impl.h"
#include "interfaces/MOBILE_API.h"
@@ -61,6 +62,7 @@
#include "utils/file_system.h"
#include "utils/logger.h"
#include "utils/macro.h"
+#include "utils/semantic_version.h"
#include "formatters/CFormatterJsonBase.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
@@ -183,6 +185,8 @@ std::pair<std::string, mobile_apis::VehicleDataType::eType>
std::make_pair(
strings::cloud_app_vehicle_id,
mobile_apis::VehicleDataType::VEHICLEDATA_CLOUDAPPVEHICLEID),
+ std::make_pair(strings::climate_data,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLIMATEDATA),
std::make_pair(strings::external_temp,
mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP),
std::make_pair(strings::turn_signal,
@@ -246,6 +250,8 @@ std::pair<std::string, mobile_apis::VehicleDataType::eType>
mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE),
std::make_pair(strings::window_status,
mobile_apis::VehicleDataType::VEHICLEDATA_WINDOWSTATUS),
+ std::make_pair(strings::seat_occupancy,
+ mobile_apis::VehicleDataType::VEHICLEDATA_SEATOCCUPANCY),
std::make_pair(
strings::hands_off_steering,
mobile_apis::VehicleDataType::VEHICLEDATA_HANDSOFFSTEERING)};
@@ -392,18 +398,23 @@ MessageHelper::CreateUIResetGlobalPropertiesRequest(
}
if (reset_result.keyboard_properties) {
- smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject keyboard_properties =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] =
+ keyboard_properties[strings::language] =
static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] =
+ keyboard_properties[hmi_request::keyboard_layout] =
static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
- key_board_properties[hmi_request::auto_complete_list] =
+ keyboard_properties[hmi_request::auto_complete_list] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ keyboard_properties[strings::auto_complete_text] = "";
+ keyboard_properties[hmi_request::mask_input_characters] =
+ static_cast<int32_t>(
+ hmi_apis::Common_KeyboardInputMask::DISABLE_INPUT_KEY_MASK);
- key_board_properties[strings::auto_complete_text] = "";
(*ui_reset_global_prop_request)[hmi_request::keyboard_properties] =
- key_board_properties;
+ keyboard_properties;
+ application->set_keyboard_props(
+ smart_objects::SmartObject(smart_objects::SmartType_Null));
}
(*ui_reset_global_prop_request)[strings::app_id] = application->app_id();
@@ -412,6 +423,39 @@ MessageHelper::CreateUIResetGlobalPropertiesRequest(
}
smart_objects::SmartObjectSPtr
+MessageHelper::CreateRCResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ const ApplicationSharedPtr application) {
+ namespace rc = rc_rpc_plugin;
+
+ smart_objects::SmartObjectSPtr rc_reset_global_prop_request =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ if (reset_result.user_location) {
+ smart_objects::SmartObject user_location =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ user_location[rc::strings::kGrid] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& grid = user_location[rc::strings::kGrid];
+ grid[rc::strings::kRow] = 0;
+ grid[rc::strings::kCol] = 0;
+ grid[rc::strings::kLevel] = 0;
+ grid[rc::strings::kRowspan] = 1;
+ grid[rc::strings::kColspan] = 1;
+ grid[rc::strings::kLevelspan] = 1;
+
+ (*rc_reset_global_prop_request)[strings::user_location] = user_location;
+ application->set_user_location(user_location);
+ }
+
+ (*rc_reset_global_prop_request)[strings::app_id] = application->app_id();
+
+ return rc_reset_global_prop_request;
+}
+
+smart_objects::SmartObjectSPtr
MessageHelper::CreateDisplayCapabilityUpdateToMobile(
const smart_objects::SmartObject& display_capabilities, Application& app) {
SDL_LOG_AUTO_TRACE();
@@ -477,7 +521,7 @@ smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
smart_objects::SmartType_Map);
app_service_capability[strings::updated_app_service_record] = record;
app_services[i] = app_service_capability;
- i++;
+ ++i;
}
app_service_capabilities[strings::app_services] = app_services;
@@ -775,31 +819,6 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
}
}
-void MessageHelper::SendUnsubscribeButtonNotification(
- mobile_apis::ButtonName::eType button,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr) {
- using namespace smart_objects;
- using namespace hmi_apis;
-
- SmartObject msg_params = SmartObject(SmartType_Map);
- msg_params[strings::app_id] = application->app_id();
- msg_params[strings::name] = button;
- msg_params[strings::is_suscribed] = false;
-
- SmartObjectSPtr message = CreateMessageForHMI(
- hmi_apis::messageType::notification, app_mngr.GetNextHMICorrelationID());
- DCHECK(message);
-
- SmartObject& object = *message;
- object[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Buttons_OnButtonSubscription;
-
- object[strings::msg_params] = msg_params;
-
- app_mngr.GetRPCService().ManageHMICommand(message);
-}
-
const VehicleData& MessageHelper::vehicle_data() {
return vehicle_data_;
}
@@ -1054,104 +1073,119 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
return set_icon;
}
-void MessageHelper::SendOnButtonSubscriptionNotification(
- uint32_t app_id,
- hmi_apis::Common_ButtonName::eType button,
- bool is_subscribed,
- ApplicationManager& app_mngr) {
- using namespace smart_objects;
- using namespace hmi_apis;
+smart_objects::SmartObjectSPtr MessageHelper::CreateButtonNotificationToMobile(
+ ApplicationSharedPtr app,
+ const smart_objects::SmartObject& source_message) {
SDL_LOG_AUTO_TRACE();
- SmartObjectSPtr notification_ptr =
- std::make_shared<SmartObject>(SmartType_Map);
- if (!notification_ptr) {
- SDL_LOG_ERROR("Memory allocation failed.");
- return;
+ if (!app) {
+ SDL_LOG_ERROR("application NULL pointer");
+ return std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
}
- SmartObject& notification = *notification_ptr;
- SmartObject msg_params = SmartObject(SmartType_Map);
- msg_params[strings::app_id] = app_id;
- msg_params[strings::name] = button;
- msg_params[strings::is_suscribed] = is_subscribed;
+ smart_objects::SmartObjectSPtr msg =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
- notification[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- notification[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- notification[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- notification[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Buttons_OnButtonSubscription;
- notification[strings::msg_params] = msg_params;
+ smart_objects::SmartObject& ref = *msg;
+ ref[strings::params][strings::connection_key] = app->app_id();
- if (!app_mngr.GetRPCService().ManageHMICommand(notification_ptr)) {
- SDL_LOG_ERROR("Unable to send HMI notification");
+ const auto function_id = static_cast<mobile_apis::FunctionID::eType>(
+ source_message[strings::params][strings::function_id].asInt());
+ ref[strings::params][strings::function_id] = function_id;
+
+ mobile_apis::ButtonName::eType btn_id = mobile_apis::ButtonName::INVALID_ENUM;
+
+ if (source_message[strings::msg_params].keyExists(
+ hmi_response::button_name)) {
+ btn_id = static_cast<mobile_apis::ButtonName::eType>(
+ source_message[strings::msg_params][hmi_response::button_name].asInt());
+
+ } else if (source_message[strings::msg_params].keyExists(
+ strings::button_name)) {
+ btn_id = static_cast<mobile_apis::ButtonName::eType>(
+ source_message[strings::msg_params][strings::button_name].asInt());
}
-}
-void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
- using namespace smart_objects;
- using namespace hmi_apis;
- using namespace mobile_apis;
- SDL_LOG_AUTO_TRACE();
+ if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
+ app->msg_version() <= utils::base_rpc_version) {
+ btn_id = mobile_apis::ButtonName::OK;
+ }
- if (app.use_count() == 0) {
- SDL_LOG_ERROR("Invalid application pointer ");
- return;
+ ref[strings::msg_params][strings::button_name] = btn_id;
+
+ auto get_mode_code = [&source_message](
+ const std::string& hmi_param_name,
+ const std::string& mobile_param_name) -> int64_t {
+ if (source_message[strings::msg_params].keyExists(hmi_param_name)) {
+ return source_message[strings::msg_params][hmi_param_name].asInt();
+ }
+
+ if (source_message[strings::msg_params].keyExists(mobile_param_name)) {
+ return source_message[strings::msg_params][mobile_param_name].asInt();
+ }
+
+ return -1;
+ };
+
+ if (mobile_apis::FunctionID::eType::OnButtonPressID == function_id) {
+ const auto press_mode = static_cast<mobile_apis::ButtonPressMode::eType>(
+ get_mode_code(hmi_response::button_mode, strings::button_press_mode));
+ ref[strings::msg_params][strings::button_press_mode] = press_mode;
+ }
+
+ if (mobile_apis::FunctionID::eType::OnButtonEventID == function_id) {
+ const auto press_mode = static_cast<mobile_apis::ButtonEventMode::eType>(
+ get_mode_code(hmi_response::button_mode, strings::button_event_mode));
+ ref[strings::msg_params][strings::button_event_mode] = press_mode;
+ }
+
+ if (source_message[strings::msg_params].keyExists(
+ hmi_response::custom_button_id)) {
+ ref[strings::msg_params][strings::custom_button_id] =
+ source_message[strings::msg_params][strings::custom_button_id];
}
- const ButtonSubscriptions subscriptions = app->SubscribedButtons().GetData();
- ButtonSubscriptions::iterator it = subscriptions.begin();
- for (; subscriptions.end() != it; ++it) {
- SendOnButtonSubscriptionNotification(
- app->hmi_app_id(),
- static_cast<Common_ButtonName::eType>(*it),
- true,
- app_mngr);
+ if (source_message[strings::msg_params].keyExists(strings::window_id)) {
+ ref[strings::msg_params][strings::window_id] =
+ source_message[strings::msg_params][strings::window_id];
}
+
+ return msg;
}
smart_objects::SmartObjectSPtr
-MessageHelper::CreateOnButtonSubscriptionNotification(
- uint32_t app_id,
- hmi_apis::Common_ButtonName::eType button,
- bool is_subscribed) {
+MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button_name,
+ const hmi_apis::FunctionID::eType function_id,
+ application_manager::ApplicationManager& app_mngr) {
using namespace smart_objects;
- using namespace hmi_apis;
SDL_LOG_AUTO_TRACE();
- SmartObjectSPtr notification_ptr =
- std::make_shared<SmartObject>(SmartType_Map);
- SmartObject& notification = *notification_ptr;
+
+ SmartObjectSPtr request_ptr = CreateMessageForHMI(
+ hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+
+ SmartObject& request = *request_ptr;
SmartObject msg_params = SmartObject(SmartType_Map);
msg_params[strings::app_id] = app_id;
- msg_params[strings::name] = button;
- msg_params[strings::is_suscribed] = is_subscribed;
- notification[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- notification[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- notification[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- notification[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Buttons_OnButtonSubscription;
- notification[strings::msg_params] = msg_params;
- return notification_ptr;
+ msg_params[strings::button_name] = button_name;
+ request[strings::params][strings::function_id] = function_id;
+ request[strings::msg_params] = msg_params;
+ return request_ptr;
}
smart_objects::SmartObjectList
-MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
+MessageHelper::CreateButtonSubscriptionsHandlingRequestsList(
ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr,
- const ButtonSubscriptions& button_subscriptions) {
- using namespace smart_objects;
+ const ButtonSubscriptions& button_subscriptions,
+ const hmi_apis::FunctionID::eType function_id,
+ ApplicationManager& app_mngr) {
using namespace hmi_apis;
- using namespace mobile_apis;
SDL_LOG_AUTO_TRACE();
- SmartObjectList button_subscription_requests;
+ smart_objects::SmartObjectList button_subscription_requests;
if (app.use_count() == 0) {
SDL_LOG_ERROR("Invalid application pointer ");
@@ -1163,7 +1197,8 @@ MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
static_cast<Common_ButtonName::eType>(it);
button_subscription_requests.push_back(
- CreateOnButtonSubscriptionNotification(app->hmi_app_id(), btn, true));
+ CreateButtonSubscriptionHandlingRequestToHmi(
+ app->app_id(), btn, function_id, app_mngr));
}
return button_subscription_requests;
@@ -1244,38 +1279,41 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
// UI global properties
- if (can_send_ui && (app->vr_help_title() || app->vr_help())) {
+ if (can_send_ui &&
+ (app->vr_help_title() || app->vr_help() || app->keyboard_props() ||
+ app->menu_title() || app->menu_icon() || app->menu_layout())) {
smart_objects::SmartObjectSPtr ui_global_properties = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
- if (!ui_global_properties) {
- return requests;
- }
-
- (*ui_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
+ if (ui_global_properties) {
+ (*ui_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
- smart_objects::SmartObject ui_msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (app->vr_help_title()) {
- ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
- }
- if (app->vr_help()) {
- ui_msg_params[strings::vr_help] = (*app->vr_help());
- }
- if (app->keyboard_props()) {
- ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
- }
- if (app->menu_title()) {
- ui_msg_params[strings::menu_title] = (*app->menu_title());
- }
- if (app->menu_icon()) {
- ui_msg_params[strings::menu_icon] = (*app->menu_icon());
- }
- ui_msg_params[strings::app_id] = app->app_id();
+ smart_objects::SmartObject ui_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->vr_help_title()) {
+ ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
+ }
+ if (app->vr_help()) {
+ ui_msg_params[strings::vr_help] = (*app->vr_help());
+ }
+ if (app->keyboard_props()) {
+ ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
+ }
+ if (app->menu_title()) {
+ ui_msg_params[strings::menu_title] = (*app->menu_title());
+ }
+ if (app->menu_icon()) {
+ ui_msg_params[strings::menu_icon] = (*app->menu_icon());
+ }
+ if (app->menu_layout()) {
+ ui_msg_params[strings::menu_layout] = (*app->menu_layout());
+ }
+ ui_msg_params[strings::app_id] = app->app_id();
- (*ui_global_properties)[strings::msg_params] = ui_msg_params;
+ (*ui_global_properties)[strings::msg_params] = ui_msg_params;
- requests.push_back(ui_global_properties);
+ requests.push_back(ui_global_properties);
+ }
}
const bool can_send_vr = helpers::
@@ -1289,27 +1327,46 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr tts_global_properties =
CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
- if (!tts_global_properties) {
- return requests;
- }
+ if (tts_global_properties) {
+ (*tts_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
- (*tts_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ smart_objects::SmartObject tts_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->help_prompt()) {
+ tts_msg_params[strings::help_prompt] = (*app->help_prompt());
+ }
+ if (app->timeout_prompt()) {
+ tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ }
+ tts_msg_params[strings::app_id] = app->app_id();
- smart_objects::SmartObject tts_msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (app->help_prompt()) {
- tts_msg_params[strings::help_prompt] = (*app->help_prompt());
- }
- if (app->timeout_prompt()) {
- tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ (*tts_global_properties)[strings::msg_params] = tts_msg_params;
+
+ requests.push_back(tts_global_properties);
}
- tts_msg_params[strings::app_id] = app->app_id();
+ }
+
+ // RC global properties
+ if (!app->get_user_location().empty()) {
+ smart_objects::SmartObjectSPtr rc_global_properties = CreateMessageForHMI(
+ hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ if (rc_global_properties) {
+ (*rc_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::RC_SetGlobalProperties);
+
+ smart_objects::SmartObject rc_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ rc_msg_params[strings::user_location] = (app->get_user_location());
+ rc_msg_params[strings::app_id] = app->app_id();
- (*tts_global_properties)[strings::msg_params] = tts_msg_params;
+ (*rc_global_properties)[strings::msg_params] = rc_msg_params;
- requests.push_back(tts_global_properties);
+ requests.push_back(rc_global_properties);
+ }
}
+
return requests;
}
@@ -1791,7 +1848,7 @@ bool MessageHelper::CreateHMIApplicationStruct(
if (file_system::FileExists(app->app_icon_path())) {
message[strings::icon] = icon_path;
}
- if (app->IsRegistered()) {
+ if (!app->is_cloud_app() || app->IsRegistered()) {
message[strings::hmi_display_language_desired] = app->ui_language();
message[strings::is_media_application] = app->is_media_application();
} else {
@@ -1933,6 +1990,9 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestsToHMI(
msg_params[strings::menu_params][strings::parent_id] =
(*i->second)[strings::parent_id];
}
+ if ((*i->second).keyExists(strings::menu_layout)) {
+ msg_params[strings::menu_layout] = (*i->second)[strings::menu_layout];
+ }
msg_params[strings::app_id] = app->app_id();
(*ui_sub_menu)[strings::msg_params] = msg_params;
if (((*i->second).keyExists(strings::menu_icon)) &&
@@ -2228,13 +2288,11 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
smart_objects::SmartObject& user_friendly_messages =
(*message)[strings::msg_params][messages];
-#ifdef EXTERNAL_PROPRIETARY_MODE
const std::string tts = "ttsString";
const std::string label = "label";
const std::string line1 = "line1";
const std::string line2 = "line2";
const std::string textBody = "textBody";
-#endif // EXTERNAL_PROPRIETARY_MODE
const std::string message_code = "messageCode";
std::vector<policy::UserFriendlyMessage>::const_iterator it = msg.begin();
std::vector<policy::UserFriendlyMessage>::const_iterator it_end = msg.end();
@@ -2244,7 +2302,6 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
smart_objects::SmartObject& obj = user_friendly_messages[index];
obj[message_code] = it->message_code;
-#ifdef EXTERNAL_PROPRIETARY_MODE
if (!it->tts.empty()) {
obj[tts] = it->tts;
}
@@ -2260,7 +2317,6 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
if (!it->text_body.empty()) {
obj[textBody] = it->text_body;
}
-#endif // EXTERNAL_PROPRIETARY_MODE
}
app_mngr.GetRPCService().ManageHMICommand(message);
@@ -2271,7 +2327,8 @@ void MessageHelper::SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
const policy::ExternalConsentStatus& external_consent_status,
uint32_t correlation_id,
- ApplicationManager& app_mngr) {
+ ApplicationManager& app_mngr,
+ const bool success_flag) {
using namespace smart_objects;
using namespace hmi_apis;
@@ -2283,7 +2340,8 @@ void MessageHelper::SendGetListOfPermissionsResponse(
params[strings::function_id] = hmi_apis::FunctionID::SDL_GetListOfPermissions;
params[strings::message_type] = MessageType::kResponse;
params[strings::correlation_id] = correlation_id;
- params[hmi_response::code] = static_cast<int32_t>(Common_Result::SUCCESS);
+ params[hmi_response::code] = static_cast<int32_t>(
+ success_flag ? Common_Result::SUCCESS : Common_Result::GENERIC_ERROR);
SmartObject& msg_params = (*message)[strings::msg_params];
@@ -2313,7 +2371,8 @@ void MessageHelper::SendGetListOfPermissionsResponse(
void MessageHelper::SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
uint32_t correlation_id,
- ApplicationManager& app_mngr) {
+ ApplicationManager& app_mngr,
+ const bool success_flag) {
using namespace smart_objects;
SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
@@ -2324,7 +2383,9 @@ void MessageHelper::SendGetListOfPermissionsResponse(
params[strings::function_id] = hmi_apis::FunctionID::SDL_GetListOfPermissions;
params[strings::message_type] = MessageType::kResponse;
params[strings::correlation_id] = correlation_id;
- params[hmi_response::code] = static_cast<int32_t>(hmi_apis::Common_Result::SUCCESS);
+ params[hmi_response::code] = static_cast<int32_t>(
+ success_flag ? hmi_apis::Common_Result::SUCCESS
+ : hmi_apis::Common_Result::GENERIC_ERROR);
SmartObject& msg_params = (*message)[strings::msg_params];
@@ -2695,7 +2756,8 @@ void MessageHelper::SendLaunchApp(const uint32_t connection_key,
using namespace smart_objects;
SmartObject content(SmartType_Map);
- content[strings::msg_params][strings::request_type] = mobile_apis::RequestType::LAUNCH_APP;
+ content[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::LAUNCH_APP;
content[strings::msg_params][strings::app_id] = connection_key;
if (!urlSchema.empty()) {
content[strings::msg_params][strings::url] = urlSchema;
@@ -2712,7 +2774,8 @@ void MessageHelper::SendQueryApps(const uint32_t connection_key,
const uint32_t timeout = policy_handler.TimeoutExchangeSec();
smart_objects::SmartObject content(smart_objects::SmartType_Map);
- content[strings::msg_params][strings::request_type] = mobile_apis::RequestType::QUERY_APPS;
+ content[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::QUERY_APPS;
content[strings::msg_params][strings::url] = policy_handler.RemoteAppsUrl();
content[strings::msg_params][strings::timeout] = timeout;
@@ -2734,7 +2797,8 @@ void MessageHelper::SendQueryApps(const uint32_t connection_key,
content[strings::params][strings::binary_data] =
smart_objects::SmartObject(binary_data);
- content[strings::msg_params][strings::file_type] = mobile_apis::FileType::BINARY;
+ content[strings::msg_params][strings::file_type] =
+ mobile_apis::FileType::BINARY;
SendSystemRequestNotification(connection_key, content, app_mngr);
}
@@ -3342,7 +3406,9 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
}
break;
}
- default: { continue; }
+ default: {
+ continue;
+ }
}
soft_buttons[j++] = request_soft_buttons[i];
@@ -3361,16 +3427,20 @@ void MessageHelper::SubscribeApplicationToSoftButton(
ApplicationSharedPtr app,
int32_t function_id,
const WindowID window_id) {
- SoftButtonID softbuttons_id;
- smart_objects::SmartObject& soft_buttons =
- message_params[strings::soft_buttons];
- unsigned int length = soft_buttons.length();
- for (unsigned int i = 0; i < length; ++i) {
- const auto button_id = std::make_pair(
- soft_buttons[i][strings::soft_button_id].asUInt(), window_id);
- softbuttons_id.insert(button_id);
+ if (!message_params.keyExists(strings::soft_buttons)) {
+ return;
+ }
+
+ std::set<uint32_t> soft_buttons;
+
+ auto& soft_buttons_so = message_params[strings::soft_buttons];
+ for (const auto& softbutton : *(soft_buttons_so.asArray())) {
+ const auto button_id = softbutton[strings::soft_button_id].asUInt();
+ soft_buttons.insert(button_id);
}
- app->SubscribeToSoftButtons(function_id, softbuttons_id);
+
+ WindowSoftButtons window_buttons{window_id, soft_buttons};
+ app->SubscribeToSoftButtons(function_id, window_buttons);
}
void MessageHelper::SubscribeApplicationToSoftButton(
@@ -3405,4 +3475,95 @@ WindowID MessageHelper::ExtractWindowIdFromSmartObject(
return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
}
+uint16_t MessageHelper::RemoveEmptyMessageParams(
+ smart_objects::SmartObject& msg_params) {
+ uint16_t erased_params = 0;
+
+ if (msg_params.empty()) {
+ return erased_params;
+ }
+
+ const auto keys = msg_params.enumerate();
+ for (const auto& key_params : keys) {
+ auto& param = msg_params[key_params];
+
+ if (smart_objects::SmartType_Array == param.getType()) {
+ smart_objects::SmartArray* array = param.asArray();
+
+ if (array == nullptr || array->empty())
+ continue;
+
+ const bool are_all_empty =
+ std::all_of(array->begin(),
+ array->end(),
+ [](const smart_objects::SmartObject& item) {
+ if (smart_objects::SmartType_Array == item.getType() ||
+ smart_objects::SmartType_Map == item.getType()) {
+ return item.empty();
+ }
+
+ return false;
+ });
+
+ if (are_all_empty) {
+ SDL_LOG_DEBUG("Remove empty array " + key_params +
+ " from msg_params in HMI response");
+ msg_params.erase(key_params);
+ ++erased_params;
+ }
+
+ continue;
+ }
+
+ if (smart_objects::SmartType_Map == param.getType()) {
+ if (param.empty()) {
+ SDL_LOG_DEBUG("Remove empty field " + key_params +
+ " from msg_params in HMI response");
+ msg_params.erase(key_params);
+ ++erased_params;
+ }
+ }
+ }
+
+ return erased_params;
+}
+
+void MessageHelper::AddDefaultParamsToTireStatus(
+ ApplicationSharedPtr app, smart_objects::SmartObject& response_from_hmi) {
+ const utils::SemanticVersion max_version_with_mandatory_params(8, 0, 0);
+
+ if (!app) {
+ SDL_LOG_ERROR("Application not found");
+ return;
+ }
+
+ if (app->msg_version() >= max_version_with_mandatory_params) {
+ SDL_LOG_DEBUG(
+ "Tire status parameters are "
+ "non-mandatory for this app version, no need in default values");
+ return;
+ }
+
+ smart_objects::SmartObject& tire_status =
+ response_from_hmi[strings::msg_params][strings::tire_pressure];
+
+ if (!tire_status.keyExists(strings::pressure_telltale)) {
+ tire_status[strings::pressure_telltale] =
+ mobile_apis::WarningLightStatus::WLS_NOT_USED;
+ }
+
+ const std::vector<std::string> tires{strings::left_front,
+ strings::right_front,
+ strings::left_rear,
+ strings::right_rear,
+ strings::inner_left_rear,
+ strings::inner_right_rear};
+ for (const std::string& tire : tires) {
+ if (!tire_status.keyExists(tire)) {
+ tire_status[tire][strings::status] =
+ mobile_apis::ComponentVolumeStatus::CVS_UNKNOWN;
+ }
+ }
+}
+
} // namespace application_manager
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 af44fd033f..7b8deb5e8c 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -55,9 +55,10 @@ void PolicyEventObserver::set_policy_handler(
policy_handler_ = policy_handler;
}
-void PolicyEventObserver::on_event(const event_engine::MobileEvent& event) {}
+void PolicyEventObserver::HandleOnEvent(
+ const event_engine::MobileEvent& event) {}
-void PolicyEventObserver::on_event(const event_engine::Event& event) {
+void PolicyEventObserver::HandleOnEvent(const event_engine::Event& event) {
sync_primitives::AutoLock auto_lock(policy_handler_lock_);
if (!policy_handler_) {
return;
@@ -70,7 +71,9 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 6f6e691db2..1c7dd0166b 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -335,7 +335,8 @@ bool PolicyHandler::LoadPolicyLibrary() {
sync_primitives::AutoWriteLock lock(policy_manager_lock_);
#ifdef __ANDROID__
- const std::string policy_lib_path = application_manager_.get_settings().plugins_folder() + "/" + kLibrary;
+ const std::string policy_lib_path =
+ application_manager_.get_settings().plugins_folder() + "/" + kLibrary;
#else
const std::string policy_lib_path = kLibrary;
#endif
@@ -607,6 +608,10 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
policy_manager->SendNotificationOnPermissionsUpdated(device_id,
policy_app_id);
+
+ if (policy_manager->IsPredataPolicy(policy_app_id) && !is_allowed) {
+ SetHeartBeatTimeout(policy_app_id, (*it_app_list)->app_id());
+ }
}
}
}
@@ -774,6 +779,23 @@ void PolicyHandler::OnAppPermissionConsentInternal(
#endif
}
+void PolicyHandler::SetHeartBeatTimeout(const std::string& policy_app_id,
+ const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ const std::shared_ptr<PolicyManager> policy_manager = LoadPolicyManager();
+ POLICY_LIB_CHECK_VOID(policy_manager);
+
+ const uint32_t timeout = policy_manager->HeartBeatTimeout(policy_app_id);
+ if (0 != timeout) {
+ SDL_LOG_DEBUG("SetHeartBeatTimeout for " << app_id << " is " << timeout);
+ application_manager_.connection_handler().SetHeartBeatTimeout(app_id,
+ timeout);
+ } else {
+ SDL_LOG_DEBUG("SetHeartBeatTimeout for " << app_id << " ignored");
+ }
+}
+
void policy::PolicyHandler::SetDaysAfterEpoch() {
const auto policy_manager = LoadPolicyManager();
POLICY_LIB_CHECK_VOID(policy_manager);
@@ -824,7 +846,7 @@ void PolicyHandler::OnSystemRequestReceived() const {
}
void PolicyHandler::TriggerPTUOnStartupIfRequired() {
-#ifdef PROPRIETARY_MODE
+#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
const auto policy_manager = LoadPolicyManager();
POLICY_LIB_CHECK_VOID(policy_manager);
policy_manager->TriggerPTUOnStartupIfRequired();
@@ -852,12 +874,11 @@ void PolicyHandler::ExchangePolicyManager(
atomic_policy_manager_.swap(policy_manager);
}
-std::vector<policy::FunctionalGroupPermission>
-PolicyHandler::CollectRegisteredAppsPermissions() {
+bool PolicyHandler::CollectRegisteredAppsPermissions(
+ std::vector<FunctionalGroupPermission>& out_permissions) {
SDL_LOG_AUTO_TRACE();
const auto policy_manager = LoadPolicyManager();
- POLICY_LIB_CHECK_OR_RETURN(policy_manager,
- std::vector<policy::FunctionalGroupPermission>());
+ POLICY_LIB_CHECK_OR_RETURN(policy_manager, false);
// If no specific app was passed, get permissions for all currently registered
// applications
sync_primitives::AutoLock lock(app_to_device_link_lock_);
@@ -873,14 +894,17 @@ PolicyHandler::CollectRegisteredAppsPermissions() {
it->first, it->second, group_permissions);
consolidator.Consolidate(group_permissions);
}
- return consolidator.GetConsolidatedPermissions();
+
+ out_permissions = consolidator.GetConsolidatedPermissions();
+ return true;
}
-std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
- const uint32_t connection_key) {
+bool PolicyHandler::CollectAppPermissions(
+ const uint32_t connection_key,
+ std::vector<policy::FunctionalGroupPermission>& out_permissions) {
std::vector<FunctionalGroupPermission> group_permissions;
const auto policy_manager = LoadPolicyManager();
- POLICY_LIB_CHECK_OR_RETURN(policy_manager, group_permissions);
+ POLICY_LIB_CHECK_OR_RETURN(policy_manager, false);
// Single app only
ApplicationSharedPtr app = application_manager_.application(connection_key);
@@ -891,7 +915,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
<< "' "
"not found within registered applications.");
- return group_permissions;
+ return false;
}
DeviceParams device_params = GetDeviceParams(
@@ -900,14 +924,13 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
if (device_params.device_mac_address.empty()) {
SDL_LOG_WARN("Couldn't find device, which hosts application.");
- return group_permissions;
+ return false;
}
- policy_manager->GetUserConsentForApp(device_params.device_mac_address,
- app->policy_app_id(),
- group_permissions);
+ policy_manager->GetUserConsentForApp(
+ device_params.device_mac_address, app->policy_app_id(), out_permissions);
- return group_permissions;
+ return true;
}
void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
@@ -921,15 +944,12 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
const bool is_app_registered = NULL != app.get();
const bool is_connection_key_valid = is_app_registered && connection_key;
- const std::vector<policy::FunctionalGroupPermission> permissions =
- is_connection_key_valid ? CollectAppPermissions(connection_key)
- : CollectRegisteredAppsPermissions();
+ std::vector<policy::FunctionalGroupPermission> permissions;
- if (permissions.empty() && is_connection_key_valid) {
- SDL_LOG_ERROR("No permissions found for application with connection key:"
- << connection_key);
- return;
- }
+ const bool collect_result =
+ is_connection_key_valid
+ ? CollectAppPermissions(connection_key, permissions)
+ : CollectRegisteredAppsPermissions(permissions);
MessageHelper::SendGetListOfPermissionsResponse(
permissions,
@@ -937,7 +957,14 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
policy_manager->GetExternalConsentStatus(),
#endif // EXTERNAL_PROPRIETARY_MODE
correlation_id,
- application_manager_);
+ application_manager_,
+ collect_result);
+
+ if (!collect_result) {
+ SDL_LOG_ERROR(
+ "Permissions collection failed for application with connection key:"
+ << connection_key);
+ }
}
void PolicyHandler::LinkAppsToDevice() {
@@ -1083,6 +1110,14 @@ void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
policy_manager->SetSystemInfo(ccpu_version, wers_country_code, language);
}
+void PolicyHandler::OnHardwareVersionReceived(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ const auto policy_manager = LoadPolicyManager();
+ POLICY_LIB_CHECK_VOID(policy_manager);
+ policy_manager->SetHardwareVersion(hardware_version);
+}
+
std::string PolicyHandler::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
const auto policy_manager = LoadPolicyManager();
@@ -1090,6 +1125,13 @@ std::string PolicyHandler::GetCCPUVersionFromPT() const {
return policy_manager->GetCCPUVersionFromPT();
}
+std::string PolicyHandler::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ const auto policy_manager = LoadPolicyManager();
+ POLICY_LIB_CHECK_OR_RETURN(policy_manager, std::string());
+ return policy_manager->GetHardwareVersionFromPT();
+}
+
void PolicyHandler::OnVIIsReady() {
SDL_LOG_AUTO_TRACE();
const uint32_t correlation_id =
@@ -1203,12 +1245,6 @@ void PolicyHandler::OnPendingPermissionChange(
}
bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
- const std::string& url) {
- const uint32_t app_id = GetAppIdForSending();
- return SendMessageToSDK(pt_string, url, app_id);
-}
-
-bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
const std::string& url,
const uint32_t app_id) {
SDL_LOG_AUTO_TRACE();
@@ -1366,7 +1402,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
}
#ifdef EXTERNAL_PROPRIETARY_MODE
-
ApplicationSet applications;
{
DataAccessor<ApplicationSet> accessor =
@@ -1412,7 +1447,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
}
#ifdef EXTERNAL_PROPRIETARY_MODE
-
if (last_activated_app_id_) {
ApplicationSharedPtr app =
application_manager_.application(last_activated_app_id_);
@@ -1423,7 +1457,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
<< "' not found among registered applications.");
return;
}
- if (is_allowed) {
+
+ bool is_allowed_by_policies = true;
+ if (PolicyEnabled()) {
+ is_allowed_by_policies =
+ !policy_manager->IsApplicationRevoked(app->policy_app_id());
+ }
+
+ if (is_allowed && is_allowed_by_policies) {
// Send HMI status notification to mobile
// Put application in full
AudioStreamingState::eType audio_state =
@@ -1496,7 +1537,9 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
// is not allowed.
if (!permissions.isSDLAllowed) {
permissions.priority.clear();
- last_activated_app_id_ = connection_key;
+ if (!permissions.appRevoked) {
+ last_activated_app_id_ = connection_key;
+ }
}
if (permissions.appRevoked) {
@@ -1973,7 +2016,9 @@ void PolicyHandler::AddStatisticsInfo(int type) {
++count_of_iap_buffer_full;
break;
}
- default: { SDL_LOG_WARN("Type of statistics is unknown"); }
+ default: {
+ SDL_LOG_WARN("Type of statistics is unknown");
+ }
}
}
@@ -1992,7 +2037,9 @@ void PolicyHandler::OnSystemError(int code) {
++count_sync_out_of_memory;
break;
}
- default: { SDL_LOG_WARN("System error is unknown"); }
+ default: {
+ SDL_LOG_WARN("System error is unknown");
+ }
}
}
diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc
deleted file mode 100644
index abb2926c9e..0000000000
--- a/src/components/application_manager/src/policies/policy_retry_sequence.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- 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/policies/policy_retry_sequence.h"
-
-#include <unistd.h>
-
-#include "application_manager/policies/policy_handler.h"
-
-namespace policy {
-
-SDL_CREATE_LOG_VARIABLE("PolicyHandler")
-
-RetrySequence::RetrySequence(PolicyHandler* const policy_handler)
- // TODO (Risk copy of PolicyHandler Pointer)
- : policy_handler_(policy_handler) {}
-
-void RetrySequence::threadMain() {
- StartNextRetry();
-}
-
-void RetrySequence::StartNextRetry() {
- SDL_LOG_TRACE("Start next retry of exchanging PT");
- DCHECK(policy_handler_);
- // TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib
-
- BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate();
- if (pt_snapshot) {
- policy_handler_->SendMessageToSDK(*pt_snapshot);
-
- const uint32_t timeout = policy_handler_->TimeoutExchangeSec();
- const int seconds = policy_handler_->NextRetryTimeout();
- SDL_LOG_DEBUG("Timeout response: " << timeout << " Next try: " << seconds);
- if (timeout > 0) {
- sleep(timeout);
- policy_handler_->OnExceededTimeout();
- }
- if (seconds > 0) {
- sleep(seconds);
- StartNextRetry();
- } else {
- SDL_LOG_INFO("End retry sequence. Update PT was not received");
- policy_handler_->OnPTUFinished(false);
- }
- }
-}
-
-} // namespace policy
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller_impl.cc
index a34457ff66..76d4a70330 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller_impl.cc
@@ -30,12 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger.h"
+#include "application_manager/request_controller.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "application_manager/commands/request_to_hmi.h"
-#include "application_manager/request_controller.h"
-
+#include "application_manager/request_controller_impl.h"
+#include "utils/logger.h"
#include "utils/timer_task_impl.h"
namespace application_manager {
@@ -46,41 +47,60 @@ using namespace sync_primitives;
SDL_CREATE_LOG_VARIABLE("RequestController")
-RequestController::RequestController(const RequestControlerSettings& settings)
- : pool_state_(UNDEFINED)
+RequestControllerImpl::RequestControllerImpl(
+ const RequestControlerSettings& settings,
+ RequestTimeoutHandler& request_timeout_handler,
+ event_engine::EventDispatcher& event_dispatcher)
+ : threads::AsyncRunner("RequestController async runner")
+ , pool_state_(TPoolState::UNDEFINED)
, pool_size_(settings.thread_pool_size())
, request_tracker_(settings)
, duplicate_message_count_()
, timer_("AM RequestCtrlTimer",
- new timer::TimerTaskImpl<RequestController>(
- this, &RequestController::TimeoutThread))
+ new timer::TimerTaskImpl<RequestControllerImpl>(
+ this, &RequestControllerImpl::TimeoutThread))
, timer_stop_flag_(false)
, is_low_voltage_(false)
- , settings_(settings) {
+ , settings_(settings)
+ , request_timeout_handler_(request_timeout_handler)
+ , event_dispatcher_(event_dispatcher) {
SDL_LOG_AUTO_TRACE();
InitializeThreadpool();
timer_.Start(0, timer::kSingleShot);
}
-RequestController::~RequestController() {
+RequestControllerImpl::~RequestControllerImpl() {
SDL_LOG_AUTO_TRACE();
+ Stop();
+}
+
+void RequestControllerImpl::Stop() {
+ SDL_LOG_AUTO_TRACE();
+
{
sync_primitives::AutoLock auto_lock(timer_lock);
timer_stop_flag_ = true;
timer_condition_.Broadcast();
}
- timer_.Stop();
+
if (pool_state_ != TPoolState::STOPPED) {
DestroyThreadpool();
}
+
+ SDL_LOG_DEBUG("Stopping async runner");
+ AsyncRunner::Stop();
+
+ SDL_LOG_DEBUG("Stopping timeout tracker");
+ timer_.Stop();
}
-void RequestController::InitializeThreadpool() {
+void RequestControllerImpl::InitializeThreadpool() {
SDL_LOG_AUTO_TRACE();
+
// TODO(DK): Consider lazy loading threads instead of creating all at once
pool_state_ = TPoolState::STARTED;
char name[50];
- for (uint32_t i = 0; i < pool_size_; i++) {
+ for (uint32_t i = 0; i < pool_size_; ++i) {
snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %u", i);
pool_.push_back(threads::CreateThread(name, new Worker(this)));
pool_[i]->Start();
@@ -88,7 +108,7 @@ void RequestController::InitializeThreadpool() {
}
}
-void RequestController::DestroyThreadpool() {
+void RequestControllerImpl::DestroyThreadpool() {
SDL_LOG_AUTO_TRACE();
{
AutoLock auto_lock(mobile_request_list_lock_);
@@ -96,7 +116,7 @@ void RequestController::DestroyThreadpool() {
SDL_LOG_DEBUG("Broadcasting STOP signal to all threads...");
cond_var_.Broadcast(); // notify all threads we are shutting down
}
- for (size_t i = 0; i < pool_.size(); i++) {
+ for (size_t i = 0; i < pool_.size(); ++i) {
threads::Thread* thread = pool_[i];
thread->Stop(threads::Thread::kThreadSoftStop);
delete thread->GetDelegate();
@@ -105,12 +125,12 @@ void RequestController::DestroyThreadpool() {
pool_.clear();
}
-RequestController::TResult RequestController::CheckPosibilitytoAdd(
+RequestControllerImpl::TResult RequestControllerImpl::CheckPosibilitytoAdd(
const RequestPtr request, const mobile_apis::HMILevel::eType level) {
SDL_LOG_AUTO_TRACE();
if (!CheckPendingRequestsAmount(settings_.pending_requests_amount())) {
SDL_LOG_ERROR("Too many pending request");
- return RequestController::TOO_MANY_PENDING_REQUESTS;
+ return RequestController::TResult::TOO_MANY_PENDING_REQUESTS;
}
const TrackResult track_result =
@@ -118,25 +138,26 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd(
if (TrackResult::kNoneLevelMaxRequestsExceeded == track_result) {
SDL_LOG_ERROR("Too many application requests in hmi level NONE");
- return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS;
+ return RequestController::TResult::NONE_HMI_LEVEL_MANY_REQUESTS;
}
if (TrackResult::kMaxRequestsExceeded == track_result) {
SDL_LOG_ERROR("Too many application requests");
- return RequestController::TOO_MANY_REQUESTS;
+ return RequestController::TResult::TOO_MANY_REQUESTS;
}
if (IsLowVoltage()) {
SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active");
- return RequestController::INVALID_DATA;
+ return RequestController::TResult::INVALID_DATA;
}
- return SUCCESS;
+ return TResult::SUCCESS;
}
-bool RequestController::CheckPendingRequestsAmount(
- const uint32_t& pending_requests_amount) {
+bool RequestControllerImpl::CheckPendingRequestsAmount(
+ const uint32_t pending_requests_amount) {
SDL_LOG_AUTO_TRACE();
+
if (pending_requests_amount > 0) {
const size_t pending_requests_size = mobile_request_list_.size();
const bool available_to_add =
@@ -152,19 +173,19 @@ bool RequestController::CheckPendingRequestsAmount(
return true;
}
-RequestController::TResult RequestController::addMobileRequest(
+RequestController::TResult RequestControllerImpl::AddMobileRequest(
const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) {
SDL_LOG_AUTO_TRACE();
if (!request) {
SDL_LOG_ERROR("Null Pointer request");
cond_var_.NotifyOne();
- return INVALID_DATA;
+ return TResult::INVALID_DATA;
}
SDL_LOG_DEBUG("correlation_id : " << request->correlation_id()
<< "connection_key : "
<< request->connection_key());
RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level);
- if (SUCCESS == result) {
+ if (TResult::SUCCESS == result) {
AutoLock auto_lock_list(mobile_request_list_lock_);
mobile_request_list_.push_back(request);
SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size());
@@ -174,13 +195,13 @@ RequestController::TResult RequestController::addMobileRequest(
return result;
}
-RequestController::TResult RequestController::addHMIRequest(
+RequestController::TResult RequestControllerImpl::AddHMIRequest(
const RequestPtr request) {
SDL_LOG_AUTO_TRACE();
if (request.use_count() == 0) {
SDL_LOG_ERROR("HMI request pointer is invalid");
- return RequestController::INVALID_DATA;
+ return RequestController::TResult::INVALID_DATA;
}
SDL_LOG_DEBUG(" correlation_id : " << request->correlation_id());
@@ -197,18 +218,19 @@ RequestController::TResult RequestController::addHMIRequest(
if (IsLowVoltage()) {
SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active");
- return RequestController::INVALID_DATA;
+ return RequestController::TResult::INVALID_DATA;
}
waiting_for_response_.Add(request_info_ptr);
SDL_LOG_DEBUG("Waiting for response count:" << waiting_for_response_.Size());
NotifyTimer();
- return RequestController::SUCCESS;
+ return RequestController::TResult::SUCCESS;
}
-void RequestController::addNotification(const RequestPtr ptr) {
+void RequestControllerImpl::AddNotification(const RequestPtr ptr) {
SDL_LOG_AUTO_TRACE();
+
if (IsLowVoltage()) {
SDL_LOG_ERROR(
"Impossible to add notification due to Low Voltage is active");
@@ -217,7 +239,7 @@ void RequestController::addNotification(const RequestPtr ptr) {
notification_list_.push_back(ptr);
}
-void RequestController::removeNotification(
+void RequestControllerImpl::RemoveNotification(
const commands::Command* notification) {
SDL_LOG_AUTO_TRACE();
std::list<RequestPtr>::iterator it = notification_list_.begin();
@@ -233,20 +255,65 @@ void RequestController::removeNotification(
SDL_LOG_DEBUG("Cannot find notification");
}
-void RequestController::TerminateRequest(const uint32_t correlation_id,
- const uint32_t connection_key,
- const int32_t function_id,
- bool force_terminate) {
+bool RequestControllerImpl::RetainRequestInstance(
+ const uint32_t connection_key, const uint32_t correlation_id) {
+ SDL_LOG_AUTO_TRACE();
+ auto request = waiting_for_response_.Find(connection_key, correlation_id);
+ if (request) {
+ retained_mobile_requests_.insert(request);
+ SDL_LOG_DEBUG("Request (" << connection_key << ", " << correlation_id
+ << ") has been retained");
+ }
+ SDL_LOG_DEBUG(
+ "Total retained requests: " << retained_mobile_requests_.size());
+
+ return static_cast<bool>(request);
+}
+
+bool RequestControllerImpl::RemoveRetainedRequest(
+ const uint32_t connection_key, const uint32_t correlation_id) {
+ SDL_LOG_AUTO_TRACE();
+ for (auto it = retained_mobile_requests_.begin();
+ it != retained_mobile_requests_.end();
+ ++it) {
+ if ((*it)->request()->connection_key() == connection_key &&
+ (*it)->request()->correlation_id() == correlation_id) {
+ SDL_LOG_DEBUG("Removing request (" << connection_key << ", "
+ << correlation_id << ")");
+ retained_mobile_requests_.erase(it);
+
+ SDL_LOG_DEBUG(
+ "Total retained requests: " << retained_mobile_requests_.size());
+ return true;
+ }
+ }
+
+ SDL_LOG_ERROR("Can't find request (" << connection_key << ", "
+ << correlation_id << ")");
+ return false;
+}
+
+bool RequestControllerImpl::IsStillWaitingForResponse(
+ const uint32_t connection_key, const uint32_t correlation_id) const {
+ auto request = waiting_for_response_.Find(connection_key, correlation_id);
+ return static_cast<bool>(request);
+}
+
+void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id,
+ bool force_terminate) {
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG("correlation_id = "
<< correlation_id << " connection_key = " << connection_key
<< " function_id = " << function_id
<< " force_terminate = " << force_terminate);
+
{
AutoLock auto_lock(duplicate_message_count_lock_);
auto dup_it = duplicate_message_count_.find(correlation_id);
if (duplicate_message_count_.end() != dup_it) {
- duplicate_message_count_[correlation_id]--;
+ --duplicate_message_count_[correlation_id];
if (0 == duplicate_message_count_[correlation_id]) {
duplicate_message_count_.erase(dup_it);
}
@@ -268,28 +335,37 @@ void RequestController::TerminateRequest(const uint32_t correlation_id,
return;
}
if (force_terminate || request->request()->AllowedToTerminate()) {
+ event_dispatcher_.remove_observer(
+ static_cast<hmi_apis::FunctionID::eType>(function_id), correlation_id);
waiting_for_response_.RemoveRequest(request);
+ if (RequestInfo::HMIRequest == request->request_type()) {
+ request_timeout_handler_.RemoveRequest(request->requestId());
+ }
+
} else {
- SDL_LOG_WARN("Request was not terminated");
+ SDL_LOG_WARN("Request was not terminated "
+ << "correlation_id = " << correlation_id
+ << " function_id = " << function_id);
}
NotifyTimer();
}
-void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id,
- const uint32_t connection_key,
- const int32_t function_id) {
+void RequestControllerImpl::OnMobileResponse(
+ const uint32_t mobile_correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id) {
SDL_LOG_AUTO_TRACE();
TerminateRequest(mobile_correlation_id, connection_key, function_id);
}
-void RequestController::OnHMIResponse(const uint32_t correlation_id,
- const int32_t function_id) {
+void RequestControllerImpl::OnHMIResponse(const uint32_t correlation_id,
+ const int32_t function_id) {
SDL_LOG_AUTO_TRACE();
- TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id);
+ TerminateRequest(correlation_id, RequestInfo::kHmiConnectionKey, function_id);
}
-void RequestController::terminateWaitingForExecutionAppRequests(
- const uint32_t& app_id) {
+void RequestControllerImpl::TerminateWaitingForExecutionAppRequests(
+ const uint32_t app_id) {
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG("app_id: " << app_id << "Waiting for execution"
<< mobile_request_list_.size());
@@ -306,15 +382,54 @@ void RequestController::terminateWaitingForExecutionAppRequests(
SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size());
}
-void RequestController::terminateWaitingForResponseAppRequests(
- const uint32_t& app_id) {
+void RequestControllerImpl::scheduleRequestsCleanup(
+ const RequestInfoPtrs& requests) {
SDL_LOG_AUTO_TRACE();
- waiting_for_response_.RemoveByConnectionKey(app_id);
- SDL_LOG_DEBUG(
- "Waiting for response count : " << waiting_for_response_.Size());
+ AsyncRun(new RequestCleanerDelegate(requests));
}
-void RequestController::terminateAppRequests(const uint32_t& app_id) {
+void RequestControllerImpl::TerminateWaitingForResponseAppRequests(
+ const uint32_t app_id) {
+ SDL_LOG_AUTO_TRACE();
+ SDL_LOG_DEBUG("Waiting for response count before cleanup: "
+ << waiting_for_response_.Size());
+
+ RequestInfoPtrs requests_to_terminate;
+
+ auto pending_requests =
+ waiting_for_response_.GetRequestsByConnectionKey(app_id);
+ for (auto it = pending_requests.begin(); it != pending_requests.end(); ++it) {
+ auto request_ptr = (*it)->request();
+ if (!request_ptr->CleanUp()) {
+ SDL_LOG_WARN("Request with corr_id: "
+ << request_ptr->correlation_id()
+ << " can't be terminated right now. Keep in the queue");
+ continue;
+ }
+
+ SDL_LOG_DEBUG(
+ "Removing request with corr_id: " << request_ptr->correlation_id());
+ requests_to_terminate.push_back(*it);
+ waiting_for_response_.RemoveRequest(*it);
+ }
+
+ SDL_LOG_DEBUG("Waiting for response count after cleanup: "
+ << waiting_for_response_.Size());
+
+ // It is necessary to release requests references after some short amount of
+ // time because here might be a possible data races in event dispatcher
+ // between GetNextObserver() and IncrementReferenceCount() when reference to
+ // corresponding request is destroyed by that function right after CleanUp()
+ // This micro delay gives a time to event dispatcher to figure out that
+ // request was finalized and event should not be handled
+ if (!requests_to_terminate.empty()) {
+ SDL_LOG_DEBUG("Scheduling cleanup for " << requests_to_terminate.size()
+ << " requests for app " << app_id);
+ scheduleRequestsCleanup(requests_to_terminate);
+ }
+}
+
+void RequestControllerImpl::TerminateAppRequests(const uint32_t app_id) {
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG("app_id : " << app_id
<< "Requests waiting for execution count : "
@@ -322,18 +437,19 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) {
<< "Requests waiting for response count : "
<< waiting_for_response_.Size());
- terminateWaitingForExecutionAppRequests(app_id);
- terminateWaitingForResponseAppRequests(app_id);
+ TerminateWaitingForExecutionAppRequests(app_id);
+ TerminateWaitingForResponseAppRequests(app_id);
NotifyTimer();
}
-void RequestController::terminateAllHMIRequests() {
+void RequestControllerImpl::TerminateAllHMIRequests() {
SDL_LOG_AUTO_TRACE();
- terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey);
+ TerminateWaitingForResponseAppRequests(RequestInfo::kHmiConnectionKey);
}
-void RequestController::terminateAllMobileRequests() {
+void RequestControllerImpl::TerminateAllMobileRequests() {
SDL_LOG_AUTO_TRACE();
+
waiting_for_response_.RemoveMobileRequests();
SDL_LOG_DEBUG("Mobile Requests waiting for response cleared");
AutoLock waiting_execution_auto_lock(mobile_request_list_lock_);
@@ -342,21 +458,30 @@ void RequestController::terminateAllMobileRequests() {
NotifyTimer();
}
-void RequestController::updateRequestTimeout(const uint32_t& app_id,
- const uint32_t& correlation_id,
- const uint32_t& new_timeout) {
+void RequestControllerImpl::UpdateRequestTimeout(const uint32_t app_id,
+ const uint32_t correlation_id,
+ const uint32_t new_timeout) {
SDL_LOG_AUTO_TRACE();
-
SDL_LOG_DEBUG("app_id : " << app_id
<< " mobile_correlation_id : " << correlation_id
<< " new_timeout : " << new_timeout);
- SDL_LOG_DEBUG(
- "New_timeout is NULL. RequestCtrl will "
- "not manage this request any more");
+
+ if (new_timeout == 0) {
+ SDL_LOG_DEBUG(
+ "New_timeout is NULL. RequestCtrl will "
+ "not manage this request any more");
+ }
RequestInfoPtr request_info =
waiting_for_response_.Find(app_id, correlation_id);
if (request_info) {
+ if (0 == request_info->timeout_msec()) {
+ SDL_LOG_INFO(
+ "Request with zero timeout is not updating, "
+ "manual control is assumed");
+ return;
+ }
+
waiting_for_response_.RemoveRequest(request_info);
request_info->updateTimeOut(new_timeout);
waiting_for_response_.Add(request_info);
@@ -371,26 +496,32 @@ void RequestController::updateRequestTimeout(const uint32_t& app_id,
}
}
-void RequestController::OnLowVoltage() {
+void RequestControllerImpl::OnLowVoltage() {
SDL_LOG_AUTO_TRACE();
is_low_voltage_ = true;
}
-void RequestController::OnWakeUp() {
+void RequestControllerImpl::OnWakeUp() {
SDL_LOG_AUTO_TRACE();
- terminateAllHMIRequests();
- terminateAllMobileRequests();
+ TerminateAllHMIRequests();
+ TerminateAllMobileRequests();
is_low_voltage_ = false;
SDL_LOG_DEBUG("Terminate old requests done");
}
-bool RequestController::IsLowVoltage() {
+bool RequestControllerImpl::IsLowVoltage() {
SDL_LOG_TRACE("result: " << is_low_voltage_);
return is_low_voltage_;
}
-void RequestController::TimeoutThread() {
+void RequestControllerImpl::TimeoutThread() {
SDL_LOG_AUTO_TRACE();
+
+ if (TPoolState::STOPPED == pool_state_) {
+ SDL_LOG_DEBUG("Thread pool has been stopped. Skipping timer restart");
+ return;
+ }
+
SDL_LOG_DEBUG(
"ENTER Waiting fore response count: " << waiting_for_response_.Size());
sync_primitives::AutoLock auto_lock(timer_lock);
@@ -427,18 +558,22 @@ void RequestController::TimeoutThread() {
<< " request id: " << probably_expired->requestId()
<< " connection_key: " << probably_expired->app_id()
<< " is expired");
- const uint32_t experied_request_id = probably_expired->requestId();
- const uint32_t experied_app_id = probably_expired->app_id();
+ const uint32_t expired_request_id = probably_expired->requestId();
+ const uint32_t expired_app_id = probably_expired->app_id();
+
+ probably_expired->request()->HandleTimeOut();
- probably_expired->request()->onTimeOut();
- if (RequestInfo::HmiConnectionKey == probably_expired->app_id()) {
+ if (RequestInfo::kHmiConnectionKey == probably_expired->app_id()) {
SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId());
waiting_for_response_.RemoveRequest(probably_expired);
+ if (RequestInfo::HMIRequest == probably_expired->request_type()) {
+ request_timeout_handler_.RemoveRequest(expired_request_id);
+ }
}
probably_expired = waiting_for_response_.FrontWithNotNullTimeout();
if (probably_expired) {
- if (experied_request_id == probably_expired->requestId() &&
- experied_app_id == probably_expired->app_id()) {
+ if (expired_request_id == probably_expired->requestId() &&
+ expired_app_id == probably_expired->app_id()) {
SDL_LOG_DEBUG("Expired request wasn't removed");
break;
}
@@ -448,12 +583,12 @@ void RequestController::TimeoutThread() {
"EXIT Waiting for response count : " << waiting_for_response_.Size());
}
-RequestController::Worker::Worker(RequestController* requestController)
- : request_controller_(requestController), stop_flag_(false) {}
+RequestControllerImpl::Worker::Worker(RequestControllerImpl* request_controller)
+ : request_controller_(request_controller), stop_flag_(false) {}
-RequestController::Worker::~Worker() {}
+RequestControllerImpl::Worker::~Worker() {}
-void RequestController::Worker::threadMain() {
+void RequestControllerImpl::Worker::threadMain() {
SDL_LOG_AUTO_TRACE();
AutoLock auto_lock(thread_lock_);
while (!stop_flag_) {
@@ -490,8 +625,8 @@ void RequestController::Worker::threadMain() {
std::make_shared<MobileRequestInfo>(request_ptr, timeout_in_mseconds);
if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) {
- commands::CommandRequestImpl* cmd_request =
- dynamic_cast<commands::CommandRequestImpl*>(request_ptr.get());
+ commands::RequestFromMobileImpl* cmd_request =
+ dynamic_cast<commands::RequestFromMobileImpl*>(request_ptr.get());
if (cmd_request != NULL) {
uint32_t corr_id = cmd_request->correlation_id();
request_controller_->duplicate_message_count_lock_.Acquire();
@@ -531,13 +666,39 @@ void RequestController::Worker::threadMain() {
}
}
-void RequestController::Worker::exitThreadMain() {
+void RequestControllerImpl::Worker::exitThreadMain() {
stop_flag_ = true;
// setup stop flag and whit while threadMain will be finished correctly
// FIXME (dchmerev@luxoft.com): There is no waiting
}
-void RequestController::NotifyTimer() {
+RequestControllerImpl::RequestCleanerDelegate::RequestCleanerDelegate(
+ const RequestInfoPtrs& requests)
+ : requests_(requests) {}
+
+RequestControllerImpl::RequestCleanerDelegate::~RequestCleanerDelegate() {
+ SDL_LOG_AUTO_TRACE();
+}
+
+void RequestControllerImpl::RequestCleanerDelegate::exitThreadMain() {
+ sync_primitives::AutoLock lock(state_lock_);
+ state_cond_.NotifyOne();
+}
+
+void RequestControllerImpl::RequestCleanerDelegate::threadMain() {
+ SDL_LOG_DEBUG("Prepare to cleanup of " << requests_.size() << " requests");
+
+ {
+ SDL_LOG_DEBUG("Waiting...");
+ sync_primitives::AutoLock lock(state_lock_);
+ state_cond_.WaitFor(lock, 50);
+ }
+
+ SDL_LOG_DEBUG("Releasing references");
+ requests_.clear();
+}
+
+void RequestControllerImpl::NotifyTimer() {
SDL_LOG_AUTO_TRACE();
timer_condition_.NotifyOne();
}
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index e1fffdf6fe..60d00b65de 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -42,12 +42,12 @@ namespace request_controller {
SDL_CREATE_LOG_VARIABLE("RequestController")
-uint32_t RequestInfo::HmiConnectionKey = 0;
+constexpr uint32_t RequestInfo::kHmiConnectionKey;
HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec)
: RequestInfo(request, HMIRequest, timeout_msec) {
correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectionKey;
+ app_id_ = RequestInfo::kHmiConnectionKey;
}
HMIRequestInfo::HMIRequestInfo(RequestPtr request,
@@ -55,7 +55,7 @@ HMIRequestInfo::HMIRequestInfo(RequestPtr request,
const uint64_t timeout_msec)
: RequestInfo(request, HMIRequest, start_time, timeout_msec) {
correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectionKey;
+ app_id_ = RequestInfo::kHmiConnectionKey;
}
MobileRequestInfo::MobileRequestInfo(RequestPtr request,
@@ -92,6 +92,7 @@ void application_manager::request_controller::RequestInfo::updateEndTime() {
void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) {
timeout_msec_ = timeout_msec;
updateEndTime();
+ request_->OnUpdateTimeOut();
}
bool RequestInfo::isExpired() {
@@ -132,13 +133,13 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) {
<< request_info->requestId());
sync_primitives::AutoLock lock(pending_requests_lock_);
CheckSetSizes();
- const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt =
+ const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_result =
hash_sorted_pending_requests_.insert(request_info);
- if (insert_resilt.second == true) {
- const std::pair<TimeSortedRequestInfoSet::iterator, bool>& insert_resilt =
+ if (insert_result.second == true) {
+ const std::pair<TimeSortedRequestInfoSet::iterator, bool>& insert_result =
time_sorted_pending_requests_.insert(request_info);
- DCHECK(insert_resilt.second);
- if (!insert_resilt.second) {
+ DCHECK(insert_result.second);
+ if (!insert_result.second) {
return false;
}
CheckSetSizes();
@@ -153,7 +154,7 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) {
}
RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key,
- const uint32_t correlation_id) {
+ const uint32_t correlation_id) const {
RequestInfoPtr result;
// Request info for searching in request info set by log_n time
@@ -197,6 +198,22 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
return result;
}
+std::list<RequestInfoPtr> RequestInfoSet::GetRequestsByConnectionKey(
+ const uint32_t connection_key) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(pending_requests_lock_);
+
+ std::list<RequestInfoPtr> output_list;
+ AppIdCompararator comparator(AppIdCompararator::Equal, connection_key);
+
+ std::copy_if(hash_sorted_pending_requests_.begin(),
+ hash_sorted_pending_requests_.end(),
+ std::back_inserter(output_list),
+ comparator);
+
+ return output_list;
+}
+
bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
DCHECK(request_info);
if (!request_info) {
@@ -244,7 +261,7 @@ uint32_t RequestInfoSet::RemoveRequests(
HashSortedRequestInfoSet::iterator to_erase = it++;
Erase(*to_erase);
it = std::find_if(it, hash_sorted_pending_requests_.end(), filter);
- erased++;
+ ++erased;
}
CheckSetSizes();
return erased;
@@ -259,7 +276,7 @@ uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) {
uint32_t RequestInfoSet::RemoveMobileRequests() {
SDL_LOG_AUTO_TRACE();
return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual,
- RequestInfo::HmiConnectionKey));
+ RequestInfo::kHmiConnectionKey));
}
const size_t RequestInfoSet::Size() {
diff --git a/src/components/application_manager/src/request_timeout_handler_impl.cc b/src/components/application_manager/src/request_timeout_handler_impl.cc
new file mode 100644
index 0000000000..1ac72393a0
--- /dev/null
+++ b/src/components/application_manager/src/request_timeout_handler_impl.cc
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2020, 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/request_timeout_handler_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/request_info.h"
+#include "utils/logger.h"
+
+SDL_CREATE_LOG_VARIABLE("RequestTimeoutHandler")
+
+namespace application_manager {
+namespace request_controller {
+
+RequestTimeoutHandlerImpl::RequestTimeoutHandlerImpl(
+ ApplicationManager& application_manager)
+ : EventObserver(application_manager.event_dispatcher())
+ , application_manager_(application_manager) {
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
+}
+
+void RequestTimeoutHandlerImpl::AddRequest(const uint32_t hmi_correlation_id,
+ const Request& request) {
+ requests_.insert(std::make_pair(hmi_correlation_id, request));
+}
+
+void RequestTimeoutHandlerImpl::RemoveRequest(
+ const uint32_t hmi_correlation_id) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(requests_lock_);
+ auto it = requests_.find(hmi_correlation_id);
+ if (it != requests_.end()) {
+ requests_.erase(it);
+ };
+}
+
+bool RequestTimeoutHandlerImpl::IsTimeoutUpdateRequired(
+ const Request& request,
+ const uint32_t timeout,
+ const hmi_apis::FunctionID::eType method_name) {
+ if (0 == timeout) {
+ SDL_LOG_WARN("Zero timeout ignored");
+ return false;
+ }
+
+ if (static_cast<hmi_apis::FunctionID::eType>(request.hmi_function_id_) !=
+ method_name) {
+ SDL_LOG_WARN("Method name does not match the hmi function id");
+ return false;
+ }
+
+ return true;
+}
+
+void RequestTimeoutHandlerImpl::HandleOnEvent(
+ const event_engine::Event& event) {
+ SDL_LOG_AUTO_TRACE();
+ const auto event_id = event.id();
+ if (hmi_apis::FunctionID::BasicCommunication_OnResetTimeout == event_id) {
+ const smart_objects::SmartObject& message = event.smart_object();
+ const auto method_name = StringToEnum<hmi_apis::FunctionID::eType>(
+ message[strings::msg_params][strings::method_name].asString());
+
+ if (hmi_apis::FunctionID::INVALID_ENUM == method_name) {
+ SDL_LOG_WARN(
+ "Wrong method name received: "
+ << message[strings::msg_params][strings::method_name].asString());
+ return;
+ }
+ uint32_t timeout = application_manager_.get_settings().default_timeout();
+ if (message[strings::msg_params].keyExists(strings::reset_period)) {
+ timeout = message[strings::msg_params][strings::reset_period].asUInt();
+ }
+ const auto hmi_corr_id =
+ message[strings::msg_params][strings::request_id].asUInt();
+ auto it = requests_.find(hmi_corr_id);
+ if (it != requests_.end()) {
+ const auto& request = it->second;
+ if (IsTimeoutUpdateRequired(request, timeout, method_name)) {
+ // Add compensation time
+ timeout +=
+ application_manager_.get_settings().default_timeout_compensation();
+ application_manager_.UpdateRequestTimeout(
+ request.connection_key_, request.mob_correlation_id_, timeout);
+ application_manager_.UpdateRequestTimeout(
+ RequestInfo::kHmiConnectionKey, hmi_corr_id, timeout);
+ }
+ } else {
+ SDL_LOG_WARN("Timeout reset failed by " << hmi_corr_id
+ << ", no such mobile command");
+ }
+ }
+}
+} // namespace request_controller
+} // namespace application_manager
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 6a045fda03..96870c12c1 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -283,10 +283,6 @@ void ResumeCtrlImpl::RemoveFromResumption(uint32_t app_id) {
queue_lock_.Release();
}
-bool ResumeCtrlImpl::Init(LastState&) {
- return false;
-}
-
bool ResumeCtrlImpl::SetAppHMIState(
ApplicationSharedPtr application,
const mobile_apis::HMILevel::eType hmi_level,
@@ -514,16 +510,30 @@ void ResumeCtrlImpl::StartAppHmiStateResumption(
const bool is_resume_allowed_by_low_voltage =
CheckLowVoltageRestrictions(saved_app);
- const bool is_hmi_level_allowed_by_ign_cycle =
- CheckIgnCycleRestrictions(saved_app);
-
+ const time_t sdl_launch_time = LaunchTime();
+ const bool is_unexpected_disconnect_in_current_ign_cycle =
+ sdl_launch_time < saved_app[strings::time_stamp].asInt();
+ SDL_LOG_DEBUG("sdl_launch_time: " << sdl_launch_time
+ << ", App disconnect time: "
+ << saved_app[strings::time_stamp].asInt());
const bool is_app_revoked =
application_manager_.GetPolicyHandler().IsApplicationRevoked(
application->policy_app_id());
- const bool restore_hmi_level_allowed = is_resume_allowed_by_low_voltage &&
- is_hmi_level_allowed_by_ign_cycle &&
- !is_app_revoked;
+ bool restore_hmi_level_allowed = true;
+ if (!is_unexpected_disconnect_in_current_ign_cycle) {
+ const bool is_hmi_level_allowed_by_ign_cycle =
+ CheckIgnCycleRestrictions(saved_app);
+ restore_hmi_level_allowed = is_resume_allowed_by_low_voltage &&
+ is_hmi_level_allowed_by_ign_cycle &&
+ !is_app_revoked;
+ } else {
+ const bool is_resume_app_data_not_expired =
+ !IsAppDataResumptionExpired(saved_app);
+ restore_hmi_level_allowed = is_resume_allowed_by_low_voltage &&
+ is_resume_app_data_not_expired &&
+ !is_app_revoked;
+ }
if (restore_hmi_level_allowed) {
SDL_LOG_INFO("Resume application " << application->policy_app_id());
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 95dd331b88..c72231d334 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -132,6 +132,8 @@ smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties(
PointerToSmartObj(application->menu_title());
global_properties[strings::menu_icon] =
PointerToSmartObj(application->menu_icon());
+ global_properties[strings::menu_layout] =
+ PointerToSmartObj(application->menu_layout());
return global_properties;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index f00b100913..eedfc48b73 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -37,6 +37,7 @@
#include "application_manager/message_helper.h"
#include "application_manager/resumption/resumption_data_db.h"
#include "application_manager/resumption/resumption_sql_queries.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
#include "application_manager/smart_object_keys.h"
#include "utils/gen_hash.h"
#include "utils/helpers.h"
@@ -326,6 +327,12 @@ bool ResumptionDataDB::GetSavedApplication(
SDL_LOG_ERROR("Problem with restoring of global properties data");
return false;
}
+
+ if (!SelectUserLocationData(policy_app_id, device_id, saved_app)) {
+ SDL_LOG_ERROR("Problem with restoring of user location data");
+ return false;
+ }
+
SDL_LOG_INFO("Application data were successfully fetched from data base");
return true;
}
@@ -762,6 +769,9 @@ bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id,
if (!DeleteSavedGlobalProperties(app_id, device_id)) {
return false;
}
+ if (!DeleteUserLocation(app_id, device_id)) {
+ return false;
+ }
if (!UpdateGrammarID(app_id, device_id, 0)) {
return false;
}
@@ -1006,6 +1016,58 @@ bool ResumptionDataDB::SelectSubscriptionsData(
return true;
}
+bool ResumptionDataDB::SelectUserLocationData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ SDL_LOG_AUTO_TRACE();
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountUserLocation, policy_app_id, device_id)) {
+ SDL_LOG_ERROR("Select query has been failed");
+ return false;
+ }
+
+ if (0 == count_item) {
+ SDL_LOG_DEBUG("Application does not contain user_location data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_user_location(db());
+ if (!PrepareSelectQuery(select_user_location,
+ policy_app_id,
+ device_id,
+ kSelectUserLocation)) {
+ SDL_LOG_ERROR("Failed to prepare user location select query");
+ return false;
+ }
+
+ if (!select_user_location.Exec()) {
+ SDL_LOG_ERROR("Failed to execute user location select query");
+ return false;
+ }
+ /* Position of data in "select_user_location" :
+ field "col" from table "applicationUserLocation" = 0
+ field "colspan" from table "applicationUserLocation" = 1
+ field "level" from table "applicationUserLocation" = 2
+ field "levelspan" from table "applicationUserLocation" = 3
+ field "row" from table "applicationUserLocation" = 4
+ field "rowspan" from table "applicationUserLocation" = 5*/
+ smart_objects::SmartObject grid =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ grid[rc_rpc_plugin::strings::kCol] = select_user_location.GetInteger(0);
+ grid[rc_rpc_plugin::strings::kColspan] = select_user_location.GetInteger(1);
+ grid[rc_rpc_plugin::strings::kLevel] = select_user_location.GetInteger(2);
+ grid[rc_rpc_plugin::strings::kLevelspan] = select_user_location.GetInteger(3);
+ grid[rc_rpc_plugin::strings::kRow] = select_user_location.GetInteger(4);
+ grid[rc_rpc_plugin::strings::kRowspan] = select_user_location.GetInteger(5);
+
+ saved_app[strings::user_location][rc_rpc_plugin::strings::kGrid] = grid;
+
+ return true;
+}
+
bool ResumptionDataDB::SelectChoiceSetData(
const std::string& policy_app_id,
const std::string& device_id,
@@ -1519,6 +1581,18 @@ bool ResumptionDataDB::DeleteSavedSubscriptions(
return true;
}
+bool ResumptionDataDB::DeleteUserLocation(const std::string& policy_app_id,
+ const std::string& device_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationUserLocation)) {
+ SDL_LOG_WARN("Incorrect delete from applicationUserLocation.");
+ return false;
+ }
+ return true;
+}
+
bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id,
const std::string& device_id) {
SDL_LOG_AUTO_TRACE();
@@ -1914,6 +1988,12 @@ bool ResumptionDataDB::SaveApplicationToDB(
db_->RollbackTransaction();
return false;
}
+ if (!InsertUserLocationData(application->get_user_location(),
+ application_primary_key)) {
+ SDL_LOG_WARN("Incorrect insert user location to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -1973,6 +2053,12 @@ bool ResumptionDataDB::SaveApplicationToDB(
db_->RollbackTransaction();
return false;
}
+ if (!InsertUserLocationData(application["userLocation"],
+ application_primary_key)) {
+ SDL_LOG_WARN("Incorrect insert userLocation to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -2222,6 +2308,58 @@ bool ResumptionDataDB::InsertChoiceSetData(
return true;
}
+bool ResumptionDataDB::InsertUserLocationData(
+ const smart_objects::SmartObject& user_location,
+ int64_t application_primary_key) const {
+ SDL_LOG_AUTO_TRACE();
+ using namespace app_mngr;
+ using namespace smart_objects;
+
+ if (user_location.empty()) {
+ SDL_LOG_DEBUG("Application doesn't contain user location");
+ return true;
+ }
+
+ const auto grid = user_location[rc_rpc_plugin::strings::kGrid];
+ const int32_t col = grid[rc_rpc_plugin::strings::kCol].asInt();
+ const int32_t row = grid[rc_rpc_plugin::strings::kRow].asInt();
+ const int32_t level = grid[rc_rpc_plugin::strings::kLevel].asInt();
+ const int32_t colspan = grid[rc_rpc_plugin::strings::kColspan].asInt();
+ const int32_t rowspan = grid[rc_rpc_plugin::strings::kRowspan].asInt();
+ const int32_t levelspan = grid[rc_rpc_plugin::strings::kLevelspan].asInt();
+
+ utils::dbms::SQLQuery insert_application_user_location(db());
+ if (!insert_application_user_location.Prepare(kInsertUserLocation)) {
+ SDL_LOG_WARN(
+ "Problem with preparation insert "
+ "application user location query");
+ return false;
+ }
+
+ /* Positions of binding data for "insert_application_user_location":
+ field "idApplication" from table "applicationUserLocation" = 0
+ field "col" from table "applicationUserLocation" = 1
+ field "colspan" from table "applicationUserLocation" = 2
+ field "level" from table "applicationUserLocation" = 3
+ field "levelspan" from table "applicationUserLocation" = 4
+ field "row" from table "applicationUserLocation" = 5
+ field "rowspan" from table "applicationUserLocation" = 6*/
+ insert_application_user_location.Bind(0, application_primary_key);
+ insert_application_user_location.Bind(1, col);
+ insert_application_user_location.Bind(2, colspan);
+ insert_application_user_location.Bind(3, level);
+ insert_application_user_location.Bind(4, levelspan);
+ insert_application_user_location.Bind(5, row);
+ insert_application_user_location.Bind(6, rowspan);
+
+ if (!insert_application_user_location.Exec()) {
+ SDL_LOG_WARN("Incorrect insertion of user location");
+ return false;
+ }
+
+ return true;
+}
+
bool ResumptionDataDB::ExecInsertApplicationChoiceSet(
int64_t& choice_set_primary_key,
const smart_objects::SmartObject& choiceset) const {
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 f3d417d128..5d6d008911 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -107,6 +107,9 @@ void ResumptionDataJson::SaveApplication(
json_app[strings::windows_info] = tmp;
json_app[strings::time_stamp] = time_stamp;
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
+ formatters::CFormatterJsonBase::objToJsonValue(
+ application->get_user_location(), tmp);
+ json_app[strings::user_location] = tmp;
accessor.GetMutableData().set_dictionary(dictionary);
SDL_LOG_DEBUG("SaveApplication : " << json_app.toStyledString());
@@ -557,6 +560,7 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
application[strings::application_global_properties].clear();
application[strings::application_subscriptions].clear();
application[strings::application_files].clear();
+ application[strings::user_location].clear();
application.removeMember(strings::grammar_id);
accessor.GetMutableData().set_dictionary(dictionary);
SDL_LOG_DEBUG("Resumption data for application "
@@ -569,8 +573,4 @@ void ResumptionDataJson::Persist() {
last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem();
}
-LastState& ResumptionDataJson::last_state() const {
- return last_state_wrapper_->get_accessor().GetMutableData();
-}
-
} // namespace resumption
diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
index 7f07bca235..70b085ea26 100644
--- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
@@ -29,6 +29,7 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/command_request_impl.h"
#include "application_manager/display_capabilities_builder.h"
#include "application_manager/event_engine/event_observer.h"
#include "application_manager/message_helper.h"
@@ -151,6 +152,8 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus(
if (IsResponseSuccessful(response)) {
status.successful_requests.push_back(found_request);
} else {
+ SDL_LOG_DEBUG("Resumption request failed");
+ MessageHelper::PrintSmartObject(response);
status.error_requests.push_back(found_request);
}
@@ -159,6 +162,11 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus(
CheckVehicleDataResponse(found_request.message, response, status);
}
+ if (hmi_apis::FunctionID::Buttons_SubscribeButton ==
+ found_request.request_id.function_id) {
+ ProcessSubscribeButtonResponse(app_id, found_request.message, response);
+ }
+
if (hmi_apis::FunctionID::UI_CreateWindow ==
found_request.request_id.function_id) {
CheckCreateWindowResponse(found_request.message, response);
@@ -304,6 +312,14 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI(
void ResumptionDataProcessorImpl::FinalizeResumption(
const ResumeCtrl::ResumptionCallBack& callback, const uint32_t app_id) {
+ auto app = application_manager_.application(app_id);
+ if (!app) {
+ SDL_LOG_ERROR("App " << app_id
+ << " is not registered, erasing resumption data");
+ EraseAppResumptionData(app_id);
+ return;
+ }
+
if (IsResumptionSuccessful(app_id)) {
SDL_LOG_DEBUG("Resumption for app " << app_id << " successful");
callback(mobile_apis::Result::SUCCESS, "Data resumption successful");
@@ -311,7 +327,7 @@ void ResumptionDataProcessorImpl::FinalizeResumption(
} else {
SDL_LOG_ERROR("Resumption for app " << app_id << " failed");
callback(mobile_apis::Result::RESUME_FAILED, "Data resumption failed");
- RevertRestoredData(application_manager_.application(app_id));
+ RevertRestoredData(app);
application_manager_.state_controller().DropPostponedWindows(app_id);
}
EraseAppResumptionData(app_id);
@@ -331,7 +347,8 @@ void ResumptionDataProcessorImpl::HandleOnTimeOut(
ProcessResponseFromHMI(*error_response, function_id, corr_id);
}
-void ResumptionDataProcessorImpl::on_event(const event_engine::Event& event) {
+void ResumptionDataProcessorImpl::HandleOnEvent(
+ const event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG(
"Handling response message from HMI "
@@ -536,7 +553,7 @@ void ResumptionDataProcessorImpl::DeleteSubmenus(
auto accessor = application->sub_menu_map();
const auto sub_menu_map = accessor.GetData();
- for (const auto& smenu : sub_menu_map) {
+ for (const auto smenu : sub_menu_map) {
auto failed_submenu_request =
FindResumptionSubmenuRequest(smenu.first, failed_requests);
if (!failed_submenu_request) {
@@ -629,7 +646,7 @@ void ResumptionDataProcessorImpl::DeleteCommands(
auto accessor = application->commands_map();
const auto commands_map = accessor.GetData();
- for (const auto& cmd : commands_map) {
+ for (const auto cmd : commands_map) {
const auto cmd_id = extract_cmd_id(cmd.second);
if (0 == cmd_id) {
SDL_LOG_ERROR("Can't extract cmd_id for command with internal number: "
@@ -744,6 +761,10 @@ void ResumptionDataProcessorImpl::SetGlobalProperties(
saved_app[strings::application_global_properties];
application->load_global_properties(properties_so);
+ if (saved_app.keyExists(strings::user_location)) {
+ application->set_user_location(saved_app[strings::user_location]);
+ }
+
ProcessMessagesToHMI(MessageHelper::CreateGlobalPropertiesRequestsToHMI(
application, application_manager_));
}
@@ -803,6 +824,21 @@ void ResumptionDataProcessorImpl::DeleteGlobalProperties(
(*msg)[strings::msg_params] = *msg_params;
ProcessMessageToHMI(msg, false);
}
+
+ if (result.HasRCPropertiesReset() &&
+ check_if_successful(hmi_apis::FunctionID::RC_SetGlobalProperties)) {
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateRCResetGlobalPropertiesRequest(result,
+ application);
+ auto msg = MessageHelper::CreateMessageForHMI(
+ hmi_apis::messageType::request,
+ application_manager_.GetNextHMICorrelationID());
+ (*msg)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::RC_SetGlobalProperties;
+
+ (*msg)[strings::msg_params] = *msg_params;
+ ProcessMessageToHMI(msg, false);
+ }
}
void ResumptionDataProcessorImpl::AddSubscriptions(
@@ -827,6 +863,7 @@ void ResumptionDataProcessorImpl::AddButtonsSubscriptions(
const smart_objects::SmartObject& subscriptions =
saved_app[strings::application_subscriptions];
+ ButtonSubscriptions button_subscriptions;
if (subscriptions.keyExists(strings::application_buttons)) {
const smart_objects::SmartObject& subscriptions_buttons =
subscriptions[strings::application_buttons];
@@ -834,29 +871,18 @@ void ResumptionDataProcessorImpl::AddButtonsSubscriptions(
for (size_t i = 0; i < subscriptions_buttons.length(); ++i) {
btn = static_cast<mobile_apis::ButtonName::eType>(
(subscriptions_buttons[i]).asInt());
- application->SubscribeToButton(btn);
+ if (mobile_apis::ButtonName::CUSTOM_BUTTON != btn) {
+ button_subscriptions.insert(btn);
+ }
}
- ButtonSubscriptions button_subscriptions =
- GetButtonSubscriptionsToResume(application);
-
ProcessMessagesToHMI(
- MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
- application, application_manager_, button_subscriptions));
- }
-}
-
-ButtonSubscriptions ResumptionDataProcessorImpl::GetButtonSubscriptionsToResume(
- ApplicationSharedPtr application) const {
- ButtonSubscriptions button_subscriptions =
- application->SubscribedButtons().GetData();
- auto it = button_subscriptions.find(mobile_apis::ButtonName::CUSTOM_BUTTON);
-
- if (it != button_subscriptions.end()) {
- button_subscriptions.erase(it);
+ MessageHelper::CreateButtonSubscriptionsHandlingRequestsList(
+ application,
+ button_subscriptions,
+ hmi_apis::FunctionID::Buttons_SubscribeButton,
+ application_manager_));
}
-
- return button_subscriptions;
}
void ResumptionDataProcessorImpl::AddPluginsSubscriptions(
@@ -886,11 +912,13 @@ void ResumptionDataProcessorImpl::DeleteButtonsSubscriptions(
if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_btn) {
continue;
}
- auto notification = MessageHelper::CreateOnButtonSubscriptionNotification(
- application->hmi_app_id(), hmi_btn, false);
- // is_subscribed = false
- ProcessMessageToHMI(notification, false);
- application->UnsubscribeFromButton(btn);
+ smart_objects::SmartObjectSPtr unsubscribe_request =
+ MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ application->app_id(),
+ hmi_btn,
+ hmi_apis::FunctionID::Buttons_UnsubscribeButton,
+ application_manager_);
+ ProcessMessageToHMI(unsubscribe_request, false);
}
}
@@ -953,7 +981,7 @@ void ResumptionDataProcessorImpl::DeletePluginsSubscriptions(
smart_objects::SmartObject(smart_objects::SmartType_Map);
module_data_so[index][message_params::kModuleType] = module.first;
module_data_so[index][message_params::kModuleId] = module.second;
- index++;
+ ++index;
}
}
@@ -973,7 +1001,12 @@ void ResumptionDataProcessorImpl::DeletePluginsSubscriptions(
}
bool IsResponseSuccessful(const smart_objects::SmartObject& response) {
- return !response[strings::params].keyExists(strings::error_msg);
+ auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ response[strings::params][application_manager::hmi_response::code]
+ .asInt());
+
+ return commands::IsHMIResultSuccess(result_code) ||
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code;
}
void ResumptionDataProcessorImpl::CheckVehicleDataResponse(
@@ -1011,6 +1044,26 @@ void ResumptionDataProcessorImpl::CheckVehicleDataResponse(
}
}
+void ResumptionDataProcessorImpl::ProcessSubscribeButtonResponse(
+ const uint32_t app_id,
+ const smart_objects::SmartObject& request,
+ const smart_objects::SmartObject& response) {
+ SDL_LOG_AUTO_TRACE();
+ if (!IsResponseSuccessful(response)) {
+ return;
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(app_id);
+ if (!app) {
+ SDL_LOG_ERROR("NULL pointer.");
+ return;
+ }
+ const mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ request[strings::msg_params][strings::button_name].asInt());
+ app->SubscribeToButton(btn_id);
+}
+
void ResumptionDataProcessorImpl::CheckModuleDataSubscription(
const ns_smart_device_link::ns_smart_objects::SmartObject& request,
const ns_smart_device_link::ns_smart_objects::SmartObject& response,
@@ -1079,8 +1132,6 @@ void ResumptionDataProcessorImpl::CheckCreateWindowResponse(
const smart_objects::SmartObject& request,
const smart_objects::SmartObject& response) const {
SDL_LOG_AUTO_TRACE();
- const auto correlation_id =
- response[strings::params][strings::correlation_id].asInt();
const auto& msg_params = request[strings::msg_params];
const auto app_id = msg_params[strings::app_id].asInt();
@@ -1093,8 +1144,9 @@ void ResumptionDataProcessorImpl::CheckCreateWindowResponse(
const auto window_id = msg_params[strings::window_id].asInt();
if (!IsResponseSuccessful(response)) {
- SDL_LOG_ERROR("UI_CreateWindow for correlation id: " << correlation_id
- << " has failed");
+ SDL_LOG_ERROR("UI_CreateWindow for correlation id: "
+ << response[strings::params][strings::correlation_id].asInt()
+ << " has failed");
auto& builder = application->display_capabilities_builder();
builder.ResetDisplayCapabilities();
return;
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
index 4770bafef4..cfcac136aa 100644
--- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -314,6 +314,23 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `_internal_data`( "
" `db_version_hash` INTEGER "
" ); "
+ "CREATE TABLE IF NOT EXISTS `applicationUserLocation`( "
+ " `idLocation` INTEGER PRIMARY KEY NOT NULL, "
+ " `idApplication` INTEGER, "
+ " `col` INTEGER, "
+ " `colspan` INTEGER, "
+ " `level` INTEGER, "
+ " `levelspan` INTEGER, "
+ " `row` INTEGER, "
+ " `rowspan` INTEGER, "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationUserLocation.fk_Application_idx` "
+ " ON `applicationUserLocation`(`idApplication`); "
+
"COMMIT;";
const std::string kDropSchema =
@@ -369,6 +386,8 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `applicationSubscriptionsArray`; "
"DROP INDEX IF EXISTS `applicationSubscriptionsArray.fk_Application_idx`; "
"DROP TABLE IF EXISTS `_internal_data`; "
+ "DROP TABLE IF EXISTS `applicationUserLocation`; "
+ "DROP INDEX IF EXISTS `applicationUserLocation.fk_Application_idx`; "
"COMMIT; "
"VACUUM;";
@@ -497,6 +516,12 @@ const std::string kDeleteApplicationSubscriptionsArray =
"FROM `application` "
"WHERE `appID` = ? AND `deviceID` = ?)";
+const std::string kDeleteApplicationUserLocation =
+ "DELETE FROM `applicationUserLocation` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
const std::string kDeleteImageFromCommands =
"DELETE FROM `image` "
"WHERE `idimage` IN (SELECT `idimage` "
@@ -732,6 +757,13 @@ const std::string kInsertSubscriptions =
"VALUES "
"(?, ?, ?);";
+const std::string kInsertUserLocation =
+ "INSERT INTO `applicationUserLocation` "
+ "(`idApplication`, `col`, `colspan`, `level`, `levelspan`, `row`, "
+ "`rowspan`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?, ?);";
+
const std::string kInsertChoice =
"INSERT INTO `choice` "
"(`choiceID`, `menuName`, `secondaryText`, "
@@ -877,6 +909,18 @@ const std::string kSelectSubscriptions =
"FROM `application` "
"WHERE `appID` = ? AND `deviceID` = ?);";
+const std::string kSelectCountUserLocation =
+ "SELECT COUNT (*) "
+ "FROM `applicationUserLocation` INNER JOIN `application` ON "
+ "`applicationUserLocation`.`idApplication` = `application`.`idApplication` "
+ "WHERE `appID` = ? AND `deviceID` = ?";
+
+const std::string kSelectUserLocation =
+ "SELECT `col`, `colspan`, `level`, `levelspan`, `row`, `rowspan` "
+ "FROM `applicationUserLocation` INNER JOIN `application` ON "
+ "`applicationUserLocation`.`idApplication` = `application`.`idApplication` "
+ "WHERE `appID` = ? AND `deviceID` = ?";
+
const std::string kSelectCountChoiceSet =
"SELECT COUNT (`idApplication`) "
"FROM `applicationChoiceSetArray` "
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 4137ab93bb..b6b9f2e16b 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -466,8 +466,6 @@ bool RPCHandlerImpl::ConvertMessageToSO(
break;
}
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: {
- static ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra v1_shema;
-
if (message.function_id() == 0 || message.type() == kUnknownType) {
SDL_LOG_ERROR("Message received: UNSUPPORTED_VERSION");
@@ -495,7 +493,8 @@ bool RPCHandlerImpl::ConvertMessageToSO(
smart_objects::SmartObjectSPtr msg_to_send =
std::make_shared<smart_objects::SmartObject>(output);
- v1_shema.attachSchema(*msg_to_send, false);
+ app_manager_.mobile_v4_protocol_so_factory().attachSchema(
+ *msg_to_send, false);
app_manager_.GetRPCService().SendMessageToMobile(msg_to_send);
return false;
}
@@ -601,5 +600,6 @@ hmi_apis::HMI_API& RPCHandlerImpl::hmi_so_factory() {
mobile_apis::MOBILE_API& RPCHandlerImpl::mobile_so_factory() {
return mobile_so_factory_;
}
+
} // namespace rpc_handler
} // namespace application_manager
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
index 74a865ff4f..b2ac58c4f7 100644
--- a/src/components/application_manager/src/rpc_passing_handler.cc
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -85,7 +85,7 @@ bool RPCPassingHandler::CanHandleFunctionID(int32_t function_id) {
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++) {
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
if (handled_rpcs[i].asInt() == function_id) {
return true;
}
@@ -266,7 +266,7 @@ void RPCPassingHandler::PopulateRPCRequestQueue(
++services_it) {
auto handled_rpcs =
services_it->record[strings::service_manifest][strings::handled_rpcs];
- for (size_t i = 0; i < handled_rpcs.length(); i++) {
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
if (handled_rpcs[i].asInt() == function_id) {
// Add requests to queue
ServiceInfo service_info{
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index 34a0bed7af..36dcb335c1 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -36,6 +36,7 @@
#include "application_manager/app_service_manager.h"
#include "application_manager/command_factory.h"
#include "application_manager/commands/command.h"
+#include "application_manager/commands/command_impl.h"
#include "application_manager/plugin_manager/plugin_keys.h"
namespace application_manager {
@@ -138,10 +139,20 @@ bool RPCServiceImpl::ManageMobileCommand(
const uint32_t connection_key = static_cast<uint32_t>(
(*message)[strings::params][strings::connection_key].asUInt());
+ const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject(
+ (*message)[strings::msg_params]);
+ int32_t message_type =
+ (*message)[strings::params][strings::message_type].asInt();
auto app_ptr = app_manager_.application(connection_key);
- if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->device(),
- app_ptr->policy_app_id())) {
+ if (app_ptr &&
+ (app_manager_.IsAppInReconnectMode(app_ptr->device(),
+ app_ptr->policy_app_id()) ||
+ (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ (!app_ptr->WindowIdExists(window_id) ||
+ mobile_apis::HMILevel::INVALID_ENUM ==
+ app_ptr->hmi_level(window_id)) &&
+ mobile_apis::messageType::notification == message_type))) {
commands_holder_.Suspend(
app_ptr, CommandHolder::CommandType::kMobileCommand, source, message);
return true;
@@ -209,8 +220,6 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
}
- int32_t message_type =
- (*message)[strings::params][strings::message_type].asInt();
if (message_type == mobile_apis::messageType::response) {
if (command->Init() && command->CheckPermissions()) {
command->Run();
@@ -219,11 +228,11 @@ bool RPCServiceImpl::ManageMobileCommand(
return true;
}
if (message_type == mobile_apis::messageType::notification) {
- request_ctrl_.addNotification(command);
+ request_ctrl_.AddNotification(command);
if (command->Init() && command->CheckPermissions()) {
command->Run();
if (command->CleanUp()) {
- request_ctrl_.removeNotification(command.get());
+ request_ctrl_.RemoveNotification(command.get());
}
// If CleanUp returned false notification should remove it self.
}
@@ -254,11 +263,11 @@ bool RPCServiceImpl::ManageMobileCommand(
// commands will be launched from request_ctrl
const request_controller::RequestController::TResult result =
- request_ctrl_.addMobileRequest(command, app_hmi_level);
+ request_ctrl_.AddMobileRequest(command, app_hmi_level);
- if (result == request_controller::RequestController::SUCCESS) {
+ if (result == request_controller::RequestController::TResult::SUCCESS) {
SDL_LOG_DEBUG("Perform request");
- } else if (result == request_controller::RequestController::
+ } else if (result == request_controller::RequestController::TResult::
TOO_MANY_PENDING_REQUESTS) {
SDL_LOG_ERROR("RET Unable top perform request: "
<< "TOO_MANY_PENDING_REQUESTS");
@@ -277,8 +286,8 @@ bool RPCServiceImpl::ManageMobileCommand(
SendMessageToMobile(response);
return false;
- } else if (result ==
- request_controller::RequestController::TOO_MANY_REQUESTS) {
+ } else if (result == request_controller::RequestController::TResult::
+ TOO_MANY_REQUESTS) {
SDL_LOG_ERROR("RET Unable to perform request: "
<< "TOO_MANY_REQUESTS");
@@ -297,7 +306,7 @@ bool RPCServiceImpl::ManageMobileCommand(
app_ptr->usage_report().RecordRemovalsForBadBehavior();
}
return false;
- } else if (result == request_controller::RequestController::
+ } else if (result == request_controller::RequestController::TResult::
NONE_HMI_LEVEL_MANY_REQUESTS) {
SDL_LOG_ERROR("RET Unable to perform request: "
<< "REQUEST_WHILE_IN_NONE_HMI_LEVEL");
@@ -385,12 +394,17 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
if (kRequest == message_type) {
SDL_LOG_DEBUG("ManageHMICommand");
command->set_warning_info(warning_info);
- request_ctrl_.addHMIRequest(command);
+ if (!app_manager_.IsStopping()) {
+ request_ctrl_.AddHMIRequest(command);
+ }
}
if (command->Init()) {
command->Run();
- if (kResponse == message_type) {
+ if (helpers::Compare<int32_t, helpers::EQ, helpers::ONE>(
+ message_type, kResponse, kErrorResponse) &&
+ message->getElement(strings::params)
+ .keyExists(strings::correlation_id)) {
const uint32_t correlation_id =
(*(message.get()))[strings::params][strings::correlation_id].asUInt();
const int32_t function_id =
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index f95476b7a6..1490f9f5b1 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -138,6 +138,9 @@ const char* minutes = "minutes";
const char* seconds = "seconds";
const char* update_mode = "updateMode";
const char* audioStreamingIndicator = "audioStreamingIndicator";
+const char* seek_time = "seekTime";
+const char* forward_seek_indicator = "forwardSeekIndicator";
+const char* back_seek_indicator = "backSeekIndicator";
const char* trigger_source = "triggerSource";
const char* hmi_level = "hmiLevel";
const char* activate_app_hmi_level = "level";
@@ -194,6 +197,8 @@ const char* policy_type = "policyType";
const char* property = "property";
const char* displays = "displays";
const char* seat_location = "seatLocation";
+const char* app_capability = "appCapability";
+const char* app_capability_type = "appCapabilityType";
// PutFile
const char* sync_file_name = "syncFileName";
@@ -263,12 +268,20 @@ 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* climate_data = "climateData";
const char* external_temp = "externalTemperature";
const char* turn_signal = "turnSignal";
const char* vin = "vin";
const char* gearStatus = "gearStatus";
const char* prndl = "prndl";
const char* tire_pressure = "tirePressure";
+const char* pressure_telltale = "pressureTelltale";
+const char* left_front = "leftFront";
+const char* right_front = "rightFront";
+const char* left_rear = "leftRear";
+const char* right_rear = "rightRear";
+const char* inner_left_rear = "innerLeftRear";
+const char* inner_right_rear = "innerRightRear";
const char* odometer = "odometer";
const char* belt_status = "beltStatus";
const char* electronic_park_brake_status = "electronicParkBrakeStatus";
@@ -303,11 +316,13 @@ const char* video_streaming = "videoStreaming";
const char* remote_control = "remoteControl";
const char* sdl_version = "sdlVersion";
const char* system_software_version = "systemSoftwareVersion";
+const char* system_hardware_version = "systemHardwareVersion";
const char* priority = "priority";
const char* engine_oil_life = "engineOilLife";
const char* oem_custom_data_type = "oemCustomDataType";
const char* window_status = "windowStatus";
const char* hands_off_steering = "handsOffSteering";
+const char* seat_occupancy = "seatOccupancy";
// app services
const char* app_service_manifest = "appServiceManifest";
@@ -439,10 +454,17 @@ const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported";
const char* const diagonal_screen_size = "diagonalScreenSize";
const char* const pixel_per_inch = "pixelPerInch";
const char* const scale = "scale";
+const char* const additional_video_streaming_capabilities =
+ "additionalVideoStreamingCapabilities";
const char* const haptic_rect_data = "hapticRectData";
const char* const rect = "rect";
const char* const x = "x";
const char* const y = "y";
+const char* const preferred_fps = "preferredFPS";
+
+// OnResetTimeout
+const char* const request_id = "requestID";
+const char* const reset_period = "resetPeriod";
} // namespace strings
namespace hmi_interface {
@@ -541,6 +563,8 @@ const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_list = "autoCompleteList";
+const char* mask_input_characters = "maskInputCharacters";
+const char* custom_keys = "customKeys";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
@@ -578,6 +602,9 @@ const char* image_capabilities = "imageCapabilities";
const char* display_type = "displayType";
const char* display_name = "displayName";
const char* text_fields = "textFields";
+const char* keyboard_capabilities = "keyboardCapabilities";
+const char* supported_keyboards = "supportedKeyboards";
+const char* num_configurable_keys = "numConfigurableKeys";
const char* media_clock_formats = "mediaClockFormats";
const char* graphic_supported = "graphicSupported";
const char* image_fields = "imageFields";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 858a353409..749ca93c6c 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -31,12 +31,13 @@
*/
#include "application_manager/state_controller_impl.h"
+
#include <tuple>
+
#include "application_manager/rpc_service.h"
#include "application_manager/usage_statistics.h"
-#include "utils/helpers.h"
-
#include "connection_handler/connection_handler.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -720,11 +721,14 @@ void StateControllerImpl::UpdateAppWindowsStreamingState(
}
}
-void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {
+void StateControllerImpl::HandleOnEvent(
+ const event_engine::MobileEvent& event) {
+ using namespace mobile_apis;
+
SDL_LOG_AUTO_TRACE();
SDL_LOG_DEBUG("Received event for function" << event.id());
switch (event.id()) {
- case mobile_apis::FunctionID::RegisterAppInterfaceID: {
+ case mobile_apis::FunctionID::RegisterAppInterfaceID: {
auto message = event.smart_object();
uint32_t connection_key =
message[strings::params][strings::connection_key].asUInt();
@@ -755,7 +759,8 @@ void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {
apps_with_pending_hmistatus_notification_.erase(app->app_id());
if (apps_with_pending_hmistatus_notification_.empty()) {
- unsubscribe_from_event(mobile_apis::FunctionID::RegisterAppInterfaceID);
+ unsubscribe_from_event(
+ mobile_apis::FunctionID::RegisterAppInterfaceID);
}
}
} break;
@@ -763,9 +768,9 @@ void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {
default:
break;
}
-}
+} // namespace application_manager
-void StateControllerImpl::on_event(const event_engine::Event& event) {
+void StateControllerImpl::HandleOnEvent(const event_engine::Event& event) {
using event_engine::Event;
using smart_objects::SmartObject;
using namespace hmi_apis;
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 a02cfe08db..25ff8f7559 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
@@ -121,7 +121,7 @@ void SystemTimeHandlerImpl::SendTimeRequest() {
awaiting_get_system_time_ = true;
}
-void SystemTimeHandlerImpl::on_event(
+void SystemTimeHandlerImpl::HandleOnEvent(
const application_manager::event_engine::Event& event) {
SDL_LOG_AUTO_TRACE();
using namespace application_manager;
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index c9c9a80391..710cd1e8ff 100755
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -72,6 +72,7 @@ set(testSources
${AM_TEST_DIR}/application_helper_test.cc
${AM_TEST_DIR}/rpc_service_impl_test.cc
${AM_TEST_DIR}/command_holder_test.cc
+ ${AM_TEST_DIR}/request_timeout_handler_test.cc
)
set(testSourcesMockHmi
@@ -119,19 +120,23 @@ if (ENABLE_SECURITY)
list(APPEND LIBRARIES SecurityManager)
endif()
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ list(APPEND LIBRARIES sqlite3)
+endif ()
+
if (${CMAKE_SYSTEM_NAME} MATCHES "QNX")
list(REMOVE_ITEM LIBRARIES dl)
endif()
-if (ENABLE_LOG)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX")
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY})
endif()
+file(COPY ${CMAKE_SOURCE_DIR}/src/appMain/sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY smartDeviceLink_test2.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(
diff --git a/src/components/application_manager/test/app_launch/CMakeLists.txt b/src/components/application_manager/test/app_launch/CMakeLists.txt
index 1c038020b9..89e1eef2b4 100644
--- a/src/components/application_manager/test/app_launch/CMakeLists.txt
+++ b/src/components/application_manager/test/app_launch/CMakeLists.txt
@@ -46,7 +46,7 @@ set(LIBRARIES
ApplicationManager
)
- if (ENABLE_LOG)
+ if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX")
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
diff --git a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
index 08868a239f..41d300cc4a 100644
--- a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
@@ -202,7 +202,7 @@ TEST_F(AppLaunchCtrlTest, StoredAppIsLaunchedAfterDeviceConnected) {
app_launch::ApplicationDataPtr app_to_launch = GetTestAppData(0);
MockAppPtr app = GetTestApp(0);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
applications_on_device.push_back(app_to_launch);
EXPECT_CALL(app_launch_data_mock_,
GetApplicationDataByDevice(app_to_launch->device_mac_))
@@ -212,11 +212,11 @@ TEST_F(AppLaunchCtrlTest, StoredAppIsLaunchedAfterDeviceConnected) {
RunAppOnDevice(app_to_launch->device_mac_, app_to_launch->bundle_id_))
.Times(AtLeast(1))
.WillOnce(DoAll(InvokeOnAppRegistered(app_launch_ctrl_.get(), app.get()),
- NotifyTestAsyncWaiter(&waiter)));
+ NotifyTestAsyncWaiter(waiter)));
app_launch_ctrl_->OnDeviceConnected(app_to_launch->device_mac_);
const uint32_t wait_time =
MAX_TEST_DURATION + settings_.app_launch_wait_time();
- EXPECT_TRUE(waiter.WaitFor(1, wait_time));
+ EXPECT_TRUE(waiter->WaitFor(1, wait_time));
}
TEST_F(AppLaunchCtrlTest, RelaunchAppIfNotRegisteredMultipleTimes) {
@@ -224,7 +224,7 @@ TEST_F(AppLaunchCtrlTest, RelaunchAppIfNotRegisteredMultipleTimes) {
app_launch::ApplicationDataPtr app_to_launch = GetTestAppData(0);
applications_on_device.push_back(app_to_launch);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
const uint32_t times = settings_.app_launch_max_retry_attempt();
EXPECT_CALL(app_launch_data_mock_,
GetApplicationDataByDevice(app_to_launch->device_mac_))
@@ -234,14 +234,14 @@ TEST_F(AppLaunchCtrlTest, RelaunchAppIfNotRegisteredMultipleTimes) {
connection_handler_mock_,
RunAppOnDevice(app_to_launch->device_mac_, app_to_launch->bundle_id_))
.Times(times)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
app_launch_ctrl_->OnDeviceConnected(app_to_launch->device_mac_);
const uint32_t wait_time = MAX_TEST_DURATION +
settings_.app_launch_wait_time() +
settings_.app_launch_max_retry_attempt() *
settings_.app_launch_retry_wait_time();
- EXPECT_TRUE(waiter.WaitFor(times, wait_time));
+ EXPECT_TRUE(waiter->WaitFor(times, wait_time));
}
TEST_F(AppLaunchCtrlTest, LaunchMultipleApps) {
@@ -253,7 +253,7 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleApps) {
apps.push_back(it->second);
}
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
const uint32_t times = apps_and_data.size();
EXPECT_CALL(app_launch_data_mock_, GetApplicationDataByDevice(DeviceMac(1)))
.WillOnce(Return(apps));
@@ -267,13 +267,13 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleApps) {
.Times(AtLeast(1))
.WillOnce(DoAll(
InvokeOnAppRegistered(app_launch_ctrl_.get(), it->first.get()),
- NotifyTestAsyncWaiter(&waiter)));
+ NotifyTestAsyncWaiter(waiter)));
}
app_launch_ctrl_->OnDeviceConnected(DeviceMac(1));
const uint32_t wait_time = MAX_TEST_DURATION +
settings_.app_launch_wait_time() +
apps.size() * settings_.wait_time_between_apps();
- waiter.WaitFor(times, wait_time);
+ waiter->WaitFor(times, wait_time);
}
TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsNoRegister) {
@@ -285,7 +285,7 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsNoRegister) {
apps.push_back(it->second);
}
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
const uint32_t times =
settings_.app_launch_max_retry_attempt() * apps_and_data.size();
EXPECT_CALL(app_launch_data_mock_, GetApplicationDataByDevice(DeviceMac(1)))
@@ -300,13 +300,13 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsNoRegister) {
RunAppOnDevice(app_data.second->device_mac_,
app_data.second->bundle_id_))
.Times(settings_.app_launch_max_retry_attempt())
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
}
app_launch_ctrl_->OnDeviceConnected(DeviceMac(1));
const uint32_t wait_time = MAX_TEST_DURATION +
settings_.app_launch_wait_time() +
apps.size() * settings_.wait_time_between_apps();
- waiter.WaitFor(times, wait_time);
+ waiter->WaitFor(times, wait_time);
}
TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsInHMILevelOrder) {
@@ -343,7 +343,7 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsInHMILevelOrder) {
apps.push_back(app_data);
}
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
const uint32_t times = apps_and_data.size();
EXPECT_CALL(app_launch_data_mock_, GetApplicationDataByDevice(DeviceMac(1)))
.WillOnce(Return(apps));
@@ -356,7 +356,7 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsInHMILevelOrder) {
.Times(AtLeast(1))
.WillRepeatedly(DoAll(
InvokeOnAppRegistered(app_launch_ctrl_.get(), it->first.get()),
- NotifyTestAsyncWaiter(&waiter)));
+ NotifyTestAsyncWaiter(waiter)));
}
app_launch_ctrl_->OnDeviceConnected(DeviceMac(1));
@@ -364,7 +364,7 @@ TEST_F(AppLaunchCtrlTest, LaunchMultipleAppsInHMILevelOrder) {
const uint32_t wait_time = MAX_TEST_DURATION +
settings_.app_launch_wait_time() +
apps.size() * settings_.wait_time_between_apps();
- waiter.WaitFor(times, wait_time);
+ waiter->WaitFor(times, wait_time);
}
} // namespace app_launch_test
diff --git a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
index f7bd636a66..240b5f7d01 100644
--- a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
@@ -60,17 +60,17 @@ using namespace file_system;
using namespace app_launch;
const std::string kAppStorageFolder = "app_storage_folder";
-const std::string kAppStorageFile = "./app_info.dat";
const std::string kAppInfoStorage = "app_info_storage";
class AppLaunchDataJsonTest : public ::testing::Test {
private:
virtual void SetUp() {
- ::file_system::DeleteFile(kAppStorageFile);
+ const std::string storage_file = kAppStorageFolder + "/" + kAppInfoStorage;
+ ::file_system::DeleteFile(storage_file);
last_state_wrapper_ = std::make_shared<resumption::LastStateWrapperImpl>(
std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
kAppInfoStorage));
- ASSERT_TRUE(::file_system::CreateFile(kAppStorageFile));
+ ASSERT_TRUE(::file_system::CreateFile(storage_file));
NiceMock<app_launch_test::MockAppLaunchSettings> mock_app_launch_settings_;
ON_CALL(mock_app_launch_settings_, max_number_of_ios_device())
@@ -85,10 +85,14 @@ class AppLaunchDataJsonTest : public ::testing::Test {
res_json_.get()->Clear();
}
- static void SetUpTestCase() {}
+ static void SetUpTestCase() {
+ ::file_system::RemoveDirectory(kAppStorageFolder);
+ ::file_system::CreateDirectoryRecursively(kAppStorageFolder);
+ }
static void TearDownTestCase() {
- ::file_system::DeleteFile(kAppStorageFile);
+ const std::string storage_file = kAppStorageFolder + "/" + kAppInfoStorage;
+ ::file_system::DeleteFile(storage_file);
::file_system::RemoveDirectory(kAppStorageFolder);
}
diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc
index 4c451ab072..1f1a76298c 100644
--- a/src/components/application_manager/test/application_helper_test.cc
+++ b/src/components/application_manager/test/application_helper_test.cc
@@ -149,7 +149,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
const uint32_t cmd_id = 1;
const uint32_t menu_id = 2;
const uint32_t choice_set_id = 3;
- const mobile_apis::ButtonName::eType button = mobile_apis::ButtonName::AC;
smart_objects::SmartObject cmd(smart_objects::SmartType_Map);
cmd[strings::msg_params][strings::cmd_id] = cmd_id;
@@ -163,8 +162,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]);
app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]);
- EXPECT_TRUE(app_impl_->SubscribeToButton(button));
-
const std::string some_string = "some_string";
smart_objects::SmartObject dummy_data =
smart_objects::SmartObject(smart_objects::SmartType_String);
@@ -176,6 +173,7 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
app_impl_->set_keyboard_props(dummy_data);
app_impl_->set_menu_title(dummy_data);
app_impl_->set_menu_icon(dummy_data);
+ app_impl_->set_menu_layout(dummy_data);
const bool persistent = false;
const bool downloaded = true;
@@ -190,7 +188,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_TRUE(smart_objects::SmartType_Null != sub_menu1.getType());
const auto choice_set1 = app_impl_->FindChoiceSet(choice_set_id);
EXPECT_TRUE(smart_objects::SmartType_Null != choice_set1.getType());
- EXPECT_TRUE(app_impl_->IsSubscribedToButton(button));
auto help_prompt = app_impl_->help_prompt();
EXPECT_TRUE(help_prompt->asString() == some_string);
auto timeout_prompt = app_impl_->timeout_prompt();
@@ -205,13 +202,12 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_TRUE(menu_title->asString() == some_string);
auto menu_icon = app_impl_->menu_icon();
EXPECT_TRUE(menu_icon->asString() == some_string);
+ auto menu_layout = app_impl_->menu_layout();
+ EXPECT_TRUE(menu_layout->asString() == some_string);
auto file_ptr = app_impl_->GetFile(filename);
EXPECT_TRUE(NULL != file_ptr);
EXPECT_TRUE(file_ptr->file_name == filename);
- EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
- .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
-
EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
.WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
@@ -227,7 +223,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_TRUE(smart_objects::SmartType_Null == sub_menu2.getType());
const auto choice_set2 = app_impl_->FindChoiceSet(choice_set_id);
EXPECT_TRUE(smart_objects::SmartType_Null == choice_set2.getType());
- EXPECT_FALSE(app_impl_->IsSubscribedToButton(button));
help_prompt = app_impl_->help_prompt();
EXPECT_FALSE(help_prompt->asString() == some_string);
timeout_prompt = app_impl_->timeout_prompt();
@@ -242,6 +237,8 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) {
EXPECT_FALSE(menu_title->asString() == some_string);
menu_icon = app_impl_->menu_icon();
EXPECT_FALSE(menu_icon->asString() == some_string);
+ menu_layout = app_impl_->menu_layout();
+ EXPECT_FALSE(menu_layout->asString() == some_string);
file_ptr = app_impl_->GetFile(filename);
EXPECT_TRUE(NULL == file_ptr);
}
@@ -259,10 +256,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) {
app_impl_->AddCommand(cmd_id, cmd[strings::msg_params]);
app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]);
app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]);
- app_impl_->SubscribeToButton(mobile_apis::ButtonName::AC);
-
- EXPECT_CALL(*mock_message_helper_, CreateUnsubscribeWayPointsRequest(_))
- .WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _))
.WillOnce(Return(std::make_shared<smart_objects::SmartObject>()));
@@ -276,9 +269,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) {
EXPECT_CALL(*mock_message_helper_, SendResetPropertiesRequest(_, _));
- EXPECT_CALL(*mock_message_helper_,
- SendUnsubscribeButtonNotification(_, _, _));
-
// Act
application_manager::DeleteApplicationData(app_impl_, app_manager_impl_);
}
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index d468c9790b..1e58ce8636 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -560,9 +560,9 @@ TEST_F(ApplicationImplTest, SubscribeToButton_UnsubscribeFromButton) {
EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::PRESET_0));
}
-TEST_F(ApplicationImplTest, SubscribeToDefaultButton_UnsubscribeFromButton) {
- EXPECT_TRUE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON));
- EXPECT_FALSE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON));
+TEST_F(ApplicationImplTest, NotSubscribedToDefaultButton_SubscribeToButton) {
+ EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON));
+ EXPECT_TRUE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON));
}
TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
@@ -571,14 +571,17 @@ TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
EXPECT_FALSE(app_impl->IsSubscribedToSoftButton(i));
}
- SoftButtonID test_button;
+ std::set<uint32_t> softbuttons_ids;
+
for (uint i = 0; i < btn_count; i++) {
- test_button.insert(std::make_pair(
- i,
- static_cast<WindowID>(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ softbuttons_ids.insert(i);
}
+
+ WindowSoftButtons window_softbuttons{
+ static_cast<WindowID>(mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
+ softbuttons_ids};
app_impl->SubscribeToSoftButtons(FunctionID::ScrollableMessageID,
- test_button);
+ window_softbuttons);
for (uint i = 0; i < btn_count; i++) {
EXPECT_TRUE(app_impl->IsSubscribedToSoftButton(i));
@@ -837,6 +840,7 @@ TEST_F(ApplicationImplTest, StartStreaming_StreamingApproved) {
TEST_F(ApplicationImplTest, SuspendNaviStreaming) {
protocol_handler::ServiceType type =
protocol_handler::ServiceType::kMobileNav;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(mock_application_manager_,
ProcessOnDataStreamingNotification(type, app_id, false));
app_impl->SuspendStreaming(type);
@@ -844,6 +848,7 @@ TEST_F(ApplicationImplTest, SuspendNaviStreaming) {
TEST_F(ApplicationImplTest, SuspendAudioStreaming) {
protocol_handler::ServiceType type = protocol_handler::ServiceType::kAudio;
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(mock_application_manager_,
ProcessOnDataStreamingNotification(type, app_id, false));
app_impl->SuspendStreaming(type);
@@ -852,16 +857,12 @@ TEST_F(ApplicationImplTest, SuspendAudioStreaming) {
// TODO {AKozoriz} : Fix tests with streaming (APPLINK-19289)
TEST_F(ApplicationImplTest, DISABLED_Suspend_WakeUpAudioStreaming) {
protocol_handler::ServiceType type = protocol_handler::ServiceType::kAudio;
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kSuspended));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendOnDataStreaming(type, false, _));
app_impl->SuspendStreaming(type);
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kStarted));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, true));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendOnDataStreaming(type, true, _));
app_impl->WakeUpStreaming(type);
@@ -870,16 +871,12 @@ TEST_F(ApplicationImplTest, DISABLED_Suspend_WakeUpAudioStreaming) {
TEST_F(ApplicationImplTest, DISABLED_Suspend_WakeUpNaviStreaming) {
protocol_handler::ServiceType type =
protocol_handler::ServiceType::kMobileNav;
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kSuspended));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendOnDataStreaming(type, false, _));
app_impl->SuspendStreaming(type);
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kStarted));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, true));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendOnDataStreaming(type, true, _));
app_impl->WakeUpStreaming(type);
@@ -891,9 +888,7 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
protocol_handler::ServiceType::kMobileNav;
app_impl->set_video_streaming_approved(true);
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kStopped));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(mock_application_manager_,
ProcessOnDataStreamingNotification(type, app_id, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
@@ -905,9 +900,7 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
// Stop audio streaming
app_impl->set_audio_streaming_approved(true);
type = protocol_handler::ServiceType::kAudio;
- EXPECT_CALL(
- mock_application_manager_,
- OnAppStreaming(app_id, type, Application::StreamingState::kStopped));
+ EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
EXPECT_CALL(mock_application_manager_,
ProcessOnDataStreamingNotification(type, app_id, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
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 cf8aadb080..48ba75275b 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -159,9 +159,7 @@ struct ServiceStatus {
: service_type_(type), service_event_(event), reason_(reason) {}
};
-class ApplicationManagerImplTest
- : public ::testing::Test,
- public ::testing::WithParamInterface<ServiceStatus> {
+class ApplicationManagerImplTest : public ::testing::Test {
public:
ApplicationManagerImplTest()
: app_id_(0u)
@@ -406,9 +404,13 @@ MATCHER_P(HMIFunctionIDIs, result_code, "") {
.asInt());
}
+class ApplicationManagerImplTestWithServiceStatus
+ : public ::testing::WithParamInterface<ServiceStatus>,
+ public ApplicationManagerImplTest {};
+
INSTANTIATE_TEST_CASE_P(
ProcessServiceStatusUpdate_REQUEST_ACCEPTED,
- ApplicationManagerImplTest,
+ ApplicationManagerImplTestWithServiceStatus,
::testing::Values(ServiceStatus(ServiceType::AUDIO,
ServiceEvent::REQUEST_ACCEPTED,
UpdateReasonOptional::EMPTY),
@@ -421,7 +423,7 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
ProcessServiceStatusUpdate_REQUEST_RECEIVED,
- ApplicationManagerImplTest,
+ ApplicationManagerImplTestWithServiceStatus,
::testing::Values(ServiceStatus(ServiceType::AUDIO,
ServiceEvent::REQUEST_RECEIVED,
UpdateReasonOptional::EMPTY),
@@ -434,7 +436,7 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
ProcessServiceStatusUpdate_REQUEST_REJECTED,
- ApplicationManagerImplTest,
+ ApplicationManagerImplTestWithServiceStatus,
::testing::Values(ServiceStatus(ServiceType::AUDIO,
ServiceEvent::REQUEST_REJECTED,
UpdateReasonOptional::EMPTY),
@@ -445,7 +447,7 @@ INSTANTIATE_TEST_CASE_P(
ServiceEvent::REQUEST_REJECTED,
UpdateReasonOptional::EMPTY)));
-TEST_P(ApplicationManagerImplTest,
+TEST_P(ApplicationManagerImplTestWithServiceStatus,
ProcessServiceStatusUpdate_SendMessageToHMI) {
smart_objects::SmartObjectSPtr notification_ =
std::make_shared<smart_objects::SmartObject>(
@@ -499,16 +501,16 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) {
TEST_F(ApplicationManagerImplTest,
SubscribeAppForWayPoints_ExpectSubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
}
TEST_F(ApplicationManagerImplTest,
- UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) {
+ UnsubscribeAppFromWayPoints_ExpectUnsubscriptionApp) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
- app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr);
+ app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr, true);
EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(*app_ptr));
const std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
@@ -520,7 +522,7 @@ TEST_F(
IsAnyAppSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
EXPECT_FALSE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
EXPECT_TRUE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
}
@@ -528,7 +530,7 @@ TEST_F(
ApplicationManagerImplTest,
GetAppsSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
- app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr, true);
std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
EXPECT_EQ(1u, result.size());
@@ -2294,6 +2296,42 @@ TEST_F(
app_manager_impl_->RequestForInterfacesAvailability();
}
+class ApplicationManagerImplTestWithFunctionID
+ : public ::testing::WithParamInterface<mobile_apis::FunctionID::eType>,
+ public ApplicationManagerImplTest {};
+
+TEST_P(ApplicationManagerImplTestWithFunctionID,
+ UnsubscribeAppFromSoftButtons_SUCCESS) {
+ AddMockApplication();
+ commands::MessageSharedPtr response_message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ const mobile_apis::FunctionID::eType function_id = GetParam();
+ (*response_message)[strings::params][strings::connection_key] =
+ kConnectionKey;
+ (*response_message)[strings::msg_params][strings::result_code] =
+ mobile_apis::Result::SUCCESS;
+ (*response_message)[strings::params][strings::function_id] = function_id;
+
+ EXPECT_CALL(*mock_app_ptr_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_ptr_, UnsubscribeFromSoftButtons(function_id));
+
+ const bool unsubscribe_result =
+ app_manager_impl_->UnsubscribeAppFromSoftButtons(response_message);
+
+ EXPECT_TRUE(unsubscribe_result);
+}
+
+INSTANTIATE_TEST_CASE_P(
+ UnsubscribeAppFromSoftButtons,
+ ApplicationManagerImplTestWithFunctionID,
+ ::testing::Values(mobile_apis::FunctionID::ScrollableMessageID,
+ mobile_apis::FunctionID::AlertID,
+ mobile_apis::FunctionID::AlertManeuverID,
+ mobile_apis::FunctionID::UpdateTurnListID,
+ mobile_apis::FunctionID::ShowConstantTBTID));
+
} // namespace application_manager_test
} // namespace components
} // namespace test
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 734a7d91b8..b12e67ceba 100644
--- a/src/components/application_manager/test/commands/command_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_impl_test.cc
@@ -150,12 +150,14 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) {
(*msg)[strings::params][strings::function_id] = kFunctionId;
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- EXPECT_EQ(kDefaultTimeout_, command->default_timeout());
+ const uint32_t expected_timeout =
+ kDefaultTimeout_ + kDefaultTimeoutCompensation_;
+ EXPECT_EQ(expected_timeout, command->default_timeout());
EXPECT_EQ(kCorrelationId, command->correlation_id());
EXPECT_EQ(kConnectionKey, command->connection_key());
EXPECT_EQ(kFunctionId, command->function_id());
EXPECT_NO_THROW(command->Run());
- EXPECT_NO_THROW(command->onTimeOut());
+ EXPECT_NO_THROW(command->HandleTimeOut());
}
TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_NoAppIdInMessage_UNSUCCESS) {
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc
index 9034bf442f..5129f09a96 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc
@@ -35,9 +35,9 @@
#include <string>
#include "application_manager/commands/command_impl.h"
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/command_request_test.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_from_mobile_impl.h"
#include "gtest/gtest.h"
#include "utils/lock.h"
@@ -78,6 +78,7 @@ using am::RPCParams;
using am::commands::CommandImpl;
using am::commands::CommandRequestImpl;
using am::commands::MessageSharedPtr;
+using am::commands::RequestFromMobileImpl;
using am::event_engine::EventObserver;
using test::components::application_manager_test::MockAppServiceManager;
@@ -101,32 +102,30 @@ const std::string kAppStorageFile = "./app_info.dat";
const std::string kAppInfoStorage = "app_info_storage";
} // namespace
-class CommandRequestImplTest
+class RequestFromMobileImplTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- CommandRequestImplTest()
+ RequestFromMobileImplTest()
: app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
- class UnwrappedCommandRequestImpl : public CommandRequestImpl {
+ class UnwrappedRequestFromMobileImpl
+ : public am::commands::RequestFromMobileImpl {
public:
- using CommandRequestImpl::AddDisallowedParameters;
- using CommandRequestImpl::CheckAllowedParameters;
- using CommandRequestImpl::HasDisallowedParams;
- using CommandRequestImpl::RemoveDisallowedParameters;
-
- UnwrappedCommandRequestImpl(const MessageSharedPtr& message,
- ApplicationManager& am,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(
- message, am, rpc_service, hmi_capabilities, policy_handler) {}
-
- const RequestState current_state() const {
- return current_state_;
+ UnwrappedRequestFromMobileImpl(
+ const MessageSharedPtr& message,
+ ApplicationManager& ap_man,
+ am::rpc_service::RPCService& rpc_service,
+ am::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : am::commands::RequestFromMobileImpl(
+ message, ap_man, rpc_service, hmi_capabilities, policy_handler) {}
+
+ const RequestState get_current_state() const {
+ return am::commands::CommandRequestImpl::current_state();
}
- void set_current_state(const RequestState state) {
- current_state_ = state;
+
+ void change_current_state(const RequestState state) {
+ am::commands::CommandRequestImpl::set_current_state(state);
}
CommandParametersPermissions& parameters_permissions() {
@@ -137,9 +136,21 @@ class CommandRequestImplTest
return removed_parameters_permissions_;
}
- void SetHashUpdateMode(HashUpdateMode mode) {
+ void SetHashUpdateMode(RequestFromMobileImpl::HashUpdateMode mode) {
hash_update_mode_ = mode;
}
+
+ void RemoveDisallowedParameters() {
+ am::commands::RequestFromMobileImpl::RemoveDisallowedParameters();
+ }
+
+ bool HasDisallowedParams() {
+ return am::commands::RequestFromMobileImpl::HasDisallowedParams();
+ }
+
+ void AddDisallowedParameters(smart_objects::SmartObject& response) {
+ am::commands::RequestFromMobileImpl::AddDisallowedParameters(response);
+ }
};
MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) {
@@ -155,41 +166,24 @@ class CommandRequestImplTest
std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_;
};
-typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
-typedef std::shared_ptr<UCommandRequestImpl> CommandPtr;
+typedef RequestFromMobileImplTest::UnwrappedRequestFromMobileImpl
+ URequestFromMobileImpl;
+typedef std::shared_ptr<URequestFromMobileImpl> CommandPtr;
-TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) {
+TEST_F(RequestFromMobileImplTest, WindowID_ExpectDefaultWindowID) {
auto msg = CreateMessage();
- const auto command = CreateCommand<UCommandRequestImpl>(msg);
+ const auto command = CreateCommand<URequestFromMobileImpl>(msg);
EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
command->window_id());
}
-TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
-
- // Should be called twice:
- // First -- on `onTimeOut` method call
- // Second -- on destruction;
- EXPECT_CALL(event_dispatcher_, remove_observer(_)).Times(2);
-
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
-
- // If `command` already done, then state should change to `kCompleted`.
- command->set_current_state(RequestState::kCompleted);
-
- command->onTimeOut();
-
- EXPECT_EQ(RequestState::kCompleted, command->current_state());
-}
-
-TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[strings::params][strings::correlation_id] = kCorrelationId;
(*msg)[strings::params][strings::function_id] = kInvalidFunctionId;
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
MessageSharedPtr dummy_msg(CreateMessage());
EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
@@ -199,15 +193,15 @@ TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) {
mock_rpc_service_,
ManageMobileCommand(dummy_msg, Command::CommandSource::SOURCE_SDL));
- command->onTimeOut();
+ command->HandleTimeOut();
// If `command` not done till now, then state should change to `kTimedOut`
// and sent it to application manager to deal with it.
- EXPECT_EQ(RequestState::kTimedOut, command->current_state());
+ EXPECT_EQ(RequestState::kTimedOut, command->get_current_state());
}
-TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+TEST_F(RequestFromMobileImplTest, CheckSyntax_SUCCESS) {
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
// Checking message syntax.
const std::string str1("\t\n");
@@ -221,14 +215,14 @@ TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) {
EXPECT_TRUE(command->CheckSyntax(str4, true));
}
-TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, GetMobileResultCode_SUCCESS) {
union ResultU {
int32_t value_;
hmi_apis::Common_Result::eType hmi_;
mobile_apis::Result::eType mobile_;
};
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
// Run thru all possible accordance
// of HMI and Mobile result codes.
@@ -253,8 +247,8 @@ TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) {
command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA));
}
-TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+TEST_F(RequestFromMobileImplTest, BasicMethodsOverloads_SUCCESS) {
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
// Current implementation always return `true`
EXPECT_TRUE(command->Init());
@@ -264,8 +258,8 @@ TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) {
EXPECT_NO_THROW(command->on_event(event));
}
-TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+TEST_F(RequestFromMobileImplTest, CreateHMINotification_SUCCESS) {
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
const std::string kTestParamsKey = "test_msg_params";
@@ -284,8 +278,8 @@ TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) {
EXPECT_TRUE((*result)[strings::msg_params].keyExists(kTestParamsKey));
}
-TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+TEST_F(RequestFromMobileImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
@@ -302,8 +296,8 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
command->SendHMIRequest(kInvalidFunctionId, NULL, false));
}
-TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
+TEST_F(RequestFromMobileImplTest, SendHMIRequest_UseEvent_SUCCESS) {
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>();
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
@@ -321,7 +315,14 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
command->SendHMIRequest(kInvalidFunctionId, NULL, true));
}
-TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, RemoveDisallowedParameters_SUCCESS) {
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
+
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][kDisallowedParam1] = 0u;
(*msg)[strings::msg_params][kDisallowedParam2] = 0u;
@@ -329,7 +330,8 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
(*msg)[strings::msg_params][kUndefinedParam] = 0u;
(*msg)[strings::msg_params][kMissedParam] = 0u;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
+
CommandParametersPermissions& permission = command->parameters_permissions();
permission.disallowed_params.insert(kDisallowedParam1);
permission.disallowed_params.insert(kDisallowedParam2);
@@ -346,27 +348,31 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
EXPECT_TRUE(command->HasDisallowedParams());
}
-TEST_F(CommandRequestImplTest,
+TEST_F(RequestFromMobileImplTest,
CheckAllowedParameters_RegisterAppInterface_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::RegisterAppInterfaceID;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
EXPECT_CALL(app_mngr_, applications()).Times(0);
EXPECT_TRUE(command->CheckPermissions());
}
-TEST_F(CommandRequestImplTest,
+TEST_F(RequestFromMobileImplTest,
CheckAllowedParameters_NoAppWithSameConnectionKey_UNSUCCESS) {
MessageSharedPtr message = CreateMessage();
- CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(message);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr()));
+ MessageSharedPtr dummy_msg(CreateMessage());
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(dummy_msg));
EXPECT_FALSE(command->CheckPermissions());
}
-TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
+TEST_F(RequestFromMobileImplTest,
+ CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
ON_CALL(*mock_app, GetWindowIds())
@@ -380,7 +386,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
(*message)[strings::msg_params] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(message);
EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(kMobResultSuccess));
@@ -388,7 +394,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
EXPECT_TRUE(command->CheckPermissions());
}
-TEST_F(CommandRequestImplTest,
+TEST_F(RequestFromMobileImplTest,
CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
@@ -405,7 +411,7 @@ TEST_F(CommandRequestImplTest,
(*message)[strings::params][strings::message_type] =
mobile_apis::messageType::request;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(message);
EXPECT_CALL(*mock_app, app_id())
.Times(1)
@@ -425,12 +431,12 @@ ACTION_P(GetArg3, output) {
*output = arg3;
}
-TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
(*msg)[strings::msg_params][kPolicyAppId] = true;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
MockAppPtr app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
@@ -449,14 +455,16 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
std::find(params.begin(), params.end(), kPolicyAppId));
}
-TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, AddDisallowedParameters_SUCCESS) {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(
kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
- MessageSharedPtr msg;
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::SubscribeVehicleDataID;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
ON_CALL(mock_message_helper_, vehicle_data())
.WillByDefault(ReturnRef(vehicle_data));
@@ -469,22 +477,9 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) {
EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kDisallowedParam1));
}
-TEST_F(CommandRequestImplTest, SendResponse_TimedOut_UNSUCCESS) {
- CommandPtr command = CreateCommand<UCommandRequestImpl>();
-
- command->set_current_state(RequestState::kTimedOut);
-
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
-
- // Args do not affect on anything in this case;
- command->SendResponse(true, kMobResultSuccess, NULL, NULL);
-
- EXPECT_EQ(RequestState::kTimedOut, command->current_state());
-}
-
-TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) {
+TEST_F(RequestFromMobileImplTest, SendResponse_SUCCESS) {
MessageSharedPtr msg;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
EXPECT_TRUE(smart_objects::SmartType_Null == (*msg).getType());
@@ -496,12 +491,10 @@ TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) {
// Args do not affect on anything in this case;
command->SendResponse(true, kMobResultSuccess, NULL, NULL);
- EXPECT_EQ(RequestState::kCompleted, command->current_state());
-
EXPECT_TRUE(smart_objects::SmartType_Map == (*msg).getType());
}
-TEST_F(CommandRequestImplTest,
+TEST_F(RequestFromMobileImplTest,
SendResponse_AddDisallowedParametersToInfo_SUCCESS) {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(
@@ -511,7 +504,7 @@ TEST_F(CommandRequestImplTest,
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::SubscribeVehicleDataID;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
command->removed_parameters_permissions().disallowed_params.insert(
kDisallowedParam1);
@@ -526,17 +519,16 @@ TEST_F(CommandRequestImplTest,
command->SendResponse(true, kMobResultSuccess, NULL, NULL);
- EXPECT_EQ(RequestState::kCompleted, command->current_state());
-
EXPECT_TRUE((*result)[strings::msg_params].keyExists(strings::info));
EXPECT_FALSE(
(*result)[strings::msg_params][strings::info].asString().empty());
}
-TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) {
+TEST_F(RequestFromMobileImplTest, HashUpdateAllowed_UpdateExpected) {
MessageSharedPtr msg;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
- command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
+ command->SetHashUpdateMode(
+ RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate);
MessageSharedPtr result;
@@ -553,11 +545,11 @@ TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) {
command.reset();
}
-TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) {
+TEST_F(RequestFromMobileImplTest, HashUpdateDisallowed_HashUpdateNotExpected) {
MessageSharedPtr msg;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
command->SetHashUpdateMode(
- CommandRequestImpl::HashUpdateMode::kSkipHashUpdate);
+ RequestFromMobileImpl::HashUpdateMode::kSkipHashUpdate);
MessageSharedPtr result;
@@ -573,10 +565,11 @@ TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) {
command.reset();
}
-TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) {
+TEST_F(RequestFromMobileImplTest, RequestFailed_HashUpdateNotExpected) {
MessageSharedPtr msg;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
- command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
+ command->SetHashUpdateMode(
+ RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate);
MessageSharedPtr result;
@@ -592,10 +585,11 @@ TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) {
command.reset();
}
-TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) {
+TEST_F(RequestFromMobileImplTest, AppNotFound_HashUpdateNotExpected) {
MessageSharedPtr msg;
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
- command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
+ command->SetHashUpdateMode(
+ RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate);
MessageSharedPtr result;
@@ -612,7 +606,7 @@ TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) {
command.reset();
}
-TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) {
+TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByServiceType) {
auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
kAppInfoStorage));
@@ -633,7 +627,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) {
mobile_apis::FunctionID::GetAppServiceDataID;
(*msg)[strings::msg_params][strings::service_type] = "MEDIA";
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
command->SendProviderRequest(
mobile_apis::FunctionID::GetAppServiceDataID,
hmi_apis::FunctionID::AppService_GetAppServiceData,
@@ -641,7 +635,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) {
true);
}
-TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) {
+TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByProviderID) {
auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
kAppInfoStorage));
@@ -662,7 +656,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) {
mobile_apis::FunctionID::GetAppServiceDataID;
(*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
command->SendProviderRequest(
mobile_apis::FunctionID::GetAppServiceDataID,
hmi_apis::FunctionID::AppService_GetAppServiceData,
@@ -670,7 +664,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) {
true);
}
-TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) {
+TEST_F(RequestFromMobileImplTest, SendProviderRequestToHMI_ByProviderID) {
auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
kAppInfoStorage));
@@ -691,7 +685,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) {
mobile_apis::FunctionID::GetAppServiceDataID;
(*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
- CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg);
command->SendProviderRequest(
mobile_apis::FunctionID::GetAppServiceDataID,
hmi_apis::FunctionID::AppService_GetAppServiceData,
diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc
index 6746e0d5ec..506eed1870 100644
--- a/src/components/application_manager/test/event_engine_test.cc
+++ b/src/components/application_manager/test/event_engine_test.cc
@@ -125,7 +125,7 @@ class EventEngineTest : public testing::Test {
event_id, correlation_id, event_observer_mock_);
event_->set_smart_object(so);
- EXPECT_CALL(event_observer_mock_, on_event(An<const Event&>()))
+ EXPECT_CALL(event_observer_mock_, HandleOnEvent(An<const Event&>()))
.Times(calls_number);
event_dispatcher_instance_->raise_event(*event_);
}
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 caff56f675..d9fb0b82d9 100644
--- a/src/components/application_manager/test/help_prompt_manager_test.cc
+++ b/src/components/application_manager/test/help_prompt_manager_test.cc
@@ -57,6 +57,7 @@ const uint32_t kAppId = 10u;
const uint32_t kCmdId = 1u;
const std::string kPolicyAppId = "fake_app_id";
const uint32_t kTimeout = 10000u;
+const uint32_t kTimeoutCompensation = 1000u;
const std::string kText = "one";
const uint32_t kPosition = 1u;
const std::string kFirstVrCommand = "first";
@@ -168,6 +169,8 @@ void HelpPromptManagerTest::SetUp() {
.WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_settings_, default_timeout())
.WillByDefault(ReturnRef(kTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kTimeoutCompensation));
ON_CALL(app_mngr_settings_, app_icons_folder())
.WillByDefault(ReturnRef(kDirectoryName));
ON_CALL(app_mngr_settings_, app_storage_folder())
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index 4e2e948335..2127f46b69 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -130,6 +130,14 @@ const std::vector<hmi_apis::Common_LightName::eType> light_name_enum_values{
hmi_apis::Common_LightName::eType::EXTERIOR_RIGHT_LIGHTS,
hmi_apis::Common_LightName::eType::EXTERIOR_ALL_LIGHTS};
+const std::vector<hmi_apis::FunctionID::eType> is_ready_requests{
+ hmi_apis::FunctionID::RC_IsReady,
+ hmi_apis::FunctionID::VR_IsReady,
+ hmi_apis::FunctionID::UI_IsReady,
+ hmi_apis::FunctionID::TTS_IsReady,
+ hmi_apis::FunctionID::Navigation_IsReady,
+ hmi_apis::FunctionID::VehicleInfo_IsReady};
+
bool IsLightNameExists(const hmi_apis::Common_LightName::eType& light_name) {
auto it = std::find(
light_name_enum_values.begin(), light_name_enum_values.end(), light_name);
@@ -155,6 +163,13 @@ class HMICapabilitiesTest : public ::testing::Test {
.WillByDefault(ReturnRef(kHmiCapabilitiesCacheFile));
hmi_capabilities_ = std::make_shared<HMICapabilitiesImpl>(mock_app_mngr_);
+ IsReadyResponsesReceived();
+ }
+
+ void IsReadyResponsesReceived() {
+ for (const auto& request : is_ready_requests) {
+ hmi_capabilities_->UpdateRequestsRequiredForCapabilities(request);
+ }
}
void TearDown() OVERRIDE {
@@ -271,7 +286,6 @@ TEST_F(
// Count of buttons in json file
const size_t btn_length = buttons_capabilities_so.length();
- EXPECT_EQ(16ull, btn_length);
for (size_t index = 0; index < btn_length; ++index) {
EXPECT_TRUE(buttons_capabilities_so
[index][rc_rpc_plugin::enums_value::kShortPressAvailable]
@@ -530,16 +544,16 @@ TEST_F(
800,
vs_capability_so[strings::preferred_resolution][strings::resolution_width]
.asInt());
- EXPECT_EQ(350,
+ EXPECT_EQ(380,
vs_capability_so[strings::preferred_resolution]
[strings::resolution_height]
.asInt());
EXPECT_TRUE(vs_capability_so.keyExists(strings::max_bitrate));
- EXPECT_EQ(10000, vs_capability_so[strings::max_bitrate].asInt());
+ EXPECT_EQ(20000, vs_capability_so[strings::max_bitrate].asInt());
EXPECT_TRUE(vs_capability_so.keyExists(strings::supported_formats));
const size_t supported_formats_len =
vs_capability_so[strings::supported_formats].length();
- EXPECT_EQ(1ull, supported_formats_len);
+ EXPECT_EQ(5u, supported_formats_len);
EXPECT_TRUE(vs_capability_so[strings::supported_formats][0].keyExists(
strings::protocol));
@@ -554,8 +568,21 @@ TEST_F(
EXPECT_TRUE(
vs_capability_so.keyExists(strings::haptic_spatial_data_supported));
- EXPECT_FALSE(
+ EXPECT_TRUE(
vs_capability_so[strings::haptic_spatial_data_supported].asBool());
+ EXPECT_TRUE(vs_capability_so.keyExists(strings::diagonal_screen_size));
+ EXPECT_EQ(8, vs_capability_so[strings::diagonal_screen_size].asInt());
+ EXPECT_TRUE(vs_capability_so.keyExists(strings::pixel_per_inch));
+ EXPECT_EQ(96, vs_capability_so[strings::pixel_per_inch].asInt());
+ EXPECT_TRUE(vs_capability_so.keyExists(strings::scale));
+ EXPECT_EQ(1, vs_capability_so[strings::scale].asInt());
+ EXPECT_TRUE(vs_capability_so.keyExists(strings::preferred_fps));
+ EXPECT_TRUE(vs_capability_so.keyExists(
+ strings::additional_video_streaming_capabilities));
+ const size_t additional_video_streaming_capabilities_len =
+ vs_capability_so[strings::additional_video_streaming_capabilities]
+ .length();
+ EXPECT_EQ(7u, additional_video_streaming_capabilities_len);
EXPECT_TRUE(hmi_capabilities_->video_streaming_supported());
}
diff --git a/src/components/application_manager/test/hmi_language_handler_test.cc b/src/components/application_manager/test/hmi_language_handler_test.cc
index 59913b19be..368f77ce8a 100644
--- a/src/components/application_manager/test/hmi_language_handler_test.cc
+++ b/src/components/application_manager/test/hmi_language_handler_test.cc
@@ -143,10 +143,10 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) {
// Repeatedly add events to set `is_*_language_received_` flags up
Event ui_event(hmi_apis::FunctionID::UI_GetLanguage);
- hmi_language_handler_->on_event(ui_event);
+ hmi_language_handler_->HandleOnEvent(ui_event);
Event vr_event(hmi_apis::FunctionID::VR_GetLanguage);
- hmi_language_handler_->on_event(vr_event);
+ hmi_language_handler_->HandleOnEvent(vr_event);
// After last flag gets up, `VerifyWithPersistedLanguages`
// method been called to and then will call `hmi_capabilities`
@@ -173,14 +173,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0);
Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage);
- hmi_language_handler_->on_event(tts_event);
+ hmi_language_handler_->HandleOnEvent(tts_event);
}
TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) {
Event ui_event(hmi_apis::FunctionID::UI_GetLanguage);
- hmi_language_handler_->on_event(ui_event);
+ hmi_language_handler_->HandleOnEvent(ui_event);
Event vr_event(hmi_apis::FunctionID::VR_GetLanguage);
- hmi_language_handler_->on_event(vr_event);
+ hmi_language_handler_->HandleOnEvent(vr_event);
ON_CALL(app_manager_, hmi_capabilities())
.WillByDefault(ReturnRef(hmi_capabilities_));
@@ -212,14 +212,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) {
EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0);
Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage);
- hmi_language_handler_->on_event(tts_event);
+ hmi_language_handler_->HandleOnEvent(tts_event);
}
TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) {
Event ui_event(hmi_apis::FunctionID::UI_GetLanguage);
- hmi_language_handler_->on_event(ui_event);
+ hmi_language_handler_->HandleOnEvent(ui_event);
Event vr_event(hmi_apis::FunctionID::VR_GetLanguage);
- hmi_language_handler_->on_event(vr_event);
+ hmi_language_handler_->HandleOnEvent(vr_event);
ON_CALL(app_manager_, hmi_capabilities())
.WillByDefault(ReturnRef(hmi_capabilities_));
@@ -242,7 +242,7 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) {
ON_CALL(app_manager_, applications()).WillByDefault(Return(data_accessor));
Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage);
- hmi_language_handler_->on_event(tts_event);
+ hmi_language_handler_->HandleOnEvent(tts_event);
}
TEST_F(HmiLanguageHandlerTest,
@@ -299,7 +299,7 @@ TEST_F(HmiLanguageHandlerTest,
event.set_smart_object(msg);
EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0);
- hmi_language_handler_->on_event(event);
+ hmi_language_handler_->HandleOnEvent(event);
EXPECT_CALL(app_manager_, hmi_capabilities())
.WillOnce(ReturnRef(hmi_capabilities_));
@@ -327,7 +327,7 @@ TEST_F(HmiLanguageHandlerTest,
.WillRepeatedly(ReturnRef(mock_rpc_service_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(2);
EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(1);
- hmi_language_handler_->on_event(event);
+ hmi_language_handler_->HandleOnEvent(event);
}
TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) {
@@ -339,7 +339,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) {
event.set_smart_object(msg);
EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0);
- hmi_language_handler_->on_event(event);
+ hmi_language_handler_->HandleOnEvent(event);
hmi_language_handler_->OnUnregisterApplication(app_id);
@@ -356,7 +356,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) {
EXPECT_CALL(app_manager_, GetRPCService()).Times(0);
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0);
- hmi_language_handler_->on_event(event);
+ hmi_language_handler_->HandleOnEvent(event);
}
} // namespace hmi_language_handler
} // namespace components
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 3a44d7b3ff..b252d37181 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
@@ -38,6 +38,7 @@
#include "gtest/gtest.h"
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/mock_request_timeout_handler.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
#include "application_manager/test/include/application_manager/mock_event_dispatcher.h"
@@ -59,6 +60,7 @@ namespace am = ::application_manager;
using am::commands::Command;
using am::commands::CommandRequestImpl;
using am::event_engine::Event;
+using test::components::application_manager_test::MockRequestTimeoutHandler;
class CallRun {
public:
@@ -112,14 +114,17 @@ class CommandRequestTest : public CommandsTest<kIsNice> {
}
MockEventDisp event_dispatcher_;
+ MockRequestTimeoutHandler mock_request_timeout_handler_;
protected:
CommandRequestTest() : CommandsTest<kIsNice>() {}
- virtual void InitCommand(const uint32_t& default_timeout) OVERRIDE {
+ void InitCommand(const uint32_t& default_timeout) OVERRIDE {
CommandsTest<kIsNice>::InitCommand(default_timeout);
ON_CALL(CommandsTest<kIsNice>::app_mngr_, event_dispatcher())
.WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(CommandsTest<kIsNice>::app_mngr_, get_request_timeout_handler())
+ .WillByDefault(ReturnRef(mock_request_timeout_handler_));
}
};
diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
index fdaef2c716..b7d4608a25 100644
--- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h
+++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
@@ -41,6 +41,7 @@
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_rpc_service.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
@@ -53,6 +54,7 @@ namespace components {
namespace commands_test {
namespace am = ::application_manager;
+namespace strings = am::strings;
using ::testing::_;
using ::testing::Mock;
@@ -68,6 +70,7 @@ using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
+using ::test::components::event_engine_test::MockEventDispatcher;
// Depending on the value type will be selected
template <const bool kIf, class ThenT, class ElseT>
@@ -145,7 +148,24 @@ class CommandsTest : public ::testing::Test {
mock_policy_handler_);
}
- enum { kDefaultTimeout_ = 100 };
+ void InitEventDispatcher() {
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ }
+
+ void InitNegativeResponse() {
+ MessageSharedPtr timeout_response =
+ CommandsTest<kIsNice>::CreateMessage(smart_objects::SmartType_Map);
+ (*timeout_response)[am::strings::msg_params][am::strings::result_code] =
+ am::mobile_api::Result::GENERIC_ERROR;
+ (*timeout_response)[am::strings::msg_params][am::strings::success] = false;
+
+ ON_CALL(mock_message_helper_,
+ CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
+ .WillByDefault(Return(timeout_response));
+ }
+
+ enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 };
MockAppManager app_mngr_;
MockRPCService mock_rpc_service_;
@@ -154,21 +174,31 @@ class CommandsTest : public ::testing::Test {
testing::NiceMock<policy_test::MockPolicyHandlerInterface>
mock_policy_handler_;
MockAppManagerSettings app_mngr_settings_;
+ MockEventDispatcher event_dispatcher_;
MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_;
am::MockMessageHelper& mock_message_helper_;
protected:
virtual void InitCommand(const uint32_t& timeout) {
+ this->InitCommand(timeout, kDefaultTimeoutCompensation_);
+ }
+
+ virtual void InitCommand(const uint32_t timeout,
+ const uint32_t compensation) {
timeout_ = timeout;
+ timeout_compensation_ = compensation;
ON_CALL(app_mngr_, get_settings())
.WillByDefault(ReturnRef(app_mngr_settings_));
ON_CALL(app_mngr_settings_, default_timeout())
.WillByDefault(ReturnRef(timeout_));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(timeout_compensation_));
}
CommandsTest()
: mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , timeout_(0) {
+ , timeout_(0)
+ , timeout_compensation_(0) {
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
@@ -179,6 +209,30 @@ class CommandsTest : public ::testing::Test {
InitHMIToMobileResultConverter();
}
+ void FillVideoStreamingCapability(
+ smart_objects::SmartObject& video_streaming_capability) {
+ video_streaming_capability[strings::preferred_resolution] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ video_streaming_capability[strings::preferred_resolution]
+ [strings::resolution_width] = 800;
+ video_streaming_capability[strings::preferred_resolution]
+ [strings::resolution_height] = 354;
+ video_streaming_capability[strings::max_bitrate] = 10000;
+ video_streaming_capability[strings::supported_formats] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ video_streaming_capability[strings::supported_formats][0] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ video_streaming_capability[strings::supported_formats][0]
+ [strings::protocol] =
+ hmi_apis::Common_VideoStreamingProtocol::RAW;
+ video_streaming_capability[strings::supported_formats][0][strings::codec] =
+ hmi_apis::Common_VideoStreamingCodec::H264;
+ video_streaming_capability[strings::haptic_spatial_data_supported] = true;
+ video_streaming_capability[strings::diagonal_screen_size] = 7.47;
+ video_streaming_capability[strings::pixel_per_inch] = 117.f;
+ video_streaming_capability[strings::scale] = 1.f;
+ }
+
void InitHMIToMobileResultConverter() {
namespace MobileResult = mobile_apis::Result;
namespace HMIResult = hmi_apis::Common_Result;
@@ -229,6 +283,7 @@ class CommandsTest : public ::testing::Test {
private:
uint32_t timeout_;
+ uint32_t timeout_compensation_;
};
MATCHER_P(MobileResultCodeIs, result_code, "") {
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
index 60d2f90297..e3a47f412a 100644
--- 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
@@ -87,6 +87,7 @@ class MockAppServiceManager : public application_manager::AppServiceManager {
const bool service_published));
MOCK_METHOD1(UpdateNavigationCapabilities,
bool(smart_objects::SmartObject& out_params));
+ MOCK_METHOD0(FindWayPointsHandler, application_manager::AppService*());
MOCK_METHOD0(GetRPCPassingHandler, application_manager::RPCPassingHandler&());
};
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 454b43b99f..ac2a534929 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
@@ -88,8 +88,9 @@ class MockApplication : public ::application_manager::Application {
void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(SuspendStreaming,
void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(WakeUpStreaming,
- void(protocol_handler::ServiceType service_type));
+ MOCK_METHOD2(WakeUpStreaming,
+ void(protocol_handler::ServiceType service_type,
+ uint32_t timer_len));
MOCK_CONST_METHOD0(is_voice_communication_supported, bool());
MOCK_METHOD1(set_voice_communication_supported,
void(bool is_voice_communication_supported));
@@ -206,9 +207,10 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD2(RemoveHMIState,
void(const application_manager::WindowID window_id,
::application_manager::HmiState::StateID state_id));
- MOCK_METHOD2(SubscribeToSoftButtons,
- void(int32_t cmd_id,
- const ::application_manager::SoftButtonID& softbuttons_id));
+ MOCK_METHOD2(
+ SubscribeToSoftButtons,
+ void(int32_t cmd_id,
+ const application_manager::WindowSoftButtons& window_softbuttons));
MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id));
MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id));
MOCK_CONST_METHOD0(IsAudioApplication, bool());
@@ -251,6 +253,7 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(menu_layout, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject());
MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject());
MOCK_CONST_METHOD0(display_layout, std::string());
@@ -303,6 +306,8 @@ class MockApplication : public ::application_manager::Application {
void(const smart_objects::SmartObject& menu_title));
MOCK_METHOD1(set_menu_icon,
void(const smart_objects::SmartObject& menu_icon));
+ MOCK_METHOD1(set_menu_layout,
+ void(const smart_objects::SmartObject& menu_layout));
MOCK_METHOD1(set_day_color_scheme,
void(const smart_objects::SmartObject& color_scheme));
MOCK_METHOD1(set_night_color_scheme,
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 b345f53c1c..f0f8bd8dd1 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
@@ -57,6 +57,10 @@ class MockEventDispatcher
remove_observer,
void(const ::application_manager::event_engine::Event::EventID& event_id,
::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD2(
+ remove_observer,
+ void(const ::application_manager::event_engine::Event::EventID& event_id,
+ int32_t hmi_correlation_id));
MOCK_METHOD1(
remove_observer,
void(::application_manager::event_engine::EventObserver& observer));
diff --git a/src/components/application_manager/test/include/application_manager/mock_event_observer.h b/src/components/application_manager/test/include/application_manager/mock_event_observer.h
index 1357d67a65..7ac9223e41 100644
--- a/src/components/application_manager/test/include/application_manager/mock_event_observer.h
+++ b/src/components/application_manager/test/include/application_manager/mock_event_observer.h
@@ -50,8 +50,10 @@ class MockEventObserver
MOCK_METHOD1(on_event,
void(const application_manager::event_engine::Event& event));
MOCK_METHOD1(
- on_event,
+ HandleOnEvent,
void(const application_manager::event_engine::MobileEvent& event));
+ MOCK_METHOD1(HandleOnEvent,
+ void(const application_manager::event_engine::Event& event));
};
} // namespace event_engine_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
index 2f9f40ad2a..f0da952d18 100644
--- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -205,13 +205,12 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
set_seat_location_capability,
void(const smart_objects::SmartObject& seat_location_capability));
- DEPRECATED
- MOCK_METHOD1(Init, void(resumption::LastState* last_state));
-
MOCK_METHOD1(Init, void(resumption::LastStateWrapperPtr last_state_wrapper));
MOCK_CONST_METHOD0(ccpu_version, const std::string&());
MOCK_METHOD1(set_ccpu_version, void(const std::string& ccpu_version));
+ MOCK_CONST_METHOD0(hardware_version, const std::string&());
+ MOCK_METHOD1(set_hardware_version, void(const std::string& hardware_version));
MOCK_METHOD1(OnSoftwareVersionReceived,
void(const std::string& ccpu_version));
MOCK_METHOD0(UpdateCachedCapabilities, void());
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 d7919a374b..67d992d4af 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
@@ -125,11 +125,12 @@ class MockMessageHelper {
MOCK_METHOD2(CreateHMIStatusNotification,
smart_objects::SmartObjectSPtr(ApplicationSharedPtr application,
const WindowID window_id));
- MOCK_METHOD3(CreateOnButtonSubscriptionNotificationsForApp,
+ MOCK_METHOD4(CreateButtonSubscriptionsHandlingRequestsList,
smart_objects::SmartObjectList(
ApplicationConstSharedPtr application,
- ApplicationManager& app_mngr,
- const ButtonSubscriptions& button_subscriptions));
+ const ButtonSubscriptions& button_subscriptions,
+ const hmi_apis::FunctionID::eType function_id,
+ ApplicationManager& app_mngr));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
const uint32_t timeout,
@@ -139,18 +140,20 @@ class MockMessageHelper {
void(const std::string& file_name,
ApplicationManager& app_mngr));
#ifdef EXTERNAL_PROPRIETARY_MODE
- MOCK_METHOD4(
+ MOCK_METHOD5(
SendGetListOfPermissionsResponse,
void(const std::vector<policy::FunctionalGroupPermission>& permissions,
const policy::ExternalConsentStatus& external_consent_status,
uint32_t correlation_id,
- ApplicationManager& app_mngr));
+ ApplicationManager& app_mngr,
+ const bool success_flag));
#else
- MOCK_METHOD3(
+ MOCK_METHOD4(
SendGetListOfPermissionsResponse,
void(const std::vector<policy::FunctionalGroupPermission>& permissions,
uint32_t correlation_id,
- ApplicationManager& app_mngr));
+ ApplicationManager& app_mngr,
+ const bool success_flag));
#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_METHOD4(SendOnPermissionsChangeNotification,
void(uint32_t connection_key,
@@ -170,9 +173,6 @@ class MockMessageHelper {
MOCK_METHOD2(CreateModuleInfoSO,
smart_objects::SmartObjectSPtr(uint32_t function_id,
ApplicationManager& app_mngr));
- MOCK_METHOD2(SendAllOnButtonSubscriptionNotificationsForApp,
- void(ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr));
MOCK_METHOD2(CreateUIResetGlobalPropertiesRequest,
smart_objects::SmartObjectSPtr(
const ResetGlobalPropertiesResult& reset_result,
@@ -182,17 +182,30 @@ class MockMessageHelper {
smart_objects::SmartObjectSPtr(
const ResetGlobalPropertiesResult& reset_result,
ApplicationSharedPtr application));
+
+ MOCK_METHOD2(CreateRCResetGlobalPropertiesRequest,
+ smart_objects::SmartObjectSPtr(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application));
+
MOCK_METHOD2(CreateGlobalPropertiesRequestsToHMI,
smart_objects::SmartObjectList(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
MOCK_METHOD1(CreateSubscribeWayPointsMessageToHMI,
smart_objects::SmartObjectSPtr(const uint32_t correlation_id));
- MOCK_METHOD3(
- CreateOnButtonSubscriptionNotification,
- smart_objects::SmartObjectSPtr(uint32_t app_id,
- hmi_apis::Common_ButtonName::eType button,
- bool is_subscribed));
+ MOCK_METHOD4(CreateButtonSubscriptionHandlingRequestToHmi,
+ smart_objects::SmartObjectSPtr(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button_name,
+ const hmi_apis::FunctionID::eType function_id,
+ application_manager::ApplicationManager& app_mngr));
+
+ MOCK_METHOD2(CreateButtonNotificationToMobile,
+ smart_objects::SmartObjectSPtr(
+ ApplicationSharedPtr app,
+ const smart_objects::SmartObject& source_message));
+
MOCK_METHOD2(SendOnResumeAudioSourceToHMI,
void(uint32_t app_id, ApplicationManager& app_mngr));
MOCK_METHOD2(CreateAddSubMenuRequestsToHMI,
@@ -344,10 +357,6 @@ class MockMessageHelper {
MOCK_METHOD2(SendResetPropertiesRequest,
void(ApplicationSharedPtr application,
ApplicationManager& app_mngr));
- MOCK_METHOD3(SendUnsubscribeButtonNotification,
- void(mobile_apis::ButtonName::eType button,
- ApplicationSharedPtr application,
- ApplicationManager& app_mngr));
MOCK_METHOD1(CreateAppServiceCapabilities,
smart_objects::SmartObject(
std::vector<smart_objects::SmartObject>& all_services));
@@ -385,6 +394,12 @@ class MockMessageHelper {
application_manager::ApplicationSharedPtr application,
application_manager::ApplicationManager& app_mngr,
const application_manager::WindowID window_id));
+ MOCK_METHOD1(RemoveEmptyMessageParams,
+ uint16_t(const smart_objects::SmartObject&));
+
+ MOCK_METHOD2(AddDefaultParamsToTireStatus,
+ void(application_manager::ApplicationSharedPtr application,
+ smart_objects::SmartObject& response_from_hmi));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h
index c1cc7f601f..4348e39020 100644
--- a/src/components/application_manager/test/include/application_manager/mock_request.h
+++ b/src/components/application_manager/test/include/application_manager/mock_request.h
@@ -56,9 +56,10 @@ class MockRequest : public application_manager::commands::Command {
MOCK_CONST_METHOD0(default_timeout, uint32_t());
MOCK_CONST_METHOD0(function_id, int32_t());
MOCK_CONST_METHOD0(window_id, application_manager::WindowID());
+ MOCK_METHOD0(HandleTimeOut, void());
+ MOCK_METHOD0(OnUpdateTimeOut, void());
MOCK_METHOD1(set_warning_info, void(const std::string info));
MOCK_CONST_METHOD0(warning_info, std::string());
- MOCK_METHOD0(onTimeOut, void());
MOCK_METHOD0(AllowedToTerminate, bool());
MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed));
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index c2c02a1d0c..ed7d08e850 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -86,8 +86,7 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(OnAppActivated,
void(app_mngr::ApplicationSharedPtr application));
MOCK_METHOD1(RemoveFromResumption, void(uint32_t app_id));
- DEPRECATED
- MOCK_METHOD1(Init, bool(resumption::LastState& last_state));
+
MOCK_METHOD1(Init, bool(resumption::LastStateWrapperPtr last_state));
MOCK_METHOD2(OnAppRegistrationStart,
void(const std::string& policy_app_id,
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index e38b428877..0596b4e500 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -157,6 +157,7 @@ class ResumptionDataTest : public ::testing::Test {
am::SubMenuMap test_submenu_map;
am::ChoiceSetMap test_choiceset_map;
am::AppFilesMap app_files_map_;
+ smart_objects::SmartObject user_location_;
am::ButtonSubscriptions btn_subscr;
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 c380805bc2..4b36647a11 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
@@ -37,7 +37,6 @@
#include "gmock/gmock.h"
#include "utils/macro.h"
-#include "application_manager/commands/command_impl.h"
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
@@ -46,12 +45,14 @@
#include "application_manager/mock_rpc_service.h"
#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
#include "application_manager/state_controller.h"
#include "policy/mock_policy_settings.h"
#include "smart_objects/enum_schema_item.h"
#include "utils/custom_string.h"
#include "utils/lock.h"
+#include "application_manager/commands/command_impl.h"
#include "policy/policy_table/types.h"
#include "rpc_base/rpc_base_json_inl.h"
@@ -167,6 +168,12 @@ TEST(MessageHelperTestCreate,
EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
.WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+ smart_objects::SmartObject user_loc =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ EXPECT_CALL(*appSharedMock, get_user_location())
+ .WillRepeatedly(ReturnRef(user_loc));
+
application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
MessageHelper::CreateGlobalPropertiesRequestsToHMI(
@@ -189,6 +196,10 @@ TEST(MessageHelperTestCreate,
(*objPtr)[5][strings::help_prompt] = "666";
(*objPtr)[6][strings::timeout_prompt] = "777";
+ smart_objects::SmartObject user_loc =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ user_loc[rc_rpc_plugin::strings::kGrid] = "[]";
+
EXPECT_CALL(*appSharedMock, vr_help_title())
.Times(AtLeast(3))
.WillRepeatedly(Return(&(*objPtr)[0]));
@@ -211,6 +222,8 @@ TEST(MessageHelperTestCreate,
.Times(AtLeast(2))
.WillRepeatedly(Return(&(*objPtr)[4]));
EXPECT_CALL(*appSharedMock, app_id()).WillRepeatedly(Return(0));
+ EXPECT_CALL(*appSharedMock, get_user_location())
+ .WillRepeatedly(ReturnRef(user_loc));
std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager =
std::make_shared<MockHelpPromptManager>();
@@ -637,7 +650,6 @@ class MessageHelperTest : public ::testing::Test {
const StringArray function_id_strings;
const StringArray events_id_strings;
const StringArray hmi_level_strings;
-
const size_t delta_from_functions_id;
};
@@ -888,16 +900,46 @@ TEST_F(MessageHelperTest,
}
}
-TEST_F(MessageHelperTest, SubscribeApplicationToSoftButton_CallFromApp) {
- // Create application mock
+TEST_F(
+ MessageHelperTest,
+ SubscribeApplicationToSoftButton_SoftbuttonsAreAbsent_DoesntCallFromApp) {
MockApplicationSharedPtr appSharedPtr = std::make_shared<MockApplication>();
- // Prepare data for method
smart_objects::SmartObject message_params;
size_t function_id = 1;
- //
+ WindowSoftButtons window_buttons{
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW, {}};
+
EXPECT_CALL(*appSharedPtr,
- SubscribeToSoftButtons(function_id, SoftButtonID()))
- .Times(1);
+ SubscribeToSoftButtons(function_id, window_buttons))
+ .Times(0);
+ MessageHelper::SubscribeApplicationToSoftButton(
+ message_params, appSharedPtr, function_id);
+}
+
+TEST_F(MessageHelperTest,
+ SubscribeApplicationToSoftButton_SoftbuttonsExist_CallFromApp) {
+ MockApplicationSharedPtr appSharedPtr = std::make_shared<MockApplication>();
+ smart_objects::SmartObject message_params;
+ message_params[strings::soft_buttons] =
+ new smart_objects::SmartObject(smart_objects::SmartType_Array);
+ const uint32_t softbutton1 = 1u;
+ const uint32_t softbutton2 = 2u;
+ const uint32_t softbutton3 = 3u;
+ message_params[strings::soft_buttons][0][strings::soft_button_id] =
+ softbutton1;
+ message_params[strings::soft_buttons][1][strings::soft_button_id] =
+ softbutton2;
+ message_params[strings::soft_buttons][2][strings::soft_button_id] =
+ softbutton3;
+
+ size_t function_id = 1;
+ WindowSoftButtons window_buttons{
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ {softbutton1, softbutton2, softbutton3}};
+
+ EXPECT_CALL(*appSharedPtr,
+ SubscribeToSoftButtons(function_id, window_buttons));
+
MessageHelper::SubscribeApplicationToSoftButton(
message_params, appSharedPtr, function_id);
}
@@ -920,7 +962,8 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
MessageHelper::SendGetListOfPermissionsResponse(permissions,
external_consent_status,
correlation_id,
- mock_application_manager_);
+ mock_application_manager_,
+ true);
ASSERT_TRUE(result.get());
@@ -960,7 +1003,8 @@ TEST_F(MessageHelperTest,
MessageHelper::SendGetListOfPermissionsResponse(permissions,
external_consent_status,
correlation_id,
- mock_application_manager_);
+ mock_application_manager_,
+ true);
ASSERT_TRUE(result.get());
diff --git a/src/components/application_manager/test/mobile_event_engine_test.cc b/src/components/application_manager/test/mobile_event_engine_test.cc
index cad1ff14ff..56824b7020 100644
--- a/src/components/application_manager/test/mobile_event_engine_test.cc
+++ b/src/components/application_manager/test/mobile_event_engine_test.cc
@@ -116,7 +116,7 @@ class MobileEventEngineTest : public testing::Test {
event_dispatcher_instance_->add_mobile_observer(
event_id, correlation_id, event_observer_mock_);
event_->set_smart_object(so);
- EXPECT_CALL(event_observer_mock_, on_event(An<const MobileEvent&>()))
+ EXPECT_CALL(event_observer_mock_, HandleOnEvent(An<const MobileEvent&>()))
.Times(calls_number);
event_dispatcher_instance_->raise_mobile_event(*event_);
}
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 91f953eaf5..9212b0feab 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -170,14 +170,16 @@ void MessageHelper::SendGetListOfPermissionsResponse(
const policy::ExternalConsentStatus& external_consent_status,
#endif // EXTERNAL_PROPRIETARY_MODE
uint32_t correlation_id,
- ApplicationManager& app_mngr) {
+ ApplicationManager& app_mngr,
+ const bool success_flag) {
MockMessageHelper::message_helper_mock()->SendGetListOfPermissionsResponse(
permissions,
#ifdef EXTERNAL_PROPRIETARY_MODE
external_consent_status,
#endif // EXTERNAL_PROPRIETARY_MODE
correlation_id,
- app_mngr);
+ app_mngr,
+ success_flag);
}
void MessageHelper::SendOnPermissionsChangeNotification(
@@ -267,11 +269,6 @@ MockMessageHelper* MockMessageHelper::message_helper_mock() {
static ::testing::NiceMock<MockMessageHelper> message_helper_mock;
return &message_helper_mock;
}
-void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
- MockMessageHelper::message_helper_mock()
- ->SendAllOnButtonSubscriptionNotificationsForApp(app, app_mngr);
-}
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr) {
@@ -582,6 +579,14 @@ MessageHelper::CreateTTSResetGlobalPropertiesRequest(
->CreateTTSResetGlobalPropertiesRequest(reset_result, application);
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateRCResetGlobalPropertiesRequest(
+ const ResetGlobalPropertiesResult& reset_result,
+ ApplicationSharedPtr application) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateRCResetGlobalPropertiesRequest(reset_result, application);
+}
+
smart_objects::SmartObjectList
MessageHelper::CreateGlobalPropertiesRequestsToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
@@ -590,30 +595,32 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
}
smart_objects::SmartObjectSPtr
-MessageHelper::CreateOnButtonSubscriptionNotification(
- uint32_t app_id,
- hmi_apis::Common_ButtonName::eType button,
- bool is_subscribed) {
+MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button_name,
+ const hmi_apis::FunctionID::eType function_id,
+ ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()
- ->CreateOnButtonSubscriptionNotification(app_id, button, is_subscribed);
+ ->CreateButtonSubscriptionHandlingRequestToHmi(
+ app_id, button_name, function_id, app_mngr);
}
-smart_objects::SmartObjectList
-MessageHelper::CreateOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr application,
- ApplicationManager& app_mngr,
- const ButtonSubscriptions& button_subscriptions) {
+smart_objects::SmartObjectSPtr MessageHelper::CreateButtonNotificationToMobile(
+ ApplicationSharedPtr app,
+ const smart_objects::SmartObject& source_message) {
return MockMessageHelper::message_helper_mock()
- ->CreateOnButtonSubscriptionNotificationsForApp(
- application, app_mngr, button_subscriptions);
+ ->CreateButtonNotificationToMobile(app, source_message);
}
-void MessageHelper::SendUnsubscribeButtonNotification(
- mobile_apis::ButtonName::eType button,
- ApplicationSharedPtr application,
+smart_objects::SmartObjectList
+MessageHelper::CreateButtonSubscriptionsHandlingRequestsList(
+ ApplicationConstSharedPtr app,
+ const ButtonSubscriptions& button_subscriptions,
+ const hmi_apis::FunctionID::eType function_id,
ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()
- ->SendUnsubscribeButtonNotification(button, application, app_mngr);
+ ->CreateButtonSubscriptionsHandlingRequestsList(
+ app, button_subscriptions, function_id, app_mngr);
}
smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
@@ -679,4 +686,18 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateResponseMessageFromHmi(
return MockMessageHelper::message_helper_mock()->CreateResponseMessageFromHmi(
function_id, correlation_id, result_code);
}
+
+uint16_t MessageHelper::RemoveEmptyMessageParams(
+ smart_objects::SmartObject& msg_params) {
+ return MockMessageHelper::message_helper_mock()->RemoveEmptyMessageParams(
+ msg_params);
+}
+
+void MessageHelper::AddDefaultParamsToTireStatus(
+ application_manager::ApplicationSharedPtr application,
+ smart_objects::SmartObject& response_from_hmi) {
+ return MockMessageHelper::message_helper_mock()->AddDefaultParamsToTireStatus(
+ application, response_from_hmi);
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc
index 22d7a8cfa0..e42c7648b9 100644
--- a/src/components/application_manager/test/policy_event_observer_test.cc
+++ b/src/components/application_manager/test/policy_event_observer_test.cc
@@ -89,7 +89,7 @@ class PolicyEventObserverTest : public ::testing::Test {
EXPECT_CALL(policy_handler_mock_,
PTUpdatedAt(Counters::KILOMETERS, field_value))
.Times(pt_updated_calls_number);
- policy_event_observer_->on_event(*event_);
+ policy_event_observer_->HandleOnEvent(*event_);
}
void DeleteEvent() {
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 39ad034d6f..353f3f05b7 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -72,6 +72,7 @@
#include "policy/mock_policy_manager.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "protocol_handler/mock_session_observer.h"
+#include "utils/test_async_waiter.h"
#include "smart_objects/enum_schema_item.h"
@@ -198,7 +199,9 @@ class PolicyHandlerTest : public ::testing::Test {
virtual void TearDown() OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_message_helper_);
- ON_CALL(mock_event_dispatcher_, remove_observer(_, _));
+ ON_CALL(
+ mock_event_dispatcher_,
+ remove_observer(_, testing::Matcher<event_engine::EventObserver&>(_)));
}
void ChangePolicyManagerToMock() {
@@ -291,39 +294,9 @@ class PolicyHandlerTest : public ::testing::Test {
}
};
-namespace {
-/**
- * @brief The WaitAsync class
- * can wait for a certain amount of function calls from different
- * threads, or a timeout expires.
- */
-class WaitAsync {
- public:
- WaitAsync(const uint32_t count, const uint32_t timeout)
- : count_(count), timeout_(timeout) {}
-
- void Notify() {
- count_--;
- cond_var_.NotifyOne();
- }
-
- bool Wait(sync_primitives::AutoLock& auto_lock) {
- while (count_ > 0) {
- sync_primitives::ConditionalVariable::WaitStatus wait_status =
- cond_var_.WaitFor(auto_lock, timeout_);
- if (wait_status == sync_primitives::ConditionalVariable::kTimeout) {
- return false;
- }
- }
- return true;
- }
-
- private:
- int count_;
- const uint32_t timeout_;
- sync_primitives::ConditionalVariable cond_var_;
-};
-} // namespace
+ACTION_P(SetDeviceParamsMacAdress, mac_adress) {
+ *arg3 = mac_adress;
+}
TEST_F(PolicyHandlerTest, LoadPolicyLibrary_Method_ExpectLibraryLoaded) {
// Check before policy enabled from ini file
@@ -926,8 +899,8 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
_,
_));
#endif // EXTERNAL_PROPRIETARY_MODE
-
- EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+ EXPECT_CALL(*application1, policy_app_id())
+ .WillRepeatedly(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_,
GetAppPermissionsChanges(kMacAddr_, kPolicyAppId_))
.WillOnce(Return(permissions));
@@ -1323,19 +1296,6 @@ TEST_F(PolicyHandlerTest, OnSystemInfoChanged) {
policy_handler_.OnSystemInfoChanged(language);
}
-TEST_F(PolicyHandlerTest, OnGetSystemInfo) {
- // Arrange
- ChangePolicyManagerToMock();
- // Check expectations
- const std::string ccpu_version("4.1.3.B_EB355B");
- const std::string wers_country_code("WAEGB");
- const std::string language("ru-ru");
- EXPECT_CALL(*mock_policy_manager_,
- SetSystemInfo(ccpu_version, wers_country_code, language));
- // Act
- policy_handler_.OnGetSystemInfo(ccpu_version, wers_country_code, language);
-}
-
TEST_F(PolicyHandlerTest, IsApplicationRevoked) {
// Arrange
EnablePolicy();
@@ -1629,6 +1589,56 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions) {
GetDataOnDeviceID(
testing::An<transport_manager::DeviceHandle>(), _, _, _, _));
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ policy::ExternalConsentStatus external_consent_status =
+ policy::ExternalConsentStatus();
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(
+ _, external_consent_status, corr_id, _, true));
+ EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus())
+ .WillOnce(Return(external_consent_status));
+#else
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(_, corr_id, _, true));
+#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
+
+ policy_handler_.OnGetListOfPermissions(app_id, corr_id);
+}
+
+TEST_F(PolicyHandlerTest, OnGetListOfPermissions_CollectResult_false) {
+ // Arrange
+ EnablePolicyAndPolicyManagerMock();
+
+ const uint32_t app_id = 10u;
+ const uint32_t corr_id = 1u;
+ test_app.insert(mock_app_);
+
+ EXPECT_CALL(app_manager_, application(app_id))
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(conn_handler, get_session_observer())
+ .WillOnce(ReturnRef(mock_session_observer));
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0));
+ EXPECT_CALL(mock_session_observer,
+ GetDataOnDeviceID(
+ testing::An<transport_manager::DeviceHandle>(), _, _, _, _))
+ .WillRepeatedly(
+ DoAll(SetDeviceParamsMacAdress(std::string()), (Return(1u))));
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ policy::ExternalConsentStatus external_consent_status =
+ policy::ExternalConsentStatus();
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(
+ _, external_consent_status, corr_id, _, false))
+ .WillOnce(Return());
+ EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus())
+ .WillOnce(Return(external_consent_status));
+#else
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(_, corr_id, _, false))
+ .WillOnce(Return());
+#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
+
policy_handler_.OnGetListOfPermissions(app_id, corr_id);
}
@@ -1660,14 +1670,14 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_WithoutConnectionKey) {
#ifdef EXTERNAL_PROPRIETARY_MODE
policy::ExternalConsentStatus external_consent_status =
policy::ExternalConsentStatus();
- EXPECT_CALL(
- mock_message_helper_,
- SendGetListOfPermissionsResponse(_, external_consent_status, corr_id, _));
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(
+ _, external_consent_status, corr_id, _, true));
EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus())
.WillOnce(Return(external_consent_status));
#else
EXPECT_CALL(mock_message_helper_,
- SendGetListOfPermissionsResponse(_, corr_id, _));
+ SendGetListOfPermissionsResponse(_, corr_id, _, true));
#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
policy_handler_.OnGetListOfPermissions(app_id, corr_id);
@@ -1736,14 +1746,14 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_GroupPermissions_SUCCESS) {
#ifdef EXTERNAL_PROPRIETARY_MODE
policy::ExternalConsentStatus external_consent_status =
policy::ExternalConsentStatus();
- EXPECT_CALL(
- mock_message_helper_,
- SendGetListOfPermissionsResponse(_, external_consent_status, corr_id, _));
+ EXPECT_CALL(mock_message_helper_,
+ SendGetListOfPermissionsResponse(
+ _, external_consent_status, corr_id, _, true));
EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus())
.WillOnce(Return(external_consent_status));
#else
EXPECT_CALL(mock_message_helper_,
- SendGetListOfPermissionsResponse(_, corr_id, _));
+ SendGetListOfPermissionsResponse(_, corr_id, _, true));
#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
policy_handler_.OnGetListOfPermissions(app_id, corr_id);
@@ -1915,7 +1925,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(true));
+ .WillRepeatedly(Return(true));
EXPECT_CALL(
*mock_policy_manager_,
@@ -1944,7 +1954,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(true));
+ .WillRepeatedly(Return(true));
EXPECT_CALL(*mock_policy_manager_,
ReactOnUserDevConsentForApp(handle, kPolicyAppId_, is_allowed))
@@ -1976,7 +1986,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
// App does not have predate policy
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
- .WillOnce(Return(false));
+ .WillRepeatedly(Return(false));
EXPECT_CALL(
*mock_policy_manager_,
@@ -2258,24 +2268,20 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_app_, device()).WillOnce(Return(device));
- sync_primitives::Lock wait_hmi_lock_first;
- sync_primitives::AutoLock auto_lock_first(wait_hmi_lock_first);
- WaitAsync waiter_first(kCallsCount_, kTimeout_);
+ auto waiter_first = TestAsyncWaiter::createInstance();
#ifdef EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(*mock_policy_manager_, SetUserConsentForApp(_, _))
- .WillOnce(NotifyAsync(&waiter_first));
+ .WillOnce(NotifyTestAsyncWaiter(waiter_first));
#else
EXPECT_CALL(*mock_policy_manager_, SetUserConsentForApp(_))
- .WillOnce(NotifyAsync(&waiter_first));
+ .WillOnce(NotifyTestAsyncWaiter(waiter_first));
#endif
ExternalConsentStatusItem item(1u, 1u, kStatusOn);
ExternalConsentStatus external_consent_status;
external_consent_status.insert(item);
#ifdef EXTERNAL_PROPRIETARY_MODE
- sync_primitives::Lock wait_hmi_lock_second;
- sync_primitives::AutoLock auto_lock_second(wait_hmi_lock_second);
- WaitAsync waiter_second(kCallsCount_, kTimeout_);
+ auto waiter_second = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_policy_manager_,
SetExternalConsentStatus(external_consent_status))
@@ -2286,9 +2292,9 @@ TEST_F(PolicyHandlerTest,
policy_handler_.OnAppPermissionConsent(kConnectionKey_, permissions);
#endif
- EXPECT_TRUE(waiter_first.Wait(auto_lock_first));
+ EXPECT_TRUE(waiter_first->WaitFor(kCallsCount_, kTimeout_));
#ifdef EXTERNAL_PROPRIETARY_MODE
- EXPECT_TRUE(waiter_second.Wait(auto_lock_second));
+ EXPECT_TRUE(waiter_second->WaitFor(kCallsCount_, kTimeout_));
#endif
}
@@ -2309,9 +2315,7 @@ TEST_F(PolicyHandlerTest,
permissions.group_permissions.push_back(group_permission_allowed);
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(app_manager_, application(_)).Times(0);
@@ -2328,7 +2332,7 @@ TEST_F(PolicyHandlerTest,
policy_handler_.OnAppPermissionConsent(invalid_connection_key, permissions);
#endif
- EXPECT_FALSE(waiter.Wait(auto_lock));
+ EXPECT_FALSE(waiter->WaitFor(kCallsCount_, kTimeout_));
}
TEST_F(PolicyHandlerTest,
@@ -2348,9 +2352,7 @@ TEST_F(PolicyHandlerTest,
permissions.group_permissions.push_back(group_permission_allowed);
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(app_manager_, application(_)).Times(0);
@@ -2369,11 +2371,7 @@ TEST_F(PolicyHandlerTest,
policy_handler_.OnAppPermissionConsent(invalid_connection_key, permissions);
#endif
- EXPECT_FALSE(waiter.Wait(auto_lock));
-}
-
-ACTION_P(SetDeviceParamsMacAdress, mac_adress) {
- *arg3 = mac_adress;
+ EXPECT_FALSE(waiter->WaitFor(kCallsCount_, kTimeout_));
}
TEST_F(PolicyHandlerTest,
@@ -2421,13 +2419,11 @@ TEST_F(PolicyHandlerTest,
ExternalConsentStatus external_consent_status;
external_consent_status.insert(item);
#ifdef EXTERNAL_PROPRIETARY_MODE
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_policy_manager_,
SetExternalConsentStatus(external_consent_status))
- .WillOnce(DoAll(NotifyAsync(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
policy_handler_.OnAppPermissionConsent(
invalid_connection_key, permissions, external_consent_status);
#else
@@ -2436,7 +2432,7 @@ TEST_F(PolicyHandlerTest,
Mock::VerifyAndClearExpectations(mock_app_.get());
#ifdef EXTERNAL_PROPRIETARY_MODE
- EXPECT_TRUE(waiter.Wait(auto_lock));
+ EXPECT_TRUE(waiter->WaitFor(kCallsCount_, kTimeout_));
#endif
}
@@ -2485,9 +2481,7 @@ TEST_F(PolicyHandlerTest,
ExternalConsentStatus external_consent_status;
external_consent_status.insert(item);
#ifdef EXTERNAL_PROPRIETARY_MODE
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter = TestAsyncWaiter::createInstance();
ON_CALL(*mock_policy_manager_, IsNeedToUpdateExternalConsentStatus(_))
.WillByDefault(Return(false));
@@ -2502,7 +2496,7 @@ TEST_F(PolicyHandlerTest,
Mock::VerifyAndClearExpectations(mock_app_.get());
#ifdef EXTERNAL_PROPRIETARY_MODE
- EXPECT_FALSE(waiter.Wait(auto_lock));
+ EXPECT_FALSE(waiter->WaitFor(kCallsCount_, kTimeout_));
#endif
}
@@ -2553,37 +2547,33 @@ TEST_F(PolicyHandlerTest, AddStatisticsInfo_UnknownStatistics_UNSUCCESS) {
TEST_F(PolicyHandlerTest, AddStatisticsInfo_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_policy_manager_, Increment(_))
- .WillOnce(NotifyAsync(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
policy_handler_.AddStatisticsInfo(
hmi_apis::Common_StatisticsType::iAPP_BUFFER_FULL);
- EXPECT_TRUE(waiter.Wait(auto_lock));
+ EXPECT_TRUE(waiter->WaitFor(kCallsCount_, kTimeout_));
}
TEST_F(PolicyHandlerTest, OnSystemError_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
- sync_primitives::Lock wait_hmi_lock;
- sync_primitives::AutoLock auto_lock(wait_hmi_lock);
- WaitAsync waiter(kCallsCount_, kTimeout_);
+ auto waiter_first = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_policy_manager_, Increment(_))
- .WillOnce(NotifyAsync(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter_first));
policy_handler_.OnSystemError(hmi_apis::Common_SystemError::SYNC_REBOOTED);
- EXPECT_TRUE(waiter.Wait(auto_lock));
+ EXPECT_TRUE(waiter_first->WaitFor(kCallsCount_, kTimeout_));
- WaitAsync waiter1(kCallsCount_, kTimeout_);
- EXPECT_CALL(*mock_policy_manager_, Increment(_))
- .WillOnce(NotifyAsync(&waiter1));
+ auto waiter_second = TestAsyncWaiter::createInstance();
+ EXPECT_CALL(*mock_policy_manager_, Increment(_))
+ .WillOnce(NotifyTestAsyncWaiter(waiter_second));
policy_handler_.OnSystemError(
hmi_apis::Common_SystemError::SYNC_OUT_OF_MEMMORY);
- EXPECT_TRUE(waiter1.Wait(auto_lock));
+ EXPECT_TRUE(waiter_second->WaitFor(kCallsCount_, kTimeout_));
}
TEST_F(PolicyHandlerTest, RemoteAppsUrl_EndpointsEmpty_UNSUCCESS) {
diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc
index 71e12b2825..2de2a69cf7 100644
--- a/src/components/application_manager/test/request_controller/request_controller_test.cc
+++ b/src/components/application_manager/test/request_controller/request_controller_test.cc
@@ -33,7 +33,7 @@
#include <stdint.h>
#include "application_manager/mock_request.h"
-#include "application_manager/request_controller.h"
+#include "application_manager/request_controller_impl.h"
#include "application_manager/request_info.h"
#include "gtest/gtest.h"
@@ -44,10 +44,14 @@
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
+
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_request_timeout_handler.h"
#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/state_controller.h"
+#include "application_manager/test/include/application_manager/mock_event_dispatcher.h"
#include "resumption/last_state.h"
#include "utils/test_async_waiter.h"
@@ -56,8 +60,11 @@ namespace components {
namespace request_controller_test {
using ::application_manager::request_controller::RequestController;
+using ::application_manager::request_controller::RequestControllerImpl;
using ::application_manager::request_controller::RequestInfo;
+using test::components::application_manager_test::MockRequestTimeoutHandler;
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
using ::testing::NiceMock;
using ::testing::Return;
@@ -65,7 +72,7 @@ using ::testing::ReturnRef;
typedef NiceMock<application_manager_test::MockRequest> MRequest;
typedef std::shared_ptr<MRequest> RequestPtr;
-typedef std::shared_ptr<RequestController> RequestControllerSPtr;
+typedef std::shared_ptr<RequestControllerImpl> RequestControllerSPtr;
namespace {
const size_t kNumberOfRequests = 10u;
@@ -103,8 +110,10 @@ class RequestControllerTestClass : public ::testing::Test {
RequestControllerTestClass() {
ON_CALL(mock_request_controller_settings_, thread_pool_size())
.WillByDefault(Return(kThreadPoolSize));
- request_ctrl_ =
- std::make_shared<RequestController>(mock_request_controller_settings_);
+ request_ctrl_ = std::make_shared<RequestControllerImpl>(
+ mock_request_controller_settings_,
+ mock_request_timeout_handler_,
+ mock_event_dispatcher_);
}
RequestPtr GetMockRequest(
@@ -126,10 +135,10 @@ class RequestControllerTestClass : public ::testing::Test {
const mobile_apis::HMILevel::eType& hmi_level =
mobile_apis::HMILevel::INVALID_ENUM) {
if (RequestInfo::RequestType::HMIRequest == request_type) {
- return request_ctrl_->addHMIRequest(request);
+ return request_ctrl_->AddHMIRequest(request);
}
CallSettings(settings);
- return request_ctrl_->addMobileRequest(request, hmi_level);
+ return request_ctrl_->AddMobileRequest(request, hmi_level);
}
void CallSettings(const TestSettings& settings) const {
@@ -154,6 +163,8 @@ class RequestControllerTestClass : public ::testing::Test {
NiceMock<application_manager_test::MockRequestControlerSettings>
mock_request_controller_settings_;
+ NiceMock<MockEventDispatcher> mock_event_dispatcher_;
+ MockRequestTimeoutHandler mock_request_timeout_handler_;
RequestControllerSPtr request_ctrl_;
RequestPtr empty_mock_request_;
const TestSettings default_settings_;
@@ -162,35 +173,35 @@ class RequestControllerTestClass : public ::testing::Test {
TEST_F(RequestControllerTestClass,
AddMobileRequest_DuplicateCorrelationId_INVALID_ID) {
RequestPtr request_valid = GetMockRequest();
- TestAsyncWaiter waiter_valid;
+ auto waiter_valid = TestAsyncWaiter::createInstance();
ON_CALL(*request_valid, default_timeout()).WillByDefault(Return(0));
EXPECT_CALL(*request_valid, Init()).WillOnce(Return(true));
EXPECT_CALL(*request_valid, Run())
.Times(1)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter_valid));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter_valid));
- EXPECT_EQ(RequestController::SUCCESS,
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
request_valid,
RequestInfo::RequestType::MobileRequest,
mobile_apis::HMILevel::HMI_NONE));
- EXPECT_TRUE(waiter_valid.WaitFor(1, 1000));
+ EXPECT_TRUE(waiter_valid->WaitFor(1, 1000));
// The command should not be run if another command with the same
// correlation_id is waiting for a response
RequestPtr request_dup_corr_id = GetMockRequest();
- TestAsyncWaiter waiter_dup;
+ auto waiter_dup = TestAsyncWaiter::createInstance();
ON_CALL(*request_dup_corr_id, default_timeout()).WillByDefault(Return(0));
EXPECT_CALL(*request_dup_corr_id, Init()).WillOnce(Return(true));
ON_CALL(*request_dup_corr_id, Run())
- .WillByDefault(NotifyTestAsyncWaiter(&waiter_dup));
+ .WillByDefault(NotifyTestAsyncWaiter(waiter_dup));
- EXPECT_EQ(RequestController::SUCCESS,
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
request_dup_corr_id,
RequestInfo::RequestType::MobileRequest,
mobile_apis::HMILevel::HMI_NONE));
- EXPECT_FALSE(waiter_dup.WaitFor(1, 1000));
+ EXPECT_FALSE(waiter_dup->WaitFor(1, 1000));
}
TEST_F(RequestControllerTestClass,
@@ -200,7 +211,7 @@ TEST_F(RequestControllerTestClass,
// app_hmi_level_none_time_scale_max_requests_ equals 0
// (in the default settings they setted to 0)
for (size_t i = 0; i < kMaxRequestAmount; ++i) {
- EXPECT_EQ(RequestController::SUCCESS,
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
GetMockRequest(i),
RequestInfo::RequestType::MobileRequest,
@@ -247,7 +258,7 @@ TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnWakeUp_FALSE) {
}
TEST_F(RequestControllerTestClass, AddMobileRequest_SetValidData_SUCCESS) {
- EXPECT_EQ(RequestController::SUCCESS,
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
GetMockRequest(),
RequestInfo::RequestType::MobileRequest,
@@ -256,7 +267,7 @@ TEST_F(RequestControllerTestClass, AddMobileRequest_SetValidData_SUCCESS) {
TEST_F(RequestControllerTestClass,
AddMobileRequest_SetInvalidData_INVALID_DATA) {
- EXPECT_EQ(RequestController::INVALID_DATA,
+ EXPECT_EQ(RequestController::TResult::INVALID_DATA,
AddRequest(default_settings_,
empty_mock_request_,
RequestInfo::RequestType::MobileRequest,
@@ -264,14 +275,14 @@ TEST_F(RequestControllerTestClass,
}
TEST_F(RequestControllerTestClass, AddHMIRequest_AddRequest_SUCCESS) {
- EXPECT_EQ(RequestController::SUCCESS,
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
GetMockRequest(),
RequestInfo::RequestType::HMIRequest));
}
TEST_F(RequestControllerTestClass, AddHMIRequest_AddInvalidData_INVALID_DATA) {
- EXPECT_EQ(RequestController::INVALID_DATA,
+ EXPECT_EQ(RequestController::TResult::INVALID_DATA,
AddRequest(default_settings_,
empty_mock_request_,
RequestInfo::RequestType::HMIRequest));
@@ -282,17 +293,17 @@ TEST_F(RequestControllerTestClass, OnTimer_SUCCESS) {
RequestPtr mock_request = GetMockRequest(
kDefaultCorrelationID, kDefaultConnectionKey, request_timeout);
- TestAsyncWaiter waiter;
- EXPECT_EQ(RequestController::SUCCESS,
+ auto waiter = TestAsyncWaiter::createInstance();
+ EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
mock_request,
RequestInfo::RequestType::MobileRequest));
- EXPECT_CALL(*mock_request, onTimeOut())
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ EXPECT_CALL(*mock_request, HandleTimeOut())
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
// Waiting for call of `onTimeOut` for `kTimeScale` seconds
- EXPECT_TRUE(waiter.WaitFor(1, kTimeScale));
+ EXPECT_TRUE(waiter->WaitFor(1, kTimeScale));
}
} // namespace request_controller_test
diff --git a/src/components/application_manager/test/request_timeout_handler_test.cc b/src/components/application_manager/test/request_timeout_handler_test.cc
new file mode 100644
index 0000000000..b1acec5eb3
--- /dev/null
+++ b/src/components/application_manager/test/request_timeout_handler_test.cc
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2020, 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/request_timeout_handler_impl.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_request_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/request_info.h"
+#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h"
+#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
+
+namespace test {
+namespace components {
+namespace request_timeout_handler_test {
+
+using application_manager::event_engine::Event;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using namespace application_manager::commands;
+using namespace application_manager::strings;
+using namespace application_manager::request_controller;
+using application_manager_test::MockRequestController;
+using sdl_rpc_plugin::commands::SubscribeWayPointsRequest;
+using sdl_rpc_plugin::commands::UnsubscribeWayPointsRequest;
+
+namespace {
+const uint32_t kDefaultTimeout = 10000u;
+const uint32_t kDefaultTimeoutCompensation = 1000u;
+const uint32_t kTimeout = 13000u;
+const uint32_t kRequestId = 22;
+const std::string kMethodNameSubscribeWayPoints =
+ "Navigation.SubscribeWayPoints";
+const std::string kMethodNameUnsubscribeWayPoints =
+ "Navigation.UnsubscribeWayPoints";
+const uint32_t kConnectionKey = 3u;
+} // namespace
+
+class RequestTimeoutHandlerTest
+ : public commands_test::CommandRequestTest<
+ commands_test::CommandsTestMocks::kIsNice> {
+ public:
+ RequestTimeoutHandlerTest()
+ : mock_message_helper_(
+ application_manager::MockMessageHelper::message_helper_mock()) {}
+
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, get_request_controller())
+ .WillByDefault(ReturnRef(mock_request_controller_));
+ request_timeout_handler_ =
+ std::make_shared<RequestTimeoutHandlerImpl>(app_mngr_);
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ }
+
+ void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ }
+
+ template <typename Command>
+ std::unique_ptr<Command> CreateCommand() {
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kDefaultTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kDefaultTimeoutCompensation));
+
+ std::shared_ptr<smart_objects::SmartObject> msg =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ std::unique_ptr<Command> command(new Command(msg,
+ app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_));
+ return command;
+ }
+
+ application_manager::MockMessageHelper* mock_message_helper_;
+ MockRequestController mock_request_controller_;
+ std::shared_ptr<RequestTimeoutHandlerImpl> request_timeout_handler_;
+ testing::NiceMock<application_manager_test::MockHMICapabilities>
+ mock_hmi_capabilities_;
+ policy_test::MockPolicyHandlerInterface mock_policy_handler_;
+};
+
+TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_SUCCESS) {
+ // RequestTimeoutHandler works with all the commands.
+ // But just for testing, only SubscribeWayPointsRequest was chosen in current
+ // test.
+ std::unique_ptr<SubscribeWayPointsRequest> command =
+ CreateCommand<SubscribeWayPointsRequest>();
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kRequestId));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
+ smart_objects::SmartObject notification_msg;
+ notification_msg[msg_params][reset_period] = kTimeout;
+ notification_msg[msg_params][request_id] = kRequestId;
+ notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints;
+ event.set_smart_object(notification_msg);
+
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kDefaultTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kDefaultTimeoutCompensation));
+
+ EXPECT_CALL(app_mngr_, get_request_timeout_handler())
+ .WillOnce(ReturnRef(*request_timeout_handler_));
+
+ EXPECT_CALL(app_mngr_,
+ UpdateRequestTimeout(mock_app->app_id(),
+ command->correlation_id(),
+ kTimeout + kDefaultTimeoutCompensation));
+ EXPECT_CALL(app_mngr_,
+ UpdateRequestTimeout(RequestInfo::kHmiConnectionKey,
+ kRequestId,
+ kTimeout + kDefaultTimeoutCompensation));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ request_timeout_handler_->HandleOnEvent(event);
+}
+
+TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) {
+ // RequestTimeoutHandler works with all the commands.
+ // But just for testing, only SubscribeWayPointsRequest was chosen in current
+ // test.
+
+ std::unique_ptr<SubscribeWayPointsRequest> command =
+ CreateCommand<SubscribeWayPointsRequest>();
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kRequestId));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
+ smart_objects::SmartObject notification_msg;
+ notification_msg[msg_params][request_id] = kRequestId;
+ notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints;
+ event.set_smart_object(notification_msg);
+
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kDefaultTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kDefaultTimeoutCompensation));
+
+ EXPECT_CALL(app_mngr_, get_request_timeout_handler())
+ .WillOnce(ReturnRef(*request_timeout_handler_));
+ EXPECT_CALL(
+ app_mngr_,
+ UpdateRequestTimeout(mock_app->app_id(),
+ command->correlation_id(),
+ kDefaultTimeout + kDefaultTimeoutCompensation));
+ EXPECT_CALL(
+ app_mngr_,
+ UpdateRequestTimeout(RequestInfo::kHmiConnectionKey,
+ kRequestId,
+ kDefaultTimeout + kDefaultTimeoutCompensation));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ request_timeout_handler_->HandleOnEvent(event);
+}
+
+TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) {
+ // RequestTimeoutHandler works with all the commands.
+ // But just for testing, only SubscribeWayPointsRequest was chosen in
+ // current test.
+ std::unique_ptr<SubscribeWayPointsRequest> command =
+ CreateCommand<SubscribeWayPointsRequest>();
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kRequestId));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
+ smart_objects::SmartObject notification_msg;
+ notification_msg[msg_params][reset_period] = kTimeout;
+ notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints;
+ notification_msg[msg_params][request_id] = 0u;
+ event.set_smart_object(notification_msg);
+
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kDefaultTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kDefaultTimeoutCompensation));
+
+ EXPECT_CALL(app_mngr_, get_request_timeout_handler())
+ .WillOnce(ReturnRef(*request_timeout_handler_));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ request_timeout_handler_->HandleOnEvent(event);
+}
+
+TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) {
+ // RequestTimeoutHandler works with all the commands.
+ // But just for testing, only SubscribeWayPointsRequest was chosen in
+ // current test.
+ std::unique_ptr<SubscribeWayPointsRequest> command =
+ CreateCommand<SubscribeWayPointsRequest>();
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app)))
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
+ .WillByDefault(Return(false));
+ ON_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kRequestId));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout);
+ smart_objects::SmartObject notification_msg;
+ notification_msg[msg_params][reset_period] = kTimeout;
+ notification_msg[msg_params][method_name] = " ";
+ notification_msg[msg_params][request_id] = kRequestId;
+ event.set_smart_object(notification_msg);
+
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kDefaultTimeout));
+ ON_CALL(app_mngr_settings_, default_timeout_compensation())
+ .WillByDefault(ReturnRef(kDefaultTimeoutCompensation));
+
+ EXPECT_CALL(app_mngr_, get_request_timeout_handler())
+ .WillOnce(ReturnRef(*request_timeout_handler_));
+ EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ request_timeout_handler_->HandleOnEvent(event);
+}
+} // namespace request_timeout_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 8d228240d2..1ff04c332c 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -315,6 +315,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
smart_objects::SmartObjectList requests;
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
@@ -363,6 +365,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
@@ -412,6 +416,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
ON_CALL(*mock_app_, help_prompt_manager())
.WillByDefault(ReturnRef(*mock_help_prompt_manager_));
@@ -497,6 +503,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
@@ -538,6 +546,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
@@ -583,6 +593,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
std::shared_ptr<sync_primitives::Lock> button_lock_ptr =
std::make_shared<sync_primitives::Lock>();
@@ -592,19 +604,13 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
ON_CALL(*mock_app_, SubscribedButtons())
.WillByDefault(Return(button_subscription_accessor));
- smart_objects::SmartObjectList button_subscription_notifications;
+ smart_objects::SmartObjectList button_subscription_requests_list;
ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateOnButtonSubscriptionNotificationsForApp(_, _, _))
- .WillByDefault(Return(button_subscription_notifications));
+ CreateButtonSubscriptionsHandlingRequestsList(_, _, _, _))
+ .WillByDefault(Return(button_subscription_requests_list));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
- for (uint32_t i = 0; i < count_of_buttons; ++i) {
- EXPECT_CALL(
- *mock_app_,
- SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(i)));
- }
-
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
@@ -612,7 +618,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateOnButtonSubscriptionNotificationsForApp(_, _, _));
+ CreateButtonSubscriptionsHandlingRequestsList(_, _, _, _));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
@@ -646,6 +652,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
@@ -674,6 +682,8 @@ TEST_F(ResumeCtrlTest,
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+ ON_CALL(mock_app_mngr_, application(kTestAppId_))
+ .WillByDefault(Return(mock_app_));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
smart_objects::SmartObjectSPtr subscribe_waypoints_msg;
@@ -685,9 +695,9 @@ TEST_F(ResumeCtrlTest,
extensions.insert(extensions.begin(), mock_app_extension_);
EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
- EXPECT_CALL(
- mock_app_mngr_,
- SubscribeAppForWayPoints(A<application_manager::ApplicationSharedPtr>()));
+ EXPECT_CALL(mock_app_mngr_,
+ SubscribeAppForWayPoints(
+ A<application_manager::ApplicationSharedPtr>(), true));
const mobile_apis::HMILevel::eType hmi_test_level =
mobile_apis::HMILevel::HMI_FULL;
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -1020,7 +1030,7 @@ TEST_F(ResumeCtrlTest,
res_ctrl_->SetupDefaultHMILevel(mock_app_);
}
-TEST_F(ResumeCtrlTest, ApplicationResumptiOnTimer_AppInFull) {
+TEST_F(ResumeCtrlTest, ApplicationResumptionTimer_AppInFull) {
ON_CALL(mock_app_mngr_, application(kTestAppId_))
.WillByDefault(Return(mock_app_));
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index d5228934db..a416cbbad5 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -437,6 +437,8 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_));
ON_CALL(*app_mock, window_optional_params_map())
.WillByDefault(Return(window_params_map));
+ ON_CALL(*app_mock, get_user_location())
+ .WillByDefault(ReturnRef(user_location_));
}
void ResumptionDataTest::SetDefaultCurrentHmiState() {
diff --git a/src/components/application_manager/test/resumption_sql_queries_test.cc b/src/components/application_manager/test/resumption_sql_queries_test.cc
index 61490ae4af..f31d8f8e28 100644
--- a/src/components/application_manager/test/resumption_sql_queries_test.cc
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -81,6 +81,7 @@ const string kDeleteData =
"DELETE FROM `applicationSubMenuArray`; "
"DELETE FROM `applicationSubscriptionsArray`; "
"DELETE FROM `_internal_data`; "
+ "DELETE FROM `applicationUserLocation`;"
"COMMIT; "
"VACUUM;";
@@ -329,6 +330,7 @@ class ResumptionSqlQueriesTest : public ::testing::Test {
db_schema.push_back("applicationSubMenuArray");
db_schema.push_back("applicationSubscriptionsArray");
db_schema.push_back("_internal_data");
+ db_schema.push_back("applicationUserLocation");
std::sort(db_schema.begin(), db_schema.end());
}
};
diff --git a/src/components/application_manager/test/rpc_passing_handler_test.cc b/src/components/application_manager/test/rpc_passing_handler_test.cc
index 6eac6ca0b1..4e7f401646 100644
--- a/src/components/application_manager/test/rpc_passing_handler_test.cc
+++ b/src/components/application_manager/test/rpc_passing_handler_test.cc
@@ -390,7 +390,7 @@ TEST_F(RPCPassingHandlerTest,
TEST_F(RPCPassingHandlerTest, RPCPassingTest_REQUEST_Timeout) {
uint32_t timeout_in_ms = 4;
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
app_services_.push_back(CreateAppService(
kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
diff --git a/src/components/application_manager/test/rpc_service_impl_test.cc b/src/components/application_manager/test/rpc_service_impl_test.cc
index 0a7cff031d..cdfc6114e9 100644
--- a/src/components/application_manager/test/rpc_service_impl_test.cc
+++ b/src/components/application_manager/test/rpc_service_impl_test.cc
@@ -43,14 +43,17 @@
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_command_factory.h"
#include "application_manager/mock_command_holder.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_request.h"
#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_request_timeout_handler.h"
#include "application_manager/mock_rpc_plugin.h"
#include "application_manager/mock_rpc_plugin_manager.h"
#include "application_manager/mock_rpc_protection_manager.h"
#include "application_manager/plugin_manager/plugin_keys.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/request_controller_impl.h"
#include "connection_handler/mock_connection_handler.h"
#include "hmi_message_handler/mock_hmi_message_handler.h"
#include "include/test/protocol_handler/mock_protocol_handler.h"
@@ -66,6 +69,8 @@ using test::components::protocol_handler_test::MockProtocolHandler;
typedef smart_objects::SmartObjectSPtr MessageSharedPtr;
typedef utils::Optional<am::plugin_manager::RPCPlugin> PluginOpt;
using test::components::application_manager_test::MockAppServiceManager;
+using test::components::application_manager_test::MockRequestTimeoutHandler;
+using test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
using ::testing::NiceMock;
using ::testing::Return;
@@ -86,7 +91,9 @@ const int32_t kConnectionSessionsCount = 2;
class RPCServiceImplTest : public ::testing::Test {
public:
RPCServiceImplTest()
- : request_controller_(mock_request_controler_)
+ : request_controller_(mock_request_controler_,
+ mock_request_timeout_handler_,
+ mock_event_dispatcher_)
, mock_rpc_protection_manager_(
std::make_shared<
testing::NiceMock<am::MockRPCProtectionManager> >())
@@ -145,8 +152,9 @@ class RPCServiceImplTest : public ::testing::Test {
testing::NiceMock<MockApplicationManager> mock_app_mngr_;
testing::NiceMock<MockRequestControlerSettings> mock_request_controler_;
testing::NiceMock<MockProtocolHandler> mock_protocol_handler_;
- am::request_controller::RequestController request_controller_;
+ am::request_controller::RequestControllerImpl request_controller_;
testing::NiceMock<MockHMIMessageHandler> mock_hmi_handler_;
+ MockEventDispatcher mock_event_dispatcher_;
testing::NiceMock<MockCommandHolder> mock_command_holder_;
std::shared_ptr<am::MockRPCProtectionManager> mock_rpc_protection_manager_;
std::shared_ptr<rpc_service::RPCService> rpc_service_;
@@ -157,6 +165,7 @@ class RPCServiceImplTest : public ::testing::Test {
mock_rpc_plugin_manager_;
testing::NiceMock<am::plugin_manager::MockRPCPlugin> mock_rpc_plugin_;
testing::NiceMock<MockCommandFactory> mock_command_factory_;
+ MockRequestTimeoutHandler mock_request_timeout_handler_;
};
TEST_F(RPCServiceImplTest, ManageMobileCommand_MessageIsNullPtr_False) {
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
deleted file mode 100644
index 536a0939f9..0000000000
--- a/src/components/application_manager/test/sdl_preloaded_pt.json
+++ /dev/null
@@ -1,1979 +0,0 @@
- {
- "policy_table": {
- "module_config": {
- "preloaded_pt": true,
- "preloaded_date": "2015-02-12",
- "exchange_after_x_ignition_cycles": 100,
- "exchange_after_x_kilometers": 1800,
- "exchange_after_x_days": 30,
- "timeout_after_x_seconds": 70,
- "seconds_between_retries": [1,
- 5,
- 25,
- 125,
- 625],
- "endpoints": {
- "0x07": {
- "default": ["http://x.x.x.x:3000/api/1/policies"]
- }
- },
- "notifications_per_minute_by_priority": {
- "EMERGENCY": 60,
- "NAVIGATION": 15,
- "PROJECTION": 15,
- "VOICECOM": 20,
- "COMMUNICATION": 6,
- "NORMAL": 4,
- "NONE": 0
- },
- "subtle_notifications_per_minute_by_priority": {
- "EMERGENCY": 60,
- "NAVIGATION": 20,
- "PROJECTION": 20,
- "VOICECOM": 30,
- "COMMUNICATION": 15,
- "NORMAL": 10,
- "NONE": 0
- }
- },
- "functional_groupings": {
- "Base-4": {
- "rpcs": {
- "AddCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "AddSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Alert": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "ChangeRegistration": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "CreateInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "DeleteInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "EncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "EndAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GenericResponse": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ListFiles": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnButtonEvent": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "OnButtonPress": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "OnCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnDriverDistraction": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHashChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHMIStatus": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnLanguageChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnPermissionsChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnSystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "PerformAudioPassThru": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PerformInteraction": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PutFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "RegisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ResetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ScrollableMessage": {
- "hmi_levels": ["FULL"]
- },
- "SetAppIcon": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetDisplayLayout": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SetMediaClockTimer": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "Show": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Slider": {
- "hmi_levels": ["FULL"]
- },
- "Speak": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "SubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnregisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnsubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "Location-1": {
- "user_consent_prompt": "Location",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- }
- }
- },
- "Notifications": {
- "user_consent_prompt": "Notifications",
- "rpcs": {
- "Alert": {
- "hmi_levels": ["BACKGROUND"]
- }
- }
- },
- "DrivingCharacteristics-3": {
- "user_consent_prompt": "DrivingCharacteristics",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "electronicParkBrakeStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "electronicParkBrakeStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "electronicParkBrakeStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "electronicParkBrakeStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- }
- }
- },
- "VehicleInfo-3": {
- "user_consent_prompt": "VehicleInfo",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "cloudAppVehicleID",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus",
- "stabilityControlsStatus"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "cloudAppVehicleID",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus",
- "stabilityControlsStatus"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "cloudAppVehicleID",
- "odometer",
- "tirePressure",
- "wiperStatus",
- "stabilityControlsStatus"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "cloudAppVehicleID",
- "odometer",
- "tirePressure",
- "wiperStatus",
- "stabilityControlsStatus"]
- }
- }
- },
- "PropriataryData-1": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GetDTCs": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ReadDID": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "Emergency-1": {
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- }
- }
- },
- "Navigation-1": {
- "rpcs": {
- "AlertManeuver": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ShowConstantTBT": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "UpdateTurnList": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "DataConsent-2": {
- "user_consent_prompt": "DataConsent",
- "rpcs": null
- },
- "BaseBeforeDataConsent": {
- "rpcs": {
- "ChangeRegistration": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "DeleteFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "EncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ListFiles": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHashChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHMIStatus": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnLanguageChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnPermissionsChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnSystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "PutFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "RegisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetAppIcon": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetDisplayLayout": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnregisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- }
- }
- }
- },
- "consumer_friendly_messages": {
- "version": "001.001.019",
- "messages": {
- "AppPermissions": {
- "languages": {
- "de-de": {
- "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
- "line1": "Zugriffsanfrage(n)",
- "line2": "erlauben?"
- },
- "en-au": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-gb": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?",
- "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
- },
- "en-ie": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-us": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
- "line1": "Grant Requested",
- "line2": "Permission(s)?",
- "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
- },
- "es-en": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
- },
- "es-es": {
- "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
- "line1": "¿Conceder permisos",
- "line2": "solicitados?"
- },
- "es-mx": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?"
- },
- "fr-ca": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)",
- "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)"
- },
- "it-it": {
- "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
- "line1": "Concedi autorizzaz.",
- "line2": "richiesta(e)?"
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
- "line1": "Aangevraagde",
- "line2": "permissie(s) verlenen?"
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
- "line1": "Udzielić żądanych",
- "line2": "pozwoleń?"
- },
- "pt-br": {
- "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
- "line1": "Conceder permissão",
- "line2": "solicitada?"
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
- "line1": "Conceder permiss.",
- "line2": "solicitada(s)?"
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
- "line1": "Предост. заправш.",
- "line2": "разрешения?"
- },
- "sv-se": {
- "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
- "line1": "Vill du ge",
- "line2": "tillstånd?"
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
- "line1": "İstenen izinler",
- "line2": "verilsin mi?"
- },
- "zh-cn": {
- "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
- "line1": "是否允许请求的",
- "line2": "权限?"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
- "line1": "允許",
- "line2": "授權請求?"
- }
- }
- },
- "AppPermissionsHelp": {
- "languages": {
- "de-de": {
- "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
- },
- "en-au": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-gb": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-ie": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-us": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
- },
- "es-en": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "es-es": {
- "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
- },
- "es-mx": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "fr-ca": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "it-it": {
- "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
- },
- "pt-br": {
- "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
- },
- "sv-se": {
- "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
- },
- "zh-cn": {
- "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
- }
- }
- },
- "AppPermissionsRevoked": {
- "languages": {
- "de-de": {
- "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
- },
- "en-au": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-gb": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-ie": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-us": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "es-en": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "es-es": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
- },
- "es-mx": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "fr-ca": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "fr-fr": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "it-it": {
- "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
- },
- "nl-nl": {
- "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
- },
- "pl-pl": {
- "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
- },
- "pt-br": {
- "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
- },
- "pt-pt": {
- "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
- },
- "ru-ru": {
- "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
- },
- "sv-se": {
- "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
- },
- "tr-tr": {
- "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
- },
- "zh-cn": {
- "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
- },
- "zh-tw": {
- "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
- }
- }
- },
- "AppUnauthorized": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
- "line1": "nicht autorisiert"
- },
- "en-au": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-gb": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized",
- "textBody": "This version of %appName% is not authorized and will not work with SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-us": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "Not Authorized",
- "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
- "line1": "No autorizada"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada"
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée",
- "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
- "line1": "non autorizzata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
- "line1": "niet geautoriseerd"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
- "line1": "brak autoryzacji"
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
- "line1": "não autorizado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
- "line1": "não autorizada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
- "line1": "не авторизировано"
- },
- "sv-se": {
- "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
- "line1": "är ej godkänd"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
- "line1": "için izin yok"
- },
- "zh-cn": {
- "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
- "line1": "未得到授权"
- },
- "zh-tw": {
- "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
- "line1": "無授權"
- }
- }
- },
- "AppUnsupported": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
- "line1": "nicht unterstützt"
- },
- "en-au": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-gb": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported",
- "textBody": "This version of %appName% is not supported by SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-us": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "Not Supported",
- "textBody": "Your version of %appName% is not supported by SYNC."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "No compatible"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible"
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible",
- "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è supportata dal SYNC.",
- "line1": "non supportata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
- "line1": "niet ondersteund"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
- "line1": "aplikacja nie obsług."
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
- "line1": "não suportado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
- "line1": "não suportada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не поддерживается SYNC.",
- "line1": "не поддерживается"
- },
- "sv-se": {
- "tts": "SYNC har inte stöd för den här versionen av %appName%.",
- "line1": "stöds ej"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
- "line1": "desteklenmiyor"
- },
- "zh-cn": {
- "tts": "SYNC不支持此版本的%appName%。",
- "line1": "不受支持"
- },
- "zh-tw": {
- "tts": "SYNC 不支援此版本的%appName% 。",
- "line1": "不支援"
- }
- }
- },
- "DataConsent": {
- "languages": {
- "en-gb": {
- "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
- },
- "en-us": {
- "line1": "Enable Mobile Apps",
- "line2": "on SYNC? (Uses Data)",
- "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
- },
- "es-en": {
- "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
- },
- "fr-ca": {
- "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
- }
- }
- },
- "DataConsentHelp": {
- "languages": {
- "en-us": {
- "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
- },
- "es-en": {
- "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
- },
- "fr-ca": {
- "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
- }
- }
- },
- "DisableApps": {
- "languages": {
- "de-de": {
- "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
- "line1": "Auto-Update",
- "line2": "und Mobile Apps deaktivieren"
- },
- "en-au": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-gb": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?",
- "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
- "en-ie": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-us": {
- "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
- "line1": "Disable Auto-Updates",
- "line2": "and Mobile Apps?",
- "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
- },
- "es-en": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
- "es-es": {
- "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
- "line1": "¿Desact. actual. auto",
- "line2": "y apl. móviles?"
- },
- "es-mx": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?"
- },
- "fr-ca": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?",
- "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
- },
- "fr-fr": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?"
- },
- "it-it": {
- "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
- "line1": "Disabilitare agg. aut.",
- "line2": "e app mobili?"
- },
- "nl-nl": {
- "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
- "line1": "Auto-updates en mob.",
- "line2": "apps uitschakelen?"
- },
- "pl-pl": {
- "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
- "line1": "Wył. automat. aktual.",
- "line2": "i aplikacje mobilne?"
- },
- "pt-br": {
- "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
- "line1": "Desativar atualizações",
- "line2": "autom. e aplicativos?"
- },
- "pt-pt": {
- "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
- "line1": "Desact. actual. autom.",
- "line2": "e aplicações móveis?"
- },
- "ru-ru": {
- "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
- "line1": "Откл. автообновления",
- "line2": "и мобил. прилож.?"
- },
- "sv-se": {
- "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
- "line1": "Avaktiverar autouppdat.",
- "line2": "och mobilappar?"
- },
- "tr-tr": {
- "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
- "line1": "Oto. güncelleme ve",
- "line2": "mobil uygul. kapat?"
- },
- "zh-cn": {
- "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
- "line1": "是否禁用自动更新和",
- "line2": "移动应用程序?"
- },
- "zh-tw": {
- "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
- "line1": "停用自動更新",
- "line2": "和行動應用程式?"
- }
- }
- },
- "DrivingCharacteristics": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
- "label": "Fahreigenschaften"
- },
- "en-au": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-gb": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
- "en-ie": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-us": {
- "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
- "label": "Driving Characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
- "label": "Características de conducción"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo"
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
- "label": "Caractéristiques de conduite",
- "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
- "label": "Caractéristiques de conduite"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
- "label": "Caratteristiche di guida"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
- "label": "Rijkenmerken"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
- "label": "Informacje dotyczące stylu jazdy"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
- "label": "Características de condução"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
- "label": "Características de condução"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
- "label": "Характеристики движения"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
- "label": "Köregenskaper"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
- "label": "Sürüş karakteristikleri"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
- "label": "行驶特性"
- },
- "zh-tw": {
- "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
- "label": "駕駛特性"
- }
- }
- },
- "Location": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
- "label": "GPS und Geschwindigkeit"
- },
- "en-au": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-gb": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "en-ie": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-us": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
- "label": "GPS y velocidad"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad"
- },
- "fr-ca": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et vitesse",
- "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
- },
- "fr-fr": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et vitesse"
- },
- "it-it": {
- "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
- "label": "GPS e velocità"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
- "label": "Gps en snelheid"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
- "label": "GPS i prędkość"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
- "label": "GPS и скорость"
- },
- "sv-se": {
- "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
- "label": "GPS och hastighet"
- },
- "tr-tr": {
- "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
- "label": "GPS ve hız"
- },
- "zh-cn": {
- "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
- "label": "GPS 和车速"
- },
- "zh-tw": {
- "tts": "應用程式可存取車輛的GPS和速度。",
- "label": "GPS和車速"
- }
- }
- },
- "Notifications": {
- "languages": {
- "de-de": {
- "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
- "label": "Push-Benachrichtigungen"
- },
- "en-au": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-gb": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "en-ie": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-us": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
- "es-es": {
- "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
- "label": "Notificaciones push"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push"
- },
- "fr-ca": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications instantanées",
- "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
- },
- "fr-fr": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications push"
- },
- "it-it": {
- "tts": "Un'app può inviare notifiche se eseguita in background.",
- "label": "Notifiche push"
- },
- "nl-nl": {
- "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
- "label": "Push-meldingen"
- },
- "pl-pl": {
- "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
- "label": "Powiadomienia Push"
- },
- "pt-br": {
- "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
- "label": "Notificações Push"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
- "label": "Notificações push"
- },
- "ru-ru": {
- "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
- "label": "Оповещения о пересылке"
- },
- "sv-se": {
- "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
- "label": "Push-notiser"
- },
- "tr-tr": {
- "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
- "label": "Anlık bildirimleri"
- },
- "zh-cn": {
- "tts": "移动应用程序在后台运行时可推送通知。",
- "label": "推送通知"
- },
- "zh-tw": {
- "tts": "車輛行進時,應用程式可在背景中傳送通知。",
- "label": "傳送通知"
- }
- }
- },
- "SettingDisableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Updates deakt."
- },
- "en-au": {
- "line1": "Disable updates"
- },
- "en-gb": {
- "line1": "Disable updates"
- },
- "en-ie": {
- "line1": "Disable updates"
- },
- "en-us": {
- "line1": "Disable Updates",
- "textBody": "Disable Updates"
- },
- "es-en": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
- "es-es": {
- "line1": "Desact. actual."
- },
- "es-mx": {
- "line1": "Deshab. actual."
- },
- "fr-ca": {
- "line1": "Désactiver MAJ",
- "textBody": "Désactiver MAJ"
- },
- "fr-fr": {
- "line1": "Désactiver màj"
- },
- "it-it": {
- "line1": "Disabilita agg."
- },
- "nl-nl": {
- "line1": "Upd. uitschak."
- },
- "pl-pl": {
- "line1": "Wyłącz aktual."
- },
- "pt-br": {
- "line1": "Desat. atualiz."
- },
- "pt-pt": {
- "line1": "Desact. actualiz."
- },
- "ru-ru": {
- "line1": "Откл. обновл."
- },
- "sv-se": {
- "line1": "Inaktivera uppd."
- },
- "tr-tr": {
- "line1": "Güncell. Kapat"
- },
- "zh-cn": {
- "line1": "禁用更新"
- },
- "zh-tw": {
- "line1": "停用更新"
- }
- }
- },
- "SettingEnableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Apps aktivieren"
- },
- "en-au": {
- "line1": "Enable Apps"
- },
- "en-gb": {
- "line1": "Enable Apps"
- },
- "en-ie": {
- "line1": "Enable Apps"
- },
- "en-us": {
- "line1": "Enable Apps"
- },
- "es-en": {
- "line1": "Hab. aplic."
- },
- "es-es": {
- "line1": "Activar apl."
- },
- "es-mx": {
- "line1": "Hab. aplic."
- },
- "fr-ca": {
- "line1": "Activer app.",
- "textBody": "Activer app."
- },
- "fr-fr": {
- "line1": "Activer app."
- },
- "it-it": {
- "line1": "Abilita app"
- },
- "nl-nl": {
- "line1": "Apps inschak."
- },
- "pl-pl": {
- "line1": "Włącz aplikacje"
- },
- "pt-br": {
- "line1": "Ativar aplic."
- },
- "pt-pt": {
- "line1": "Activar actualiz."
- },
- "ru-ru": {
- "line1": "Вкл. прилож."
- },
- "sv-se": {
- "line1": "Aktivera appar"
- },
- "tr-tr": {
- "line1": "Uygulamaları aç"
- },
- "zh-cn": {
- "line1": "启用应用程序"
- },
- "zh-tw": {
- "line1": "啟用應用程式"
- }
- }
- },
- "SettingUpdateAuto": {
- "languages": {
- "de-de": {
- "line1": "Update anford."
- },
- "en-au": {
- "line1": "Request update"
- },
- "en-gb": {
- "line1": "Request update"
- },
- "en-ie": {
- "line1": "Request update"
- },
- "en-us": {
- "line1": "Request Update",
- "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
- },
- "es-en": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
- "es-es": {
- "line1": "Solicitar actual."
- },
- "es-mx": {
- "line1": "Solicit. actualiz."
- },
- "fr-ca": {
- "line1": "Demander MAJ",
- "textBody": "Demander MAJ"
- },
- "fr-fr": {
- "line1": "Demander màj"
- },
- "it-it": {
- "line1": "Rich. aggiorn."
- },
- "nl-nl": {
- "line1": "Upd. aanvragen"
- },
- "pl-pl": {
- "line1": "Zażądaj aktual."
- },
- "pt-br": {
- "line1": "Solicitar atualiz."
- },
- "pt-pt": {
- "line1": "Solicit. actualiz."
- },
- "ru-ru": {
- "line1": "Запрос на обн."
- },
- "sv-se": {
- "line1": "Begär uppdat."
- },
- "tr-tr": {
- "line1": "Güncelleme iste"
- },
- "zh-cn": {
- "line1": "请求更新"
- },
- "zh-tw": {
- "line1": "請求更新"
- }
- }
- },
- "StatusNeeded": {
- "languages": {
- "de-de": {
- "line1": "Update benötigt"
- },
- "en-au": {
- "line1": "Update needed"
- },
- "en-gb": {
- "line1": "Update needed",
- "textBody": "Update needed"
- },
- "en-ie": {
- "line1": "Update needed"
- },
- "en-us": {
- "line1": "Update Needed",
- "textBody": "Update Needed"
- },
- "es-en": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
- "es-es": {
- "line1": "Actu. necesaria"
- },
- "es-mx": {
- "line1": "Actualiz. neces."
- },
- "fr-ca": {
- "line1": "Màj requise",
- "textBody": "Màj requise"
- },
- "fr-fr": {
- "line1": "Mise à jour requise"
- },
- "it-it": {
- "line1": "Necess. aggiorn."
- },
- "nl-nl": {
- "line1": "Update nodig"
- },
- "pl-pl": {
- "line1": "Potrzeba aktual."
- },
- "pt-br": {
- "line1": "Atualiz. necess."
- },
- "pt-pt": {
- "line1": "Actual. necess."
- },
- "ru-ru": {
- "line1": "Необх. обновл."
- },
- "sv-se": {
- "line1": "Uppdat. krävs"
- },
- "tr-tr": {
- "line1": "Güncellenmeli"
- },
- "zh-cn": {
- "line1": "需要进行更新"
- },
- "zh-tw": {
- "line1": "需更新"
- }
- }
- },
- "StatusPending": {
- "languages": {
- "de-de": {
- "line1": "Aktualisieren..."
- },
- "en-au": {
- "line1": "Updating..."
- },
- "en-gb": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "en-ie": {
- "line1": "Updating..."
- },
- "en-us": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "es-en": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
- "es-es": {
- "line1": "Actualizando..."
- },
- "es-mx": {
- "line1": "Actualizando..."
- },
- "fr-ca": {
- "line1": "MAJ en cours...",
- "textBody": "MAJ en cours..."
- },
- "fr-fr": {
- "line1": "Màj en cours..."
- },
- "it-it": {
- "line1": "Aggiornamento"
- },
- "nl-nl": {
- "line1": "Updaten..."
- },
- "pl-pl": {
- "line1": "Aktualizowanie"
- },
- "pt-br": {
- "line1": "Atualizando..."
- },
- "pt-pt": {
- "line1": "A actualizar..."
- },
- "ru-ru": {
- "line1": "Обновление..."
- },
- "sv-se": {
- "line1": "Uppdaterar..."
- },
- "tr-tr": {
- "line1": "Güncelleniyor..."
- },
- "zh-cn": {
- "line1": "正在更新......"
- },
- "zh-tw": {
- "line1": "更新中..."
- }
- }
- },
- "StatusUpToDate": {
- "languages": {
- "de-de": {
- "line1": "Aktuelle Version"
- },
- "en-au": {
- "line1": "Up-to-date"
- },
- "en-gb": {
- "line1": "Up-to-date",
- "textBody": "Up-to-date"
- },
- "en-ie": {
- "line1": "Up-to-date"
- },
- "en-us": {
- "line1": "Up-To-Date",
- "textBody": "Up-To-Date"
- },
- "es-en": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
- "es-es": {
- "line1": "Actualizada"
- },
- "es-mx": {
- "line1": "Actualizado"
- },
- "fr-ca": {
- "line1": "Déjà à jour",
- "textBody": "Déjà à jour"
- },
- "fr-fr": {
- "line1": "Déjà à jour"
- },
- "it-it": {
- "line1": "più recente"
- },
- "nl-nl": {
- "line1": "Up-to-date"
- },
- "pl-pl": {
- "line1": "Aktualne"
- },
- "pt-br": {
- "line1": "Atualizado"
- },
- "pt-pt": {
- "line1": "Actualizado"
- },
- "ru-ru": {
- "line1": "Обновлено"
- },
- "sv-se": {
- "line1": "Uppdat. krävs ej"
- },
- "tr-tr": {
- "line1": "Güncel"
- },
- "zh-cn": {
- "line1": "最新更新"
- },
- "zh-tw": {
- "line1": "更新最新"
- }
- }
- },
- "VehicleInfo": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
- "label": "Fahrzeuginformationen"
- },
- "en-au": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-gb": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
- "label": "Vehicle information",
- "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
- },
- "en-ie": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-us": {
- "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
- "label": "Vehicle information",
- "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
- "label": "Información del vehículo"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo"
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
- "label": "Renseignements du véhicule",
- "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
- "label": "Renseignements du véhicule"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
- "label": "Informazioni sul veicolo"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
- "label": "Voertuiginformatie"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
- "label": "Informacje o pojeździe"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
- "label": "Informações sobre o veículo"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
- "label": "Informações do veículo"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
- "label": "Информация об автомобиле"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
- "label": "Fordonsinformation"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
- "label": "Araç bilgisi"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
- "label": "车辆信息"
- },
- "zh-tw": {
- "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
- "label": "車輛資訊"
- }
- }
- }
- }
- },
- "app_policies": {
- "default": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["Base-4"],
- "RequestType": [
- "QUERY_APPS",
- "LAUNCH_APP",
- "PROPRIETARY"
- ]
- },
- "device": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["DataConsent-2"]
- },
- "pre_DataConsent": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["BaseBeforeDataConsent"],
- "RequestType": ["HTTP"]
- }
- }
- }
- }
diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json
index dc4fe16027..bb69933497 100644
--- a/src/components/application_manager/test/sdl_pt_update.json
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -75,21 +75,11 @@
"line2" : "permission(s)?",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
},
- "en-ie" : {
- "line1" : "Grant requested",
- "line2" : "permission(s)?",
- "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
- },
"en-us" : {
"line1" : "Grant Requested",
"line2" : "Permission(s)?",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny."
},
- "es-en" : {
- "line1" : "¿Otorgar permiso(s)",
- "line2" : "solicitado(s)?",
- "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
- },
"es-es" : {
"line1" : "¿Conceder permisos",
"line2" : "solicitados?",
@@ -173,15 +163,9 @@
"en-gb" : {
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
},
- "en-ie" : {
- "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
"en-us" : {
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en" : {
- "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es" : {
"tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
},
@@ -237,15 +221,9 @@
"en-gb" : {
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "en-ie" : {
- "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
"en-us" : {
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en" : {
- "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es" : {
"tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
},
@@ -304,18 +282,10 @@
"line1" : "not authorized",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "en-ie" : {
- "line1" : "not authorized",
- "tts" : "This version of %appName% is not authorized and will not work with SYNC."
- },
"en-us" : {
"line1" : "Not Authorized",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "es-en" : {
- "line1" : "no autorizada",
- "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es" : {
"line1" : "No autorizada",
"tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC."
@@ -388,18 +358,10 @@
"line1" : "not supported",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "en-ie" : {
- "line1" : "not supported",
- "tts" : "This version of %appName% is not supported by SYNC."
- },
"en-us" : {
"line1" : "Not Supported",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "es-en" : {
- "line1" : "no compatible",
- "tts" : "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es" : {
"line1" : "No compatible",
"tts" : "Esta versión de %appName% no es compatible con SYNC."
@@ -491,21 +453,11 @@
"line2" : "and Mobile Apps?",
"tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
},
- "en-ie" : {
- "line1" : "Disable auto-updates",
- "line2" : "and Mobile Apps?",
- "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
"en-us" : {
"line1" : "Disable Auto-Updates",
"line2" : "and Mobile Apps?",
"tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
},
- "es-en" : {
- "line1" : "¿Deshab. actualiz.",
- "line2" : "autom. y aplic. móv.?",
- "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es" : {
"line1" : "¿Desact. actual. auto",
"line2" : "y apl. móviles?",
@@ -592,18 +544,10 @@
"label" : "Driving characteristics",
"tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
},
- "en-ie" : {
- "label" : "Driving characteristics",
- "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
"en-us" : {
"label" : "Driving Characteristics",
"tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
},
- "es-en" : {
- "label" : "Características del manejo",
- "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es" : {
"label" : "Características de conducción",
"tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad."
@@ -676,18 +620,10 @@
"label" : "GPS and speed",
"tts" : "An app can access vehicle GPS and speed."
},
- "en-ie" : {
- "label" : "GPS and speed",
- "tts" : "An app can access vehicle GPS and speed."
- },
"en-us" : {
"label" : "GPS and speed",
"tts" : "An app can access vehicle GPS and speed."
},
- "es-en" : {
- "label" : "GPS y velocidad",
- "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es" : {
"label" : "GPS y velocidad",
"tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo."
@@ -760,18 +696,10 @@
"label" : "Push notifications",
"tts" : "An app can send notifications when running in the background."
},
- "en-ie" : {
- "label" : "Push notifications",
- "tts" : "An app can send notifications when running in the background."
- },
"en-us" : {
"label" : "Push notifications",
"tts" : "An app can send notifications when running in the background."
},
- "es-en" : {
- "label" : "Notificaciones tipo Push",
- "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es" : {
"label" : "Notificaciones push",
"tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano."
@@ -841,15 +769,9 @@
"en-gb" : {
"line1" : "Disable updates"
},
- "en-ie" : {
- "line1" : "Disable updates"
- },
"en-us" : {
"line1" : "Disable Updates"
},
- "es-en" : {
- "line1" : "Deshab. actual."
- },
"es-es" : {
"line1" : "Desact. actual."
},
@@ -905,15 +827,9 @@
"en-gb" : {
"line1" : "Enable Apps"
},
- "en-ie" : {
- "line1" : "Enable Apps"
- },
"en-us" : {
"line1" : "Enable Apps"
},
- "es-en" : {
- "line1" : "Hab. aplic."
- },
"es-es" : {
"line1" : "Activar apl."
},
@@ -969,15 +885,9 @@
"en-gb" : {
"line1" : "Request update"
},
- "en-ie" : {
- "line1" : "Request update"
- },
"en-us" : {
"line1" : "Request Update"
},
- "es-en" : {
- "line1" : "Solicit. actualiz."
- },
"es-es" : {
"line1" : "Solicitar actual."
},
@@ -1033,15 +943,9 @@
"en-gb" : {
"line1" : "Update needed"
},
- "en-ie" : {
- "line1" : "Update needed"
- },
"en-us" : {
"line1" : "Update Needed"
},
- "es-en" : {
- "line1" : "Actualiz. neces."
- },
"es-es" : {
"line1" : "Actu. necesaria"
},
@@ -1097,15 +1001,9 @@
"en-gb" : {
"line1" : "Updating..."
},
- "en-ie" : {
- "line1" : "Updating..."
- },
"en-us" : {
"line1" : "Updating..."
},
- "es-en" : {
- "line1" : "Actualizando..."
- },
"es-es" : {
"line1" : "Actualizando..."
},
@@ -1161,15 +1059,9 @@
"en-gb" : {
"line1" : "Up-to-date"
},
- "en-ie" : {
- "line1" : "Up-to-date"
- },
"en-us" : {
"line1" : "Up-To-Date"
},
- "es-en" : {
- "line1" : "Actualizado"
- },
"es-es" : {
"line1" : "Actualizada"
},
@@ -1228,18 +1120,10 @@
"label" : "Vehicle information",
"tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
},
- "en-ie" : {
- "label" : "Vehicle information",
- "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
- },
"en-us" : {
"label" : "Vehicle information",
"tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
},
- "es-en" : {
- "label" : "Información del vehículo",
- "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es" : {
"label" : "Información del vehículo",
"tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos."
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 16e8bff8b8..b6ec4fc8ef 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
@@ -392,22 +392,22 @@ class StateControllerImplTest : public ::testing::Test {
case APP_TYPE_MEDIA: {
PrepareCommonStateResults(result_hmi_state);
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_BACKGROUND,
+ createHmiState(HMILevel::HMI_LIMITED,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_BACKGROUND,
+ createHmiState(HMILevel::HMI_LIMITED,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_BACKGROUND,
+ createHmiState(HMILevel::HMI_FULL,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_BACKGROUND,
+ createHmiState(HMILevel::HMI_FULL,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
@@ -426,18 +426,20 @@ class StateControllerImplTest : public ::testing::Test {
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_LIMITED,
+ createHmiState(HMILevel::HMI_FULL,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
result_hmi_state.push_back(
- createHmiState(HMILevel::HMI_LIMITED,
+ createHmiState(HMILevel::HMI_FULL,
AudioStreamingState::NOT_AUDIBLE,
VideoStreamingState::NOT_STREAMABLE,
SystemContext::SYSCTXT_MAIN));
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
@@ -491,7 +493,9 @@ class StateControllerImplTest : public ::testing::Test {
PrepareStateResultsForAttenuated(result_hmi_state);
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
@@ -548,7 +552,9 @@ class StateControllerImplTest : public ::testing::Test {
PrepareStateResultsForAttenuated(result_hmi_state);
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
@@ -579,7 +585,9 @@ class StateControllerImplTest : public ::testing::Test {
PrepareStateResultsForAttenuated(result_hmi_state);
break;
}
- default: { break; }
+ default: {
+ break;
+ }
}
}
@@ -604,7 +612,8 @@ class StateControllerImplTest : public ::testing::Test {
return APP_TYPE_NAVI;
}
- if (app->is_media_application()) {
+ if (app->is_media_application() ||
+ app->is_voice_communication_supported()) {
return APP_TYPE_MEDIA;
}
@@ -1294,12 +1303,12 @@ class StateControllerImplTest : public ::testing::Test {
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_start_event(FunctionID::VR_Started);
- state_ctrl_->on_event(vr_start_event);
+ state_ctrl_->HandleOnEvent(vr_start_event);
break;
}
case am::HmiState::StateID::STATE_ID_TTS_SESSION: {
Event tts_start_event(FunctionID::TTS_Started);
- state_ctrl_->on_event(tts_start_event);
+ state_ctrl_->HandleOnEvent(tts_start_event);
break;
}
case am::HmiState::StateID::STATE_ID_PHONE_CALL: {
@@ -1310,7 +1319,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::PHONE_CALL;
phone_call_event.set_smart_object(message);
- state_ctrl_->on_event(phone_call_event);
+ state_ctrl_->HandleOnEvent(phone_call_event);
break;
}
case am::HmiState::StateID::STATE_ID_SAFETY_MODE: {
@@ -1321,7 +1330,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::EMERGENCY_EVENT;
emergency_event.set_smart_object(message);
- state_ctrl_->on_event(emergency_event);
+ state_ctrl_->HandleOnEvent(emergency_event);
break;
}
case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: {
@@ -1365,12 +1374,12 @@ class StateControllerImplTest : public ::testing::Test {
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_start_event(FunctionID::VR_Started);
- state_ctrl_->on_event(vr_start_event);
+ state_ctrl_->HandleOnEvent(vr_start_event);
break;
}
case am::HmiState::StateID::STATE_ID_TTS_SESSION: {
Event tts_start_event(FunctionID::TTS_Started);
- state_ctrl_->on_event(tts_start_event);
+ state_ctrl_->HandleOnEvent(tts_start_event);
break;
}
case am::HmiState::StateID::STATE_ID_PHONE_CALL: {
@@ -1381,7 +1390,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::PHONE_CALL;
phone_call_event.set_smart_object(message);
- state_ctrl_->on_event(phone_call_event);
+ state_ctrl_->HandleOnEvent(phone_call_event);
break;
}
case am::HmiState::StateID::STATE_ID_SAFETY_MODE: {
@@ -1392,7 +1401,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::EMERGENCY_EVENT;
emergency_event.set_smart_object(message);
- state_ctrl_->on_event(emergency_event);
+ state_ctrl_->HandleOnEvent(emergency_event);
break;
}
case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: {
@@ -1418,12 +1427,12 @@ class StateControllerImplTest : public ::testing::Test {
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_stop_event(FunctionID::VR_Stopped);
- state_ctrl_->on_event(vr_stop_event);
+ state_ctrl_->HandleOnEvent(vr_stop_event);
break;
}
case am::HmiState::StateID::STATE_ID_TTS_SESSION: {
Event tts_stop_event(FunctionID::TTS_Stopped);
- state_ctrl_->on_event(tts_stop_event);
+ state_ctrl_->HandleOnEvent(tts_stop_event);
break;
}
case am::HmiState::StateID::STATE_ID_PHONE_CALL: {
@@ -1434,7 +1443,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::PHONE_CALL;
phone_call_event.set_smart_object(message);
- state_ctrl_->on_event(phone_call_event);
+ state_ctrl_->HandleOnEvent(phone_call_event);
break;
}
case am::HmiState::StateID::STATE_ID_SAFETY_MODE: {
@@ -1445,7 +1454,7 @@ class StateControllerImplTest : public ::testing::Test {
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::EMERGENCY_EVENT;
emergency_event.set_smart_object(message);
- state_ctrl_->on_event(emergency_event);
+ state_ctrl_->HandleOnEvent(emergency_event);
break;
}
case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: {
@@ -2286,7 +2295,7 @@ TEST_F(StateControllerImplTest, ActivateAppSuccessReceivedFromHMI) {
am::event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
}
@@ -2348,7 +2357,7 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) {
message[am::strings::params][am::strings::correlation_id] = corr_id;
am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
}
@@ -2372,7 +2381,7 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
message[am::strings::params][am::strings::correlation_id] = corr_id;
am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp);
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, ApplyTempStatesForSimpleApp) {
@@ -2866,7 +2875,7 @@ TEST_F(StateControllerImplTest,
// Precondition
am::event_engine::Event event(hmi_apis::FunctionID::VR_Started);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
HmiStatePtr check_state = FullNotAudibleState();
@@ -2900,10 +2909,10 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
// Precondition
am::event_engine::Event prev_event(hmi_apis::FunctionID::VR_Started);
- state_ctrl_->on_event(prev_event);
+ state_ctrl_->HandleOnEvent(prev_event);
am::event_engine::Event next_event(hmi_apis::FunctionID::VR_Stopped);
- state_ctrl_->on_event(next_event);
+ state_ctrl_->HandleOnEvent(next_event);
// Set state of non-media app after vr has stopped
HmiStatePtr check_state = FullNotAudibleState();
@@ -2964,7 +2973,7 @@ TEST_F(StateControllerImplTest,
Common_EventTypes::EMERGENCY_EVENT;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
// Non-media app can't have LIMITED-AUDIO state
HmiStatePtr check_state = FullNotAudibleState();
@@ -3012,7 +3021,7 @@ TEST_F(StateControllerImplTest,
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
am::HmiStatePtr check_state = FullAudibleState();
@@ -3048,7 +3057,7 @@ TEST_F(StateControllerImplTest,
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
am::HmiStatePtr hmi_state = FullAudibleState();
@@ -3082,7 +3091,7 @@ TEST_F(StateControllerImplTest,
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
am::HmiStatePtr hmi_state = FullAudibleState();
@@ -3119,7 +3128,7 @@ TEST_F(StateControllerImplTest,
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
am::HmiStatePtr hmi_state = FullAudibleState();
@@ -3156,7 +3165,7 @@ TEST_F(StateControllerImplTest,
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(message);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
am::HmiStatePtr hmi_state = FullAudibleState();
@@ -3211,7 +3220,7 @@ TEST_F(StateControllerImplTest,
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_FULL);
EXPECT_EQ(new_state->audio_streaming_state(),
@@ -3246,7 +3255,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_BACKGROUND);
EXPECT_EQ(new_state->audio_streaming_state(),
@@ -3278,7 +3287,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceNavAppToLimited) {
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*navi_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_LIMITED);
EXPECT_EQ(new_state->audio_streaming_state(),
@@ -3299,12 +3308,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+
EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) {
@@ -3318,7 +3328,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) {
EXPECT_CALL(app_manager_mock_, application(_))
.WillOnce(Return(incorrect_app));
EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) {
@@ -3352,7 +3362,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) {
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) {
@@ -3387,7 +3397,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) {
am::WindowIds window_ids = {kDefaultWindowId};
EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) {
@@ -3402,7 +3412,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) {
EXPECT_CALL(app_manager_mock_, application(_))
.WillOnce(Return(incorrect_app));
EXPECT_CALL(*simple_app_ptr_, app_id()).Times(0);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
TEST_F(StateControllerImplTest, OnEventOnAppActivated) {
@@ -3440,7 +3450,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivated) {
std::make_shared<smart_objects::SmartObject>();
(*activate_app)[am::strings::params][am::strings::correlation_id] = kCorrID;
SetBCActivateAppRequestToHMI(hmi_apis::Common_HMILevel::FULL, kCorrID);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
}
}
@@ -3476,7 +3486,7 @@ TEST_F(StateControllerImplTest, IsStateActiveApplyNotCorrectTempStates) {
const hmi_apis::FunctionID::eType event_id = hmi_apis::FunctionID::VR_Started;
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
EXPECT_FALSE(state_ctrl_->IsStateActive(HmiState::STATE_ID_AUDIO_SOURCE));
}
@@ -3493,19 +3503,19 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::AUDIO_SOURCE;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::DEACTIVATE_HMI;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::EMBEDDED_NAVI;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType<am::HmiState>(
mobile_apis::HMILevel::HMI_FULL,
@@ -3556,11 +3566,11 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::AUDIO_SOURCE;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
msg[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::PHONE_CALL;
event.set_smart_object(msg);
- state_ctrl_->on_event(event);
+ state_ctrl_->HandleOnEvent(event);
const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType<am::HmiState>(
mobile_apis::HMILevel::HMI_FULL,
@@ -3603,7 +3613,7 @@ TEST_F(
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::AUDIO_SOURCE;
audio_source_event.set_smart_object(message);
- state_ctrl_->on_event(audio_source_event);
+ state_ctrl_->HandleOnEvent(audio_source_event);
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0);
@@ -3624,7 +3634,7 @@ TEST_F(
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::EMBEDDED_NAVI;
embedded_navi_event.set_smart_object(message);
- state_ctrl_->on_event(embedded_navi_event);
+ state_ctrl_->HandleOnEvent(embedded_navi_event);
EXPECT_CALL(*media_wep_app_ptr_, is_resuming())
.Times(2)
@@ -3724,7 +3734,7 @@ TEST_F(StateControllerImplTest,
ExpectAppWontChangeHmiStateDueToConflictResolving(
simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState());
- state_ctrl_->on_event(activate_widget_event);
+ state_ctrl_->HandleOnEvent(activate_widget_event);
}
TEST_F(StateControllerImplTest,
@@ -3765,7 +3775,7 @@ TEST_F(StateControllerImplTest,
GetBCActivateAppRequestToHMI(_, _, _, _, _))
.Times(0);
- state_ctrl_->on_event(activate_widget_event);
+ state_ctrl_->HandleOnEvent(activate_widget_event);
}
}
@@ -3786,7 +3796,7 @@ TEST_F(StateControllerImplTest,
ExpectAppWontChangeHmiStateDueToConflictResolving(
simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState());
- state_ctrl_->on_event(activate_widget_event);
+ state_ctrl_->HandleOnEvent(activate_widget_event);
}
TEST_F(StateControllerImplTest,
@@ -3827,7 +3837,7 @@ TEST_F(StateControllerImplTest,
GetBCActivateAppRequestToHMI(_, _, _, _, _))
.Times(0);
- state_ctrl_->on_event(activate_widget_event);
+ state_ctrl_->HandleOnEvent(activate_widget_event);
}
}
@@ -3911,7 +3921,7 @@ TEST_F(StateControllerImplTest,
message[am::strings::msg_params][am::hmi_notification::event_name] =
hmi_apis::Common_EventTypes::AUDIO_SOURCE;
audio_source_event.set_smart_object(message);
- state_ctrl_->on_event(audio_source_event);
+ state_ctrl_->HandleOnEvent(audio_source_event);
HmiStatePtr initial_state =
createHmiState(mobile_apis::HMILevel::INVALID_ENUM,
diff --git a/src/components/application_manager/test/zero_request_amount_test.cc b/src/components/application_manager/test/zero_request_amount_test.cc
index 0166c036c1..4f943176c0 100644
--- a/src/components/application_manager/test/zero_request_amount_test.cc
+++ b/src/components/application_manager/test/zero_request_amount_test.cc
@@ -99,19 +99,19 @@ TEST(RequestControlTest, ZeroValuePendingRequestsAmount) {
RequestController request_ctrl_;
commands::Command* reg = RegisterApplication();
- request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
correlation_id = i;
commands::Command* testCommand =
PutFileCommand(correlation_id, connection_key);
- result = request_ctrl_.addMobileRequest(testCommand,
+ result = request_ctrl_.AddMobileRequest(testCommand,
mobile_apis::HMILevel::HMI_FULL);
EXPECT_EQ(RequestController::SUCCESS, result);
}
commands::Command* unreg = UnregisterApplication();
- request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
}
TEST(RequestControlTest, ZeroValueAppRequestsTimeScale) {
@@ -124,19 +124,19 @@ TEST(RequestControlTest, ZeroValueAppRequestsTimeScale) {
RequestController request_ctrl_;
commands::Command* reg = RegisterApplication();
- request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
correlation_id = i;
commands::Command* testCommand =
PutFileCommand(correlation_id, connection_key);
- result = request_ctrl_.addMobileRequest(testCommand,
+ result = request_ctrl_.AddMobileRequest(testCommand,
mobile_apis::HMILevel::HMI_FULL);
EXPECT_EQ(RequestController::SUCCESS, result);
}
commands::Command* unreg = UnregisterApplication();
- request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
}
TEST(RequestControlTest, ZeroValueAppTimeScaleMaxRequests) {
@@ -149,19 +149,19 @@ TEST(RequestControlTest, ZeroValueAppTimeScaleMaxRequests) {
RequestController request_ctrl_;
commands::Command* reg = RegisterApplication();
- request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
correlation_id = i;
commands::Command* testCommand =
PutFileCommand(correlation_id, connection_key);
- result = request_ctrl_.addMobileRequest(testCommand,
+ result = request_ctrl_.AddMobileRequest(testCommand,
mobile_apis::HMILevel::HMI_FULL);
EXPECT_EQ(RequestController::SUCCESS, result);
}
commands::Command* unreg = UnregisterApplication();
- request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+ request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
}
} // namespace application_manager_test
diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt
index 87d310d16f..1cb1cb76a4 100644
--- a/src/components/config_profile/CMakeLists.txt
+++ b/src/components/config_profile/CMakeLists.txt
@@ -33,6 +33,7 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories (
${COMPONENTS_DIR}/config_profile/include
${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/smart_objects/include
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
${BOOST_INCLUDE_DIR}
@@ -45,6 +46,7 @@ set(PATHS
)
set(LIBRARIES
+ SmartObjects
Utils
)
diff --git a/src/components/config_profile/include/config_profile/android_profile.h b/src/components/config_profile/include/config_profile/android_profile.h
index 2de37b345f..e3b176ca9c 100644
--- a/src/components/config_profile/include/config_profile/android_profile.h
+++ b/src/components/config_profile/include/config_profile/android_profile.h
@@ -38,18 +38,18 @@
#include "utils/macro.h"
namespace profile {
- class AndroidProfile : public Profile {
- public:
- AndroidProfile(
- const std::string& internal_storage_dir,
- const std::string& external_storage_dir);
+class AndroidProfile : public Profile {
+ public:
+ AndroidProfile(const std::string& internal_storage_dir,
+ const std::string& external_storage_dir);
- void SubstituteMacroInString(std::string& in_string) const OVERRIDE;
+ void SubstituteMacroInString(std::string& in_string) const OVERRIDE;
- private:
- std::string internal_storage_dir_;
- std::string external_storage_dir_;
- };
-}
+ private:
+ std::string internal_storage_dir_;
+ std::string external_storage_dir_;
+};
+} // namespace profile
-#endif //#ifndef SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_ANDROID_PROFILE_H_
+#endif //#ifndef
+ // SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_ANDROID_PROFILE_H_
diff --git a/src/components/config_profile/include/config_profile/ini_file.h b/src/components/config_profile/include/config_profile/ini_file.h
deleted file mode 100644
index 204fb6c7bf..0000000000
--- a/src/components/config_profile/include/config_profile/ini_file.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_
-#define SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_
-
-#include <stdint.h>
-
-namespace profile {
-
-#define INI_FILE_VER 1000
-
-#if !defined TRUE
-#define TRUE 1
-#endif
-#if !defined True
-#define True 1
-#endif
-
-#if !defined FALSE
-#define FALSE 0
-#endif
-#if !defined False
-#define False 0
-#endif
-
-/*
- * @brief Global defines
- */
-#define INI_LINE_LEN 1024
-#define INI_FILE_TEMP_NAME "ini.tmp"
-
-#define INI_FLAG_UPDATE 0x00
-#define INI_FLAG_ITEM_UP_CREA 0x01
-#define INI_FLAG_FILE_UP_CREA 0x10
-
-/*
- * @brief Global typedefs
- */
-typedef enum Ini_search_id_e {
- INI_NOTHING,
- INI_RIGHT_CHAPTER,
- INI_WRONG_CHAPTER,
- INI_RIGHT_ITEM,
- INI_WRONG_ITEM,
- INI_REMARK,
-
- INI_SEARCH_MAX
-} Ini_search_id;
-
-/*
- * @brief Prototypes of functions
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * @brief Write usage instructions to the end of the file
- * @param
- *
- * @return NULL if file or desired entry not found, otherwise pointer to fname
- */
-extern char* ini_write_inst(const char* fname, uint8_t flag);
-
-/*
- * @brief Read a certain item of the specified chapter of a ini-file
- *
- * @return NULL if file or desired entry not found, otherwise pointer to value
- */
-extern char* ini_read_value(const char* fname,
- const char* chapter,
- const char* item,
- char* value);
-
-/*
- * @brief Write a certain item of the specified chapter of a ini-file
- *
- * @return NULL if file not found, otherwise pointer to value
- */
-extern char ini_write_value(const char* fname,
- const char* chapter,
- const char* item,
- const char* value,
- uint8_t flag);
-
-/*
- * @brief Parse the given line for the item and returns the value if
- * there is one otherwise NULL
- *
- * @return NULL if desired entry not found, otherwise pointer to value
- */
-extern Ini_search_id ini_parse_line(const char* line,
- const char* tag,
- char* value);
-
-#ifdef __cplusplus
-}
-#endif
-
-} // namespace profile
-
-#endif // SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 71b2e0d988..f8fdb46c8f 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -44,6 +44,7 @@
#include "media_manager/media_manager_settings.h"
#include "policy/policy_settings.h"
#include "protocol_handler/protocol_handler_settings.h"
+#include "smart_objects/smart_object.h"
#include "transport_manager/transport_manager_settings.h"
#include "utils/macro.h"
@@ -249,6 +250,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const uint32_t& default_timeout() const;
/**
+ * @brief Default timeout compensation for waiting some extra time for
+ * response to mobile app
+ */
+ const uint32_t& default_timeout_compensation() const;
+
+ /**
* @brief Default timeout for waiting for resuming
*/
const uint32_t& app_resuming_timeout() const;
@@ -552,6 +559,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
*/
size_t update_before_hours() const;
+ /**
+ * @brief Return security level that will be configured in the OpenSSL
+ */
+ uint32_t security_level() const;
+
#endif // ENABLE_SECURITY
/**
@@ -825,6 +837,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
uint32_t app_transport_change_timer_addition() const OVERRIDE;
/**
+ * @brief Parses values in config_file_name_ to config_obj_ smart object
+ */
+ void ParseConfiguration();
+
+ /**
* @brief Updates all related values from ini file
*/
void UpdateValues();
@@ -989,6 +1006,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
size_t maximum_audio_payload_size_;
size_t maximum_video_payload_size_;
std::string config_file_name_;
+ smart_objects::SmartObject config_obj_;
std::string server_address_;
uint16_t server_port_;
uint16_t video_streaming_port_;
@@ -1005,6 +1023,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
bool is_redecoding_enabled_;
uint32_t max_cmd_id_;
uint32_t default_timeout_;
+ uint32_t default_timeout_compensation_;
uint32_t app_resuming_timeout_;
uint32_t app_resumption_save_persistent_data_timeout_;
std::string vr_help_title_;
@@ -1078,6 +1097,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
std::string security_manager_protocol_name_;
std::vector<int> force_protected_service_;
std::vector<int> force_unprotected_service_;
+ uint32_t security_level_;
#endif
/*
@@ -1113,6 +1133,13 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
int iap2_hub_connect_attempts_;
int iap_hub_connection_wait_timeout_;
uint16_t tts_global_properties_timeout_;
+ size_t maximum_payload_size_;
+ size_t message_frequency_count_;
+ size_t message_frequency_time_;
+ bool malformed_message_filtering_;
+ size_t malformed_frequency_count_;
+ size_t malformed_frequency_time_;
+ uint32_t multiframe_waiting_timeout_;
uint16_t attempts_to_open_policy_db_;
uint16_t open_attempt_timeout_ms_;
uint32_t resumption_delay_before_ign_;
diff --git a/src/components/config_profile/src/android_profile.cc b/src/components/config_profile/src/android_profile.cc
index 6911592c83..b9cd826a64 100644
--- a/src/components/config_profile/src/android_profile.cc
+++ b/src/components/config_profile/src/android_profile.cc
@@ -35,30 +35,30 @@
namespace profile {
-AndroidProfile::AndroidProfile(const std::string &internal_storage_dir,
- const std::string &external_storage_dir)
- : internal_storage_dir_(internal_storage_dir)
- , external_storage_dir_(external_storage_dir) {}
+AndroidProfile::AndroidProfile(const std::string& internal_storage_dir,
+ const std::string& external_storage_dir)
+ : internal_storage_dir_(internal_storage_dir)
+ , external_storage_dir_(external_storage_dir) {}
-void AndroidProfile::SubstituteMacroInString(std::string &in_string) const {
- std::string out_string = in_string;
- const std::map<std::string, std::string> replace_macro = {
- {"%ANDROID_INTERNAL_DIR%", internal_storage_dir_},
- {"%ANDROID_EXTERNAL_DIR%", external_storage_dir_}
- };
+void AndroidProfile::SubstituteMacroInString(std::string& in_string) const {
+ std::string out_string = in_string;
+ const std::map<std::string, std::string> replace_macro = {
+ {"%ANDROID_INTERNAL_DIR%", internal_storage_dir_},
+ {"%ANDROID_EXTERNAL_DIR%", external_storage_dir_}};
- for (const auto& macro : replace_macro) {
- size_t index = 0;
- while (true) {
- index = out_string.find(macro.first, index);
- if (index == std::string::npos) break;
+ for (const auto& macro : replace_macro) {
+ size_t index = 0;
+ while (true) {
+ index = out_string.find(macro.first, index);
+ if (index == std::string::npos)
+ break;
- out_string.replace(index, macro.first.size(), macro.second);
- index += macro.first.size();
- }
+ out_string.replace(index, macro.first.size(), macro.second);
+ index += macro.first.size();
}
+ }
- in_string = out_string;
+ in_string = out_string;
}
-} \ No newline at end of file
+} // namespace profile \ No newline at end of file
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
deleted file mode 100644
index dd64f48afa..0000000000
--- a/src/components/config_profile/src/ini_file.cc
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * 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 "config_profile/ini_file.h"
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/logger.h"
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#define PATH_MAX _MAX_PATH
-#endif
-
-#ifdef __linux__
-#define USE_MKSTEMP 1
-#endif
-
-#include <string>
-
-namespace profile {
-
-SDL_CREATE_LOG_VARIABLE("Profile")
-
-char* ini_write_inst(const char* fname, uint8_t flag) {
- FILE* fp = 0;
-
- if (NULL == fname)
- return NULL;
- if ('\0' == *fname)
- return NULL;
-
- if ((fp = fopen(fname, "a")) == 0)
- if (flag & INI_FLAG_FILE_UP_CREA)
- if ((fp = fopen(fname, "w")) == 0)
- return NULL;
- if (0 == fp) {
- return NULL;
- }
- fprintf(fp, "\n");
- fprintf(fp, "; The INI-file consists of different chapters.\n");
- fprintf(fp, "; Each chapter begins with the line containing\n");
- fprintf(fp, "; the name in square brackets. Syntax:\n");
- fprintf(fp, "; [chapter]\n");
- fprintf(fp, "; The chapters consists of a set of items with a\n");
- fprintf(fp, "; assinged value. The syntax is:\n");
- fprintf(fp, "; item=value\n");
- fprintf(fp, "; All white spaces an second encounters of chapters\n");
- fprintf(fp, "; or items will be ignored.\n");
- fprintf(fp, "; Remarks start with semicolon or star as first character.\n");
- fprintf(fp, "; It is alowed for names of chapters and items to\n");
- fprintf(fp, "; contain semicolon and star. Possible syntax is:\n");
- fprintf(fp, "; [ chapter ] ;Remark\n");
- fprintf(fp, "; item = value\n");
- fprintf(fp, "\n");
-
- fclose(fp);
- return const_cast<char*>(fname);
-}
-
-char* ini_read_value(const char* fname,
- const char* chapter,
- const char* item,
- char* value) {
- FILE* fp = 0;
- bool chapter_found = false;
- char line[INI_LINE_LEN] = "";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "";
-
- Ini_search_id result;
- *line = '\0';
- *val = '\0';
- *tag = '\0';
- if ((NULL == fname) || (NULL == chapter) || (NULL == item) || (NULL == value))
- return NULL;
-
- *value = '\0';
- if (('\0' == *fname) || ('\0' == *chapter) || ('\0' == *item))
- return NULL;
-
- if ((fp = fopen(fname, "r")) == 0)
- return NULL;
-
- snprintf(tag, INI_LINE_LEN, "%s", chapter);
- for (uint32_t i = 0; i < strlen(tag); i++) {
- tag[i] = toupper(tag[i]);
- }
-
- while (NULL != fgets(line, INI_LINE_LEN, fp)) {
- // Now start the line parsing
- result = ini_parse_line(line, tag, val);
- if (!chapter_found) {
- if (INI_RIGHT_CHAPTER == result) {
- chapter_found = true;
-
- snprintf(tag, INI_LINE_LEN, "%s", item);
- for (uint32_t i = 0; i < strlen(tag); i++)
- tag[i] = toupper(tag[i]);
- }
- } else {
- // FIXME (dchmerev): Unnecessary condition
- if ((INI_RIGHT_CHAPTER == result) || (INI_WRONG_CHAPTER == result)) {
- fclose(fp);
- return NULL;
- }
- if (INI_RIGHT_ITEM == result) {
- fclose(fp);
- snprintf(value, INI_LINE_LEN, "%s", val);
- return value;
- }
- }
- }
-
- fclose(fp);
-
- return NULL;
-}
-
-#ifdef BUILD_TESTS
-// cppcheck-suppress unusedFunction //Used in unit tests
-char ini_write_value(const char* fname,
- const char* chapter,
- const char* item,
- const char* value,
- uint8_t flag) {
- FILE *rd_fp, *wr_fp = 0;
- uint16_t cr_count;
- int32_t wr_result;
- bool chapter_found = false;
- bool value_written = false;
- char line[INI_LINE_LEN] = "";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "";
- char temp_fname[PATH_MAX] = "";
- Ini_search_id result;
- *line = '\0';
- *val = '\0';
- *tag = '\0';
- *temp_fname = '\0';
-
- if ((NULL == fname) || (NULL == chapter) || (NULL == item) || (NULL == value))
- return FALSE;
- if (('\0' == *fname) || ('\0' == *chapter) || ('\0' == *item))
- return FALSE;
-
- if (0 == (rd_fp = fopen(fname, "r"))) {
- ini_write_inst(fname, flag);
- if (0 == (rd_fp = fopen(fname, "r")))
- return FALSE;
- }
-
-#if USE_MKSTEMP
- {
- const char* temp_str = "./";
- if (temp_str) {
- snprintf(temp_fname, PATH_MAX, "%s/ini.XXXXXX", temp_str);
- int32_t fd = mkstemp(temp_fname);
- if (-1 == fd) {
- fclose(rd_fp);
- return FALSE;
- }
- wr_fp = fdopen(fd, "w");
- if (NULL == wr_fp) {
- unlink(temp_fname);
- close(fd);
- fclose(rd_fp);
- return FALSE;
- }
- } else {
- fclose(rd_fp);
- return FALSE;
- }
- }
-#else // #if USE_MKSTEMP
- tmpnam(temp_fname);
- if (0 == (wr_fp = fopen(temp_fname, "w"))) {
- fclose(rd_fp);
- return FALSE;
- }
-#endif // #else #if USE_MKSTEMP
-
- snprintf(tag, INI_LINE_LEN, "%s", chapter);
- for (uint32_t i = 0; i < strlen(tag); i++)
- tag[i] = toupper(tag[i]);
-
- wr_result = 1;
- cr_count = 0;
- while ((NULL != fgets(line, INI_LINE_LEN, rd_fp)) && (0 < wr_result)) {
- // Now start the line parsing
- result = ini_parse_line(line, tag, val);
-
- if (!value_written) {
- if (!chapter_found) {
- if (INI_RIGHT_CHAPTER == result) {
- chapter_found = true;
- // coding style
- snprintf(tag, INI_LINE_LEN, "%s", item);
- for (uint32_t i = 0; i < strlen(tag); i++)
- tag[i] = toupper(tag[i]);
- }
- } else {
- if ((INI_RIGHT_CHAPTER == result) || (INI_WRONG_CHAPTER == result)) {
- /* item not found but new capture */
- if (flag & INI_FLAG_ITEM_UP_CREA)
- fprintf(wr_fp, "%s=%s\n", item, value);
- /* The item must not update in an other chapter
- even it has the right name because only the
- first chapter is significant */
- value_written = true;
- } else if (result == INI_RIGHT_ITEM) {
- for (uint16_t i = 0; i < cr_count; i++)
- fprintf(wr_fp, "\n");
- cr_count = 0;
- wr_result = fprintf(wr_fp, "%s=%s\n", item, value);
- value_written = true;
- continue;
- }
- }
- } /* if (!value_written) */
-
- if (0 == strcmp(val, "\n")) {
- cr_count++;
- } else {
- for (uint32_t i = 0; i < cr_count; i++)
- fprintf(wr_fp, "\n");
- cr_count = 0;
- wr_result = fprintf(wr_fp, "%s", line);
- }
- }
- if (0 < (wr_result) && (!value_written)) {
- if (flag & INI_FLAG_ITEM_UP_CREA) {
- if (!chapter_found)
- fprintf(wr_fp, "\n[%s]\n", chapter);
- fprintf(wr_fp, "%s=%s\n", item, value);
- value_written = true;
- }
- }
- fprintf(wr_fp, "\n");
-
- fclose(wr_fp);
- fclose(rd_fp);
-
- if (0 != rename(temp_fname, fname)) {
- if (0 != remove(temp_fname)) {
- SDL_LOG_WARN_WITH_ERRNO(
- "Unable to remove temp file: " << std::string(temp_fname));
- }
- return FALSE;
- }
-
- return (value_written);
-}
-#endif // BUILD_TESTS
-
-Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) {
- const char* line_ptr;
- char temp_str[INI_LINE_LEN] = "";
- *temp_str = '\0';
-
- snprintf(value, INI_LINE_LEN, "%s", line);
-
- /* cut leading spaces */
- line_ptr = line;
- for (uint32_t i = 0; i < strlen(line); i++) {
- if ((line[i] == ' ') || (line[i] == 9) || // TAB
- (line[i] == 10) || // LF
- (line[i] == 13)) { // CR
- line_ptr++;
- } else {
- break;
- }
- }
- if ('\0' == *line_ptr) {
- snprintf(value, INI_LINE_LEN, "\n");
- return INI_NOTHING;
- }
-
- if ((*line_ptr == ';') || (*line_ptr == '*')) /* remark */
- return INI_REMARK;
-
- if (*line_ptr == '[' && strrchr(line_ptr, ']') != NULL) {
- line_ptr++;
-
- /* cut leading stuff */
- uint16_t len = strlen(line_ptr);
- for (int32_t i = 0; i < len; i++) {
- if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB
- (*line_ptr == 10) || // LF
- (*line_ptr == 13)) { // CR
- line_ptr++;
- } else {
- break;
- }
- }
- if (*line_ptr == '\0')
- return INI_NOTHING;
-
- snprintf(temp_str, INI_LINE_LEN, "%s", line_ptr);
- char* temp_ptr = strrchr(temp_str, ']');
- if (NULL == temp_ptr) {
- return INI_NOTHING;
- } else {
- *temp_ptr = '\0';
- }
-
- /* cut trailing stuff */
- for (int32_t i = strlen(temp_str) - 1; i > 0; i--) {
- if ((temp_str[i] == ' ') || (temp_str[i] == 9) || // TAB
- (temp_str[i] == 10) || // LF
- (temp_str[i] == 13)) { // CR
- temp_str[i] = '\0';
- } else {
- break;
- }
- }
-
- snprintf(value, INI_LINE_LEN, "%s", temp_str);
-
- for (uint32_t i = 0; i < strlen(temp_str); i++)
- temp_str[i] = toupper(temp_str[i]);
- if (strcmp(temp_str, tag) == 0)
- return INI_RIGHT_CHAPTER;
- else
- return INI_WRONG_CHAPTER;
- }
-
- if (NULL != strchr(line_ptr, '=')) {
- strncpy(temp_str, line_ptr, (strchr(line_ptr, '=') - line_ptr));
- /* cut trailing stuff */
- for (int32_t i = strlen(temp_str) - 1; i > 0; i--) {
- if ((temp_str[i] == '=') || (temp_str[i] == ' ') ||
- (temp_str[i] == 9) || // TAB
- (temp_str[i] == 10) || // LF
- (temp_str[i] == 13)) { // CR
- temp_str[i] = '\0';
- } else {
- break;
- }
- }
-
- snprintf(value, INI_LINE_LEN, "%s", temp_str);
-
- for (uint32_t i = 0; i < strlen(temp_str); i++)
- temp_str[i] = toupper(temp_str[i]);
- if (strcmp(temp_str, tag) == 0) {
- line_ptr = strchr(line_ptr, '=') + 1;
- uint16_t len = strlen(line_ptr);
- /* cut trailing stuff */
- for (uint32_t i = 0; i < len; i++) {
- if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB
- (*line_ptr == 10) || // LF
- (*line_ptr == 13)) { // CR
- line_ptr++;
- } else {
- break;
- }
- }
-
- snprintf(value, INI_LINE_LEN, "%s", line_ptr);
-
- if (value[0] != '\0') {
- /* cut trailing stuff */
- for (int32_t i = strlen(value) - 1; i > 0; i--) {
- if ((value[i] == ' ') || (value[i] == ';') ||
- (value[i] == 9) || // TAB
- (value[i] == 10) || // LF
- (value[i] == 13)) { // CR
- value[i] = '\0';
- } else {
- break;
- }
- }
- }
- return INI_RIGHT_ITEM;
- } else {
- return INI_WRONG_ITEM;
- }
- }
-
- return INI_NOTHING;
-}
-} // namespace profile
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 56bd3de84a..c8a5b7993a 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -41,7 +41,6 @@
#include <string>
-#include "config_profile/ini_file.h"
#include "utils/file_system.h"
#include "utils/logger.h"
#include "utils/threads/thread.h"
@@ -64,6 +63,8 @@ namespace {
<< "'."); \
}
+#define INI_LINE_LEN 1024
+
const char* kDefaultConfigFileName = "smartDeviceLink.ini";
const char* kMainSection = "MAIN";
@@ -140,6 +141,7 @@ const char* kSecurityKeyPathKey = "KeyPath";
const char* kSecurityCipherListKey = "CipherList";
const char* kSecurityVerifyPeerKey = "VerifyPeer";
const char* kBeforeUpdateHours = "UpdateBeforeHours";
+const char* kSecurityLevel = "SecurityLevel";
#endif
const char* kAudioDataStoppedTimeoutKey = "AudioDataStoppedTimeout";
@@ -179,6 +181,7 @@ const char* kDeleteFileRequestKey = "DeleteFileRequest";
const char* kListFilesRequestKey = "ListFilesRequest";
const char* kListFilesResponseSizeKey = "ListFilesResponseSize";
const char* kDefaultTimeoutKey = "DefaultTimeout";
+const char* kDefaultTimeoutCompensationKey = "DefaultTimeoutCompensation";
const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout";
const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout";
const char* kResumptionDelayBeforeIgnKey = "ResumptionDelayBeforeIgn";
@@ -337,10 +340,11 @@ const char* kDefaultSecurityProtocol = "TLSv1.2";
const char* kDefaultSSLMode = "CLIENT";
const bool kDefaultVerifyPeer = false;
const uint32_t kDefaultBeforeUpdateHours = 24;
+const uint32_t kDefaultSecurityLevel = 1;
#endif // ENABLE_SECURITY
const uint32_t kDefaultHubProtocolIndex = 0;
-const uint32_t kDefaultHeartBeatTimeout = 0;
+const uint32_t kDefaultHeartBeatTimeout = 5000;
const uint16_t kDefaultMaxSupportedProtocolVersion = 5;
const uint16_t kDefautTransportManagerTCPPort = 12345;
const uint16_t kDefaultWebSocketServerPort = 2020;
@@ -356,6 +360,7 @@ const uint32_t kDefaultPutFileRequestInNone = 5;
const uint32_t kDefaultDeleteFileRequestInNone = 5;
const uint32_t kDefaultListFilesRequestInNone = 5;
const uint32_t kDefaultTimeout = 10000;
+const uint32_t kDefaultTimeoutCompensation = 1000;
const uint32_t kDefaultAppResumingTimeout = 3000;
const uint32_t kDefaultAppSavePersistentDataTimeout = 10000;
const uint32_t kDefaultResumptionDelayBeforeIgn = 30;
@@ -479,6 +484,7 @@ Profile::Profile()
, is_redecoding_enabled_(false)
, max_cmd_id_(kDefaultMaxCmdId)
, default_timeout_(kDefaultTimeout)
+ , default_timeout_compensation_(kDefaultTimeoutCompensation)
, app_resuming_timeout_(kDefaultAppResumingTimeout)
, app_resumption_save_persistent_data_timeout_(
kDefaultAppSavePersistentDataTimeout)
@@ -530,6 +536,13 @@ Profile::Profile()
, iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts)
, iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout)
, tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout)
+ , maximum_payload_size_(kDefaultMaximumPayloadSize)
+ , message_frequency_count_(kDefaultFrequencyCount)
+ , message_frequency_time_(kDefaultFrequencyTime)
+ , malformed_message_filtering_(kDefaulMalformedMessageFiltering)
+ , malformed_frequency_count_(kDefaultMalformedFrequencyCount)
+ , malformed_frequency_time_(kDefaultMalformedFrequencyTime)
+ , multiframe_waiting_timeout_(kDefaultExpectedConsecutiveFramesTimeout)
, attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB)
, open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB)
, resumption_delay_before_ign_(kDefaultResumptionDelayBeforeIgn)
@@ -562,9 +575,6 @@ Profile::Profile()
, ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset)
, rpc_pass_through_timeout_(kDefaultRpcPassThroughTimeout)
, period_for_consent_expiration_(kDefaultPeriodForConsentExpiration) {
- // SDL version
- ReadStringValue(
- &sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
}
Profile::~Profile() {}
@@ -678,6 +688,10 @@ const uint32_t& Profile::default_timeout() const {
return default_timeout_;
}
+const uint32_t& Profile::default_timeout_compensation() const {
+ return default_timeout_compensation_;
+}
+
const uint32_t& Profile::app_resuming_timeout() const {
return app_resuming_timeout_;
}
@@ -991,65 +1005,30 @@ uint32_t Profile::iap_hub_connection_wait_timeout() const {
}
size_t Profile::maximum_payload_size() const {
- size_t maximum_payload_size = 0;
- ReadUIntValue(&maximum_payload_size,
- kDefaultMaximumPayloadSize,
- kProtocolHandlerSection,
- kMaximumPayloadSizeKey);
- return maximum_payload_size;
+ return maximum_payload_size_;
}
size_t Profile::message_frequency_count() const {
- size_t message_frequency_count = 0;
- ReadUIntValue(&message_frequency_count,
- kDefaultFrequencyCount,
- kProtocolHandlerSection,
- kFrequencyCount);
- return message_frequency_count;
+ return message_frequency_count_;
}
size_t Profile::message_frequency_time() const {
- size_t message_frequency_time = 0;
- ReadUIntValue(&message_frequency_time,
- kDefaultFrequencyTime,
- kProtocolHandlerSection,
- kFrequencyTime);
- return message_frequency_time;
+ return message_frequency_time_;
}
bool Profile::malformed_message_filtering() const {
- bool malformed_message_filtering = 0;
- ReadBoolValue(&malformed_message_filtering,
- kDefaulMalformedMessageFiltering,
- kProtocolHandlerSection,
- kMalformedMessageFiltering);
- return malformed_message_filtering;
+ return malformed_message_filtering_;
}
size_t Profile::malformed_frequency_count() const {
- size_t malformed_frequency_count = 0;
- ReadUIntValue(&malformed_frequency_count,
- kDefaultMalformedFrequencyCount,
- kProtocolHandlerSection,
- kMalformedFrequencyCount);
- return malformed_frequency_count;
+ return malformed_frequency_count_;
}
size_t Profile::malformed_frequency_time() const {
- size_t malformed_frequency_time = 0;
- ReadUIntValue(&malformed_frequency_time,
- kDefaultMalformedFrequencyTime,
- kProtocolHandlerSection,
- kMalformedFrequencyTime);
- return malformed_frequency_time;
+ return malformed_frequency_time_;
}
uint32_t Profile::multiframe_waiting_timeout() const {
- uint32_t multiframe_waiting_timeout = 0;
- ReadUIntValue(&multiframe_waiting_timeout,
- kDefaultExpectedConsecutiveFramesTimeout,
- kProtocolHandlerSection,
- kExpectedConsecutiveFramesTimeout);
- return multiframe_waiting_timeout;
+ return multiframe_waiting_timeout_;
}
uint16_t Profile::attempts_to_open_policy_db() const {
@@ -1117,6 +1096,10 @@ const std::vector<int>& Profile::force_protected_service() const {
const std::vector<int>& Profile::force_unprotected_service() const {
return force_unprotected_service_;
}
+
+uint32_t Profile::security_level() const {
+ return security_level_;
+}
#endif // ENABLE_SECURITY
bool Profile::logs_enabled() const {
@@ -1244,9 +1227,81 @@ const std::string Profile::hmi_origin_id() const {
return hmi_origin_id_;
}
+void Profile::ParseConfiguration() {
+ FILE* config_file_ = fopen(config_file_name_.c_str(), "r");
+ config_obj_ = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (nullptr != config_file_) {
+ char line[INI_LINE_LEN] = "\0";
+ std::string chapter;
+
+ while (nullptr != fgets(line, INI_LINE_LEN, config_file_)) {
+ std::string line_str(line);
+ auto whitespace_len = line_str.find_first_not_of(" \t\r\n");
+ if (std::string::npos == whitespace_len) {
+ continue;
+ }
+ line_str.erase(0, whitespace_len);
+
+ if (';' == line_str[0] || '*' == line_str[0]) {
+ continue;
+ }
+
+ if ('[' == line_str[0] && std::string::npos != line_str.find(']')) {
+ line_str.erase(0, line_str.find_first_not_of("[ \t\r\n"));
+ line_str.erase(line_str.find_last_not_of(" \t\r\n]") + 1);
+
+ if (false == line_str.empty()) {
+ chapter = line_str;
+ config_obj_[chapter] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ }
+
+ continue;
+ }
+
+ size_t equals_idx = line_str.find('=');
+ if (std::string::npos == equals_idx) {
+ continue;
+ }
+
+ std::string key(line_str.data(), equals_idx);
+ std::string value(line_str.data() + equals_idx + 1);
+
+ auto key_whitespace_len = key.find_first_not_of(" \t\r\n");
+ if (std::string::npos == key_whitespace_len) {
+ continue;
+ }
+ key.erase(0, key_whitespace_len);
+ key.erase(key.find_last_not_of(" \t\r\n") + 1);
+
+ if (true == config_obj_[chapter].keyExists(key)) {
+ continue;
+ }
+
+ auto val_whitespace_len = value.find_first_not_of(" \t\r\n");
+ if (std::string::npos == val_whitespace_len) {
+ value = "";
+ } else {
+ value.erase(0, value.find_first_not_of(" \t\r\n"));
+ value.erase(value.find_last_not_of(" \t\r\n") + 1);
+ }
+
+ config_obj_[chapter][key] = value;
+ }
+ }
+
+ if (nullptr != config_file_) {
+ fclose(config_file_);
+ config_file_ = nullptr;
+ }
+}
+
void Profile::UpdateValues() {
SDL_LOG_AUTO_TRACE();
+ ParseConfiguration();
+
// SDL version
ReadStringValue(
&sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
@@ -1308,6 +1363,11 @@ void Profile::UpdateValues() {
kSecuritySection,
kBeforeUpdateHours);
+ ReadUIntValue(&security_level_,
+ kDefaultSecurityLevel,
+ kSecuritySection,
+ kSecurityLevel);
+
#endif // ENABLE_SECURITY
// Logs enabled
@@ -1345,7 +1405,8 @@ void Profile::UpdateValues() {
kMainSection,
kHmiCapabilitiesCacheFileKey);
- if (!hmi_capabilities_cache_file_name_.empty() && IsRelativePath(hmi_capabilities_cache_file_name_)) {
+ if (!hmi_capabilities_cache_file_name_.empty() &&
+ IsRelativePath(hmi_capabilities_cache_file_name_)) {
hmi_capabilities_cache_file_name_ =
app_storage_folder_ + "/" + hmi_capabilities_cache_file_name_;
}
@@ -1384,10 +1445,6 @@ void Profile::UpdateValues() {
kSDL4Section,
kAppIconsFolderMaxSizeKey);
- if (app_icons_folder_max_size_ < kDefaultAppIconsFolderMaxSize) {
- app_icons_folder_max_size_ = kDefaultAppIconsFolderMaxSize;
- }
-
LOG_UPDATED_VALUE(
app_icons_folder_max_size_, kAppIconsFolderMaxSizeKey, kSDL4Section);
@@ -1672,6 +1729,16 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(default_timeout_, kDefaultTimeoutKey, kMainSection);
+ // Default timeout compensation
+ ReadUIntValue(&default_timeout_compensation_,
+ kDefaultTimeoutCompensation,
+ kMainSection,
+ kDefaultTimeoutCompensationKey);
+
+ LOG_UPDATED_VALUE(default_timeout_compensation_,
+ kDefaultTimeoutCompensationKey,
+ kMainSection);
+
// Application resuming timeout
ReadUIntValue(&app_resuming_timeout_,
kDefaultAppResumingTimeout,
@@ -2123,6 +2190,73 @@ void Profile::UpdateValues() {
error_description_ = "PathToSnapshot has forbidden(non-portable) symbols";
}
+ // Packet with payload bigger than this value will be marked as malformed
+ ReadUIntValue(&maximum_payload_size_,
+ kDefaultMaximumPayloadSize,
+ kProtocolHandlerSection,
+ kMaximumPayloadSizeKey);
+
+ LOG_UPDATED_VALUE(
+ maximum_payload_size_, kMaximumPayloadSizeKey, kProtocolHandlerSection);
+
+ // Check for apps sending too many messages
+ ReadUIntValue(&message_frequency_count_,
+ kDefaultFrequencyCount,
+ kProtocolHandlerSection,
+ kFrequencyCount);
+
+ LOG_UPDATED_VALUE(
+ message_frequency_count_, kFrequencyCount, kProtocolHandlerSection);
+
+ // Check for apps sending too many messages
+ ReadUIntValue(&message_frequency_time_,
+ kDefaultFrequencyTime,
+ kProtocolHandlerSection,
+ kFrequencyTime);
+
+ LOG_UPDATED_VALUE(
+ message_frequency_time_, kFrequencyTime, kProtocolHandlerSection);
+
+ // Enable filter malformed messages
+ ReadBoolValue(&malformed_message_filtering_,
+ kDefaulMalformedMessageFiltering,
+ kProtocolHandlerSection,
+ kMalformedMessageFiltering);
+
+ LOG_UPDATED_BOOL_VALUE(malformed_message_filtering_,
+ kMalformedMessageFiltering,
+ kProtocolHandlerSection);
+
+ // Count for malformed message detection
+ ReadUIntValue(&malformed_frequency_count_,
+ kDefaultMalformedFrequencyCount,
+ kProtocolHandlerSection,
+ kMalformedFrequencyCount);
+
+ LOG_UPDATED_VALUE(malformed_frequency_count_,
+ kMalformedFrequencyCount,
+ kProtocolHandlerSection);
+
+ // Time for malformed message detection
+ ReadUIntValue(&malformed_frequency_time_,
+ kDefaultMalformedFrequencyTime,
+ kProtocolHandlerSection,
+ kMalformedFrequencyTime);
+
+ LOG_UPDATED_VALUE(malformed_frequency_time_,
+ kMalformedFrequencyTime,
+ kProtocolHandlerSection);
+
+ // Timeout for waiting CONSECUTIVE frames of multiframe
+ ReadUIntValue(&multiframe_waiting_timeout_,
+ kDefaultExpectedConsecutiveFramesTimeout,
+ kProtocolHandlerSection,
+ kExpectedConsecutiveFramesTimeout);
+
+ LOG_UPDATED_VALUE(multiframe_waiting_timeout_,
+ kExpectedConsecutiveFramesTimeout,
+ kProtocolHandlerSection);
+
// Attempts number for opening policy DB
ReadUIntValue(&attempts_to_open_policy_db_,
kDefaultAttemptsToOpenPolicyDB,
@@ -2350,7 +2484,7 @@ void Profile::UpdateValues() {
entry->ini_key_name,
kTransportRequiredForResumptionSection);
}
- entry++;
+ ++entry;
}
}
@@ -2550,7 +2684,7 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(
list_with_comma, entry->ini_key_name, entry->ini_section_name);
}
- entry++;
+ ++entry;
}
}
@@ -2588,7 +2722,7 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(
list_with_comma, entry->ini_key_name, entry->ini_section_name);
}
- entry++;
+ ++entry;
}
}
}
@@ -2599,18 +2733,18 @@ bool Profile::ReadValue(bool* value,
DCHECK(value);
bool ret = false;
- char buf[INI_LINE_LEN + 1];
- *buf = '\0';
- if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) &&
- ('\0' != *buf)) {
- const int32_t tmpVal = atoi(buf);
- if ((0 == strcmp("true", buf)) || (0 != tmpVal)) {
+ if (config_obj_.keyExists(pSection) &&
+ config_obj_[pSection].keyExists(pKey)) {
+ auto val_str = config_obj_[pSection][pKey].asString();
+ const int32_t tmpVal = atoi(val_str.data());
+ if ((0 == strcmp("true", val_str.data())) || (0 != tmpVal)) {
*value = true;
} else {
*value = false;
}
ret = true;
}
+
return ret;
}
@@ -2627,10 +2761,9 @@ bool Profile::ReadValueEmpty(std::string* value,
DCHECK(value);
bool ret = false;
- char buf[INI_LINE_LEN + 1];
- *buf = '\0';
- if (0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) {
- *value = buf;
+ if (config_obj_.keyExists(pSection) &&
+ config_obj_[pSection].keyExists(pKey)) {
+ *value = config_obj_[pSection][pKey].asString();
ret = true;
}
diff --git a/src/components/config_profile/test/CMakeLists.txt b/src/components/config_profile/test/CMakeLists.txt
index 597be8fe00..d586485f64 100644
--- a/src/components/config_profile/test/CMakeLists.txt
+++ b/src/components/config_profile/test/CMakeLists.txt
@@ -33,11 +33,13 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories (
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/config_profile/include
+ ${COMPONENTS_DIR}/smart_objects/include
)
set(LIBRARIES
gmock
ConfigProfile
+ SmartObjects
)
collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc
deleted file mode 100644
index ca4f2fc849..0000000000
--- a/src/components/config_profile/test/ini_file_test.cc
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2015, 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 "config_profile/ini_file.h"
-#include "gtest/gtest.h"
-#include "utils/file_system.h"
-
-namespace test {
-namespace components {
-namespace profile_test {
-
-using namespace ::profile;
-
-TEST(IniFileTest, WriteItemReadItem) {
- // Write line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* item = "Test_item";
- const char* value = "test_value";
- const bool write_result =
- ini_write_value(fname, chapter, item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_TRUE(write_result);
- char search_value[INI_LINE_LEN] = {0};
- const bool read_result = ini_read_value(fname, chapter, item, search_value);
- const char* res = search_value;
-
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res, value);
- EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
-}
-
-TEST(IniFileTest, WriteItemWithoutValueReadItem) {
- // Write line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* test_item = "Test_item";
- const char* value = "";
- const bool write_result =
- ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_TRUE(write_result);
-
- // Read value from file
- char search_value[INI_LINE_LEN] = {0};
- const bool read_result =
- ini_read_value(fname, chapter, test_item, search_value);
- const char* res = search_value;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res, value);
-
- EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
-}
-
-TEST(IniFileTest, WriteSameItemInDifferentChapters) {
- // Write line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter1 = "Chapter1";
- const char* test_item = "Test_item";
- const char* value = "test_value";
- const bool write_result =
- ini_write_value(fname, chapter1, test_item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_TRUE(write_result);
- char search_value[INI_LINE_LEN] = {0};
- const bool read_result =
- ini_read_value(fname, chapter1, test_item, search_value);
- const char* res = search_value;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res, value);
-
- // Create new chapter and write the same value
- const char* chapter2 = "Chapter2";
-
- const bool write_result2 =
- ini_write_value(fname, chapter2, test_item, value, INI_FLAG_ITEM_UP_CREA);
-
- EXPECT_TRUE(write_result2);
-
- char value2[INI_LINE_LEN] = "test_value";
- const bool read_result2 = ini_read_value(fname, chapter2, test_item, value2);
- const char* res2 = value2;
- EXPECT_TRUE(read_result2);
- EXPECT_STREQ(res2, res);
- EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
-}
-
-TEST(IniFileTest, RewriteItem) {
- // Write line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* item = "Test_item";
- const char* value = "test_value";
- bool write_result =
- ini_write_value(fname, chapter, item, value, INI_FLAG_ITEM_UP_CREA);
-
- EXPECT_TRUE(write_result);
- char search_value[INI_LINE_LEN] = {0};
- bool read_result = ini_read_value(fname, chapter, item, search_value);
- const char* res = search_value;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res, value);
-
- // Write item again
- const char* newvalue = "new_test_value";
- write_result =
- ini_write_value(fname, chapter, item, newvalue, INI_FLAG_ITEM_UP_CREA);
-
- EXPECT_TRUE(write_result);
- char new_search_value[INI_LINE_LEN] = {0};
- read_result = ini_read_value(fname, chapter, item, new_search_value);
- const char* new_res = new_search_value;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(new_res, newvalue);
- EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
-}
-
-TEST(IniFileTest, WriteTwoItemsInOneChapter) {
- // Write line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* item = "Test_item";
- const char* value1 = "test_value";
-
- bool write_result =
- ini_write_value(fname, chapter, item, value1, INI_FLAG_ITEM_UP_CREA);
- EXPECT_TRUE(write_result);
-
- // Write another line in the same chapter
- const char* item2 = "Test_item2";
- const char* value2 = "test_value2";
-
- write_result =
- ini_write_value(fname, chapter, item2, value2, INI_FLAG_ITEM_UP_CREA);
- EXPECT_TRUE(write_result);
-
- // Search both values
- char search_value[INI_LINE_LEN] = {0};
- bool read_result = ini_read_value(fname, chapter, item, search_value);
- const char* res = search_value;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res, value1);
-
- char search_value2[INI_LINE_LEN] = {0};
- read_result = ini_read_value(fname, chapter, item2, search_value2);
- const char* res2 = search_value2;
- EXPECT_TRUE(read_result);
- EXPECT_STREQ(res2, value2);
- EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
-}
-
-TEST(IniFileTest, WriteEmptyItemWithValueReadItem) {
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* test_item = "";
- const char* value = "test_value";
- bool result =
- ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_FALSE(result);
-}
-
-TEST(IniFileTest, WriteEmptyItemWithEmptyValue_ExpectFalse) {
- // Write empty line in chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "Chapter";
- const char* test_item = "";
- const char* value = "";
- bool result =
- ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_FALSE(result);
-}
-
-TEST(IniFileTest, WriteItemInEmptyChapter_ExpectFalse) {
- // Write line in empty chapter
- const char* fname = "./test_ini_file.ini";
- const char* chapter = "";
- const char* test_item = "Test_item";
- const char* value = "test_value";
- bool result =
- ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA);
- EXPECT_FALSE(result);
-}
-
-TEST(IniFileTest, ParseEmptyLine) {
- char line[INI_LINE_LEN] = {0};
- char val[INI_LINE_LEN] = {0};
- const char* tag = "HMI";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_NOTHING, result);
-}
-
-TEST(IniFileTest, ParseChapter) {
- const char* line = "[HMI]";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "HMI";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_RIGHT_CHAPTER, result);
-}
-
-TEST(IniFileTest, ParseChapterTagEmpty) {
- const char* line = "[HMI]";
- char val[INI_LINE_LEN] = {0};
- char tag[INI_LINE_LEN] = {0};
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_WRONG_CHAPTER, result);
-}
-
-TEST(IniFileTest, ParseChapterWithUppercaseTag) {
- const char* line = "[Security Manager]";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "SECURITY MANAGER";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_RIGHT_CHAPTER, result);
-}
-
-TEST(IniFileTest, ParseChapterWithLowcaseTag) {
- const char* line = "[Security Manager]";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "Security Manager";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_WRONG_CHAPTER, result);
-}
-
-TEST(IniFileTest, ParseWithWrongChapter) {
- const char* line = "[HMI]";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "MAIN";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_WRONG_CHAPTER, result);
-}
-
-TEST(IniFileTest, ParseLineWithItem) {
- char line[INI_LINE_LEN] = "LaunchHMI = true";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "LAUNCHHMI";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_RIGHT_ITEM, result);
-
- char check_val[INI_LINE_LEN] = "true";
- EXPECT_EQ(*check_val, *val);
-}
-
-TEST(IniFileTest, ParseLineWithoutItem) {
- const char* line = "LaunchHMI = ";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "LAUNCHHMI";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- const char* res = val;
- const char* check_val = "";
- EXPECT_EQ(INI_RIGHT_ITEM, result);
- EXPECT_STREQ(check_val, res);
-}
-
-TEST(IniFileTest, ParseLineWithEmptytag) {
- const char* line = "LaunchHMI = true";
- char val[INI_LINE_LEN] = {0};
- char tag[INI_LINE_LEN] = {0};
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_WRONG_ITEM, result);
-}
-
-TEST(IniFileTest, ParseLineWithLowcaseTag) {
- const char* line = "LaunchHMI = true";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "LaunchHmi";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- EXPECT_EQ(INI_WRONG_ITEM, result);
-}
-
-TEST(IniFileTest, ParseLineWithComment) {
- const char* line = "; [HMI]";
- char val[INI_LINE_LEN] = {0};
- const char* tag = "HMI";
-
- Ini_search_id result;
- result = ini_parse_line(line, tag, val);
- const char* res = val;
- EXPECT_EQ(INI_REMARK, result);
- EXPECT_STREQ(line, res);
-}
-
-} // namespace profile_test
-} // namespace components
-} // namespace test
diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc
index 7b9bb374b9..900bbd1f93 100644
--- a/src/components/config_profile/test/profile_test.cc
+++ b/src/components/config_profile/test/profile_test.cc
@@ -373,7 +373,7 @@ TEST_F(ProfileTest, IntInsteadOfPair) {
TEST_F(ProfileTest, WrongIntValue) {
// Default value
- uint32_t heart_beat_timeout = 0;
+ uint32_t heart_beat_timeout = 5000;
EXPECT_EQ(heart_beat_timeout, profile_.heart_beat_timeout());
// Change config file
@@ -381,7 +381,7 @@ TEST_F(ProfileTest, WrongIntValue) {
EXPECT_EQ("smartDeviceLink_invalid_int.ini", profile_.config_file_name());
// Value in file includes letters. Check that value is default
- heart_beat_timeout = 0;
+ heart_beat_timeout = 5000;
EXPECT_EQ(heart_beat_timeout, profile_.heart_beat_timeout());
// Update config file
@@ -679,6 +679,7 @@ TEST_F(ProfileTest, CheckVectorContainer) {
std::vector<int> diagmodes_list =
profile_.ReadIntContainer("MAIN", "SupportedDiagModes", &isread);
EXPECT_TRUE(isread);
+
// Compare with result of ReadIntContainer
ASSERT_EQ(diag_modes.size(), diagmodes_list.size());
bool isEqual = true;
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index 8b286e1309..4ef2d724c3 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -280,6 +280,14 @@ class Connection {
void KeepAlive(uint8_t session_id);
/**
+ * @brief Check is heartbeat monitoring started for specified session
+ * @param session_id session id
+ * @return returns true if heartbeat monitoring started for specified session
+ * otherwise returns false
+ */
+ bool IsSessionHeartbeatTracked(const uint8_t session_id) const;
+
+ /**
* @brief Start heartbeat for specified session
* @param session_id session id
*/
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 3bfa5b34b8..25a89ea4b3 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
@@ -466,6 +466,14 @@ class ConnectionHandlerImpl
void SendEndService(uint32_t key, uint8_t service_type) OVERRIDE;
/**
+ * @brief Check is heartbeat monitoring started for specified connection key
+ * @param connection_key pair of connection and session id
+ * @return returns true if heartbeat monitoring started for specified
+ * connection key otherwise returns false
+ */
+ bool IsSessionHeartbeatTracked(const uint32_t connection_key) const OVERRIDE;
+
+ /**
* \brief Start heartbeat for specified session
*
* \param connection_key pair of connection and session id
@@ -640,6 +648,8 @@ class ConnectionHandlerImpl
void CreateWebEngineDevice() OVERRIDE;
+ bool GetProtocolVehicleData(ProtocolVehicleData& data) OVERRIDE;
+
private:
/**
* \brief Disconnect application.
diff --git a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
index 9e04929f79..7713d2490f 100644
--- a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
+++ b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
@@ -69,6 +69,14 @@ class HeartBeatMonitor : public threads::ThreadDelegate {
void KeepAlive(uint8_t session_id);
/**
+ * @brief Check is heartbeat monitoring started for specified session
+ * @param session_id session id
+ * @return returns true if heartbeat monitoring started for specified session
+ * otherwise returns false
+ */
+ bool IsSessionHeartbeatTracked(const uint8_t session_id) const;
+
+ /**
* \brief Thread exit procedure.
*/
virtual void exitThreadMain();
@@ -111,7 +119,7 @@ class HeartBeatMonitor : public threads::ThreadDelegate {
typedef std::map<uint8_t, SessionState> SessionMap;
SessionMap sessions_;
- sync_primitives::RecursiveLock sessions_list_lock_; // recurcive
+ mutable sync_primitives::RecursiveLock sessions_list_lock_; // recursive
sync_primitives::Lock main_thread_lock_;
mutable sync_primitives::Lock heartbeat_timeout_seconds_lock_;
sync_primitives::ConditionalVariable heartbeat_monitor_;
diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc
index 5bd72773c2..0ed5182a9b 100644
--- a/src/components/connection_handler/src/connection.cc
+++ b/src/components/connection_handler/src/connection.cc
@@ -527,6 +527,10 @@ bool Connection::ProtocolVersion(uint8_t session_id,
return true;
}
+bool Connection::IsSessionHeartbeatTracked(const uint8_t session_id) const {
+ return heartbeat_monitor_->IsSessionHeartbeatTracked(session_id);
+}
+
bool Connection::ProtocolVersion(
uint8_t session_id, utils::SemanticVersion& full_protocol_version) {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index ca8f86f151..1e90923d34 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -547,11 +547,16 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
session_key,
service_type,
params);
- } else {
+ }
+#ifdef BUILD_TESTS
+ else {
+ // FIXME (VSemenyuk): This code is only used in unit tests, so should be
+ // removed. ConnectionHandler unit tests should be fixed.
if (protocol_handler_) {
protocol_handler_->NotifySessionStarted(context, rejected_params);
}
}
+#endif
}
void ConnectionHandlerImpl::NotifyServiceStartedResult(
@@ -589,17 +594,20 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult(
if (!result) {
SDL_LOG_WARN("Service starting forbidden by connection_handler_observer");
+ context.is_start_session_failed_ = true;
+ }
+
+ if (protocol_handler_) {
+ protocol_handler_->NotifySessionStarted(context, rejected_params, reason);
+ }
+
+ if (context.is_start_session_failed_) {
if (protocol_handler::kRpc == context.service_type_) {
connection->RemoveSession(context.new_session_id_);
} else {
connection->RemoveService(context.initial_session_id_,
context.service_type_);
}
- context.new_session_id_ = 0;
- }
-
- if (protocol_handler_ != NULL) {
- protocol_handler_->NotifySessionStarted(context, rejected_params, reason);
}
}
@@ -919,6 +927,15 @@ void ConnectionHandlerImpl::CreateWebEngineDevice() {
transport_manager_.CreateWebEngineDevice();
}
+bool ConnectionHandlerImpl::GetProtocolVehicleData(ProtocolVehicleData& data) {
+ sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
+ if (connection_handler_observer_) {
+ return connection_handler_observer_->GetProtocolVehicleData(data);
+ }
+
+ return false;
+}
+
const std::string
ConnectionHandlerImpl::TransportTypeProfileStringFromConnHandle(
transport_manager::ConnectionUID connection_handle) const {
@@ -987,7 +1004,7 @@ uint32_t ConnectionHandlerImpl::KeyFromPair(
transport_manager::ConnectionUID connection_handle,
uint8_t session_id) const {
const uint32_t key = connection_handle | (session_id << 16);
- SDL_LOG_DEBUG("Key for ConnectionHandle:"
+ SDL_LOG_TRACE("Key for ConnectionHandle:"
<< static_cast<uint32_t>(connection_handle)
<< " Session:" << static_cast<uint32_t>(session_id) << " is: 0x"
<< std::hex << static_cast<uint32_t>(key));
@@ -1005,7 +1022,7 @@ void ConnectionHandlerImpl::PairFromKey(
uint8_t* session_id) const {
*connection_handle = key & 0xFF00FFFF;
*session_id = key >> 16;
- SDL_LOG_DEBUG("ConnectionHandle: "
+ SDL_LOG_TRACE("ConnectionHandle: "
<< static_cast<int32_t>(*connection_handle)
<< " Session: " << static_cast<int32_t>(*session_id)
<< " for key: " << static_cast<int32_t>(key));
@@ -1459,6 +1476,10 @@ void ConnectionHandlerImpl::ConnectToAllDevices() {
SDL_LOG_DEBUG("No need to connect to web engine device");
continue;
}
+ if ("CLOUD_WEBSOCKET" == i->second.connection_type()) {
+ SDL_LOG_DEBUG("No need to connect to cloud device");
+ continue;
+ }
ConnectToDevice(i->first);
}
}
@@ -1669,6 +1690,21 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) {
}
}
+bool ConnectionHandlerImpl::IsSessionHeartbeatTracked(
+ const uint32_t connection_key) const {
+ SDL_LOG_AUTO_TRACE();
+ uint32_t connection_handle = 0;
+ uint8_t session_id = 0;
+ PairFromKey(connection_key, &connection_handle, &session_id);
+
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ ConnectionList::const_iterator it = connection_list_.find(connection_handle);
+ if (connection_list_.end() != it) {
+ return it->second->IsSessionHeartbeatTracked(session_id);
+ }
+ return false;
+}
+
void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) {
SDL_LOG_AUTO_TRACE();
uint32_t connection_handle = 0;
diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc
index f3e2da2696..8e15c934b9 100644
--- a/src/components/connection_handler/src/heartbeat_monitor.cc
+++ b/src/components/connection_handler/src/heartbeat_monitor.cc
@@ -87,6 +87,13 @@ void HeartBeatMonitor::threadMain() {
}
void HeartBeatMonitor::AddSession(uint8_t session_id) {
+ if (0 == default_heartbeat_timeout_) {
+ SDL_LOG_INFO("Won't add session with id "
+ << static_cast<uint32_t>(session_id)
+ << " because Heartbeat is disabled.");
+ return;
+ }
+
const uint32_t converted_session_id = static_cast<int32_t>(session_id);
UNUSED(converted_session_id);
SDL_LOG_DEBUG("Add session with id " << converted_session_id);
@@ -96,6 +103,7 @@ void HeartBeatMonitor::AddSession(uint8_t session_id) {
<< " already exists");
return;
}
+
sessions_.insert(
std::make_pair(session_id, SessionState(default_heartbeat_timeout_)));
SDL_LOG_INFO("Start heartbeat for session: " << converted_session_id);
@@ -125,6 +133,14 @@ void HeartBeatMonitor::KeepAlive(uint8_t session_id) {
}
}
+bool HeartBeatMonitor::IsSessionHeartbeatTracked(
+ const uint8_t session_id) const {
+ SDL_LOG_AUTO_TRACE();
+ AutoLock auto_lock(sessions_list_lock_);
+
+ return sessions_.end() != sessions_.find(session_id);
+}
+
void HeartBeatMonitor::exitThreadMain() {
// FIXME (dchmerev@luxoft.com): thread requested to stop should stop as soon
// as possible,
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc
index 87dac9182e..79b237253c 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -56,6 +56,7 @@ using namespace ::connection_handler;
using ::protocol_handler::ServiceType;
using namespace ::protocol_handler;
using ::testing::_;
+using ::testing::An;
using ::testing::ByRef;
using ::testing::DoAll;
using ::testing::InSequence;
@@ -127,7 +128,8 @@ class ConnectionHandlerTest : public ::testing::Test {
void AddTestSession() {
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(temp_protocol_handler,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(
@@ -164,7 +166,8 @@ class ConnectionHandlerTest : public ::testing::Test {
SessionContext context;
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(temp_protocol_handler,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&context));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -371,7 +374,8 @@ TEST_F(ConnectionHandlerTest, StartSession_NoConnection) {
protocol_handler::SessionContext context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&context));
connection_handler_->OnSessionStartedCallback(
@@ -1045,34 +1049,34 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithCommonReason) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
SendEndSession(uid_, out_context_.new_session_id_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kAudio, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kBulk, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kRpc, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_handler_->CloseSession(connection_key_, kCommon);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) {
@@ -1087,34 +1091,34 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
SendEndSession(uid_, out_context_.new_session_id_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kFlood))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kAudio, kFlood))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kBulk, kFlood))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kRpc, kFlood))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_handler_->CloseSession(connection_key_, kFlood);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
@@ -1129,7 +1133,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
SendEndSession(uid_, out_context_.new_session_id_))
@@ -1138,24 +1142,24 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kAudio, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kBulk, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kRpc, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_handler_->CloseSession(connection_key_, kMalformed);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
@@ -1170,7 +1174,7 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
SendEndSession(uid_, out_context_.new_session_id_))
@@ -1179,24 +1183,24 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kAudio, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kBulk, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kRpc, kMalformed))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_handler_->CloseConnectionSessions(uid_, kMalformed);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ConnectionHandlerTest, CloseConnectionSessionsInvalidConnectionId) {
@@ -1229,34 +1233,34 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithCommonReason) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
SendEndSession(uid_, out_context_.new_session_id_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kAudio, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kBulk, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kRpc, kCommon))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_handler_->CloseConnectionSessions(uid_, kCommon);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ConnectionHandlerTest, StartService_withServices) {
@@ -1268,7 +1272,8 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) {
SessionContext audio_context, video_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&audio_context))
.WillOnce(SaveArg<0>(&video_context));
@@ -1309,7 +1314,8 @@ TEST_F(ConnectionHandlerTest, StartService_withServices_withParams) {
std::vector<std::string> empty;
BsonObject* dummy_param = reinterpret_cast<BsonObject*>(&dummy);
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), empty, _))
.WillOnce(SaveArg<0>(&video_context));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1354,7 +1360,8 @@ TEST_F(ConnectionHandlerTest, ServiceStop) {
SessionContext audio_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillRepeatedly(SaveArg<0>(&audio_context));
// Check ignoring hash_id on stop non-rpc service
@@ -1445,7 +1452,8 @@ TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) {
reason));
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&out_context_));
// Start new session with RPC service
@@ -1485,7 +1493,8 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) {
// confirm that NotifySessionStarted() is called
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), empty, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1527,7 +1536,8 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) {
// confirm that NotifySessionStarted() is called
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), empty, _))
.WillOnce(SaveArg<0>(&out_context_));
connection_handler_->OnSessionStartedCallback(uid_,
@@ -1536,7 +1546,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) {
PROTECTION_OFF,
dummy_params);
- EXPECT_EQ(0u, out_context_.new_session_id_);
+ EXPECT_TRUE(out_context_.is_start_session_failed_);
}
/*
@@ -1551,7 +1561,8 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
- EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(temp_protocol_handler,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&context_first))
.WillOnce(SaveArg<0>(&context_second));
@@ -1622,7 +1633,8 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
// verify that connection handler will not mix up the two results
SessionContext new_context_first, new_context_second;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), empty, _))
.WillOnce(SaveArg<0>(&new_context_second))
.WillOnce(SaveArg<0>(&new_context_first));
@@ -1637,8 +1649,10 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
PROTECTION_OFF,
dummy_params);
- EXPECT_NE(0u, new_context_first.new_session_id_); // result is positive
- EXPECT_EQ(0u, new_context_second.new_session_id_); // result is negative
+ EXPECT_FALSE(
+ new_context_first.is_start_session_failed_); // result is positive
+ EXPECT_TRUE(
+ new_context_second.is_start_session_failed_); // result is negative
}
TEST_F(ConnectionHandlerTest,
@@ -1654,7 +1668,8 @@ TEST_F(ConnectionHandlerTest,
SessionContext fail_context;
SessionContext positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&fail_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1697,7 +1712,8 @@ TEST_F(ConnectionHandlerTest,
SessionContext fail_context;
SessionContext positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&fail_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1742,7 +1758,8 @@ TEST_F(ConnectionHandlerTest,
SessionContext context_first, context_second;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&context_first))
.WillOnce(SaveArg<0>(&context_second));
@@ -1797,7 +1814,8 @@ TEST_F(ConnectionHandlerTest,
SessionContext rejected_context, positive_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&rejected_context))
.WillOnce(SaveArg<0>(&positive_context));
@@ -1840,7 +1858,8 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DelayProtect) {
SessionContext context_new, context_second, context_third;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&context_new))
.WillOnce(SaveArg<0>(&context_second))
.WillOnce(SaveArg<0>(&context_third));
@@ -1895,7 +1914,8 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DelayProtectBulk) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&new_context));
connection_handler_->OnSessionStartedCallback(uid_,
out_context_.new_session_id_,
@@ -2001,7 +2021,8 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&new_context));
// Open kAudio service
@@ -2038,7 +2059,8 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&new_context));
// Protect kRpc (Bulk will be protect also)
@@ -2078,7 +2100,8 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) {
SessionContext new_context;
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _, _))
+ EXPECT_CALL(mock_protocol_handler_,
+ NotifySessionStarted(An<SessionContext&>(), _, _))
.WillOnce(SaveArg<0>(&new_context));
// Protect Bulk (kRpc will be protected also)
diff --git a/src/components/connection_handler/test/heart_beat_monitor_test.cc b/src/components/connection_handler/test/heart_beat_monitor_test.cc
index d736255134..2ca8a46184 100644
--- a/src/components/connection_handler/test/heart_beat_monitor_test.cc
+++ b/src/components/connection_handler/test/heart_beat_monitor_test.cc
@@ -123,19 +123,19 @@ TEST_F(HeartBeatMonitorTest, TimerElapsed) {
const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(connection_handler_mock_, CloseSession(_, session, _))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
RemoveSession(connection_, session)));
times++;
EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, session))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_->StartHeartBeat(session);
- EXPECT_TRUE(waiter.WaitFor(
+ EXPECT_TRUE(waiter->WaitFor(
times,
2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
@@ -166,13 +166,13 @@ TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, session))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(connection_handler_mock_, CloseSession(_, session, _))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
RemoveSession(connection_, session)));
times++;
@@ -180,7 +180,7 @@ TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
usleep(timeout_);
connection_->KeepAlive(session);
- EXPECT_TRUE(waiter.WaitFor(
+ EXPECT_TRUE(waiter->WaitFor(
times,
2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
@@ -203,28 +203,28 @@ TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
const uint32_t kSession2 =
connection_->AddNewSession(kAnotherConnectionHandle);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession1, _))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
RemoveSession(connection_, kSession1)));
times++;
EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession2, _))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
RemoveSession(connection_, kSession2)));
times++;
EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession1))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession2))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
connection_->StartHeartBeat(kSession1);
connection_->StartHeartBeat(kSession2);
- EXPECT_TRUE(waiter.WaitFor(
+ EXPECT_TRUE(waiter->WaitFor(
times,
2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
@@ -256,21 +256,21 @@ TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
const uint32_t kSession =
connection_->AddNewSession(kDefaultConnectionHandle);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession, _))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
RemoveSession(connection_, kSession)));
times++;
EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
const uint32_t new_timeout = timeout_ - kTime_offset;
connection_->StartHeartBeat(kSession);
connection_->SetHeartBeatTimeout(new_timeout, kSession);
- EXPECT_TRUE(waiter.WaitFor(
+ EXPECT_TRUE(waiter->WaitFor(
times,
2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
diff --git a/src/components/formatters/src/CFormatterJsonBase.cc b/src/components/formatters/src/CFormatterJsonBase.cc
index d88ffc7158..4e67d5dcbe 100644
--- a/src/components/formatters/src/CFormatterJsonBase.cc
+++ b/src/components/formatters/src/CFormatterJsonBase.cc
@@ -45,14 +45,14 @@ void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::
Json::Value::Members members = value.getMemberNames();
- for (uint32_t i = 0; i < members.size(); i++) {
+ for (uint32_t i = 0; i < members.size(); ++i) {
jsonValueToObj(value[members[i]], obj[members[i]]);
}
} else if (value.type() == Json::arrayValue) {
obj = ns_smart_device_link::ns_smart_objects::SmartObject(
ns_smart_device_link::ns_smart_objects::SmartType_Array);
- for (uint32_t i = 0; i < value.size(); i++) {
+ for (uint32_t i = 0; i < value.size(); ++i) {
jsonValueToObj(value[i], obj[i]);
}
} else if (value.type() == Json::intValue) {
@@ -81,7 +81,7 @@ void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::
obj.getType()) {
item = Json::arrayValue;
- for (uint32_t i = 0; i < obj.length(); i++) {
+ for (uint32_t i = 0; i < obj.length(); ++i) {
Json::Value value(Json::nullValue);
objToJsonValue(obj.getElement(i), value);
diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt
index dc4ed12750..868f1b3fdd 100644
--- a/src/components/hmi_message_handler/CMakeLists.txt
+++ b/src/components/hmi_message_handler/CMakeLists.txt
@@ -74,7 +74,7 @@ endif()
target_link_libraries("HMIMessageHandler" ${LIBRARIES})
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries("HMIMessageHandler" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
index 67a46aca56..693b72eb50 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
@@ -36,7 +36,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/placeholders.hpp>
-#include <boost/asio/strand.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/make_shared.hpp>
@@ -87,7 +86,6 @@ class CMessageBrokerController;
class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
boost::beast::websocket::stream<boost::asio::ip::tcp::socket> ws_;
- boost::asio::strand<boost::asio::io_context::executor_type> strand_;
boost::beast::multi_buffer buffer_;
boost::beast::multi_buffer send_buffer_;
CMessageBrokerController* controller_;
@@ -189,7 +187,6 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
WebsocketSession& 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_;
diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
index 02a977a273..959696c5af 100644
--- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
+++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
@@ -35,100 +35,103 @@
namespace hmi_message_handler {
- SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
-
- HMIMessageHandlerImpl::HMIMessageHandlerImpl(
- const HMIMessageHandlerSettings &settings)
- : settings_(settings), observer_(NULL), messages_to_hmi_(
- "HMH ToHMI",
- this,
- threads::ThreadOptions(get_settings().thread_min_stack_size())), messages_from_hmi_(
- "HMH FromHMI",
- this,
- threads::ThreadOptions(get_settings().thread_min_stack_size())) {}
-
- HMIMessageHandlerImpl::~HMIMessageHandlerImpl() {
- SDL_LOG_AUTO_TRACE();
- messages_to_hmi_.Shutdown();
- messages_from_hmi_.Shutdown();
- set_message_observer(NULL);
- }
-
- void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) {
- SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock lock(observer_locker_);
- if (!observer_) {
- SDL_LOG_WARN("No HMI message observer set!");
- return;
- }
- messages_from_hmi_.PostMessage(impl::MessageFromHmi(message));
- }
-
- void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) {
- SDL_LOG_INFO("SendMessageToHMI");
- messages_to_hmi_.PostMessage(impl::MessageToHmi(message));
- }
-
- void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver *observer) {
- SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock lock(observer_locker_);
- observer_ = observer;
- }
-
- void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) {
- SDL_LOG_AUTO_TRACE();
- sync_primitives::AutoLock lock(observer_locker_);
- if (!observer_) {
- SDL_LOG_WARN("No HMI message observer set!");
- return;
- }
- observer_->OnErrorSending(message);
- }
-
- void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter *adapter) {
- SDL_LOG_AUTO_TRACE();
- if (!adapter) {
- SDL_LOG_WARN("HMIMessageAdapter is not valid!");
- return;
- }
- sync_primitives::AutoLock lock(message_adapters_locker_);
- message_adapters_.insert(adapter);
- }
-
- void HMIMessageHandlerImpl::RemoveHMIMessageAdapter(
- HMIMessageAdapter *adapter) {
- SDL_LOG_AUTO_TRACE();
- if (!adapter) {
- SDL_LOG_WARN("HMIMessageAdapter is not valid!");
- return;
- }
- sync_primitives::AutoLock lock(message_adapters_locker_);
- message_adapters_.erase(adapter);
- }
-
- const HMIMessageHandlerSettings &HMIMessageHandlerImpl::get_settings() const {
- return settings_;
- }
-
- void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) {
- SDL_LOG_INFO("Received message from hmi");
- sync_primitives::AutoLock lock(observer_locker_);
- if (!observer_) {
- SDL_LOG_ERROR("Observer is not set for HMIMessageHandler");
- return;
- }
-
- observer_->OnMessageReceived(message);
- SDL_LOG_INFO("Message from hmi given away.");
- }
-
- void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) {
- sync_primitives::AutoLock lock(message_adapters_locker_);
- for (std::set<HMIMessageAdapter *>::iterator it = message_adapters_.begin();
- it != message_adapters_.end();
- ++it) {
- (*it)->SendMessageToHMI(message);
- }
- }
+SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
+
+HMIMessageHandlerImpl::HMIMessageHandlerImpl(
+ const HMIMessageHandlerSettings& settings)
+ : settings_(settings)
+ , observer_(NULL)
+ , messages_to_hmi_(
+ "HMH ToHMI",
+ this,
+ threads::ThreadOptions(get_settings().thread_min_stack_size()))
+ , messages_from_hmi_(
+ "HMH FromHMI",
+ this,
+ threads::ThreadOptions(get_settings().thread_min_stack_size())) {}
+
+HMIMessageHandlerImpl::~HMIMessageHandlerImpl() {
+ SDL_LOG_AUTO_TRACE();
+ messages_to_hmi_.Shutdown();
+ messages_from_hmi_.Shutdown();
+ set_message_observer(NULL);
+}
+
+void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(observer_locker_);
+ if (!observer_) {
+ SDL_LOG_WARN("No HMI message observer set!");
+ return;
+ }
+ messages_from_hmi_.PostMessage(impl::MessageFromHmi(message));
+}
+
+void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) {
+ SDL_LOG_INFO("SendMessageToHMI");
+ messages_to_hmi_.PostMessage(impl::MessageToHmi(message));
+}
+
+void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver* observer) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(observer_locker_);
+ observer_ = observer;
+}
+
+void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) {
+ SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock lock(observer_locker_);
+ if (!observer_) {
+ SDL_LOG_WARN("No HMI message observer set!");
+ return;
+ }
+ observer_->OnErrorSending(message);
+}
+
+void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) {
+ SDL_LOG_AUTO_TRACE();
+ if (!adapter) {
+ SDL_LOG_WARN("HMIMessageAdapter is not valid!");
+ return;
+ }
+ sync_primitives::AutoLock lock(message_adapters_locker_);
+ message_adapters_.insert(adapter);
+}
+
+void HMIMessageHandlerImpl::RemoveHMIMessageAdapter(
+ HMIMessageAdapter* adapter) {
+ SDL_LOG_AUTO_TRACE();
+ if (!adapter) {
+ SDL_LOG_WARN("HMIMessageAdapter is not valid!");
+ return;
+ }
+ sync_primitives::AutoLock lock(message_adapters_locker_);
+ message_adapters_.erase(adapter);
+}
+
+const HMIMessageHandlerSettings& HMIMessageHandlerImpl::get_settings() const {
+ return settings_;
+}
+
+void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) {
+ SDL_LOG_INFO("Received message from hmi");
+ sync_primitives::AutoLock lock(observer_locker_);
+ if (!observer_) {
+ SDL_LOG_ERROR("Observer is not set for HMIMessageHandler");
+ return;
+ }
+
+ observer_->OnMessageReceived(message);
+ SDL_LOG_INFO("Message from hmi given away.");
+}
+
+void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) {
+ sync_primitives::AutoLock lock(message_adapters_locker_);
+ for (std::set<HMIMessageAdapter*>::iterator it = message_adapters_.begin();
+ it != message_adapters_.end();
+ ++it) {
+ (*it)->SendMessageToHMI(message);
+ }
+}
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/src/websocket_session.cc b/src/components/hmi_message_handler/src/websocket_session.cc
index a387b639a2..6e1c4b9bc4 100644
--- a/src/components/hmi_message_handler/src/websocket_session.cc
+++ b/src/components/hmi_message_handler/src/websocket_session.cc
@@ -41,7 +41,6 @@ SDL_CREATE_LOG_VARIABLE("HMIMessageHandler")
WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket,
CMessageBrokerController* controller)
: ws_(std::move(socket))
- , strand_(ws_.get_executor())
, controller_(controller)
, stop(false)
, m_receivingBuffer("")
@@ -57,10 +56,8 @@ WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket,
WebsocketSession::~WebsocketSession() {}
void WebsocketSession::Accept() {
- ws_.async_accept(boost::asio::bind_executor(
- strand_,
- std::bind(
- &WebsocketSession::Recv, shared_from_this(), std::placeholders::_1)));
+ ws_.async_accept(std::bind(
+ &WebsocketSession::Recv, shared_from_this(), std::placeholders::_1));
}
void WebsocketSession::Shutdown() {
@@ -90,11 +87,10 @@ void WebsocketSession::Recv(boost::system::error_code ec) {
}
ws_.async_read(buffer_,
- boost::asio::bind_executor(strand_,
- std::bind(&WebsocketSession::Read,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2)));
+ std::bind(&WebsocketSession::Read,
+ shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2));
}
void WebsocketSession::Send(const std::string& message,
diff --git a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
index c9ad49efed..a750bc236b 100644
--- a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
+++ b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
@@ -175,11 +175,11 @@ TEST_F(HMIMessageHandlerImplTest, OnMessageReceived_InvalidObserver_Cancelled) {
TEST_F(HMIMessageHandlerImplTest, SendMessageToHMI_Success) {
hmi_message_handler::MessageSharedPointer message = CreateMessage();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
MockHMIMessageAdapterImpl message_adapter(hmi_handler_);
EXPECT_CALL(message_adapter, SendMessageToHMI(message))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
hmi_handler_->AddHMIMessageAdapter(&message_adapter);
hmi_handler_->SendMessageToHMI(message);
@@ -187,7 +187,7 @@ TEST_F(HMIMessageHandlerImplTest, SendMessageToHMI_Success) {
// Wait for the message to be processed
hmi_handler_->messages_to_hmi()->WaitDumpQueue();
- EXPECT_TRUE(waiter.WaitFor(1, 100));
+ EXPECT_TRUE(waiter->WaitFor(1, 100));
}
TEST(WebsocketSessionTest, SendMessage_UnpreparedConnection_WithoutFall) {
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 67f23956be..5fd9be2a66 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -42,9 +42,14 @@
#include "connection_handler/connection_handler.h"
#include "utils/data_accessor.h"
+#include "interfaces/v4_protocol_v1_2_no_extra.h"
+#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
+
#include "application_manager/application_manager_settings.h"
#include "application_manager/hmi_interfaces.h"
#include "application_manager/plugin_manager/rpc_plugin_manager.h"
+#include "application_manager/request_controller.h"
+#include "application_manager/request_timeout_handler.h"
#include "application_manager/state_controller.h"
#include "policy/policy_types.h"
@@ -84,7 +89,10 @@ class RPCService;
namespace rpc_handler {
class RPCHandler;
}
-
+namespace request_controller {
+class RequestTimeoutHandler;
+class RequestController;
+} // namespace request_controller
class Application;
class AppServiceManager;
class StateControllerImpl;
@@ -111,6 +119,11 @@ struct ApplicationsPolicyAppIdSorter {
}
};
+struct ExpiredButtonRequestData {
+ uint32_t app_id_;
+ hmi_apis::Common_ButtonName::eType button_name_;
+};
+
typedef std::set<ApplicationSharedPtr, ApplicationsSorter> ApplicationSet;
typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
@@ -132,10 +145,6 @@ class ApplicationManager {
public:
virtual ~ApplicationManager() {}
- DEPRECATED
- virtual bool Init(resumption::LastState&,
- media_manager::MediaManager* media_manager) = 0;
-
/**
* Inits application manager
*/
@@ -207,9 +216,6 @@ class ApplicationManager {
virtual ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const = 0;
- DEPRECATED 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;
@@ -345,7 +351,7 @@ class ApplicationManager {
/**
* @brief Checks if Application is subscribed for way points
- * @param Application id
+ * @param app_id Application id
* @return true if Application is subscribed for way points
* otherwise false
*/
@@ -353,7 +359,7 @@ class ApplicationManager {
/**
* @brief Checks if Application is subscribed for way points
- * @param Application reference
+ * @param app Application reference
* @return true if Application is subscribed for way points
* otherwise false
*/
@@ -361,27 +367,45 @@ class ApplicationManager {
/**
* @brief Subscribe Application for way points
- * @param Application id
+ * @param app_id Application id
+ * @param response_from_hmi True if a successful HMI response was received
+ * when subscribing
*/
- virtual void SubscribeAppForWayPoints(uint32_t id) = 0;
+ virtual void SubscribeAppForWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) = 0;
/**
* @brief Subscribe Application for way points
- * @param Application pointer
+ * @param app Application pointer
+ * @param response_from_hmi True if a successful HMI response was received
+ * when subscribing
*/
- virtual void SubscribeAppForWayPoints(ApplicationSharedPtr app) = 0;
+ virtual void SubscribeAppForWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) = 0;
/**
* @brief Unsubscribe Application for way points
- * @param Application id
+ * @param app_id Application id
+ * @param response_from_hmi True if a successful HMI response was received
+ * when unsubscribing
*/
- virtual void UnsubscribeAppFromWayPoints(uint32_t app_id) = 0;
+ virtual void UnsubscribeAppFromWayPoints(uint32_t app_id,
+ bool response_from_hmi = true) = 0;
/**
* @brief Unsubscribe Application for way points
- * @param Application pointer
+ * @param app Application pointer
+ * @param response_from_hmi True if a successful HMI response was received
+ * when unsubscribing
*/
- virtual void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) = 0;
+ virtual void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app,
+ bool response_from_hmi = true) = 0;
+
+ /**
+ * @brief Is SDL Core subscribed to HMI waypoints
+ * @return true if SDL Core is subscribed to HMI waypoints, otherwise false
+ */
+ virtual bool IsSubscribedToHMIWayPoints() const = 0;
/**
* @brief Is Any Application is subscribed for way points
@@ -392,9 +416,12 @@ class ApplicationManager {
/**
* @brief Save message after OnWayPointsChangeNotification reception
* @param way_points_message pointer to the smartobject
+ * @param app_id the app ID of the provider sending the way points update or 0
+ * if the HMI is the provider
*/
virtual void SaveWayPointsMessage(
- smart_objects::SmartObjectSPtr way_points_message) = 0;
+ smart_objects::SmartObjectSPtr way_points_message,
+ uint32_t app_id = 0) = 0;
/**
* @brief Get subscribed for way points
@@ -478,6 +505,10 @@ class ApplicationManager {
virtual rpc_service::RPCService& GetRPCService() const = 0;
virtual rpc_handler::RPCHandler& GetRPCHandler() const = 0;
+ virtual request_controller::RequestTimeoutHandler&
+ get_request_timeout_handler() const = 0;
+ virtual request_controller::RequestController& get_request_controller()
+ const = 0;
virtual bool is_stopping() const = 0;
virtual bool is_audio_pass_thru_active() const = 0;
@@ -486,12 +517,20 @@ class ApplicationManager {
virtual uint32_t GenerateNewHMIAppID() = 0;
/**
- * @brief Ends opened navi services (audio/video) for application
+ * @brief Ends opened navi services audio and video for application
* @param app_id Application id
*/
virtual void EndNaviServices(uint32_t app_id) = 0;
/**
+ * @brief Ends opened navi service audio or video for application
+ * @param app_id Application id
+ * @param service_type Service type to check
+ */
+ virtual void EndService(const uint32_t app_id,
+ const protocol_handler::ServiceType service_type) = 0;
+
+ /**
* @brief returns true if low voltage state is active
*/
virtual bool IsLowVoltage() const = 0;
@@ -599,6 +638,12 @@ class ApplicationManager {
virtual bool IsStopping() const = 0;
+ /**
+ * @brief Waits for HMI readiness and blocks thread if it's not ready yet
+ * @return true if HMI is ready and cooperating, otherwise returns false
+ */
+ virtual bool WaitForHmiIsReady() = 0;
+
virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0;
/**
@@ -672,6 +717,36 @@ class ApplicationManager {
const uint32_t corr_id,
const int32_t function_id) = 0;
+ /**
+ * @brief RetainRequestInstance retains request instance by its
+ * connection+correlation key
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ * @return true if request was rerained. false if the request with such
+ * connection+correlation key was not found
+ */
+ virtual bool RetainRequestInstance(const uint32_t connection_key,
+ const uint32_t correlation_id) = 0;
+
+ /**
+ * @brief RemoveRetainedRequest removes request instance retained before
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ */
+ virtual bool RemoveRetainedRequest(const uint32_t connection_key,
+ const uint32_t correlation_id) = 0;
+
+ /**
+ * @brief IsStillWaitingForResponse check if request is still waiting for
+ * response
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ * @return true if request is still waiting for response, otherwise returns
+ * false
+ */
+ virtual bool IsStillWaitingForResponse(
+ const uint32_t connection_key, const uint32_t correlation_id) const = 0;
+
/*
* @brief Closes application by id
*
@@ -694,7 +769,7 @@ class ApplicationManager {
* @param mobile_correlation_id Correlation ID of the mobile request
* @param new_timeout_value New timeout in milliseconds to be set
*/
- virtual void updateRequestTimeout(uint32_t connection_key,
+ virtual void UpdateRequestTimeout(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) = 0;
@@ -775,6 +850,9 @@ class ApplicationManager {
*/
virtual HmiInterfaces& hmi_interfaces() = 0;
+ virtual ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra&
+ mobile_v4_protocol_so_factory() = 0;
+
virtual app_launch::AppLaunchCtrl& app_launch_ctrl() = 0;
virtual protocol_handler::MajorProtocolVersion SupportedSDLVersion()
@@ -828,11 +906,11 @@ class ApplicationManager {
* @brief Callback calls when application starts/stops data streaming
* @param app_id Streaming application id
* @param service_type Streaming service type
- * @param new_state Defines new streaming state
+ * @param state True if streaming started, false if streaming stopped.
*/
virtual void OnAppStreaming(uint32_t app_id,
protocol_handler::ServiceType service_type,
- const Application::StreamingState new_state) = 0;
+ bool state) = 0;
/**
* @brief CreateRegularState create regular HMI state for application
@@ -861,9 +939,6 @@ class ApplicationManager {
virtual bool CanAppStream(
uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
- DEPRECATED
- virtual void ForbidStreaming(uint32_t app_id) = 0;
-
/**
* @brief ForbidStreaming forbid the stream over the certain application.
* @param app_id the application's id which should stop streaming.
@@ -907,6 +982,43 @@ class ApplicationManager {
virtual bool IsSOStructValid(
const hmi_apis::StructIdentifiers::eType struct_id,
const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /**
+ * @brief Unsubscribe application specified in message from softbuttons.
+ * @param response_message - Response message received from HMI.
+ * @return bool - Result of unsubscribing process.
+ */
+ virtual bool UnsubscribeAppFromSoftButtons(
+ const commands::MessageSharedPtr response_message) = 0;
+
+ /**
+ * @brief Save subscribe/unsubscribe button request after timeout to ensure
+ * possibility to align mobile subscription/unsubscription status with actual
+ * subscription/unsubscription status on HMI
+ * @param app_id Application id from request message
+ * @param corr_id Correlation id
+ * @param button_name name of button to subscribe/unsubscribe
+ */
+ virtual void AddExpiredButtonRequest(
+ const uint32_t app_id,
+ const int32_t corr_id,
+ const hmi_apis::Common_ButtonName::eType button_name) = 0;
+
+ /**
+ * @brief Return optional structure with information regarding
+ * subscribe/unsubscribe button request data
+ * @param corr_id Correlation id
+ * @return optional structure with subscribe/unsubscribe button request data
+ */
+ virtual utils::Optional<ExpiredButtonRequestData> GetExpiredButtonRequestData(
+ const int32_t corr_id) const = 0;
+
+ /**
+ * @brief Delete data about already processed expired subscribe/unsubscribe
+ * button request in case if HMI send response to expired request
+ * @param corr_id Correlation id
+ */
+ virtual void DeleteExpiredButtonRequest(const int32_t corr_id) = 0;
};
} // namespace application_manager
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 02cd79aa8e..c7ab634ad0 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -63,6 +63,7 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual uint16_t tts_global_properties_timeout() const = 0;
virtual uint16_t max_supported_protocol_version() const = 0;
virtual const uint32_t& default_timeout() const = 0;
+ virtual const uint32_t& default_timeout_compensation() const = 0;
virtual const uint32_t& max_cmd_id() const = 0;
virtual bool launch_hmi() const = 0;
virtual const uint32_t& delete_file_in_none() const = 0;
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index 56ac807d63..93cb09737d 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -97,11 +97,26 @@ class HMICapabilities {
/**
* @brief Returns software version of the target
- * @return TRUE if it supported, otherwise FALSE
+ * @return string representation of software version if supported, otherwise
+ * empty string
*/
virtual const std::string& ccpu_version() const = 0;
/**
+ * @brief Interface used to store information about hardware version of the
+ * target
+ * @param hardware_version Received system/hmi hardware version
+ */
+ virtual void set_hardware_version(const std::string& hardware_version) = 0;
+
+ /**
+ * @brief Returns hardware version of the target
+ * @return string representation of hardware version if supported, otherwise
+ * empty string
+ */
+ virtual const std::string& hardware_version() const = 0;
+
+ /**
* @brief Retrieves if mixing audio is supported by HMI
* (ie recording TTS command and playing audio)
* @return Current state of the mixing audio flag
@@ -259,7 +274,7 @@ class HMICapabilities {
/**
* @brief Sets supported Button's capabilities
- * @param soft_button_capabilities supported Button's capabilities
+ * @param button_capabilities supported Button's capabilities
*/
virtual void set_button_capabilities(
const smart_objects::SmartObject& button_capabilities) = 0;
@@ -504,9 +519,6 @@ class HMICapabilities {
virtual const smart_objects::SmartObjectSPtr seat_location_capability()
const = 0;
- DEPRECATED
- virtual void Init(resumption::LastState* last_state) = 0;
-
virtual void Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0;
/**
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index d8aef7cc1a..d79c059b34 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -77,9 +77,7 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
virtual bool InitPolicyTable() = 0;
virtual bool ResetPolicyTable() = 0;
virtual bool ClearUserConsent() = 0;
- // Deprecated in favor of private variant
- DEPRECATED virtual bool SendMessageToSDK(const BinaryMessage& pt_string,
- const std::string& url) = 0;
+
virtual bool ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) = 0;
virtual bool UnloadPolicyLibrary() = 0;
@@ -332,12 +330,26 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
const std::string& language) = 0;
/**
+ * @brief Save hardware version from GetSystemInfo request to policy table, if
+ * present
+ * @param hardware_version Hardware version
+ */
+ virtual void OnHardwareVersionReceived(
+ const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() = 0;
diff --git a/src/components/include/application_manager/request_controller.h b/src/components/include/application_manager/request_controller.h
new file mode 100644
index 0000000000..e892762312
--- /dev/null
+++ b/src/components/include/application_manager/request_controller.h
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2020, 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_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
+
+#include "application_manager/commands/command.h"
+
+#include <memory>
+
+namespace application_manager {
+namespace request_controller {
+
+typedef std::shared_ptr<commands::Command> RequestPtr;
+/**
+ * @brief RequestController class is used to control currently active mobile
+ * requests.
+ */
+class RequestController {
+ public:
+ /**
+ * @brief Result code for addRequest
+ */
+ enum class TResult {
+ SUCCESS = 0,
+ TOO_MANY_REQUESTS,
+ TOO_MANY_PENDING_REQUESTS,
+ NONE_HMI_LEVEL_MANY_REQUESTS,
+ INVALID_DATA
+ };
+
+ /**
+ * @brief Thread pool state
+ */
+ enum class TPoolState {
+ UNDEFINED = 0,
+ STARTED,
+ STOPPED,
+ };
+
+ /**
+ * @brief Class destructor
+ */
+ virtual ~RequestController() {}
+
+ /**
+ * @brief Stop request controller internal activities
+ */
+ virtual void Stop() = 0;
+
+ /**
+ * @brief Initialize thread pool
+ */
+ virtual void InitializeThreadpool() = 0;
+
+ /**
+ * @brief Destroy thread pool
+ */
+ virtual void DestroyThreadpool() = 0;
+
+ /**
+ * @brief Check if max request amount wasn't exceed and adds request to queue.
+ * @param request Active request to mobile
+ * @param hmi_level Current application hmi_level
+ * @return Result code
+ */
+ virtual TResult AddMobileRequest(
+ const RequestPtr request,
+ const mobile_apis::HMILevel::eType& hmi_level) = 0;
+
+ /**
+ * @brief Store HMI request until response or timeout won't remove it
+ * @param request Active request to hmi
+ * @return Result code
+ */
+ virtual TResult AddHMIRequest(const RequestPtr request) = 0;
+
+ /**
+ * @brief Add notification to collection
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
+ virtual void AddNotification(const RequestPtr ptr) = 0;
+
+ /**
+ * @brief RetainRequestInstance retains request instance by its
+ * connection+correlation key
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ * @return true if request was rerained. false if the request with such
+ * connection+correlation key was not found
+ */
+ virtual bool RetainRequestInstance(const uint32_t connection_key,
+ const uint32_t correlation_id) = 0;
+
+ /**
+ * @brief RemoveRetainedRequest removes request instance retained before
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ */
+ virtual bool RemoveRetainedRequest(const uint32_t connection_key,
+ const uint32_t correlation_id) = 0;
+
+ /**
+ * @brief IsStillWaitingForResponse check if request is still waiting for
+ * response
+ * @param connection_key connection key of application
+ * @param correlation_id correlation id of request
+ * @return true if request is still waiting for response, otherwise returns
+ * false
+ */
+ virtual bool IsStillWaitingForResponse(
+ const uint32_t connection_key, const uint32_t correlation_id) const = 0;
+
+ /**
+ * @brief Removes request from queue
+ * @param correlation_id Active request correlation ID,
+ * @param connection_key Active request connection key (0 for HMI requests)
+ * @param function_id Active request function id
+ * @param force_terminate if true, request controller will terminate
+ * even if not allowed by request
+ */
+ virtual void TerminateRequest(const uint32_t correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id,
+ const bool force_terminate = false) = 0;
+
+ /**
+ * @brief Removes request from queue
+ * @param mobile_correlation_id Active mobile request correlation ID
+ * @param connection_key Active request connection key (0 for HMI requests)
+ * @param function_id Active request function ID
+ */
+ virtual void OnMobileResponse(const uint32_t mobile_correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id) = 0;
+
+ /**
+ * @brief Removes request from queue
+ * @param mobile_correlation_id Active mobile request correlation ID
+ * @param function_id Active request function ID
+ */
+ virtual void OnHMIResponse(const uint32_t correlation_id,
+ const int32_t function_id) = 0;
+
+ /**
+ * @ Add notification to collection
+ * @param notification Pointer that points to hmi notification
+ */
+ virtual void RemoveNotification(const commands::Command* notification) = 0;
+
+ /**
+ * @brief Removes all requests from queue for specified application
+ * @param app_id Mobile application ID (app_id)
+ */
+ virtual void TerminateAppRequests(const uint32_t app_id) = 0;
+
+ /**
+ * @brief Terminates all requests from HMI
+ */
+ virtual void TerminateAllHMIRequests() = 0;
+
+ /**
+ * @brief Terminates all requests from Mobile
+ */
+ virtual void TerminateAllMobileRequests() = 0;
+
+ /**
+ * @brief Updates request timeout
+ * @param app_id Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ * @param new_timeout_value New timeout to be set in milliseconds
+ */
+ virtual void UpdateRequestTimeout(const uint32_t app_id,
+ const uint32_t mobile_correlation_id,
+ const uint32_t new_timeout) = 0;
+ /**
+ * @brief Function Should be called when Low Voltage is occured
+ */
+ virtual void OnLowVoltage() = 0;
+
+ /**
+ * @brief Function Should be called when WakeUp occures after Low Voltage
+ */
+ virtual void OnWakeUp() = 0;
+
+ /**
+ * @return true if low voltage state is active
+ */
+ virtual bool IsLowVoltage() = 0;
+};
+
+} // namespace request_controller
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
diff --git a/src/components/include/application_manager/request_timeout_handler.h b/src/components/include/application_manager/request_timeout_handler.h
new file mode 100644
index 0000000000..ef646d8a94
--- /dev/null
+++ b/src/components/include/application_manager/request_timeout_handler.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2020, 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_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_
+
+#include <cstdint>
+
+namespace application_manager {
+namespace request_controller {
+
+/*
+ * @brief Structure for active mobile request
+ * that is waiting for a response from the HMI.
+ * Used for OnResetTimeout logic.
+ */
+struct Request {
+ Request(const uint32_t mob_correlation_id,
+ const uint32_t connection_key,
+ const uint32_t hmi_function_id)
+ : mob_correlation_id_(mob_correlation_id)
+ , connection_key_(connection_key)
+ , hmi_function_id_(hmi_function_id) {}
+
+ uint32_t mob_correlation_id_;
+ uint32_t connection_key_;
+ uint32_t hmi_function_id_;
+};
+
+/**
+ * @brief The RequestTimeoutHandler class
+ * handles OnResetTimeout notification from HMI,
+ * reset timeout for mobile request
+ */
+class RequestTimeoutHandler {
+ public:
+ /**
+ * @brief AddRequest adds request that waits for response
+ * @param hmi_correlation_id hmi correlation id
+ * @param request active mobile request
+ */
+ virtual void AddRequest(const uint32_t hmi_correlation_id,
+ const Request& request) = 0;
+ /**
+ * @brief RemoveRequest removes processed request
+ * @param hmi_correlation_id hmi correlation id
+ */
+ virtual void RemoveRequest(const uint32_t hmi_correlation_id) = 0;
+
+ virtual ~RequestTimeoutHandler() {}
+};
+
+} // namespace request_controller
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index c5995fbbb8..7cb1448a37 100644
--- a/src/components/include/connection_handler/connection_handler.h
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -58,6 +58,18 @@ enum CloseSessionReason {
class ConnectionHandlerObserver;
+/**
+ * @brief Helper structure to collect all required vehicle data
+ */
+struct ProtocolVehicleData {
+ std::string vehicle_make;
+ std::string vehicle_model;
+ std::string vehicle_year;
+ std::string vehicle_trim;
+ std::string vehicle_system_software_version;
+ std::string vehicle_system_hardware_version;
+};
+
// The SessionConnectionMap keeps track of the primary and secondary transports
// associated with a session ID
typedef struct {
@@ -173,6 +185,15 @@ class ConnectionHandler {
virtual void SendEndService(uint32_t key, uint8_t service_type) = 0;
/**
+ * @brief Check is heartbeat monitoring started for specified connection key
+ * @param connection_key pair of connection and session id
+ * @return returns true if heartbeat monitoring started for specified
+ * connection key otherwise returns false
+ */
+ virtual bool IsSessionHeartbeatTracked(
+ const uint32_t connection_key) const = 0;
+
+ /**
* \brief Start heartbeat for specified session
*
* \param connection_key pair of connection and session id
@@ -336,6 +357,14 @@ class ConnectionHandler {
const = 0;
/**
+ * @brief Collects all vehicle data required by a protocol layer
+ * @param data output structure to store received vehicle data
+ * @return true if data has been received successfully, otherwise returns
+ * false
+ */
+ virtual bool GetProtocolVehicleData(ProtocolVehicleData& data) = 0;
+
+ /**
* @brief Called when HMI cooperation is started,
* creates WebSocketDevice for WebEngine
*/
diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h
index 7d6664a009..cfbbefefd4 100644
--- a/src/components/include/connection_handler/connection_handler_observer.h
+++ b/src/components/include/connection_handler/connection_handler_observer.h
@@ -177,6 +177,14 @@ class ConnectionHandlerObserver {
*/
virtual void OnWebEngineDeviceCreated() = 0;
+ /**
+ * @brief Collects all vehicle data required by a protocol layer
+ * @param data output structure to store received vehicle data
+ * @return true if data has been received successfully, otherwise returns
+ * false
+ */
+ virtual bool GetProtocolVehicleData(ProtocolVehicleData& data) = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h
index 0729adc7d8..60c93843d1 100644
--- a/src/components/include/media_manager/media_manager.h
+++ b/src/components/include/media_manager/media_manager.h
@@ -42,13 +42,6 @@ namespace media_manager {
class MediaManager {
public:
- virtual void PlayA2DPSource(int32_t application_key) = 0;
- virtual void StopA2DPSource(int32_t application_key) = 0;
-
- DEPRECATED virtual void StartMicrophoneRecording(
- int32_t application_key,
- const std::string& outputFileName,
- int32_t duration) = 0;
virtual void StartMicrophoneRecording(
int32_t application_key,
const std::string& outputFileName,
@@ -70,6 +63,14 @@ class MediaManager {
*/
virtual const MediaManagerSettings& settings() const = 0;
+ /**
+ * \brief Convert an amount of audio bytes to an estimated time in ms
+ * \param data_size number of bytes to be played
+ * \return milliseconds required to play <data_size> many bytes with
+ * the current pcm stream capabilities
+ */
+ virtual uint32_t DataSizeToMilliseconds(uint64_t data_size) const = 0;
+
virtual ~MediaManager() {}
};
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 9d4ad5ea57..5d57d5ca45 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -433,12 +433,25 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Set hardware version from GetSystemInfo response to policy table, if
+ * present
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Send OnPermissionsUpdated for choosen application
* @param device_id device identifier
* @param application_id Unique application id
@@ -740,15 +753,6 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual const PolicySettings& get_settings() const = 0;
/**
- * @deprecated Unused in EXTERNAL_PROPRIETARY policies
- * @brief Finds the next URL that must be sent on OnSystemRequest retry
- * @param urls vector of vectors that contain urls for each application
- * @return Pair of policy application id and application url id from the
- * urls vector
- */
- DEPRECATED virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
-
- /**
* @brief Assigns new HMI types for specified application
* @param device_handle device identifier
* @param application_id Unique application id
@@ -858,6 +862,11 @@ class PolicyManager : public usage_statistics::StatisticsManager,
*/
virtual void ResetTimeout() = 0;
+ /**
+ * @brief Trigger a PTU once on startup if it is required
+ */
+ virtual void TriggerPTUOnStartupIfRequired() = 0;
+
protected:
/**
* @brief Checks is PT exceeded IgnitionCycles
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 c90006928a..b4043067ab 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -424,12 +424,25 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Set hardware version from GetSystemInfo response to policy table, if
+ * present
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Send OnPermissionsUpdated for choosen application
* @param device_id device identifier
* @param application_id Unique application id
diff --git a/src/components/include/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h
index f81de4cc81..830c33b3eb 100644
--- a/src/components/include/protocol/bson_object_keys.h
+++ b/src/components/include/protocol/bson_object_keys.h
@@ -49,6 +49,12 @@ extern const char* tcp_ip_address;
extern const char* tcp_port;
extern const char* reason;
extern const char* auth_token;
+extern const char* vehicle_make;
+extern const char* vehicle_model;
+extern const char* vehicle_model_year;
+extern const char* vehicle_trim;
+extern const char* vehicle_system_software_version;
+extern const char* vehicle_system_hardware_version;
} // namespace strings
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index c7ee670972..2cea958bae 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -138,7 +138,7 @@ class ProtocolHandler {
* generated_session_id is 0.
*/
virtual void NotifySessionStarted(
- const SessionContext& context,
+ SessionContext& context,
std::vector<std::string>& rejected_params,
const std::string err_reason = std::string()) = 0;
@@ -146,7 +146,7 @@ class ProtocolHandler {
virtual void ProcessFailedPTU() = 0;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify security manager that
* certificate decryption failed in the external flow
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index 593ce8408c..ca12f4b6ad 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -69,6 +69,7 @@ struct SessionContext {
uint32_t hash_id_;
bool is_protected_;
bool is_new_service_;
+ bool is_start_session_failed_;
/**
* @brief Constructor
@@ -81,7 +82,8 @@ struct SessionContext {
, service_type_(protocol_handler::kInvalidServiceType)
, hash_id_(0)
, is_protected_(false)
- , is_new_service_(false) {}
+ , is_new_service_(false)
+ , is_start_session_failed_(false) {}
/**
* @brief Constructor
@@ -111,7 +113,8 @@ struct SessionContext {
, service_type_(service_type)
, hash_id_(hash_id)
, is_protected_(is_protected)
- , is_new_service_(false) {}
+ , is_new_service_(false)
+ , is_start_session_failed_(false) {}
};
/**
diff --git a/src/components/include/resumption/last_state.h b/src/components/include/resumption/last_state.h
index b28e5611b7..1f54959ffc 100644
--- a/src/components/include/resumption/last_state.h
+++ b/src/components/include/resumption/last_state.h
@@ -46,12 +46,6 @@ class LastState {
virtual ~LastState() {}
/**
- * @brief Saves dictionary to filesystem
- */
- DEPRECATED
- virtual void SaveStateToFileSystem() = 0;
-
- /**
* @brief SaveToFileSystem
* Saving dictionary to filesystem
*/
@@ -65,12 +59,6 @@ class LastState {
/**
* @brief dictionary Gets internal dictionary
- * @return Reference to internal dictionary json value
- */
- virtual Json::Value& get_dictionary() = 0;
-
- /**
- * @brief dictionary Gets internal dictionary
* @return Copy of internal dictionary json value
*/
virtual Json::Value dictionary() const = 0;
diff --git a/src/components/include/security_manager/crypto_manager.h b/src/components/include/security_manager/crypto_manager.h
index d64d26bb25..6254055aef 100644
--- a/src/components/include/security_manager/crypto_manager.h
+++ b/src/components/include/security_manager/crypto_manager.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
+#include <utils/time64.h>
#include "application_manager/policies/policy_handler_observer.h"
#include "security_manager/security_manager_settings.h"
-#include <utils/time64.h>
/**
* \class security_manager::CryptoManager
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 358c4e5268..b231005010 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -69,6 +69,9 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
ERROR_DECRYPTION_FAILED = 0x06,
ERROR_ENCRYPTION_FAILED = 0x07,
ERROR_SSL_INVALID_DATA = 0x08,
+ ERROR_HANDSHAKE_FAILED = 0x09, // Handshake failed
+ ERROR_INVALID_CERT = 0x0A, // Handshake failed because cert is invalid
+ ERROR_EXPIRED_CERT = 0x0B, // Handshake failed because cert is expired
ERROR_INTERNAL = 0xFF,
ERROR_UNKNOWN_INTERNAL_ERROR = 0xFE // error value for testing
};
@@ -99,24 +102,24 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
* \param connection_key Unique key used by other components as session
* identifier
* \param error_id unique error identifier
- * \param erorr_text SSL impelmentation error text
+ * \param error_text SSL impelmentation error text
* \param seq_number received from Mobile Application
*/
virtual void SendInternalError(const uint32_t connection_key,
const uint8_t& error_id,
- const std::string& erorr_text,
+ const std::string& error_text,
const uint32_t seq_number) = 0;
/**
* \brief Sends InternalError override methode for sending without seq_number
* \param connection_key Unique key used by other components as session
* identifier
* \param error_id unique error identifier
- * \param erorr_text SSL impelmentation error text
+ * \param error_text SSL impelmentation error text
*/
void SendInternalError(const uint32_t connection_key,
const uint8_t& error_id,
- const std::string& erorr_text) {
- SendInternalError(connection_key, error_id, erorr_text, 0);
+ const std::string& error_text) {
+ SendInternalError(connection_key, error_id, error_text, 0);
}
/**
@@ -170,7 +173,7 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
virtual void ProcessFailedPTU() = 0;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify listeners that
* certificate decryption failed in the external flow
diff --git a/src/components/include/security_manager/security_manager_settings.h b/src/components/include/security_manager/security_manager_settings.h
index 0bbe0f4f96..4e601c3e0e 100644
--- a/src/components/include/security_manager/security_manager_settings.h
+++ b/src/components/include/security_manager/security_manager_settings.h
@@ -60,6 +60,7 @@ class CryptoManagerSettings {
virtual size_t maximum_payload_size() const = 0;
virtual const std::vector<int>& force_protected_service() const = 0;
virtual const std::vector<int>& force_unprotected_service() const = 0;
+ virtual uint32_t security_level() const = 0;
};
} // namespace security_manager
diff --git a/src/components/include/security_manager/ssl_context.h b/src/components/include/security_manager/ssl_context.h
index 7743146e6b..84875e3e46 100644
--- a/src/components/include/security_manager/ssl_context.h
+++ b/src/components/include/security_manager/ssl_context.h
@@ -74,7 +74,6 @@ class SSLContext {
Handshake_Result_NotYetValid,
Handshake_Result_CertNotSigned,
Handshake_Result_AppIDMismatch,
- Handshake_Result_AppNameMismatch,
};
struct HandshakeContext {
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 ee5d7f315a..ef0f20ac65 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -68,10 +68,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD2(Init,
bool(resumption::LastStateWrapperPtr last_state,
media_manager::MediaManager* media_manager));
- DEPRECATED
- MOCK_METHOD2(Init,
- bool(resumption::LastState& last_state,
- media_manager::MediaManager* media_manager));
MOCK_METHOD0(Stop, bool());
MOCK_METHOD1(set_hmi_message_handler,
void(hmi_message_handler::HMIMessageHandler* handler));
@@ -117,9 +113,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
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));
@@ -184,6 +177,8 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(application_manager::ApplicationSharedPtr app));
MOCK_METHOD1(OnApplicationSwitched,
void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD0(mobile_v4_protocol_so_factory,
+ ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra&());
MOCK_CONST_METHOD0(connection_handler,
connection_handler::ConnectionHandler&());
MOCK_CONST_METHOD0(protocol_handler, protocol_handler::ProtocolHandler&());
@@ -193,12 +188,21 @@ class MockApplicationManager : public application_manager::ApplicationManager {
application_manager::rpc_service::RPCService&());
MOCK_CONST_METHOD0(GetRPCHandler,
application_manager::rpc_handler::RPCHandler&());
+ MOCK_CONST_METHOD0(
+ get_request_timeout_handler,
+ application_manager::request_controller::RequestTimeoutHandler&());
+ MOCK_CONST_METHOD0(
+ get_request_controller,
+ application_manager::request_controller::RequestController&());
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_METHOD2(EndService,
+ void(const uint32_t app_id,
+ const protocol_handler::ServiceType service_type));
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));
@@ -230,6 +234,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD1(IsAppsQueriedFrom,
bool(const connection_handler::DeviceHandle handle));
MOCK_CONST_METHOD0(IsStopping, bool());
+ MOCK_METHOD0(WaitForHmiIsReady, bool());
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
void(const uint32_t app_id));
MOCK_METHOD2(ResetGlobalProperties,
@@ -266,7 +271,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(const connection_handler::DeviceHandle));
MOCK_METHOD4(UnregisterApplication,
void(const uint32_t&, mobile_apis::Result::eType, bool, bool));
- MOCK_METHOD3(updateRequestTimeout,
+ MOCK_METHOD3(UpdateRequestTimeout,
void(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value));
@@ -312,11 +317,10 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(OnAppUnauthorized, void(const uint32_t& app_id));
MOCK_METHOD1(ActivateApplication,
bool(application_manager::ApplicationSharedPtr app));
- MOCK_METHOD3(
- OnAppStreaming,
- void(uint32_t app_id,
- protocol_handler::ServiceType service_type,
- application_manager::Application::StreamingState new_state));
+ MOCK_METHOD3(OnAppStreaming,
+ void(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state));
MOCK_CONST_METHOD6(CreateRegularState,
application_manager::HmiStatePtr(
application_manager::ApplicationSharedPtr app,
@@ -331,8 +335,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD2(CanAppStream,
bool(uint32_t app_id,
protocol_handler::ServiceType service_type));
- DEPRECATED
- MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id));
MOCK_METHOD2(ForbidStreaming,
void(uint32_t app_id,
protocol_handler::ServiceType service_type));
@@ -348,19 +350,23 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD2(IsSOStructValid,
bool(const hmi_apis::StructIdentifiers::eType struct_id,
const smart_objects::SmartObject& display_capabilities));
+ MOCK_METHOD1(UnsubscribeAppFromSoftButtons,
+ bool(const application_manager::commands::MessageSharedPtr
+ response_message));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints, bool(uint32_t));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
bool(application_manager::Application& app));
- MOCK_METHOD1(SubscribeAppForWayPoints, void(uint32_t));
- MOCK_METHOD1(SubscribeAppForWayPoints,
- void(application_manager::ApplicationSharedPtr));
- MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(uint32_t));
- MOCK_METHOD1(UnsubscribeAppFromWayPoints,
- void(application_manager::ApplicationSharedPtr));
+ MOCK_METHOD2(SubscribeAppForWayPoints, void(uint32_t, bool));
+ MOCK_METHOD2(SubscribeAppForWayPoints,
+ void(application_manager::ApplicationSharedPtr, bool));
+ MOCK_METHOD2(UnsubscribeAppFromWayPoints, void(uint32_t, bool));
+ MOCK_METHOD2(UnsubscribeAppFromWayPoints,
+ void(application_manager::ApplicationSharedPtr, bool));
+ MOCK_CONST_METHOD0(IsSubscribedToHMIWayPoints, bool());
MOCK_CONST_METHOD0(IsAnyAppSubscribedForWayPoints, bool());
MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<uint32_t>());
- MOCK_METHOD1(SaveWayPointsMessage,
- void(std::shared_ptr<smart_objects::SmartObject>));
+ MOCK_METHOD2(SaveWayPointsMessage,
+ void(std::shared_ptr<smart_objects::SmartObject>, uint32_t));
MOCK_CONST_METHOD1(
WaitingApplicationByID,
application_manager::ApplicationConstSharedPtr(const uint32_t));
@@ -393,6 +399,24 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(GetCommandFactory, application_manager::CommandFactory&());
MOCK_CONST_METHOD0(get_current_audio_source, uint32_t());
MOCK_METHOD1(set_current_audio_source, void(const uint32_t));
+ MOCK_METHOD2(RetainRequestInstance,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_METHOD2(RemoveRetainedRequest,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_CONST_METHOD2(IsStillWaitingForResponse,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_METHOD3(AddExpiredButtonRequest,
+ void(const uint32_t app_id,
+ const int32_t corr_id,
+ const hmi_apis::Common_ButtonName::eType button_name));
+ MOCK_CONST_METHOD1(
+ GetExpiredButtonRequestData,
+ utils::Optional<application_manager::ExpiredButtonRequestData>(
+ const int32_t corr_id));
+ MOCK_METHOD1(DeleteExpiredButtonRequest, void(const int32_t corr_id));
};
} // namespace application_manager_test
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 9a70a374a7..b30fc09830 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
@@ -70,6 +70,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(tts_global_properties_timeout, uint16_t());
MOCK_CONST_METHOD0(max_supported_protocol_version, uint16_t());
MOCK_CONST_METHOD0(default_timeout, const uint32_t&());
+ MOCK_CONST_METHOD0(default_timeout_compensation, const uint32_t&());
MOCK_CONST_METHOD0(max_cmd_id, const uint32_t&());
MOCK_CONST_METHOD0(launch_hmi, bool());
MOCK_CONST_METHOD0(delete_file_in_none, const uint32_t&());
diff --git a/src/components/include/test/application_manager/mock_request_controller.h b/src/components/include/test/application_manager/mock_request_controller.h
new file mode 100644
index 0000000000..a4a7cbc1e2
--- /dev/null
+++ b/src/components/include/test/application_manager/mock_request_controller.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2020, 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_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_
+
+#include "application_manager/request_controller.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockRequestController
+ : public application_manager::request_controller::RequestController {
+ public:
+ MOCK_METHOD0(Stop, void());
+ MOCK_METHOD0(InitializeThreadpool, void());
+ MOCK_METHOD0(DestroyThreadpool, void());
+ MOCK_METHOD2(
+ AddMobileRequest,
+ TResult(const application_manager::request_controller::RequestPtr request,
+ const mobile_apis::HMILevel::eType& hmi_level));
+ MOCK_METHOD1(AddHMIRequest,
+ TResult(const application_manager::request_controller::RequestPtr
+ request));
+ MOCK_METHOD1(
+ AddNotification,
+ void(const application_manager::request_controller::RequestPtr request));
+ MOCK_METHOD2(RetainRequestInstance,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_METHOD2(RemoveRetainedRequest,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_CONST_METHOD2(IsStillWaitingForResponse,
+ bool(const uint32_t connection_key,
+ const uint32_t correlation_id));
+ MOCK_METHOD4(TerminateRequest,
+ void(const uint32_t correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id,
+ bool force_terminate));
+ MOCK_METHOD3(OnMobileResponse,
+ void(const uint32_t mobile_correlation_id,
+ const uint32_t connection_key,
+ const int32_t function_id));
+ MOCK_METHOD2(OnHMIResponse,
+ void(const uint32_t correlation_id, const int32_t function_id));
+ MOCK_METHOD1(
+ RemoveNotification,
+ void(const application_manager::commands::Command* notification));
+ MOCK_METHOD1(TerminateAppRequests, void(const uint32_t app_id));
+ MOCK_METHOD0(TerminateAllHMIRequests, void());
+ MOCK_METHOD0(TerminateAllMobileRequests, void());
+ MOCK_METHOD3(UpdateRequestTimeout,
+ void(const uint32_t app_id,
+ const uint32_t mobile_correlation_id,
+ const uint32_t new_timeout));
+ MOCK_METHOD0(OnLowVoltage, void());
+ MOCK_METHOD0(OnWakeUp, void());
+ MOCK_METHOD0(IsLowVoltage, bool());
+};
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_
diff --git a/src/components/include/test/protocol_handler/mock_telemetry_observer.h b/src/components/include/test/application_manager/mock_request_timeout_handler.h
index 82c42775fa..b1492a9812 100644
--- a/src/components/include/test/protocol_handler/mock_telemetry_observer.h
+++ b/src/components/include/test/application_manager/mock_request_timeout_handler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2018, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,26 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
-#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_
+#include "application_manager/request_timeout_handler.h"
#include "gmock/gmock.h"
-#include "protocol_handler/telemetry_observer.h"
-
namespace test {
namespace components {
-namespace protocol_handler_test {
+namespace application_manager_test {
-class MockPHTelemetryObserver : public PHTelemetryObserver {
+class MockRequestTimeoutHandler
+ : public application_manager::request_controller::RequestTimeoutHandler {
public:
- MOCK_METHOD2(StartMessageProcess,
- void(uint32_t message_id,
- const date_time::TimeDuration& start_time));
- MOCK_METHOD1(EndMessageProcess, void(std::shared_ptr<MessageMetric> m));
+ MOCK_METHOD2(
+ AddRequest,
+ void(const uint32_t hmi_correlation_id,
+ const application_manager::request_controller::Request& request));
+ MOCK_METHOD1(RemoveRequest, void(const uint32_t hmi_correlation_id));
};
-} // namespace protocol_handler_test
-} // namespace components
-} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_
diff --git a/src/components/include/test/application_manager/mock_rpc_plugin.h b/src/components/include/test/application_manager/mock_rpc_plugin.h
index 2633825428..2dba5367c6 100644
--- a/src/components/include/test/application_manager/mock_rpc_plugin.h
+++ b/src/components/include/test/application_manager/mock_rpc_plugin.h
@@ -16,13 +16,6 @@ class MockRPCPlugin : public RPCPlugin {
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler,
resumption::LastStateWrapperPtr last_state));
- DEPRECATED
- MOCK_METHOD5(Init,
- bool(ApplicationManager& app_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- resumption::LastState& last_state));
MOCK_METHOD2(IsAbleToProcess,
bool(const int32_t function_id,
const commands::Command::CommandSource message_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 7b6da68c51..ca5d25ed4c 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
@@ -53,9 +53,6 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD0(InitPolicyTable, bool());
MOCK_METHOD0(ResetPolicyTable, bool());
MOCK_METHOD0(ClearUserConsent, bool());
- MOCK_METHOD2(SendMessageToSDK,
- bool(const policy::BinaryMessage& pt_string,
- const std::string& url));
MOCK_METHOD2(ReceiveMessageFromSDK,
bool(const std::string& file,
const policy::BinaryMessage& pt_string));
@@ -186,7 +183,10 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(OnHardwareVersionReceived,
+ void(const std::string& hardware_version));
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
MOCK_METHOD0(OnVIIsReady, void());
MOCK_METHOD1(OnVehicleDataUpdated,
void(const smart_objects::SmartObject& message));
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 bf266751d4..bdfcf55e34 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -87,6 +87,8 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
uint8_t session_id,
CloseSessionReason close_reason));
MOCK_METHOD2(SendEndService, void(uint32_t key, uint8_t service_type));
+ MOCK_CONST_METHOD1(IsSessionHeartbeatTracked,
+ bool(const uint32_t connection_key));
MOCK_METHOD1(StartSessionHeartBeat, void(uint32_t connection_key));
MOCK_METHOD2(SendHeartBeat,
void(ConnectionHandle connection_handle, uint8_t session_id));
@@ -137,6 +139,8 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
OnSecondaryTransportEnded,
void(const transport_manager::ConnectionUID primary_connection_handle,
const transport_manager::ConnectionUID secondary_connection_handle));
+ MOCK_METHOD1(GetProtocolVehicleData,
+ bool(connection_handler::ProtocolVehicleData& data));
MOCK_METHOD0(CreateWebEngineDevice, void());
MOCK_CONST_METHOD0(GetWebEngineDeviceInfo, transport_manager::DeviceInfo&());
};
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 61877daa23..90174017c3 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
@@ -83,6 +83,8 @@ class MockConnectionHandlerObserver
MOCK_METHOD2(SetPendingApplicationState,
void(const transport_manager::ConnectionUID connection_id,
const transport_manager::DeviceInfo& device_info));
+ MOCK_METHOD1(GetProtocolVehicleData,
+ bool(connection_handler::ProtocolVehicleData& data));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/media_manager/mock_media_manager.h b/src/components/include/test/media_manager/mock_media_manager.h
index 36e35352d6..cfee287d12 100644
--- a/src/components/include/test/media_manager/mock_media_manager.h
+++ b/src/components/include/test/media_manager/mock_media_manager.h
@@ -41,12 +41,6 @@ namespace media_manager_test {
class MockMediaManager : public media_manager::MediaManager {
public:
- MOCK_METHOD1(PlayA2DPSource, void(int32_t application_key));
- MOCK_METHOD1(StopA2DPSource, void(int32_t application_key));
- MOCK_METHOD3(StartMicrophoneRecording,
- void(int32_t application_key,
- const std::string& outputFileName,
- int32_t duration));
MOCK_METHOD6(StartMicrophoneRecording,
void(int32_t application_key,
const std::string& outputFileName,
@@ -64,6 +58,7 @@ class MockMediaManager : public media_manager::MediaManager {
MOCK_METHOD2(FramesProcessed,
void(int32_t application_key, int32_t frame_number));
MOCK_CONST_METHOD0(settings, const media_manager::MediaManagerSettings&());
+ MOCK_CONST_METHOD1(DataSizeToMilliseconds, uint32_t(uint64_t data_size));
};
} // namespace media_manager_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 d93bdff7f7..a79918cc39 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
@@ -207,7 +207,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
bool(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
MOCK_CONST_METHOD0(IsMetaInfoPresent, bool());
MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
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 0123c6c912..22ab31307a 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
@@ -173,6 +173,7 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
@@ -269,6 +270,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(ExceededIgnitionCycles, bool());
MOCK_METHOD0(ExceededDays, bool());
MOCK_METHOD0(StartPTExchange, void());
+ MOCK_METHOD0(TriggerPTUOnStartupIfRequired, void());
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
MOCK_METHOD2(Increment,
void(const std::string& app_id,
@@ -308,6 +310,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(RetrySequenceFailed, void());
MOCK_METHOD0(ResetTimeout, void());
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
};
} // namespace policy_manager_test
} // namespace components
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 19de301dc3..716f66f994 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
@@ -181,7 +181,9 @@ class MockCacheManagerInterface : public CacheManagerInterface {
bool(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
MOCK_CONST_METHOD0(IsMetaInfoPresent, bool());
MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
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 4cb6455db6..076f0423ef 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
@@ -172,6 +172,7 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
@@ -311,6 +312,7 @@ class MockPolicyManager : public PolicyManager {
RequestSubType::State(const std::string& policy_app_id));
MOCK_METHOD0(ResetTimeout, void());
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
};
} // namespace policy_manager_test
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index 94a9efd9e5..aa7c1293c3 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -65,13 +65,17 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
const ::protocol_handler::ProtocolHandlerSettings&());
MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&());
MOCK_METHOD3(NotifySessionStarted,
+ void(::protocol_handler::SessionContext& context,
+ std::vector<std::string>& rejected_params,
+ const std::string err_reason));
+ MOCK_METHOD3(NotifySessionStarted,
void(const ::protocol_handler::SessionContext& context,
std::vector<std::string>& rejected_params,
const std::string err_reason));
MOCK_METHOD0(NotifyOnGetSystemTimeFailed, void());
MOCK_CONST_METHOD1(IsRPCServiceSecure, bool(const uint32_t connection_key));
MOCK_METHOD0(ProcessFailedPTU, void());
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
MOCK_METHOD0(ProcessFailedCertDecrypt, void());
#endif
};
diff --git a/src/components/include/test/resumption/mock_last_state.h b/src/components/include/test/resumption/mock_last_state.h
index 99c3799a95..c646dcd286 100644
--- a/src/components/include/test/resumption/mock_last_state.h
+++ b/src/components/include/test/resumption/mock_last_state.h
@@ -43,10 +43,6 @@ namespace resumption_test {
class MockLastState : public resumption::LastState {
public:
- DEPRECATED
- MOCK_METHOD0(SaveStateToFileSystem, void());
- DEPRECATED
- MOCK_METHOD0(get_dictionary, Json::Value&());
MOCK_METHOD0(SaveToFileSystem, void());
MOCK_METHOD0(RemoveFromFileSystem, void());
MOCK_CONST_METHOD0(dictionary, Json::Value());
diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h
index e44d6207c1..d6ef7d1bbd 100644
--- a/src/components/include/test/security_manager/mock_security_manager.h
+++ b/src/components/include/test/security_manager/mock_security_manager.h
@@ -75,7 +75,7 @@ class MockSecurityManager : public ::security_manager::SecurityManager {
MOCK_METHOD1(PostponeHandshake, void(const uint32_t));
MOCK_CONST_METHOD0(IsSystemTimeProviderReady, bool());
MOCK_METHOD0(ResetPendingSystemTimeRequests, void());
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
MOCK_METHOD0(ProcessFailedCertDecrypt, void());
#endif
};
diff --git a/src/components/include/test/security_manager/mock_security_manager_settings.h b/src/components/include/test/security_manager/mock_security_manager_settings.h
index b1c869cd1b..2c62973413 100644
--- a/src/components/include/test/security_manager/mock_security_manager_settings.h
+++ b/src/components/include/test/security_manager/mock_security_manager_settings.h
@@ -56,6 +56,7 @@ class MockCryptoManagerSettings
MOCK_CONST_METHOD0(maximum_payload_size, size_t());
MOCK_CONST_METHOD0(force_protected_service, const std::vector<int>&());
MOCK_CONST_METHOD0(force_unprotected_service, const std::vector<int>&());
+ MOCK_CONST_METHOD0(security_level, uint32_t());
};
} // namespace security_manager_test
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 1920af18a3..7aa70b8061 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager.h
@@ -57,8 +57,6 @@ class MockTransportManager : public ::transport_manager::TransportManager,
transport_manager::TMTelemetryObserver> {
public:
MOCK_METHOD1(Init, int(resumption::LastStateWrapperPtr last_state));
- DEPRECATED
- MOCK_METHOD1(Init, int(resumption::LastState& last_state));
MOCK_METHOD0(Reinit, int());
MOCK_METHOD0(Deinit, void());
MOCK_METHOD0(StopEventsProcessing, void());
diff --git a/src/components/include/test/utils/test_async_waiter.h b/src/components/include/test/utils/test_async_waiter.h
index 12d6cd04b7..6ad9ca12c5 100644
--- a/src/components/include/test/utils/test_async_waiter.h
+++ b/src/components/include/test/utils/test_async_waiter.h
@@ -48,17 +48,15 @@ namespace test {
*
* Usage example:
* TEST() {
- * TestAsyncWaiter waiter;
+ * auto waiter = TestAsyncWaiter::createInstance();
* EXPECT_CALL(mock, InterestingCall())
* .Times(n)
- * .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
- * EXPECT_TRUE(waiter.WaitFor(n, 1000));
+ * .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
+ * EXPECT_TRUE(waiter->WaitFor(n, 1000));
* }
*/
class TestAsyncWaiter {
public:
- TestAsyncWaiter() : notified_(false), count_(0), lock_(), cond_var_() {}
-
/**
* @brief WaitFor
* Waits for specified number of notifications but not longer
@@ -80,6 +78,10 @@ class TestAsyncWaiter {
return true;
}
+ static std::shared_ptr<TestAsyncWaiter> createInstance() {
+ return std::shared_ptr<TestAsyncWaiter>(new TestAsyncWaiter());
+ }
+
/**
* @brief Notify
* Notifies async waiter
@@ -92,6 +94,8 @@ class TestAsyncWaiter {
}
private:
+ TestAsyncWaiter() : notified_(false), count_(0), lock_(), cond_var_() {}
+
bool notified_;
uint32_t count_;
sync_primitives::Lock lock_;
diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h
index 184616d714..770b55a347 100644
--- a/src/components/include/transport_manager/transport_adapter/device.h
+++ b/src/components/include/transport_manager/transport_adapter/device.h
@@ -163,7 +163,7 @@ class Device {
* @brief Increment @link retry_count_ @endlink value
*/
inline void next_retry() {
- retry_count_++;
+ ++retry_count_;
}
/**
diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h
index 4697bf9982..45bb159aa2 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -53,9 +53,6 @@ class TransportManager {
**/
virtual ~TransportManager() {}
- DEPRECATED
- virtual int Init(resumption::LastState& last_state) = 0;
-
/**
* @brief Initialize transport manager.
* @return Error code.
diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h
index eac58787f1..8b307e5a5e 100644
--- a/src/components/include/utils/logger.h
+++ b/src/components/include/utils/logger.h
@@ -51,7 +51,7 @@
logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__}, \
std::this_thread::get_id()}; \
logger::Logger::instance().PushLog(message); \
- }
+ }
#include "utils/auto_trace.h"
#define SDL_CREATE_LOG_VARIABLE(component_name) \
@@ -75,8 +75,8 @@
LOG_WITH_LEVEL(logger::LogLevel::TRACE_LEVEL, logEvent)
#define SDL_LOG_AUTO_TRACE() \
- logger::AutoTrace auto_trace( \
- logger_, logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__})
+ logger::AutoTrace auto_trace( \
+ logger_, logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__})
#define SDL_LOG_DEBUG(logEvent) \
LOG_WITH_LEVEL(logger::LogLevel::DEBUG_LEVEL, logEvent)
diff --git a/src/components/include/utils/semantic_version.h b/src/components/include/utils/semantic_version.h
index 01b04495ad..54be460bab 100644
--- a/src/components/include/utils/semantic_version.h
+++ b/src/components/include/utils/semantic_version.h
@@ -43,12 +43,6 @@ struct SemanticVersion {
patch_version_ = patch;
}
- SemanticVersion(const SemanticVersion& other) {
- major_version_ = other.major_version_;
- minor_version_ = other.minor_version_;
- patch_version_ = other.patch_version_;
- }
-
SemanticVersion(const std::string& versionString)
: major_version_(0), minor_version_(0), patch_version_(0) {
int readElements = sscanf(versionString.c_str(),
diff --git a/src/components/include/utils/threads/pt-internal.h b/src/components/include/utils/threads/pt-internal.h
index 19f3f1cb8d..915bf351a3 100644
--- a/src/components/include/utils/threads/pt-internal.h
+++ b/src/components/include/utils/threads/pt-internal.h
@@ -49,14 +49,14 @@ struct pthread_internal_t {
void* alternate_signal_stack;
/*
- * The dynamic linker implements dlerror(3), which makes it hard for us to implement this
- * per-thread buffer by simply using malloc(3) and free(3).
+ * The dynamic linker implements dlerror(3), which makes it hard for us to
+ * implement this per-thread buffer by simply using malloc(3) and free(3).
*/
#define __BIONIC_DLERROR_BUFFER_SIZE 508
char dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
-
- // ugly hack: use last 4 bytes of dlerror_buffer as cancel_lock
- pthread_mutex_t cancel_lock;
+
+ // ugly hack: use last 4 bytes of dlerror_buffer as cancel_lock
+ pthread_mutex_t cancel_lock;
};
/* Has the thread a cancellation request? */
@@ -71,9 +71,9 @@ struct pthread_internal_t {
/* Has the thread a cancellation handler? */
#define PTHREAD_ATTR_FLAG_CANCEL_HANDLER 0x00000040
-struct pthread_internal_t *__pthread_getid ( pthread_t );
+struct pthread_internal_t* __pthread_getid(pthread_t);
-int __pthread_do_cancel (struct pthread_internal_t *);
+int __pthread_do_cancel(struct pthread_internal_t*);
void pthread_init(void);
diff --git a/src/components/include/utils/threads/pthread_android.h b/src/components/include/utils/threads/pthread_android.h
index c0e1e69002..b14d88c0f8 100644
--- a/src/components/include/utils/threads/pthread_android.h
+++ b/src/components/include/utils/threads/pthread_android.h
@@ -20,118 +20,118 @@
#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_PTHREAD_ANDROID_H
#include "pt-internal.h"
-#define PTHREAD_CANCELED ((void *) -1)
+#define PTHREAD_CANCELED ((void*)-1)
#define PTHREAD_CANCEL_ENABLE 0x00000010
#define PTHREAD_CANCEL_DISABLE 0x00000000
inline void pthread_cancel_handler(int signum) {
- pthread_exit(0);
- }
+ pthread_exit(0);
+}
inline void pthread_init() {
- struct sigaction sa;
- struct pthread_internal_t *p = (struct pthread_internal_t *) pthread_self();
+ struct sigaction sa;
+ struct pthread_internal_t* p = (struct pthread_internal_t*)pthread_self();
- if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_HANDLER)
- return;
+ if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_HANDLER)
+ return;
- // set thread status as pthread_create should do.
- // ASYNCROUNOUS is not set, see pthread_setcancelstate(3)
- p->attr.flags |= PTHREAD_ATTR_FLAG_CANCEL_HANDLER | PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
+ // set thread status as pthread_create should do.
+ // ASYNCROUNOUS is not set, see pthread_setcancelstate(3)
+ p->attr.flags |=
+ PTHREAD_ATTR_FLAG_CANCEL_HANDLER | PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
- sa.sa_handler = pthread_cancel_handler;
- sigemptyset(&(sa.sa_mask));
- sa.sa_flags = 0;
+ sa.sa_handler = pthread_cancel_handler;
+ sigemptyset(&(sa.sa_mask));
+ sa.sa_flags = 0;
- sigaction(SIGRTMIN, &sa, NULL);
- }
+ sigaction(SIGRTMIN, &sa, NULL);
+}
inline static void call_exit() {
- pthread_exit(0);
- }
+ pthread_exit(0);
+}
-inline int __pthread_do_cancel(struct pthread_internal_t *p) {
+inline int __pthread_do_cancel(struct pthread_internal_t* p) {
+ if (p == (struct pthread_internal_t*)pthread_self())
+ call_exit();
+ else if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_HANDLER)
+ pthread_kill((pthread_t)p, SIGRTMIN);
+ else
+ pthread_kill((pthread_t)p, SIGTERM);
- if (p == (struct pthread_internal_t *) pthread_self())
- call_exit();
- else if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_HANDLER)
- pthread_kill((pthread_t) p, SIGRTMIN);
- else
- pthread_kill((pthread_t) p, SIGTERM);
-
- return 0;
- }
+ return 0;
+}
inline void pthread_testcancel() {
- struct pthread_internal_t *p = (struct pthread_internal_t *) pthread_self();
- int cancelled;
+ struct pthread_internal_t* p = (struct pthread_internal_t*)pthread_self();
+ int cancelled;
- pthread_init();
+ pthread_init();
- pthread_mutex_lock(&p->cancel_lock);
- cancelled = (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE) &&
- (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_PENDING);
- pthread_mutex_unlock(&p->cancel_lock);
+ pthread_mutex_lock(&p->cancel_lock);
+ cancelled = (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE) &&
+ (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_PENDING);
+ pthread_mutex_unlock(&p->cancel_lock);
- if (cancelled)
- pthread_exit(PTHREAD_CANCELED);
- }
+ if (cancelled)
+ pthread_exit(PTHREAD_CANCELED);
+}
-inline int pthread_setcancelstate(int state, int *oldstate) {
- struct pthread_internal_t *p = (struct pthread_internal_t *) pthread_self();
- int newflags;
+inline int pthread_setcancelstate(int state, int* oldstate) {
+ struct pthread_internal_t* p = (struct pthread_internal_t*)pthread_self();
+ int newflags;
- pthread_init();
+ pthread_init();
- switch (state) {
- default:
- return EINVAL;
- case PTHREAD_CANCEL_ENABLE:
- case PTHREAD_CANCEL_DISABLE:
- break;
- }
+ switch (state) {
+ default:
+ return EINVAL;
+ case PTHREAD_CANCEL_ENABLE:
+ case PTHREAD_CANCEL_DISABLE:
+ break;
+ }
- pthread_mutex_lock(&p->cancel_lock);
- if (oldstate)
- *oldstate = p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
+ pthread_mutex_lock(&p->cancel_lock);
+ if (oldstate)
+ *oldstate = p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
- if (state == PTHREAD_ATTR_FLAG_CANCEL_ENABLE)
- p->attr.flags |= PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
- else
- p->attr.flags &= ~PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
- newflags = p->attr.flags;
- pthread_mutex_unlock(&p->cancel_lock);
+ if (state == PTHREAD_ATTR_FLAG_CANCEL_ENABLE)
+ p->attr.flags |= PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
+ else
+ p->attr.flags &= ~PTHREAD_ATTR_FLAG_CANCEL_ENABLE;
+ newflags = p->attr.flags;
+ pthread_mutex_unlock(&p->cancel_lock);
- if ((newflags & PTHREAD_ATTR_FLAG_CANCEL_PENDING) &&
- (newflags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE) &&
- (newflags & PTHREAD_ATTR_FLAG_CANCEL_ASYNCRONOUS))
- __pthread_do_cancel(p);
+ if ((newflags & PTHREAD_ATTR_FLAG_CANCEL_PENDING) &&
+ (newflags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE) &&
+ (newflags & PTHREAD_ATTR_FLAG_CANCEL_ASYNCRONOUS))
+ __pthread_do_cancel(p);
- return 0;
- }
+ return 0;
+}
inline int pthread_cancel(pthread_t t) {
- int err = 0;
- struct pthread_internal_t *p = (struct pthread_internal_t *) t;
+ int err = 0;
+ struct pthread_internal_t* p = (struct pthread_internal_t*)t;
- pthread_init();
+ pthread_init();
- pthread_mutex_lock(&p->cancel_lock);
- if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_PENDING) {
- pthread_mutex_unlock(&p->cancel_lock);
- return 0;
- }
+ pthread_mutex_lock(&p->cancel_lock);
+ if (p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_PENDING) {
+ pthread_mutex_unlock(&p->cancel_lock);
+ return 0;
+ }
- p->attr.flags |= PTHREAD_ATTR_FLAG_CANCEL_PENDING;
+ p->attr.flags |= PTHREAD_ATTR_FLAG_CANCEL_PENDING;
- if (!(p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE)) {
- pthread_mutex_unlock(&p->cancel_lock);
- return 0;
- }
+ if (!(p->attr.flags & PTHREAD_ATTR_FLAG_CANCEL_ENABLE)) {
+ pthread_mutex_unlock(&p->cancel_lock);
+ return 0;
+ }
- pthread_mutex_unlock(&p->cancel_lock);
- err = __pthread_do_cancel(p);
+ pthread_mutex_unlock(&p->cancel_lock);
+ err = __pthread_do_cancel(p);
- return err;
- }
-#endif //SRC_COMPONENTS_INCLUDE_UTILS_THREADS_PTHREAD_ANDROID_H
+ return err;
+}
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_THREADS_PTHREAD_ANDROID_H
diff --git a/src/components/include/utils/time64.h b/src/components/include/utils/time64.h
index 175b2940a7..9e4efcdd20 100644
--- a/src/components/include/utils/time64.h
+++ b/src/components/include/utils/time64.h
@@ -51,10 +51,10 @@ typedef time_t TIME_TYPE;
template <typename DURATION_TYPE>
double get_duration_diff(TIME_TYPE from, TIME_TYPE to) {
- const DURATION_TYPE time_from(from);
- const DURATION_TYPE time_to(to);
+ const DURATION_TYPE time_from(from);
+ const DURATION_TYPE time_to(to);
- return std::chrono::duration_cast<DURATION_TYPE>(time_from - time_to).count();
+ return std::chrono::duration_cast<DURATION_TYPE>(time_from - time_to).count();
}
#endif // SRC_COMPONENTS_INCLUDE_UTILS_TIME64_H
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 9233503748..5e010c1339 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.1.0" date="2019-03-18">
+<interface name="Common" version="2.2.0" date="2021-04-14">
<enum name="Result">
<element name="SUCCESS" value="0"/>
@@ -635,6 +635,12 @@
<element name="phoneNumber">
<description> Optional phone number of intended location / establishment (if applicable) for SendLocation.</description>
</element>
+ <element name="timeToDestination">
+ <description>Optional time to destination field for ShowConstantTBT</description>
+ </element>
+ <element name="turnText">
+ <description>Turn text for turnList parameter of UpdateTurnList</description>
+ </element>
<element name="subtleAlertText1">
<description>The first line of the subtle alert text field; applies to `SubtleAlert` `alertText1`</description>
</element>
@@ -644,14 +650,17 @@
<element name="subtleAlertSoftButtonText">
<description>A text field in the soft button of a subtle alert; applies to `SubtleAlert` `softButtons`</description>
</element>
- <element name="timeToDestination"/>
- <!-- TO DO to be removed -->
- <element name="turnText"/>
- <element name="navigationText">
- <description>Navigation text for UpdateTurnList.</description>
+ <element name="menuCommandSecondaryText">
+ <description>Secondary text for AddCommand</description>
+ </element>
+ <element name="menuCommandTertiaryText">
+ <description>Tertiary text for AddCommand</description>
</element>
- <element name="notificationText">
- <description>Text of notification to be displayed on screen.</description>
+ <element name="menuSubMenuSecondaryText">
+ <description>Secondary text for AddSubMenu</description>
+ </element>
+ <element name="menuSubMenuTertiaryText">
+ <description>Tertiary text for AddSubMenu</description>
</element>
</enum>
@@ -743,6 +752,12 @@
<element name="subtleAlertIcon">
<description>The image of the subtle alert; applies to `SubtleAlert` `alertIcon`</description>
</element>
+ <element name="menuCommandSecondaryImage">
+ <description>The secondary image field for AddCommand</description>
+ </element>
+ <element name="menuSubMenuSecondaryImage">
+ <description>The secondary image field for AddSubMenu</description>
+ </element>
</enum>
<enum name="TextAlignment">
@@ -833,6 +848,11 @@
</element>
</enum>
+<enum name="AppCapabilityType">
+ <description>Enumerations of all available app capability types</description>
+ <element name="VIDEO_STREAMING"/>
+</enum>
+
<!--IVI part-->
<enum name="ElectronicParkBrakeStatus">
<element name="CLOSED">
@@ -1209,6 +1229,7 @@
<element name="VEHICLEDATA_FUELLEVEL_STATE" />
<element name="VEHICLEDATA_FUELCONSUMPTION" />
<element name="VEHICLEDATA_EXTERNTEMP" />
+ <element name="VEHICLEDATA_CLIMATEDATA"/>
<element name="VEHICLEDATA_VIN" />
<element name="VEHICLEDATA_GEARSTATUS" />
<element name="VEHICLEDATA_PRNDL" />
@@ -1238,6 +1259,7 @@
<element name="VEHICLEDATA_STABILITYCONTROLSSTATUS" />
<element name="VEHICLEDATA_WINDOWSTATUS"/>
<element name="VEHICLEDATA_HANDSOFFSTEERING"/>
+ <element name="VEHICLEDATA_SEATOCCUPANCY"/>
</enum>
<enum name="WiperStatus">
@@ -1327,6 +1349,7 @@
<element name="QWERTY" />
<element name="QWERTZ" />
<element name="AZERTY" />
+ <element name="NUMERIC"/>
</enum>
<enum name="KeyboardEvent">
@@ -1336,6 +1359,15 @@
<element name="ENTRY_VOICE" />
<element name="ENTRY_CANCELLED" />
<element name="ENTRY_ABORTED" />
+ <element name="INPUT_KEY_MASK_ENABLED"/>
+ <element name="INPUT_KEY_MASK_DISABLED"/>
+</enum>
+
+<enum name="KeyboardInputMask">
+ <description>Enumeration listing possible input character masking.</description>
+ <element name="ENABLE_INPUT_KEY_MASK" />
+ <element name="DISABLE_INPUT_KEY_MASK" />
+ <element name="USER_CHOICE_INPUT_KEY_MASK" />
</enum>
<enum name="KeypressMode">
@@ -1742,7 +1774,6 @@
<!-- End of Policies -->
<!-- Remote Control -->
-
<struct name="Grid">
<description>Describes a location (origin coordinates and span) of a vehicle component.</description>
<param name="col" type="Integer" mandatory="true" minvalue="-1" maxvalue="100">
@@ -1779,10 +1810,10 @@
<param name="moduleId" type="String" maxlength="100" mandatory="true">
<description> uuid of a module. "moduleId + moduleType" uniquely identify a module.</description>
</param>
- <param name="location" type="Grid" mandatory="false">
+ <param name="location" type="Common.Grid" mandatory="false">
<description>Location of a module.</description>
</param>
- <param name="serviceArea" type="Grid" mandatory="false">
+ <param name="serviceArea" type="Common.Grid" mandatory="false">
<description>Service area of a module. </description>
</param>
<param name="allowMultipleAccess" type="Boolean" mandatory="false" defvalue="true">
@@ -1792,7 +1823,7 @@
<struct name="SeatLocation">
<description>Describes the location of a seat.</description>
- <param name="grid" type="Grid" mandatory="false">
+ <param name="grid" type="Common.Grid" mandatory="false">
</param>
</struct>
@@ -1802,11 +1833,26 @@
<param name="columns" type="Integer" minvalue="1" maxvalue="100" mandatory="false"></param>
<param name="levels" type="Integer" minvalue="1" maxvalue="100" defvalue="1" mandatory="false">
</param>
- <param name="seats" type="SeatLocation" array="true" mandatory="false">
+ <param name="seats" type="Common.SeatLocation" array="true" mandatory="false">
<description>Contains a list of SeatLocation in the vehicle</description>
</param>
</struct>
+<struct name="SeatStatus">
+ <description>Describes the status of a parameter of seat.</description>
+ <param name="seatLocation" type="Common.SeatLocation" mandatory="true"/>
+ <param name="conditionActive" type="Boolean" mandatory="true"/>
+</struct>
+
+<struct name="SeatOccupancy">
+ <param name="seatsOccupied" type="Common.SeatStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>Seat status array containing location and whether the seats are occupied.</description>
+ </param>
+ <param name="seatsBelted" type="Common.SeatStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>Seat status array containing location and whether the seats are belted.</description>
+ </param>
+</struct>
+
<enum name="ModuleType">
<element name="CLIMATE"/>
<element name="RADIO"/>
@@ -1835,8 +1881,8 @@
<struct name="MassageModeData">
<description>Specify the mode of a massage zone.</description>
- <param name="massageZone" type="MassageZone" mandatory="true"></param>
- <param name="massageMode" type="MassageMode" mandatory="true"></param>
+ <param name="massageZone" type="Common.MassageZone" mandatory="true"></param>
+ <param name="massageMode" type="Common.MassageMode" mandatory="true"></param>
</struct>
<enum name="MassageCushion">
@@ -1850,7 +1896,7 @@
<struct name="MassageCushionFirmness">
<description>The intensity or firmness of a cushion.</description>
- <param name="cushion" type="MassageCushion" mandatory="true"></param>
+ <param name="cushion" type="Common.MassageCushion" mandatory="true"></param>
<param name="firmness" type="Integer" minvalue="0" maxvalue="100" mandatory="true"></param>
</struct>
@@ -1869,7 +1915,7 @@
<struct name="SeatMemoryAction">
<param name="id" type="Integer" minvalue="1" maxvalue="10" mandatory="true"/>
<param name="label" type="String" maxlength="100" mandatory="false"/>
- <param name="action" type="SeatMemoryActionType" mandatory="true"/>
+ <param name="action" type="Common.SeatMemoryActionType" mandatory="true"/>
</struct>
<enum name="SupportedSeat">
@@ -1880,7 +1926,7 @@
<struct name="SeatControlData">
<description>Seat control data corresponds to "SEAT" ModuleType. </description>
- <param name="id" type="SupportedSeat" mandatory="false"></param>
+ <param name="id" type="Common.SupportedSeat" mandatory="false"></param>
<param name="heatingEnabled" type="Boolean" mandatory="false"></param>
<param name="coolingEnabled" type="Boolean" mandatory="false"></param>
<param name="heatingLevel" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
@@ -1896,19 +1942,19 @@
<param name="headSupportVerticalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
<param name="massageEnabled" type="Boolean" mandatory="false"></param>
- <param name="massageMode" type="MassageModeData" minsize="1" maxsize="2" array="true" mandatory="false"></param>
- <param name="massageCushionFirmness" type="MassageCushionFirmness" minsize="1" maxsize="5" array="true" mandatory="false"></param>
- <param name="memory" type="SeatMemoryAction" mandatory="false"></param>
+ <param name="massageMode" type="Common.MassageModeData" minsize="1" maxsize="2" array="true" mandatory="false"></param>
+ <param name="massageCushionFirmness" type="Common.MassageCushionFirmness" minsize="1" maxsize="5" array="true" mandatory="false"></param>
+ <param name="memory" type="Common.SeatMemoryAction" mandatory="false"></param>
</struct>
<struct name="SeatControlCapabilities">
<param name="moduleName" type="String" maxlength="100" mandatory="true">
<description>
- The short friendly name of the light control module.
+ The short friendly name of the seat control module.
It should not be used to identify a module by mobile application.
</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="heatingEnabledAvailable" type="Boolean" mandatory="false">
@@ -2062,13 +2108,13 @@
<param name="stationShortName" type="String" minlength="4" maxlength="7" mandatory="false">
<description>Identifies the 4-alpha-character station call sign plus an optional (-FM) extension</description>
</param>
- <param name="stationIDNumber" type="StationIDNumber" mandatory="false">
+ <param name="stationIDNumber" type="Common.StationIDNumber" mandatory="false">
<description>Used for network Application. Consists of Country Code and FCC Facility ID.</description>
</param>
<param name="stationLongName" type="String" minlength="0" maxlength="56" mandatory="false">
<description>Identifies the station call sign or other identifying information in the long format.</description>
</param>
- <param name="stationLocation" type="GPSData" mandatory="false">
+ <param name="stationLocation" type="Common.GPSData" mandatory="false">
<description>Provides the 3-dimensional geographic station location.</description>
</param>
<param name="stationMessage" type="String" minlength="0" maxlength="56" mandatory="false">
@@ -2112,7 +2158,7 @@
</param>
<param name="state" type="Common.RadioState" mandatory="false">
</param>
- <param name="sisData" type="SisData" mandatory="false">
+ <param name="sisData" type="Common.SisData" mandatory="false">
<description>Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number</description>
</param>
</struct>
@@ -2122,7 +2168,7 @@
<param name="moduleName" type="String" maxlength="100" mandatory="true" >
<description>The short name or a short description of the radio control module.</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="radioEnableAvailable" type="Boolean" mandatory="false">
@@ -2227,7 +2273,7 @@
</enum>
<struct name="Temperature">
- <param name="unit" type="TemperatureUnit" mandatory="true" >
+ <param name="unit" type="Common.TemperatureUnit" mandatory="true" >
<description>Temperature Unit</description>
</param>
<param name="value" type="Float" mandatory="true" >
@@ -2248,7 +2294,7 @@
</param>
<param name="autoModeEnable" type="Boolean" mandatory="false">
</param>
- <param name="defrostZone" type="DefrostZone" mandatory="false">
+ <param name="defrostZone" type="Common.DefrostZone" mandatory="false">
</param>
<param name="dualModeEnable" type="Boolean" mandatory="false">
</param>
@@ -2277,7 +2323,7 @@
<param name="moduleName" type="String" maxlength="100" mandatory="true" >
<description>The short name or a short description of the climate control module.</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="currentTemperatureAvailable" type="Boolean" mandatory="false">
@@ -2392,7 +2438,7 @@
</struct>
<struct name="AudioControlData">
- <param name="source" type="PrimaryAudioSource" mandatory="false">
+ <param name="source" type="Common.PrimaryAudioSource" mandatory="false">
<description>
In a getter response or a notification, it is the current primary audio source of the system.
In a setter request, it is the target audio source that the system shall switch to.
@@ -2411,7 +2457,7 @@
<param name="volume" type="Integer" mandatory="false" minvalue="0" maxvalue="100">
<description>Reflects the volume of audio, from 0%-100%.</description>
</param>
- <param name="equalizerSettings" type="EqualizerSettings" minsize="1" maxsize="100" mandatory="false" array="true">
+ <param name="equalizerSettings" type="Common.EqualizerSettings" minsize="1" maxsize="100" mandatory="false" array="true">
<description>Defines the list of supported channels (band) and their current/desired settings on HMI</description>
</param>
</struct>
@@ -2419,11 +2465,11 @@
<struct name="AudioControlCapabilities">
<param name="moduleName" type="String" maxlength="100" mandatory="true">
<description>
- The short friendly name of the light control module.
+ The short friendly name of the audio control module.
It should not be used to identify a module by mobile application.
</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="sourceAvailable" type="Boolean" mandatory="false">
@@ -2560,7 +2606,7 @@
</enum>
<struct name="LightCapabilities">
- <param name="name" type="LightName" mandatory="true" />
+ <param name="name" type="Common.LightName" mandatory="true" />
<param name="statusAvailable" type="Boolean" mandatory="false">
<description>
Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
@@ -2585,25 +2631,25 @@
It should not be used to identify a module by mobile application.
</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
- <param name="supportedLights" type="LightCapabilities" minsize="1" maxsize="100" array="true" mandatory="true">
+ <param name="supportedLights" type="Common.LightCapabilities" minsize="1" maxsize="100" array="true" mandatory="true">
<description> An array of available light names that are controllable. </description>
</param>
</struct>
<struct name="LightState">
- <param name="id" type="LightName" mandatory="true">
+ <param name="id" type="Common.LightName" mandatory="true">
<description>The name of a light or a group of lights. </description>
</param>
- <param name="status" type="LightStatus" mandatory="true"/>
+ <param name="status" type="Common.LightStatus" mandatory="true"/>
<param name="density" type="Float" minvalue="0" maxvalue="1" mandatory="false" />
- <param name="color" type="RGBColor" mandatory="false" />
+ <param name="color" type="Common.RGBColor" mandatory="false" />
</struct>
<struct name="LightControlData">
- <param name="lightState" type="LightState" mandatory="true" minsize="1" maxsize="100" array="true">
+ <param name="lightState" type="Common.LightState" mandatory="true" minsize="1" maxsize="100" array="true">
<description>An array of LightNames and their current or desired status. No change to the status of the LightNames that are not listed in the array.</description>
</param>
</struct>
@@ -2620,9 +2666,9 @@
<struct name="HMISettingsControlData">
<description>Corresponds to "HMI_SETTINGS" ModuleType</description>
- <param name="displayMode" type="DisplayMode" mandatory="false"></param>
- <param name="temperatureUnit" type="TemperatureUnit" mandatory="false"></param>
- <param name="distanceUnit" type="DistanceUnit" mandatory="false"></param>
+ <param name="displayMode" type="Common.DisplayMode" mandatory="false"></param>
+ <param name="temperatureUnit" type="Common.TemperatureUnit" mandatory="false"></param>
+ <param name="distanceUnit" type="Common.DistanceUnit" mandatory="false"></param>
</struct>
<struct name="HMISettingsControlCapabilities">
@@ -2632,7 +2678,7 @@
It should not be used to identify a module by mobile application.
</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="distanceUnitAvailable" type="Boolean" mandatory="false">
@@ -2657,13 +2703,13 @@
</param>
<param name="climateControlData" type="Common.ClimateControlData" mandatory="false">
</param>
- <param name="seatControlData" type="SeatControlData" mandatory="false">
+ <param name="seatControlData" type="Common.SeatControlData" mandatory="false">
</param>
- <param name="audioControlData" type="AudioControlData" mandatory="false">
+ <param name="audioControlData" type="Common.AudioControlData" mandatory="false">
</param>
- <param name="lightControlData" type="LightControlData" mandatory="false">
+ <param name="lightControlData" type="Common.LightControlData" mandatory="false">
</param>
- <param name="hmiSettingsControlData" type="HMISettingsControlData" mandatory="false">
+ <param name="hmiSettingsControlData" type="Common.HMISettingsControlData" mandatory="false">
</param>
</struct>
@@ -2699,7 +2745,7 @@
<param name="name" type="Common.ButtonName" mandatory="true">
<description>The name of the Button from the ButtonName enum</description>
</param>
- <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <param name="moduleInfo" type="Common.ModuleInfo" mandatory="false">
<description>Information about a RC module, including its id. </description>
</param>
<param name="shortPressAvailable" type="Boolean" mandatory="true">
@@ -2841,8 +2887,8 @@
Currently only predefined window template layouts are defined.
</description>
</param>
- <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false" />
- <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" />
+ <param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false" />
+ <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false" />
</struct>
<struct name="HMIApplication">
@@ -2934,6 +2980,12 @@
<param name="menuName" type="String" maxlength="500" mandatory="true">
<description>The name of the sub menu/command.</description>
</param>
+ <param name="secondaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional secondary text to display</description>
+ </param>
+ <param name="tertiaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional tertiary text to display</description>
+ </param>
</struct>
<enum name="MenuLayout">
@@ -3170,11 +3222,20 @@
If empty, the auto-complete list will be removed from the screen.
</description>
</param>
+ <param name="maskInputCharacters" type="Common.KeyboardInputMask" mandatory="false">
+ <description>Allows an app to mask entered characters on HMI</description>
+ </param>
+ <param name="customKeys" type="String" maxlength="1" minsize="1" maxsize="10" array="true" mandatory="false">
+ <description>
+ Array of special characters to show in customizable keys.
+ If omitted, keyboard will show default special characters
+ </description>
+ </param>
</struct>
<struct name="Turn">
<param name="navigationText" type="Common.TextFieldStruct" mandatory="false">
- <description>Uses navigationText from TextFieldStruct.</description>
+ <description>Describes the `Turn` using `TextFieldName` `turnText`</description>
</param>
<param name="turnIcon" type="Common.Image" mandatory="false">
</param>
@@ -3220,7 +3281,7 @@
<param name="status" type="Common.ComponentVolumeStatus" mandatory="true">
<description>The status of component volume. See ComponentVolumeStatus.</description>
</param>
- <param name="tpms" type="TPMS" mandatory="false">
+ <param name="tpms" type="Common.TPMS" mandatory="false">
<description>The status of TPMS according to the particular tire.</description>
</param>
<param name="pressure" type="Float" mandatory="false" minvalue="0" maxvalue="2000">
@@ -3335,6 +3396,35 @@
</param>
</struct>
+<enum name="DoorStatusType">
+ <element name="CLOSED"/>
+ <element name="LOCKED"/>
+ <element name="AJAR"/>
+ <element name="REMOVED"/>
+</enum>
+
+<struct name="DoorStatus">
+ <description>Describes the status of a parameter of door.</description>
+ <param name="location" type="Common.Grid" mandatory="true"/>
+ <param name="status" type="Common.DoorStatusType" mandatory="true"/>
+</struct>
+
+<struct name="GateStatus">
+ <description>Describes the status of a parameter of trunk/hood/etc.</description>
+ <param name="location" type="Common.Grid" mandatory="true"/>
+ <param name="status" type="Common.DoorStatusType" mandatory="true"/>
+</struct>
+
+<struct name="RoofStatus">
+ <description>
+ Describes the status of a parameter of roof, convertible roof, sunroof/moonroof etc.
+ If roof is open (AJAR), state will determine percentage of roof open.
+ </description>
+ <param name="location" type="Common.Grid" mandatory="true"/>
+ <param name="status" type="Common.DoorStatusType" mandatory="true"/>
+ <param name="state" type="Common.WindowState" mandatory="false"/>
+</struct>
+
<struct name="BodyInformation">
<param name="parkBrakeActive" type="Boolean" mandatory="true">
<description>Must be true if the park brake is active</description>
@@ -3346,16 +3436,25 @@
<description>The status of the ignition. See IgnitionStatus.</description>
</param>
<param name="driverDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatDrv_B_Actl".</description>
+ <description>References signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description>
</param>
<param name="passengerDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatPsngr_B_Actl".</description>
+ <description>References signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description>
</param>
<param name="rearLeftDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRl_B_Actl".</description>
+ <description>References signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description>
</param>
<param name="rearRightDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRr_B_Actl".</description>
+ <description>References signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.</description>
+ </param>
+ <param name="doorStatuses" type="Common.DoorStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>Provides status for doors if Ajar/Closed/Locked</description>
+ </param>
+ <param name="gateStatuses" type="Common.GateStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>Provides status for trunk/hood/etc. if Ajar/Closed/Locked</description>
+ </param>
+ <param name="roofStatuses" type="Common.RoofStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>Provides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removed etc.</description>
</param>
</struct>
@@ -3540,7 +3639,7 @@
</struct>
<struct name="LocationDetails">
- <param name="coordinate" type="Coordinate" mandatory="false">
+ <param name="coordinate" type="Common.Coordinate" mandatory="false">
<description>Latitude/Longitude of the location.</description>
</param>
<param name="locationName" type="String" maxlength="500" mandatory="false">
@@ -3555,10 +3654,10 @@
<param name="phoneNumber" type="String" maxlength="500" mandatory="false">
<description>Phone number of location / establishment.</description>
</param>
- <param name="locationImage" type="Image" mandatory="false">
+ <param name="locationImage" type="Common.Image" mandatory="false">
<description>Image / icon of intended location.</description>
</param>
- <param name="searchAddress" type="OASISAddress" mandatory="false">
+ <param name="searchAddress" type="Common.OASISAddress" mandatory="false">
<description>Address to be used by navigation engines for search</description>
</param>
</struct>
@@ -3607,10 +3706,27 @@
<param name="scale" type="Float" minvalue="1" maxvalue="10" mandatory="false">
<description>The scaling factor the app should use to change the size of the projecting view.</description>
</param>
+ <param name="preferredFPS" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false">
+ <description>The preferred frame rate per second of the head unit. The mobile application / app library may take other factors into account that constrain the frame rate lower than this value, but it should not perform streaming at a higher frame rate than this value.</description>
+ </param>
+ <param name="additionalVideoStreamingCapabilities" type="Common.VideoStreamingCapability" array="true" minsize="1" maxsize="100" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="AppCapability">
+ <param name="appCapabilityType" type="Common.AppCapabilityType" 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="videoStreamingCapability" type="Common.VideoStreamingCapability" mandatory="false">
+ <description>Describes supported capabilities for video streaming </description>
+ </param>
</struct>
<struct name="DynamicUpdateCapabilities">
- <param name="supportedDynamicImageFieldNames" type="ImageFieldName" array="true" mandatory="false" minsize="1">
+ <param name="supportedDynamicImageFieldNames" type="Common.ImageFieldName" array="true" mandatory="false" minsize="1">
<description>An array of ImageFieldName values for which the system supports sending OnFileUpdate notifications. If you send an Image struct for that image field with a name without having uploaded the image data using PutFile that matches that name, the system will request that you upload the data with PutFile at a later point when the HMI needs it. The HMI will then display the image in the appropriate field. If not sent, assume false.</description>
</param>
@@ -3624,6 +3740,25 @@
<param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
</struct>
+ <struct name="KeyboardLayoutCapability">
+ <description>
+ Describes the capabilities of a single keyboard layout.
+ </description>
+ <param name="keyboardLayout" type="Common.KeyboardLayout" mandatory="true"/>
+ <param name="numConfigurableKeys" type="Integer" minvalue="0" maxvalue="10" mandatory="true">
+ <description>Number of keys available for special characters, App can customize as per their needs.</description>
+ </param>
+ </struct>
+
+ <struct name="KeyboardCapabilities">
+ <param name="maskInputCharactersSupported" type="Boolean" mandatory="false">
+ <description>Availability of capability to mask input characters using keyboard. True: Available, False: Not Available</description>
+ </param>
+ <param name="supportedKeyboards" type="Common.KeyboardLayoutCapability" minsize="1" maxsize="1000" array="true" mandatory="false">
+ <description>Capabilities of supported keyboard layouts by HMI.</description>
+ </param>
+ </struct>
+
<struct name="WindowCapability">
<param name="windowID" type="Integer" mandatory="false">
<description>
@@ -3631,13 +3766,13 @@
or omitted for the main window on the main display.
</description>
</param>
- <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <param name="textFields" type="Common.TextField" minsize="1" maxsize="100" array="true" mandatory="false">
<description>A set of all fields that support text data. See TextField</description>
</param>
- <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <param name="imageFields" type="Common.ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
<description>A set of all fields that support images. See ImageField</description>
</param>
- <param name="imageTypeSupported" type="ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
+ <param name="imageTypeSupported" type="Common.ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
<description>Provides information about image types supported by the system.</description>
</param>
<param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
@@ -3646,29 +3781,32 @@
<param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
<description>The number of on-window custom presets available (if any); otherwise omitted.</description>
</param>
- <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>The number of buttons and the capabilities of each on-window button.</description>
</param>
- <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>The number of soft buttons available on-window and the capabilities for each button.</description>
</param>
<param name="menuLayoutsAvailable" type="Common.MenuLayout" array="true" minsize="1" maxsize="1000" mandatory="false">
<description>An array of available menu layouts. If this parameter is not provided, only the `LIST` layout is assumed to be available</description>
</param>
- <param name="dynamicUpdateCapabilities" type="DynamicUpdateCapabilities" mandatory="false">
+ <param name="dynamicUpdateCapabilities" type="Common.DynamicUpdateCapabilities" mandatory="false">
<description>Contains the head unit's capabilities for dynamic updating features declaring if the module will send dynamic update RPCs.</description>
</param>
+ <param name="keyboardCapabilities" type="Common.KeyboardCapabilities" mandatory="false">
+ <description>See KeyboardCapabilities</description>
+ </param>
</struct>
<struct name="DisplayCapability">
<description>Contains information about the display capabilities.</description>
<param name="displayName" type="String" mandatory="false" />
- <param name="windowTypeSupported" type="WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
+ <param name="windowTypeSupported" type="Common.WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
<description>
Informs the application how many windows the app is allowed to create per type.
</description>
</param>
- <param name="windowCapabilities" type="WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <param name="windowCapabilities" type="Common.WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
<description>
Contains a list of capabilities of all windows related to the app.
Once the app has registered the capabilities of all windows are provided.
@@ -3693,39 +3831,39 @@
</struct>
<struct name="SystemCapabilities">
- <param name="navigationCapability" type="NavigationCapability" mandatory="false">
+ <param name="navigationCapability" type="Common.NavigationCapability" mandatory="false">
</param>
- <param name="phoneCapability" type="PhoneCapability" mandatory="false">
+ <param name="phoneCapability" type="Common.PhoneCapability" mandatory="false">
</param>
- <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
+ <param name="videoStreamingCapability" type="Common.VideoStreamingCapability" mandatory="false">
</param>
- <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false">
+ <param name="driverDistractionCapability" type="Common.DriverDistractionCapability" mandatory="false">
<description>Describes capabilities when the driver is distracted</description>
- </param>
+ </param>
</struct>
<struct name="RemoteControlCapabilities">
- <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <param name="climateControlCapabilities" type="Common.ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
<description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
</param>
- <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <param name="radioControlCapabilities" type="Common.RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
<description>If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
</param>
- <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
+ <param name="buttonCapabilities" type="Common.ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
<description>If included, the platform supports RC button controls with the included button names.</description >
</param>
- <param name="seatControlCapabilities" type="SeatControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <param name="seatControlCapabilities" type="Common.SeatControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
<description>
If included, the platform supports seat controls.
</description >
</param>
- <param name="audioControlCapabilities" type="AudioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <param name="audioControlCapabilities" type="Common.AudioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
<description> If included, the platform supports audio controls. </description >
</param>
- <param name="hmiSettingsControlCapabilities" type="HMISettingsControlCapabilities" mandatory="false">
+ <param name="hmiSettingsControlCapabilities" type="Common.HMISettingsControlCapabilities" mandatory="false">
<description> If included, the platform supports hmi setting controls. </description >
</param>
- <param name="lightControlCapabilities" type="LightControlCapabilities" mandatory="false">
+ <param name="lightControlCapabilities" type="Common.LightControlCapabilities" mandatory="false">
<description> If included, the platform supports light controls. </description >
</param>
</struct>
@@ -4258,10 +4396,10 @@
</description>
</param>
<param name="displayCapabilities" type="Common.DisplayCapability" array="true" minsize="1" maxsize="1000" mandatory="false"/>
- <param name="seatLocationCapability" type="SeatLocationCapability" mandatory="false">
+ <param name="seatLocationCapability" type="Common.SeatLocationCapability" mandatory="false">
<description>Contains information about the locations of each seat</description>
</param>
- <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false">
+ <param name="driverDistractionCapability" type="Common.DriverDistractionCapability" mandatory="false">
<description>Describes capabilities when the driver is distracted</description>
</param>
</struct>
@@ -4301,6 +4439,18 @@
</param>
</struct>
+ <struct name="ClimateData">
+ <param name="externalTemperature" type="Common.Temperature" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="cabinTemperature" type="Common.Temperature" mandatory="false">
+ <description>Internal ambient cabin temperature in degrees celsius</description>
+ </param>
+ <param name="atmosphericPressure" type="Float" minvalue="0" maxvalue="2000" mandatory="false">
+ <description>Current atmospheric pressure in mBar</description>
+ </param>
+ </struct>
+
<struct name="GearStatus">
<param name="userSelectedGear" type="Common.PRNDL" mandatory="false">
<description>Gear position selected by the user i.e. Park, Drive, Reverse</description>
@@ -4313,6 +4463,23 @@
</param>
</struct>
+ <enum name="SeekIndicatorType">
+ <element name="TRACK" />
+ <element name="TIME" />
+ </enum>
+
+ <struct name="SeekStreamingIndicator">
+ <description>
+ The seek next / skip previous subscription buttons' content
+ </description>
+ <param name="type" type="Common.SeekIndicatorType" mandatory="true" />
+ <param name="seekTime" type="Integer" minvalue="1" maxvalue="99" mandatory="false">
+ <description>
+ If the type is TIME, this number of seconds may be present alongside the skip indicator.
+ It will indicate the number of seconds that the currently playing media will skip forward or backward.
+ </description>
+ </param>
+ </struct>
</interface>
<interface name="Buttons" version="1.3.0" date="2017-07-18">
@@ -4380,47 +4547,53 @@
</description>
</param>
</function>
- <function name="OnButtonSubscription" messagetype="notification">
+ <function name="SubscribeButton" messagetype="request">
<description>
- Sender: SDL->HMI. Purpose: to notify about button subscription state is changed for the named application
+ Subscribes to buttons.
</description>
- <param name="name" type="Common.ButtonName" mandatory="true" />
- <param name="isSubscribed" type="Boolean" mandatory="true">
- <description>
- Defines whether the named button has status of 'subscribed' or 'unsubscribed':
- If "true" - the named button is subscribed.
- If "false" - the named button is unsubscribed.
- </description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>The ID of the application requesting this button subscription. </description>
+ </param>
+ <param name="buttonName" type="Common.ButtonName" mandatory="true">
+ <description>Name of the button to subscribe.</description>
</param>
+ </function>
+ <function name="SubscribeButton" messagetype="response"> </function>
+ <function name="UnsubscribeButton" messagetype="request">
+ <description>
+ Unsubscribes from buttons.
+ </description>
<param name="appID" type="Integer" mandatory="true">
- <description>
- The ID of application that relates to this button-subscription status change.
- </description>
+ <description>The ID of the application requesting this button unsubscription. </description>
+ </param>
+ <param name="buttonName" type="Common.ButtonName" mandatory="true">
+ <description>Name of the button to unsubscribe from.</description>
</param>
</function>
+ <function name="UnsubscribeButton" messagetype="response"></function>
</interface>
-<interface name="BasicCommunication" version="2.1.0" date="2019-03-18">
-<function name="OnServiceUpdate" messagetype="notification">
- <description>
- Must be sent by SDL to HMI when there is an update on status of certain services.
- Services supported with current version: Video
- </description>
- <param name="serviceType" type="Common.ServiceType" mandatory="true">
- <description>Specifies the service which has been updated.</description>
- </param>
- <param name="serviceEvent" type="Common.ServiceEvent" mandatory="false">
- <description>Specifies service update event.</description>
- </param>
- <param name="reason" type="Common.ServiceStatusUpdateReason" mandatory="false">
- <description>
- The reason for a service event. Certain events may not have a reason, such as when a service is ACCEPTED (which is the normal expected behavior).
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="false">
- <description>ID of the application which triggered the update.</description>
- </param>
-</function>
+<interface name="BasicCommunication" version="2.2.0" date="2021-04-14">
+ <function name="OnServiceUpdate" messagetype="notification">
+ <description>
+ Must be sent by SDL to HMI when there is an update on status of certain services.
+ Services supported with current version: Video
+ </description>
+ <param name="serviceType" type="Common.ServiceType" mandatory="true">
+ <description>Specifies the service which has been updated.</description>
+ </param>
+ <param name="serviceEvent" type="Common.ServiceEvent" mandatory="false">
+ <description>Specifies service update event.</description>
+ </param>
+ <param name="reason" type="Common.ServiceStatusUpdateReason" mandatory="false">
+ <description>
+ The reason for a service event. Certain events may not have a reason, such as when a service is ACCEPTED (which is the normal expected behavior).
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="false">
+ <description>ID of the application which triggered the update.</description>
+ </param>
+ </function>
<function name="GetSystemTime" messagetype="request">
<description>Request from SDL to HMI to obtain current UTC time.</description>
</function>
@@ -4617,6 +4790,27 @@
</function>
<function name="DialNumber" messagetype="response">
</function>
+ <function name="OnResetTimeout" messagetype="notification">
+ <description>
+ HMI must send this notification to SDL for method instance for which timeout needs to be reset
+ </description>
+ <param name="requestID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>
+ Id between HMI and SDL which SDL used to send the request for method in question, for which timeout needs to be reset.
+ </description>
+ </param>
+ <param name="methodName" type="String" mandatory="true">
+ <description>
+ Name of the function for which timeout needs to be reset
+ </description>
+ </param>
+ <param name="resetPeriod" type="Integer" minvalue="0" maxvalue="1000000" mandatory="false">
+ <description>
+ Timeout period in milliseconds, for the method for which timeout needs to be reset.
+ If omitted, timeout would be reset by defaultTimeout specified in smartDeviceLink.ini
+ </description>
+ </param>
+ </function>
<!-- Policies -->
<!-- SyncP RPC-->
@@ -4790,6 +4984,9 @@
<param name="wersCountryCode" type="String" maxlength="500" mandatory="true">
<description>Country code from the Ford system WERS (i.e.WAEGB).</description>
</param>
+ <param name="systemHardwareVersion" type="String" maxlength="500" mandatory="false">
+ <description>The hardware version of the system</description>
+ </param>
</function>
<function name="OnSystemInfoChanged" messagetype="notification">
<description>Issued by system to SDL to notify that some system param has changed. Currently applied for Sync Language.</description>
@@ -4871,9 +5068,18 @@
<description>The new application properties</description>
</param>
</function>
+
+ <function name="OnAppCapabilityUpdated" messagetype="notification">
+ <description>A notification to inform HMI that a specific app capability has changed.</description>
+ <param name="appCapability" type="Common.AppCapability" mandatory="true">
+ <description>The app capability that has been updated</description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ </param>
+ </function>
</interface>
-<interface name="VR" version="1.1.0" date="2017-04-27">
+<interface name="VR" version="1.2.0" date="2021-04-14">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response provides information about presence of VR module and its readiness to cooperate with SDL.</description>
</function>
@@ -5139,21 +5345,9 @@
</function>
<function name="SetGlobalProperties" messagetype="response">
</function>
- <function name="OnResetTimeout" messagetype="notification">
- <description>
- Sender: HMI->SDL. HMI must send this notification every 10 sec. in case the 'methodName'
- results long processing on HMI
- </description>
- <param name="appID" type="Integer" mandatory="true">
- <description>Id of application that concerns the 'methodName'.</description>
- </param>
- <param name="methodName" type="String" mandatory="true">
- <description>The name of the method, the renew of timeout is required for</description>
- </param>
- </function>
</interface>
-<interface name="UI" version="1.4.0" date="2019-07-24">
+<interface name="UI" version="1.5.0" date="2021-04-14">
<function name="Alert" messagetype="request">
<description>Request from SDL to show an alert message on the display.</description>
<param name="alertStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="3">
@@ -5410,6 +5604,9 @@
<description>Image to be displayed for representing the command. See Image.</description>
<description>If omitted, no (or the default if applicable) icon should be displayed.</description>
</param>
+ <param name="secondaryImage" type="Common.Image" mandatory="false">
+ <description>Optional secondary image struct for menu cell</description>
+ </param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that concerns this RPC.</description>
</param>
@@ -5442,6 +5639,9 @@
<param name="menuIcon" type="Common.Image" mandatory="false">
<description>The image field for AddSubMenu</description>
</param>
+ <param name="secondaryImage" type="Common.Image" mandatory="false">
+ <description>Optional secondary image struct for menu cell</description>
+ </param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that requested this RPC.</description>
</param>
@@ -5554,6 +5754,19 @@
<param name="audioStreamingIndicator" type="Common.AudioStreamingIndicator" mandatory="false">
<description>Indicates that a button press of the Play/Pause button would play, pause or Stop the current playback.</description>
</param>
+ <param name="forwardSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false">
+ <description>Used to control the forward seek button to either skip forward a set amount of time or to the next track.</description>
+ </param>
+ <param name="backSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false">
+ <description>Used to control the backward seek button to either skip back a set amount of time or to the previous track.</description>
+ </param>
+ <param name="countRate" type="Float" minvalue="0.1" maxvalue="100.0" defvalue="1.0" mandatory="false">
+ <description>
+ The value of this parameter is the amount that the media clock timer will advance per 1.0 seconds of real time.
+ Values less than 1.0 will therefore advance the timer slower than real-time, while values greater than 1.0 will advance the timer faster than real-time.
+ e.g. If this parameter is set to `0.5`, the timer will advance one second per two seconds real-time, or at 50% speed. If this parameter is set to `2.0`, the timer will advance two seconds per one second real-time, or at 200% speed.
+ </description>
+ </param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that requested this RPC.</description>
</param>
@@ -5831,15 +6044,6 @@
<function name="ClosePopUp" messagetype="response">
<description>Provides the result of operation.</description>
</function>
- <function name="OnResetTimeout" messagetype="notification">
- <description>HMI must provide SDL with notifications specific to the current Turn-By-Turn client status on the module</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>Id of application that invoked notifcation.</description>
- </param>
- <param name="methodName" type="String" mandatory="true">
- <description>Currently used method name on which was triggered action</description>
- </param>
- </function>
<function name="OnRecordStart" messagetype="notification">
<description>Issued by SDL to notify HMI about capturing mic data should be started</description>
<param name="appID" type="Integer" mandatory="true">
@@ -5891,7 +6095,7 @@
</interface>
-<interface name="Navigation" version="1.5.0" date="2017-08-15">
+<interface name="Navigation" version="1.6.0" date="2021-04-14">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response must provide the information about presence of UI Navigation module and its readiness to cooperate with SDL.</description>
@@ -5955,12 +6159,10 @@
<param name="nextTurnIcon" type="Common.Image" mandatory="false">
</param>
<param name="distanceToManeuver" type="Float" minvalue="0" maxvalue="1000000000" mandatory="true">
- <description>Fraction of distance till next maneuver (from previous maneuver).</description>
- <description>May be used to calculate progress bar.</description>
+ <description>Distance (in meters) until next maneuver. May be used to calculate progress bar.</description>
</param>
<param name="distanceToManeuverScale" type="Float" minvalue="0" maxvalue="1000000000" mandatory="true">
- <description>Fraction of distance till next maneuver (starting from when AlertManeuver is triggered).</description>
- <description>May be used to calculate progress bar.</description>
+ <description>Distance (in meters) from previous maneuver to next maneuver. May be used to calculate progress bar.</description>
</param>
<param name="maneuverComplete" type="Boolean" mandatory="false">
<description>If and when a maneuver has completed while an AlertManeuver is active, SDL will send this value set to TRUE in order to clear the AlertManeuver overlay.</description>
@@ -6117,7 +6319,7 @@
</interface>
-<interface name="VehicleInfo" version="2.1.0" date="2019-03-18">
+<interface name="VehicleInfo" version="2.2.0" date="2021-04-14">
<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>
@@ -6231,6 +6433,9 @@
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
+ <param name="climateData" type="Boolean" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Boolean" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6291,6 +6496,9 @@
<param name="handsOffSteering" type="Boolean" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Boolean" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6339,6 +6547,9 @@
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
<description>The external temperature in degrees celsius.</description>
</param>
+ <param name="climateData" type="Common.VehicleDataResult" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Common.VehicleDataResult" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6399,6 +6610,9 @@
<param name="handsOffSteering" type="Common.VehicleDataResult" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Common.VehicleDataResult" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
@@ -6450,6 +6664,9 @@
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius.</description>
</param>
+ <param name="climateData" type="Boolean" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Boolean" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6510,6 +6727,9 @@
<param name="handsOffSteering" type="Boolean" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Boolean" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6558,6 +6778,9 @@
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
+ <param name="climateData" type="Common.VehicleDataResult" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Common.VehicleDataResult" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6618,6 +6841,9 @@
<param name="handsOffSteering" type="Common.VehicleDataResult" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Common.VehicleDataResult" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
@@ -6667,6 +6893,9 @@
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
+ <param name="climateData" type="Boolean" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Boolean" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6730,6 +6959,9 @@
<param name="handsOffSteering" type="Boolean" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Boolean" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6778,6 +7010,9 @@
<param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
+ <param name="climateData" type="Common.ClimateData" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Common.TurnSignal" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6841,6 +7076,9 @@
<param name="handsOffSteering" type="Boolean" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Common.SeatOccupancy" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
@@ -6890,6 +7128,9 @@
<param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
+ <param name="climateData" type="Common.ClimateData" mandatory="false">
+ <description>See ClimateData</description>
+ </param>
<param name="turnSignal" type="Common.TurnSignal" mandatory="false">
<description>See TurnSignal</description>
</param>
@@ -6953,6 +7194,9 @@
<param name="handsOffSteering" type="Boolean" mandatory="false">
<description>To indicate whether driver hands are off the steering wheel</description>
</param>
+ <param name="seatOccupancy" type="Common.SeatOccupancy" mandatory="false">
+ <description>See SeatOccupancy</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
@@ -6976,7 +7220,7 @@
</interface>
<!-- Policies -->
-<interface name="SDL" version="1.2.0" date="2018-09-05">
+<interface name="SDL" version="1.3.0" date="2021-04-14">
<function name="ActivateApp" messagetype="request">
<param name="appID" type="Integer" mandatory="true">
</param>
@@ -7157,7 +7401,7 @@
</function>
</interface>
-<interface name="RC" version="2.0.0" date="2018-09-05">
+<interface name="RC" version="2.1.0" date="2021-04-14">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response should provide information about presence of any of remote controllable module and its readiness to cooperate with SDL.</description>
</function>
@@ -7280,7 +7524,7 @@
</interface>
-<interface name="AppService" version="1.0.0" date="2019-03-18">
+<interface name="AppService" version="1.1.0" date="2021-04-14">
<description>Interface used for interacting with app services as a producer or consumer</description>
<function name="PublishAppService" messagetype="request">
<description>
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt
index a8cd3017f7..f6908cc95f 100644
--- a/src/components/media_manager/CMakeLists.txt
+++ b/src/components/media_manager/CMakeLists.txt
@@ -102,7 +102,7 @@ collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
add_library("MediaManager" ${SOURCES})
target_link_libraries("MediaManager" ${LIBRARIES})
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries("MediaManager" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
index 9e0a8b5123..5ecb1a6b4a 100644
--- a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
@@ -53,7 +53,6 @@ class FromMicRecorderAdapter : public MediaAdapterImpl {
void StopActivity(int32_t application_key);
bool is_app_performing_activity(int32_t application_key) const;
void set_output_file(const std::string& output_file);
- DEPRECATED void set_duration(int32_t duration);
void set_config(mobile_apis::SamplingRate::eType sampling_rate,
mobile_apis::BitsPerSample::eType bits_per_sample,
mobile_apis::AudioType::eType audio_type,
diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h
index 8d60cd0e54..faa51feec9 100644
--- a/src/components/media_manager/include/media_manager/media_manager_impl.h
+++ b/src/components/media_manager/include/media_manager/media_manager_impl.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_IMPL_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_IMPL_H_
+#include <chrono>
#include <map>
#include <string>
#include "interfaces/MOBILE_API.h"
@@ -59,13 +60,6 @@ class MediaManagerImpl : public MediaManager,
const MediaManagerSettings& settings);
virtual ~MediaManagerImpl();
- virtual void PlayA2DPSource(int32_t application_key);
- virtual void StopA2DPSource(int32_t application_key);
-
- DEPRECATED virtual void StartMicrophoneRecording(
- int32_t application_key,
- const std::string& outputFileName,
- int32_t duration);
virtual void StartMicrophoneRecording(
int32_t application_key,
const std::string& outputFileName,
@@ -79,6 +73,7 @@ class MediaManagerImpl : public MediaManager,
protocol_handler::ServiceType service_type);
virtual void StopStreaming(int32_t application_key,
protocol_handler::ServiceType service_type);
+
virtual void SetProtocolHandler(
protocol_handler::ProtocolHandler* protocol_handler);
virtual void OnMessageReceived(
@@ -89,6 +84,8 @@ class MediaManagerImpl : public MediaManager,
virtual const MediaManagerSettings& settings() const OVERRIDE;
+ virtual uint32_t DataSizeToMilliseconds(uint64_t data_size) const OVERRIDE;
+
#ifdef BUILD_TESTS
void set_mock_a2dp_player(MediaAdapter* media_adapter);
void set_mock_mic_listener(MediaListenerPtr media_listener);
@@ -114,6 +111,12 @@ class MediaManagerImpl : public MediaManager,
std::map<protocol_handler::ServiceType, MediaAdapterImplPtr> streamer_;
std::map<protocol_handler::ServiceType, MediaListenerPtr> streamer_listener_;
+ uint32_t bits_per_sample_;
+ uint32_t sampling_rate_;
+ uint64_t stream_data_size_;
+ std::chrono::time_point<std::chrono::system_clock>
+ socket_audio_stream_start_time_;
+
application_manager::ApplicationManager& application_manager_;
private:
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
index 68018028ae..911ef239cc 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
@@ -108,10 +108,6 @@ void FromMicRecorderAdapter::set_output_file(const std::string& output_file) {
output_file_ = output_file;
}
-void FromMicRecorderAdapter::set_duration(int32_t duration) {
- duration_ = duration;
-}
-
void FromMicRecorderAdapter::set_config(
mobile_apis::SamplingRate::eType sampling_rate,
mobile_apis::BitsPerSample::eType bits_per_sample,
diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
index d2634214fa..310fca7aa3 100644
--- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
+++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
@@ -111,7 +111,7 @@ void FromMicToFileRecorderThread::deinitArgs() {
SDL_LOG_AUTO_TRACE();
if (argv_) {
- for (int32_t i = 0; i < argc_; i++) {
+ for (int32_t i = 0; i < argc_; ++i) {
delete[] argv_[i];
}
delete[] argv_;
@@ -164,7 +164,7 @@ void FromMicToFileRecorderThread::threadMain() {
// g_option_context_parse() modifies params, so keep argc_ and argv_
int32_t argc = argc_;
gchar** argv = new gchar*[argc];
- for (int32_t i = 0; i < argc; i++) {
+ for (int32_t i = 0; i < argc; ++i) {
argv[i] = argv_[i];
}
@@ -366,7 +366,7 @@ void FromMicToFileRecorderThread::exitThreadMain() {
if (sleepThread_) {
SDL_LOG_DEBUG("Stop sleep thread\n");
- sleepThread_->stop();
+ sleepThread_->Stop(threads::Thread::kThreadStopDelegate);
}
SDL_LOG_TRACE("Set should be stopped flag\n");
diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc
index 301b093829..f17d1f89ed 100644
--- a/src/components/media_manager/src/file_streamer_adapter.cc
+++ b/src/components/media_manager/src/file_streamer_adapter.cc
@@ -95,7 +95,7 @@ bool FileStreamerAdapter::FileStreamer::Send(
return false;
}
- SDL_LOG_INFO("Streamer::sent " << msg->data_size());
+ SDL_LOG_TRACE("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index 6f0a67b0c9..8a73101b47 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -35,6 +35,8 @@
#include "application_manager/application_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
#include "media_manager/audio/from_mic_recorder_listener.h"
#include "media_manager/streamer_listener.h"
#include "protocol_handler/protocol_handler.h"
@@ -64,6 +66,9 @@ MediaManagerImpl::MediaManagerImpl(
, protocol_handler_(NULL)
, a2dp_player_(NULL)
, from_mic_recorder_(NULL)
+ , bits_per_sample_(16)
+ , sampling_rate_(16000)
+ , stream_data_size_(0ull)
, application_manager_(application_manager) {
Init();
}
@@ -160,41 +165,25 @@ void MediaManagerImpl::Init() {
streamer_[ServiceType::kAudio]->AddListener(
streamer_listener_[ServiceType::kAudio]);
}
-}
-void MediaManagerImpl::PlayA2DPSource(int32_t application_key) {
- SDL_LOG_AUTO_TRACE();
+ if (application_manager_.hmi_capabilities().pcm_stream_capabilities()) {
+ const auto pcm_caps =
+ application_manager_.hmi_capabilities().pcm_stream_capabilities();
-#if defined(EXTENDED_MEDIA_MODE)
- if (!a2dp_player_ && protocol_handler_) {
- a2dp_player_ =
- new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer());
- }
-#endif
-
- if (a2dp_player_) {
- a2dp_player_->StartActivity(application_key);
- }
-}
+ if (pcm_caps->keyExists(application_manager::strings::bits_per_sample)) {
+ bits_per_sample_ =
+ pcm_caps->getElement(application_manager::strings::bits_per_sample)
+ .asUInt();
+ }
-void MediaManagerImpl::StopA2DPSource(int32_t application_key) {
- SDL_LOG_AUTO_TRACE();
- if (a2dp_player_) {
- a2dp_player_->StopActivity(application_key);
+ if (pcm_caps->keyExists(application_manager::strings::sampling_rate)) {
+ sampling_rate_ =
+ pcm_caps->getElement(application_manager::strings::sampling_rate)
+ .asUInt();
+ }
}
}
-void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key,
- const std::string& output_file,
- int32_t duration) {
- StartMicrophoneRecording(application_key,
- output_file,
- duration,
- mobile_apis::SamplingRate::INVALID_ENUM,
- mobile_apis::BitsPerSample::INVALID_ENUM,
- mobile_apis::AudioType::INVALID_ENUM);
-}
-
void MediaManagerImpl::StartMicrophoneRecording(
int32_t application_key,
const std::string& output_file,
@@ -276,6 +265,8 @@ void MediaManagerImpl::StopStreaming(
int32_t application_key, protocol_handler::ServiceType service_type) {
SDL_LOG_AUTO_TRACE();
+ stream_data_size_ = 0ull;
+
if (streamer_[service_type]) {
streamer_[service_type]->StopActivity(application_key);
}
@@ -313,7 +304,24 @@ void MediaManagerImpl::OnMessageReceived(
ApplicationSharedPtr app = application_manager_.application(streaming_app_id);
if (app) {
- app->WakeUpStreaming(service_type);
+ if (ServiceType::kAudio == service_type) {
+ if (stream_data_size_ == 0) {
+ socket_audio_stream_start_time_ = std::chrono::system_clock::now();
+ }
+
+ stream_data_size_ += message->data_size();
+ uint32_t ms_for_all_data = DataSizeToMilliseconds(stream_data_size_);
+ uint32_t ms_since_stream_start =
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now() -
+ socket_audio_stream_start_time_)
+ .count();
+ uint32_t ms_stream_remaining = ms_for_all_data - ms_since_stream_start;
+
+ app->WakeUpStreaming(service_type, ms_stream_remaining);
+ } else {
+ app->WakeUpStreaming(service_type);
+ }
streamer_[service_type]->SendData(streaming_app_id, message);
}
}
@@ -326,36 +334,16 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key,
if (protocol_handler_) {
protocol_handler_->SendFramesNumber(application_key, frame_number);
}
-
- application_manager::ApplicationSharedPtr app =
- application_manager_.application(application_key);
-
- if (app) {
- auto audio_stream = std::dynamic_pointer_cast<StreamerAdapter>(
- streamer_[protocol_handler::ServiceType::kAudio]);
- auto video_stream = std::dynamic_pointer_cast<StreamerAdapter>(
- streamer_[protocol_handler::ServiceType::kMobileNav]);
-
- if (audio_stream.use_count() != 0) {
- size_t audio_queue_size = audio_stream->GetMsgQueueSize();
- SDL_LOG_DEBUG("# Messages in audio queue = " << audio_queue_size);
- if (audio_queue_size > 0) {
- app->WakeUpStreaming(protocol_handler::ServiceType::kAudio);
- }
- }
-
- if (video_stream.use_count() != 0) {
- size_t video_queue_size = video_stream->GetMsgQueueSize();
- SDL_LOG_DEBUG("# Messages in video queue = " << video_queue_size);
- if (video_queue_size > 0) {
- app->WakeUpStreaming(protocol_handler::ServiceType::kMobileNav);
- }
- }
- }
}
const MediaManagerSettings& MediaManagerImpl::settings() const {
return settings_;
}
+uint32_t MediaManagerImpl::DataSizeToMilliseconds(uint64_t data_size) const {
+ constexpr uint16_t latency_compensation = 500;
+ return 1000 * data_size / (sampling_rate_ * bits_per_sample_ / 8) +
+ latency_compensation;
+}
+
} // namespace media_manager
diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc
index 5e4c87c73d..b4e66be483 100644
--- a/src/components/media_manager/src/pipe_streamer_adapter.cc
+++ b/src/components/media_manager/src/pipe_streamer_adapter.cc
@@ -144,7 +144,7 @@ bool PipeStreamerAdapter::PipeStreamer::Send(
// Loop to send remaining data if there is any.
} while (data_remaining);
- SDL_LOG_INFO("Streamer::sent " << msg->data_size());
+ SDL_LOG_TRACE("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 2f10a29c7d..134ccb8038 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -149,7 +149,7 @@ bool SocketStreamerAdapter::SocketStreamer::Send(
SDL_LOG_WARN("Couldn't send all the data to socket " << send_socket_fd_);
}
- SDL_LOG_INFO("Streamer::sent " << msg->data_size());
+ SDL_LOG_TRACE("Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
index 8dedd56ea5..ad61ac1f63 100644
--- a/src/components/media_manager/src/streamer_adapter.cc
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -59,6 +59,7 @@ void StreamerAdapter::StartActivity(int32_t application_key) {
<< " has been already started");
return;
}
+ messages_.Reset();
DCHECK(thread_);
const size_t kStackSize = 16384;
@@ -86,7 +87,6 @@ void StreamerAdapter::StopActivity(int32_t application_key) {
DCHECK(streamer_);
streamer_->exitThreadMain();
- messages_.Reset();
for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
media_listeners_.end() != it;
@@ -150,7 +150,7 @@ void StreamerAdapter::Streamer::threadMain() {
static int32_t messages_for_session = 0;
++messages_for_session;
- SDL_LOG_DEBUG("Handling map streaming message. This is "
+ SDL_LOG_TRACE("Handling map streaming message. This is "
<< messages_for_session << " message for "
<< adapter_->current_application_);
std::set<MediaListenerPtr>::iterator it =
diff --git a/src/components/media_manager/test/CMakeLists.txt b/src/components/media_manager/test/CMakeLists.txt
index 65bfcc985e..e4ee1c3bdd 100644
--- a/src/components/media_manager/test/CMakeLists.txt
+++ b/src/components/media_manager/test/CMakeLists.txt
@@ -69,6 +69,6 @@ endif()
create_test("media_manager_test" "${SOURCES}" "${LIBRARIES}")
-if(ENABLE_LOG AND NOT ANDROIDs)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries("media_manager_test" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/media_manager/test/media_manager_impl_test.cc b/src/components/media_manager/test/media_manager_impl_test.cc
index a64faabe91..8cca2ad995 100644
--- a/src/components/media_manager/test/media_manager_impl_test.cc
+++ b/src/components/media_manager/test/media_manager_impl_test.cc
@@ -35,6 +35,7 @@
#include "application_manager/message.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/state_controller.h"
#include "gmock/gmock.h"
@@ -109,6 +110,10 @@ class MediaManagerImplTest : public ::testing::Test {
.WillByDefault(ReturnRef(kDefaultValue));
ON_CALL(mock_media_manager_settings_, audio_server_type())
.WillByDefault(ReturnRef(kDefaultValue));
+ ON_CALL(mock_hmi_capabilities_, pcm_stream_capabilities())
+ .WillByDefault(Return(nullptr));
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(mock_hmi_capabilities_));
mock_app_ = std::make_shared<MockApp>();
media_manager_impl_.reset(
new MediaManagerImpl(app_mngr_, mock_media_manager_settings_));
@@ -176,7 +181,7 @@ class MediaManagerImplTest : public ::testing::Test {
.WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type));
+ EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type, _));
MockMediaAdapterImplPtr mock_media_streamer =
std::make_shared<MockMediaAdapterImpl>();
media_manager_impl_->set_mock_streamer(service_type, mock_media_streamer);
@@ -206,6 +211,7 @@ class MediaManagerImplTest : public ::testing::Test {
const ::testing::NiceMock<MockMediaManagerSettings>
mock_media_manager_settings_;
std::shared_ptr<MediaManagerImpl> media_manager_impl_;
+ application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
};
TEST_F(MediaManagerImplTest,
@@ -273,21 +279,6 @@ TEST_F(MediaManagerImplTest, Init_Settings_ExpectFileValue) {
InitMediaManagerFileServerType();
}
-TEST_F(MediaManagerImplTest, PlayA2DPSource_WithCorrectA2DP_SUCCESS) {
- // media_adapter_mock_ will be deleted in media_manager_impl (dtor)
- MockMediaAdapter* media_adapter_mock = new MockMediaAdapter();
- media_manager_impl_->set_mock_a2dp_player(media_adapter_mock);
- EXPECT_CALL(*media_adapter_mock, StartActivity(kApplicationKey));
- media_manager_impl_->PlayA2DPSource(kApplicationKey);
-}
-
-TEST_F(MediaManagerImplTest, StopA2DPSource_WithCorrectA2DP_SUCCESS) {
- MockMediaAdapter* media_adapter_mock = new MockMediaAdapter();
- media_manager_impl_->set_mock_a2dp_player(media_adapter_mock);
- EXPECT_CALL(*media_adapter_mock, StopActivity(kApplicationKey));
- media_manager_impl_->StopA2DPSource(kApplicationKey);
-}
-
TEST_F(MediaManagerImplTest,
StartMicrophoneRecording_SourceFileIsWritable_ExpectTrue) {
StartMicrophoneCheckHelper();
@@ -410,17 +401,11 @@ TEST_F(MediaManagerImplTest,
TEST_F(MediaManagerImplTest,
CheckFramesProcessed_WithCorrectFramesNumber_SUCCESS) {
- ON_CALL(mock_media_manager_settings_, video_server_type())
- .WillByDefault(ReturnRef(kDefaultValue));
- ON_CALL(mock_media_manager_settings_, audio_server_type())
- .WillByDefault(ReturnRef(kDefaultValue));
protocol_handler_test::MockProtocolHandler mock_protocol_handler;
media_manager_impl_->SetProtocolHandler(&mock_protocol_handler);
const int32_t frame_number = 10;
EXPECT_CALL(mock_protocol_handler,
SendFramesNumber(kApplicationKey, frame_number));
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app_));
media_manager_impl_->FramesProcessed(kApplicationKey, frame_number);
}
diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt
index 03b1251c85..70bb01221b 100644
--- a/src/components/policy/policy_external/CMakeLists.txt
+++ b/src/components/policy/policy_external/CMakeLists.txt
@@ -133,7 +133,7 @@ target_link_libraries(PolicyStatic ${LIBRARIES})
add_library(Policy SHARED "src/policy_manager_impl.cc")
target_link_libraries(Policy PolicyStatic)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
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 12fe8f10cd..8384f56f77 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -597,13 +597,11 @@ class CacheManager : public CacheManagerInterface {
*/
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
- /**
- * @brief Records information about head unit system to PT
- * @return bool Success of operation
- */
bool SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
- const std::string& language);
+ const std::string& language) OVERRIDE;
+
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
/**
* @brief Get information about last ccpu_version from PT
@@ -611,6 +609,8 @@ class CacheManager : public CacheManagerInterface {
*/
std::string GetCCPUVersionFromPT() const;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Checks, if specific head unit is present in PT
* @return boot Suceess, if present, otherwise - false
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 8ed46e0c72..f33dabd025 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
@@ -645,7 +645,7 @@ class CacheManagerInterface {
virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
/**
- * @brief Records information about head unit system to PT
+ * @brief Records mandatory information about head unit system to PT
* @return bool Success of operation
*/
virtual bool SetMetaInfo(const std::string& ccpu_version,
@@ -653,12 +653,24 @@ class CacheManagerInterface {
const std::string& language) = 0;
/**
+ * @brief Records information about hardware version to PT
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Checks, if specific head unit is present in PT
* @return boot Suceess, if present, otherwise - false
*/
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 27ce30bb3d..2be8183bfa 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
@@ -435,10 +435,14 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
+
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
std::string GetCCPUVersionFromPT() const OVERRIDE;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
@@ -787,14 +791,6 @@ class PolicyManagerImpl : public PolicyManager {
const PolicySettings& get_settings() const OVERRIDE;
/**
- * @brief Finds the next URL that must be sent on OnSystemRequest retry
- * @param urls vector of vectors that contain urls for each application
- * @return Pair of policy application id and application url id from the
- * urls vector
- */
- DEPRECATED AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE;
-
- /**
* @brief Checks if there is existing URL in the EndpointUrls vector with
* index saved in the policy manager and if not, it moves to the next
* application index
@@ -1053,6 +1049,11 @@ class PolicyManagerImpl : public PolicyManager {
void StartPTExchange() OVERRIDE;
/**
+ * @brief Trigger a PTU once on startup if it is required
+ */
+ void TriggerPTUOnStartupIfRequired() OVERRIDE;
+
+ /**
* @brief Checks is PT exceeded days
* @return true if exceeded
*/
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 4da7683347..e42ac0285e 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
@@ -490,6 +490,7 @@ struct ModuleMeta : CompositeType {
Optional<String<0, 500> > ccpu_version;
Optional<String<0, 250> > language;
Optional<String<0, 250> > wers_country_code;
+ Optional<String<0, 500> > hardware_version;
Optional<Integer<uint32_t, 0, ODO_MAX> > pt_exchanged_at_odometer_x;
Optional<Integer<uint16_t, 0, 65535> > pt_exchanged_x_days_after_epoch;
Optional<Integer<uint16_t, 0, 65535> > ignition_cycles_since_last_exchange;
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 64eab51870..a3b91abbc5 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
@@ -25,6 +25,7 @@
<element name="gps" />
<element name="speed" />
<element name="engineTorque" />
+ <element name="climateData" />
<element name="externalTemperature" />
<element name="turnSignal" />
<element name="fuelLevel" />
@@ -60,6 +61,7 @@
<element name="tpms" />
<element name="cloudAppVehicleID" />
<element name="handsOffSteering" />
+ <element name="seatOccupancy" />
</enum>
<enum name="AppHMIType">
@@ -221,6 +223,7 @@
<param name="ccpu_version" type="String" maxlength="250" mandatory="false"/>
<param name="language" type="String" maxlength="250" mandatory="false"/>
<param name="wers_country_code" type="String" maxlength="250" mandatory="false"/>
+ <param name="hardware_version" type="String" maxlength="500" mandatory="false"/>
<param name="pt_exchanged_at_odometer_x" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
<param name="pt_exchanged_x_days_after_epoch" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
<param name="ignition_cycles_since_last_exchange" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h
index 7e8abd5989..ff3a89d084 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -278,6 +278,7 @@ struct AppPermissions {
, appRevoked(false)
, appPermissionsConsentNeeded(false)
, appUnauthorized(false)
+ , isSDLAllowed(false)
, requestTypeChanged(false)
, requestSubTypeChanged(false) {}
diff --git a/src/components/policy/policy_external/include/policy/pt_ext_representation.h b/src/components/policy/policy_external/include/policy/pt_ext_representation.h
index f03947268a..867033bc20 100644
--- a/src/components/policy/policy_external/include/policy/pt_ext_representation.h
+++ b/src/components/policy/policy_external/include/policy/pt_ext_representation.h
@@ -198,7 +198,7 @@ class PTExtRepresentation : public virtual PTRepresentation {
const std::string& language) = 0;
/**
- * @brief Records information about head unit system to PT
+ * @brief Records mandatory information about head unit system to PT
* @return bool Success of operation
*/
virtual bool SetMetaInfo(const std::string& ccpu_version,
@@ -206,6 +206,12 @@ class PTExtRepresentation : public virtual PTRepresentation {
const std::string& language) = 0;
/**
+ * @brief Records information about hardware version to PT
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Checks, if specific head unit is present in PT
* @return boot Suceess, if present, otherwise - false
*/
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_ext_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_ext_queries.h
index b8f85ec7b1..abb18d51e4 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_ext_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_ext_queries.h
@@ -65,6 +65,7 @@ extern const std::string kInsertExternalConsentStatusGroups;
extern const std::string kCountUnconsentedGroups;
extern const std::string kSelectModuleMeta;
extern const std::string kUpdateMetaParams;
+extern const std::string kUpdateMetaHardwareVersion;
extern const std::string kUpdateModuleMetaVinParam;
extern const std::string kSaveModuleMeta;
extern const std::string kSelectMetaParams;
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
index 889ede9d20..de2d0c1536 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
@@ -94,7 +94,9 @@ class SQLPTExtRepresentation : public SQLPTRepresentation,
bool SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
- const std::string& language);
+ const std::string& language) OVERRIDE;
+
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
bool IsMetaInfoPresent();
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 81a5518cb8..07f2df1991 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -348,17 +348,20 @@ bool CacheManager::CanAppKeepContext(const std::string& app_id) const {
bool result = false;
if (kDeviceId == app_id) {
result = pt_->policy_table.app_policies_section.device.keep_context;
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
result = pt_->policy_table.app_policies_section.apps[app_id].keep_context;
}
return result;
}
uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const {
+ SDL_LOG_AUTO_TRACE();
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
uint32_t result = 0;
if (!IsApplicationRepresented(app_id)) {
+ SDL_LOG_WARN("Application " << app_id << " is not represented");
return result;
}
@@ -368,6 +371,7 @@ uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const {
result = *(app.heart_beat_timeout_ms);
}
+ SDL_LOG_DEBUG("HB timer for app " << app_id << " is " << result);
return result;
}
@@ -407,7 +411,8 @@ bool CacheManager::CanAppStealFocus(const std::string& app_id) const {
bool result = false;
if (kDeviceId == app_id) {
result = pt_->policy_table.app_policies_section.device.steal_focus;
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
result = pt_->policy_table.app_policies_section.apps[app_id].steal_focus;
}
return result;
@@ -422,7 +427,8 @@ bool CacheManager::GetDefaultHMI(const std::string& app_id,
if (kDeviceId == app_id) {
default_hmi = EnumToJsonString(
pt_->policy_table.app_policies_section.device.default_hmi);
- } else if (IsApplicationRepresented(app_id)) {
+ } else if (IsApplicationRepresented(app_id) &&
+ !IsApplicationRevoked(app_id)) {
default_hmi = EnumToJsonString(
pt_->policy_table.app_policies_section.apps[app_id].default_hmi);
}
@@ -671,6 +677,7 @@ void CacheManager::ProcessUpdate(
const policy_table::ApplicationPolicies::const_iterator
initial_policy_iter) {
using namespace policy;
+ using rpc::policy_table_interface_base::ApplicationParams;
using rpc::policy_table_interface_base::RequestTypes;
const RequestTypes& new_request_types =
*(initial_policy_iter->second.RequestType);
@@ -678,6 +685,14 @@ void CacheManager::ProcessUpdate(
const std::string& app_id = initial_policy_iter->first;
bool update_request_types = true;
+ ApplicationParams& params =
+ pt_->policy_table.app_policies_section.apps[app_id];
+ if (kPreDataConsentId == app_id) {
+ *(params.heart_beat_timeout_ms) =
+ *(initial_policy_iter->second.heart_beat_timeout_ms);
+ SDL_LOG_INFO("heart_beat_timeout_ms in predata = "
+ << *(params.heart_beat_timeout_ms));
+ }
if (app_id == kDefaultId || app_id == kPreDataConsentId) {
if (new_request_types.is_omitted()) {
SDL_LOG_INFO("Application " << app_id
@@ -1820,7 +1835,8 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
policy_table::ApplicationPolicies::const_iterator policy_iter =
policies.find(policy_app_id);
- const bool app_id_exists = policies.end() != policy_iter;
+ const bool app_id_exists =
+ policies.end() != policy_iter && !IsApplicationRevoked(policy_app_id);
if (app_id_exists) {
priority = EnumToJsonString((*policy_iter).second.priority);
}
@@ -2031,7 +2047,8 @@ void CacheManager::PersistData() {
*(*copy_pt.policy_table.module_meta).wers_country_code,
*(*copy_pt.policy_table.module_meta).language);
ex_backup_->SetVINValue(*(*copy_pt.policy_table.module_meta).vin);
-
+ ex_backup_->SetHardwareVersion(
+ *(*copy_pt.policy_table.module_meta).hardware_version);
// Save unpaired flag for devices
policy_table::DeviceData::const_iterator it_device =
copy_pt.policy_table.device_data->begin();
@@ -2284,13 +2301,35 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
return true;
}
+void CacheManager::SetHardwareVersion(const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ *pt_->policy_table.module_meta->hardware_version = hardware_version;
+ Backup();
+}
+
std::string CacheManager::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK(std::string(""));
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
rpc::Optional<policy_table::ModuleMeta>& module_meta =
pt_->policy_table.module_meta;
return *(module_meta->ccpu_version);
}
+std::string CacheManager::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK(std::string(""));
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ rpc::Optional<policy_table::ModuleMeta>& module_meta =
+ pt_->policy_table.module_meta;
+ return *(module_meta->hardware_version);
+}
+
bool CacheManager::IsMetaInfoPresent() const {
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock lock(cache_lock_);
@@ -2524,6 +2563,10 @@ bool policy::CacheManager::SetIsPredata(const std::string& app_id) {
if (IsApplicationRepresented(app_id)) {
pt_->policy_table.app_policies_section.apps[app_id].set_to_string(
kPreDataConsentId);
+
+ pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms =
+ pt_->policy_table.app_policies_section.apps[kPreDataConsentId]
+ .heart_beat_timeout_ms;
}
return true;
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 9bcea70803..75920be58c 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -762,6 +762,13 @@ void PolicyManagerImpl::StartPTExchange() {
}
}
+void PolicyManagerImpl::TriggerPTUOnStartupIfRequired() {
+ SDL_LOG_AUTO_TRACE();
+ if (ignition_check) {
+ StartPTExchange();
+ }
+}
+
void PolicyManagerImpl::OnAppsSearchStarted() {
SDL_LOG_AUTO_TRACE();
update_status_manager_.OnAppsSearchStarted();
@@ -1589,7 +1596,6 @@ void PolicyManagerImpl::GetPermissionsForApp(
FillFunctionalGroupPermissions(
all_disallowed, group_names, kGroupDisallowed, permissions);
}
- return;
}
std::string& PolicyManagerImpl::GetCurrentDeviceId(
@@ -1617,11 +1623,22 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
+void PolicyManagerImpl::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ cache_->SetHardwareVersion(hardware_version);
+}
+
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
+std::string PolicyManagerImpl::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ return cache_->GetHardwareVersionFromPT();
+}
+
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
SDL_LOG_AUTO_TRACE();
@@ -2126,18 +2143,6 @@ void PolicyManagerImpl::SetDecryptedCertificate(
cache_->SetDecryptedCertificate(certificate);
}
-AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) {
- SDL_LOG_AUTO_TRACE();
-
- const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls);
-
- retry_sequence_url_.url_idx_ = next_app_url.second + 1;
- retry_sequence_url_.app_idx_ = next_app_url.first;
- retry_sequence_url_.policy_app_id_ = urls[next_app_url.first].app_id;
-
- return next_app_url;
-}
-
AppIdURL PolicyManagerImpl::RetrySequenceUrl(const struct RetrySequenceURL& rs,
const EndpointUrls& urls) const {
uint32_t url_idx = rs.url_idx_;
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 269aa33c72..2143d028e6 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -19,7 +19,9 @@ std::string PolicyTableTypeToString(const PolicyTableType pt_type) {
case PT_SNAPSHOT: {
return "PT_SNAPSHOT";
}
- default: { return "INVALID_PT_TYPE"; }
+ default: {
+ return "INVALID_PT_TYPE";
+ }
}
}
@@ -1357,8 +1359,7 @@ ConsumerFriendlyMessages::ConsumerFriendlyMessages(const Json::Value* value__)
Json::Value ConsumerFriendlyMessages::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("version", version, &result__);
- // According to requirements, it is not necessary to provide this to PTS
- // impl::WriteJsonField("messages", messages, &result__);
+ impl::WriteJsonField("messages", messages, &result__);
return result__;
}
@@ -1425,6 +1426,7 @@ ModuleMeta::ModuleMeta(const Json::Value* value__)
, ccpu_version(impl::ValueMember(value__, "ccpu_version"))
, language(impl::ValueMember(value__, "language"))
, wers_country_code(impl::ValueMember(value__, "wers_country_code"))
+ , hardware_version(impl::ValueMember(value__, "hardware_version"))
, pt_exchanged_at_odometer_x(
impl::ValueMember(value__, "pt_exchanged_at_odometer_x"))
, pt_exchanged_x_days_after_epoch(
@@ -1438,6 +1440,7 @@ Json::Value ModuleMeta::ToJsonValue() const {
impl::WriteJsonField("ccpu_version", ccpu_version, &result__);
impl::WriteJsonField("language", language, &result__);
impl::WriteJsonField("wers_country_code", wers_country_code, &result__);
+ impl::WriteJsonField("hardware_version", hardware_version, &result__);
impl::WriteJsonField(
"pt_exchanged_at_odometer_x", pt_exchanged_at_odometer_x, &result__);
impl::WriteJsonField("pt_exchanged_x_days_after_epoch",
@@ -1463,6 +1466,11 @@ bool ModuleMeta::is_valid() const {
if (!wers_country_code.is_valid()) {
return false;
}
+
+ if (!hardware_version.is_valid()) {
+ return false;
+ }
+
if (!pt_exchanged_at_odometer_x.is_valid()) {
return false;
}
@@ -1493,6 +1501,11 @@ bool ModuleMeta::struct_empty() const {
if (wers_country_code.is_initialized()) {
return false;
}
+
+ if (hardware_version.is_initialized()) {
+ return false;
+ }
+
if (pt_exchanged_at_odometer_x.is_initialized()) {
return false;
}
@@ -1507,6 +1520,7 @@ bool ModuleMeta::struct_empty() const {
if (vin.is_initialized()) {
return false;
}
+
return true;
}
@@ -1524,6 +1538,10 @@ void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const {
wers_country_code.ReportErrors(
&report__->ReportSubobject("wers_country_code"));
}
+ if (!hardware_version.is_valid()) {
+ hardware_version.ReportErrors(
+ &report__->ReportSubobject("hardware_version"));
+ }
if (!pt_exchanged_at_odometer_x.is_valid()) {
pt_exchanged_at_odometer_x.ReportErrors(
&report__->ReportSubobject("pt_exchanged_at_odometer_x"));
@@ -1552,6 +1570,7 @@ void ModuleMeta::SetPolicyTableType(PolicyTableType pt_type) {
ccpu_version.SetPolicyTableType(pt_type);
language.SetPolicyTableType(pt_type);
wers_country_code.SetPolicyTableType(pt_type);
+ hardware_version.SetPolicyTableType(pt_type);
pt_exchanged_at_odometer_x.SetPolicyTableType(pt_type);
pt_exchanged_x_days_after_epoch.SetPolicyTableType(pt_type);
ignition_cycles_since_last_exchange.SetPolicyTableType(pt_type);
@@ -1624,7 +1643,7 @@ AppLevel::AppLevel(const Json::Value* value__)
impl::ValueMember(value__, "count_of_rpcs_sent_in_hmi_none"))
, count_of_removals_for_bad_behavior(
impl::ValueMember(value__, "count_of_removals_for_bad_behavior"))
- , count_of_tls_errors(impl::ValueMember(value__, "count_of_tls_errors"))
+ , count_of_tls_errors(impl::ValueMember(value__, "count_of_TLS_errors"))
, count_of_run_attempts_while_revoked(
impl::ValueMember(value__, "count_of_run_attempts_while_revoked")) {}
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 ea323908c0..26d2124d07 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
@@ -170,18 +170,27 @@ const std::string kCountUnconsentedGroups =
" WHERE (`a`.`functional_group_id` = `f`.`id`"
" AND`f`.`user_consent_prompt` IS NULL))";
-const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
+const std::string kSelectModuleMeta =
+ "SELECT `ccpu_version`, `language`, "
+ "`wers_country_code`, `hardware_version`, `pt_exchanged_at_odometer_x`, "
+ "`pt_exchanged_x_days_after_epoch`, "
+ "`ignition_cycles_since_last_exchange`, `vin` "
+ "FROM `module_meta`";
const std::string kUpdateMetaParams =
"UPDATE `module_meta` SET "
- "`ccpu_version` = ?, `wers_country_code` = ?, `language` = ? ";
+ "`ccpu_version` = ?, `wers_country_code` = ?, `language` = ?";
+
+const std::string kUpdateMetaHardwareVersion =
+ "UPDATE `module_meta` SET `hardware_version` = ? ";
const std::string kUpdateModuleMetaVinParam =
"UPDATE `module_meta` SET `vin` = ? ";
const std::string kSaveModuleMeta =
"UPDATE `module_meta` SET `ccpu_version` = ?, `language` = ?,"
- "`wers_country_code` = ?, `pt_exchanged_at_odometer_x` = ?,"
+ "`wers_country_code` = ?, `hardware_version` = ?, "
+ "`pt_exchanged_at_odometer_x` = ?,"
"`pt_exchanged_x_days_after_epoch` = ?,"
"`ignition_cycles_since_last_exchange` = ?, `vin` = ?";
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 7147e0949d..fc35551808 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
@@ -600,6 +600,22 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
return true;
}
+void SQLPTExtRepresentation::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt_ext::kUpdateMetaHardwareVersion)) {
+ SDL_LOG_WARN("Incorrect statement for insert to module meta.");
+ return;
+ }
+
+ query.Bind(0, hardware_version);
+
+ if (!query.Exec()) {
+ SDL_LOG_WARN("Incorrect insert to module meta.");
+ }
+}
+
bool SQLPTExtRepresentation::IsMetaInfoPresent() {
SDL_LOG_AUTO_TRACE();
utils::dbms::SQLQuery query(db());
@@ -1320,10 +1336,11 @@ void SQLPTExtRepresentation::GatherModuleMeta(
*meta->ccpu_version = query.GetString(0);
*meta->language = query.GetString(1);
*meta->wers_country_code = query.GetString(2);
- *meta->pt_exchanged_at_odometer_x = query.GetInteger(3);
- *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(4);
- *meta->ignition_cycles_since_last_exchange = query.GetInteger(5);
- *meta->vin = query.GetString(6);
+ *meta->hardware_version = query.GetString(3);
+ *meta->pt_exchanged_at_odometer_x = query.GetInteger(4);
+ *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(5);
+ *meta->ignition_cycles_since_last_exchange = query.GetInteger(6);
+ *meta->vin = query.GetString(7);
}
}
@@ -1652,10 +1669,11 @@ bool SQLPTExtRepresentation::SaveModuleMeta(
query.Bind(0, *(meta.ccpu_version));
query.Bind(1, *(meta.language));
query.Bind(2, *(meta.wers_country_code));
- query.Bind(3, odometer);
- query.Bind(4, *(meta.pt_exchanged_x_days_after_epoch));
- query.Bind(5, *(meta.ignition_cycles_since_last_exchange));
- query.Bind(6, *(meta.vin));
+ query.Bind(3, *(meta.hardware_version));
+ query.Bind(4, odometer);
+ query.Bind(5, *(meta.pt_exchanged_x_days_after_epoch));
+ query.Bind(6, *(meta.ignition_cycles_since_last_exchange));
+ query.Bind(7, *(meta.vin));
if (!query.Exec()) {
SDL_LOG_WARN("Incorrect update for module_meta.");
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 9e69d2cef8..c5fc3a9e92 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -59,6 +59,7 @@ const std::string kCreateSchema =
" `ccpu_version` VARCHAR(45), "
" `language` VARCHAR(45), "
" `wers_country_code` VARCHAR(45), "
+ " `hardware_version` VARCHAR(45), "
" `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0, "
" `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, "
" `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, "
@@ -399,8 +400,8 @@ const std::string kCreateSchema =
" ON `endpoint`(`application_id` COLLATE NOCASE); "
/*endpoint properties*/
"CREATE TABLE IF NOT EXISTS `endpoint_properties`( "
- " `service` VARCHAR(100) NOT NULL, "
- " `version` VARCHAR(100) NOT NULL "
+ " `service` VARCHAR(100) PRIMARY KEY NOT NULL, "
+ " `version` VARCHAR(100) "
");"
"CREATE TABLE IF NOT EXISTS `message`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
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 fb605c1fdc..f3eb4e3798 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -535,9 +535,13 @@ void SQLPTRepresentation::GatherModuleConfig(
} else {
while (endpoint_properties.Next()) {
const std::string& service = endpoint_properties.GetString(0);
- const std::string& version = endpoint_properties.GetString(1);
auto& ep_properties = (*config->endpoint_properties);
- *ep_properties[service].version = version;
+ if (!endpoint_properties.IsNull(1)) {
+ const std::string& version = endpoint_properties.GetString(1);
+ *ep_properties[service].version = version;
+ } else {
+ ep_properties[service].version = rpc::Optional<rpc::String<0, 100> >();
+ }
}
}
@@ -1586,7 +1590,9 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
for (auto& endpoint_property : endpoint_properties) {
query.Bind(0, endpoint_property.first);
- query.Bind(1, endpoint_property.second.version);
+ endpoint_property.second.version.is_initialized()
+ ? query.Bind(1, *endpoint_property.second.version)
+ : query.Bind(1);
if (!query.Exec() || !query.Reset()) {
SDL_LOG_WARN(
diff --git a/src/components/policy/policy_external/test/CMakeLists.txt b/src/components/policy/policy_external/test/CMakeLists.txt
index 8f1b8b2539..7a28b2d3c2 100644
--- a/src/components/policy/policy_external/test/CMakeLists.txt
+++ b/src/components/policy/policy_external/test/CMakeLists.txt
@@ -52,6 +52,8 @@ file (GLOB POLICY_TEST_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/policy_manager_impl_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_ext_representation_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_representation_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_representation_storage_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_ext_representation_storage_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/update_status_manager_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/shared_library_test.cc)
diff --git a/src/components/policy/policy_external/test/boostlogconfig.ini b/src/components/policy/policy_external/test/boostlogconfig.ini
new file mode 100644
index 0000000000..5cf35d0e7a
--- /dev/null
+++ b/src/components/policy/policy_external/test/boostlogconfig.ini
@@ -0,0 +1,46 @@
+# Core settings
+[Core]
+DisableLogging=false
+
+# Console Logging (Only ERROR and FATAL messages are logged to console)
+[Sinks.Console]
+DisableLogging=false
+Destination=Console
+Filter="%Severity% >= error"
+Format="%Severity% [%TimeStamp%][%Component%] %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# SDL log file
+[Sinks.AllMessages]
+DisableLogging=false
+Destination=TextFile
+FileName=SmartDeviceLinkCore.log
+Append=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for all SQLPTRepresentation messages
+[Sinks.SQLPTRepresentation]
+DisableLogging=false
+Destination=TextFile
+FileName="SQLRepresentation_%Y-%m-%d.log"
+RotationTimePoint="00:00:00"
+Append=false
+Filter="%Trace% contains SQLPTRepresentation"
+Format="%Severity% [%TimeStamp%] :%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for all PolicyManagerImpl messages
+[Sinks.PolicyManagerImpl]
+DisableLogging=false
+Destination=TextFile
+FileName="PolicyManagerImpl_%Y-%m-%d.log"
+RotationTimePoint="00:00:00"
+Append=false
+Filter="%Trace% contains PolicyManagerImpl"
+Format="%Severity% [%TimeStamp%] :%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
diff --git a/src/components/policy/policy_external/test/cache_manager_test.cc b/src/components/policy/policy_external/test/cache_manager_test.cc
index 746d0c7221..9819811803 100644
--- a/src/components/policy/policy_external/test/cache_manager_test.cc
+++ b/src/components/policy/policy_external/test/cache_manager_test.cc
@@ -2169,6 +2169,18 @@ TEST_F(CacheManagerTest, RemoveAppConsentForGroup_GroupIsRemoved) {
EXPECT_FALSE(unconsented_groups_after_removal.empty());
}
+TEST_F(CacheManagerTest, GetHardwareVersion_ValueWasSetBefore_ReturnValue) {
+ std::string hardware_version = "1.1.1.1";
+ cache_manager_->SetHardwareVersion(hardware_version);
+ EXPECT_EQ(hardware_version, cache_manager_->GetHardwareVersionFromPT());
+}
+
+TEST_F(CacheManagerTest,
+ GetHardwareVersion_ValueNotSettedBefore_ReturnEmptyString) {
+ std::string empty_string = "";
+ EXPECT_EQ(empty_string, cache_manager_->GetHardwareVersionFromPT());
+}
+
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
index b307270b10..f43fedcfab 100644
--- a/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
+++ b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
@@ -105,6 +105,7 @@ class MockPTExtRepresentation : public MockPTRepresentation,
bool(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& vin));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_METHOD0(IsMetaInfoPresent, bool());
MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
MOCK_METHOD0(GetKmFromSuccessfulExchange, int());
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json
index c949575190..087da1e93b 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json
@@ -56,12 +56,6 @@
"textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny."
},
- "en-ie" :
- {
- "line1" : "Grant requested",
- "line2" : "permission(s)?",
- "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
- },
"en-us" :
{
"line1" : "Grant Requested",
@@ -69,13 +63,6 @@
"textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.",
"tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny."
},
- "es-en" :
- {
- "line1" : "¿Otorgar permiso(s)",
- "line2" : "solicitado(s)?",
- "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.",
- "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
- },
"es-es" :
{
"line1" : "¿Conceder permisos",
@@ -180,18 +167,10 @@
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
},
- "en-ie" :
- {
- "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
"en-us" :
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en" :
- {
- "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es" :
{
"tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
@@ -266,18 +245,10 @@
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "en-ie" :
- {
- "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
"en-us" :
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en" :
- {
- "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es" :
{
"tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
@@ -356,23 +327,12 @@
"textBody" : "This version of %appName% is not authorized and will not work with SYNC.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "en-ie" :
- {
- "line1" : "not authorized",
- "tts" : "This version of %appName% is not authorized and will not work with SYNC."
- },
"en-us" :
{
"line1" : "Not Authorized",
"textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "es-en" :
- {
- "line1" : "no autorizada",
- "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es" :
{
"line1" : "No autorizada",
@@ -467,23 +427,12 @@
"textBody" : "This version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "en-ie" :
- {
- "line1" : "not supported",
- "tts" : "This version of %appName% is not supported by SYNC."
- },
"en-us" :
{
"line1" : "Not Supported",
"textBody" : "Your version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "es-en" :
- {
- "line1" : "no compatible",
- "textBody" : "Esta versión de %appName% no es compatible con SYNC.",
- "tts" : "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es" :
{
"line1" : "No compatible",
@@ -623,12 +572,6 @@
"textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
"tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
},
- "en-ie" :
- {
- "line1" : "Disable auto-updates",
- "line2" : "and Mobile Apps?",
- "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
"en-us" :
{
"line1" : "Disable Auto-Updates",
@@ -636,13 +579,6 @@
"textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.",
"tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
},
- "es-en" :
- {
- "line1" : "¿Deshab. actualiz.",
- "line2" : "autom. y aplic. móv.?",
- "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es" :
{
"line1" : "¿Desact. actual. auto",
@@ -751,23 +687,12 @@
"textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
"tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
},
- "en-ie" :
- {
- "label" : "Driving characteristics",
- "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
"en-us" :
{
"label" : "Driving Characteristics",
"textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.",
"tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM."
},
- "es-en" :
- {
- "label" : "Características del manejo",
- "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es" :
{
"label" : "Características de conducción",
@@ -863,23 +788,12 @@
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "en-ie" :
- {
- "label" : "GPS and speed",
- "tts" : "An app can access vehicle GPS and speed."
- },
"en-us" :
{
"label" : "GPS and Speed",
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "es-en" :
- {
- "label" : "GPS y velocidad",
- "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es" :
{
"label" : "GPS y velocidad",
@@ -974,23 +888,12 @@
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "en-ie" :
- {
- "label" : "Push notifications",
- "tts" : "An app can send notifications when running in the background."
- },
"en-us" :
{
"label" : "Push Notifications",
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "es-en" :
- {
- "label" : "Notificaciones tipo Push",
- "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es" :
{
"label" : "Notificaciones push",
@@ -1100,20 +1003,11 @@
{
"line1" : "Disable updates"
},
- "en-ie" :
- {
- "line1" : "Disable updates"
- },
"en-us" :
{
"line1" : "Disable Updates",
"textBody" : "Disable Updates"
},
- "es-en" :
- {
- "line1" : "Deshab. actual.",
- "textBody" : "Deshab. actual."
- },
"es-es" :
{
"line1" : "Desact. actual."
@@ -1190,18 +1084,10 @@
{
"line1" : "Enable Apps"
},
- "en-ie" :
- {
- "line1" : "Enable Apps"
- },
"en-us" :
{
"line1" : "Enable Apps"
},
- "es-en" :
- {
- "line1" : "Hab. aplic."
- },
"es-es" :
{
"line1" : "Activar apl."
@@ -1277,20 +1163,11 @@
{
"line1" : "Request update"
},
- "en-ie" :
- {
- "line1" : "Request update"
- },
"en-us" :
{
"line1" : "Request Update",
"textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
},
- "es-en" :
- {
- "line1" : "Solicit. actualiz.",
- "textBody" : "Solicit. actualiz."
- },
"es-es" :
{
"line1" : "Solicitar actual."
@@ -1368,20 +1245,11 @@
"line1" : "Update needed",
"textBody" : "Update needed"
},
- "en-ie" :
- {
- "line1" : "Update needed"
- },
"en-us" :
{
"line1" : "Update Needed",
"textBody" : "Update Needed"
},
- "es-en" :
- {
- "line1" : "Actualiz. neces.",
- "textBody" : "Actualiz. neces."
- },
"es-es" :
{
"line1" : "Actu. necesaria"
@@ -1459,20 +1327,11 @@
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "en-ie" :
- {
- "line1" : "Updating..."
- },
"en-us" :
{
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "es-en" :
- {
- "line1" : "Actualizando...",
- "textBody" : "Actualizando..."
- },
"es-es" :
{
"line1" : "Actualizando..."
@@ -1550,20 +1409,11 @@
"line1" : "Up-to-date",
"textBody" : "Up-to-date"
},
- "en-ie" :
- {
- "line1" : "Up-to-date"
- },
"en-us" :
{
"line1" : "Up-To-Date",
"textBody" : "Up-To-Date"
},
- "es-en" :
- {
- "line1" : "Actualizado",
- "textBody" : "Actualizado"
- },
"es-es" :
{
"line1" : "Actualizada"
@@ -1644,23 +1494,12 @@
"textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
"tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
},
- "en-ie" :
- {
- "label" : "Vehicle information",
- "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
- },
"en-us" :
{
"label" : "Vehicle Information",
"textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.",
"tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure."
},
- "es-en" :
- {
- "label" : "Información del vehículo",
- "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es" :
{
"label" : "Información del vehículo",
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json
index 81c2093c72..43c16f18b8 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json
@@ -56,12 +56,6 @@
"textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny."
},
- "en-ie" :
- {
- "line1" : "Grant requested",
- "line2" : "permission(s)?",
- "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
- },
"en-us" :
{
"line1" : "Grant Requested",
@@ -69,13 +63,6 @@
"textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.",
"tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny."
},
- "es-en" :
- {
- "line1" : "¿Otorgar permiso(s)",
- "line2" : "solicitado(s)?",
- "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.",
- "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
- },
"es-es" :
{
"line1" : "¿Conceder permisos",
@@ -180,18 +167,10 @@
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
},
- "en-ie" :
- {
- "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
"en-us" :
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en" :
- {
- "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es" :
{
"tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
@@ -266,18 +245,10 @@
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "en-ie" :
- {
- "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
"en-us" :
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en" :
- {
- "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es" :
{
"tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
@@ -356,23 +327,12 @@
"textBody" : "This version of %appName% is not authorized and will not work with SYNC.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "en-ie" :
- {
- "line1" : "not authorized",
- "tts" : "This version of %appName% is not authorized and will not work with SYNC."
- },
"en-us" :
{
"line1" : "Not Authorized",
"textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "es-en" :
- {
- "line1" : "no autorizada",
- "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es" :
{
"line1" : "No autorizada",
@@ -467,23 +427,12 @@
"textBody" : "This version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "en-ie" :
- {
- "line1" : "not supported",
- "tts" : "This version of %appName% is not supported by SYNC."
- },
"en-us" :
{
"line1" : "Not Supported",
"textBody" : "Your version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "es-en" :
- {
- "line1" : "no compatible",
- "textBody" : "Esta versión de %appName% no es compatible con SYNC.",
- "tts" : "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es" :
{
"line1" : "No compatible",
@@ -623,12 +572,6 @@
"textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
"tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
},
- "en-ie" :
- {
- "line1" : "Disable auto-updates",
- "line2" : "and Mobile Apps?",
- "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
"en-us" :
{
"line1" : "Disable Auto-Updates",
@@ -636,13 +579,6 @@
"textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.",
"tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
},
- "es-en" :
- {
- "line1" : "¿Deshab. actualiz.",
- "line2" : "autom. y aplic. móv.?",
- "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es" :
{
"line1" : "¿Desact. actual. auto",
@@ -751,23 +687,12 @@
"textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
"tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
},
- "en-ie" :
- {
- "label" : "Driving characteristics",
- "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
"en-us" :
{
"label" : "Driving Characteristics",
"textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.",
"tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM."
},
- "es-en" :
- {
- "label" : "Características del manejo",
- "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es" :
{
"label" : "Características de conducción",
@@ -863,23 +788,12 @@
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "en-ie" :
- {
- "label" : "GPS and speed",
- "tts" : "An app can access vehicle GPS and speed."
- },
"en-us" :
{
"label" : "GPS and Speed",
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "es-en" :
- {
- "label" : "GPS y velocidad",
- "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es" :
{
"label" : "GPS y velocidad",
@@ -974,23 +888,12 @@
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "en-ie" :
- {
- "label" : "Push notifications",
- "tts" : "An app can send notifications when running in the background."
- },
"en-us" :
{
"label" : "Push Notifications",
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "es-en" :
- {
- "label" : "Notificaciones tipo Push",
- "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es" :
{
"label" : "Notificaciones push",
@@ -1100,20 +1003,11 @@
{
"line1" : "Disable updates"
},
- "en-ie" :
- {
- "line1" : "Disable updates"
- },
"en-us" :
{
"line1" : "Disable Updates",
"textBody" : "Disable Updates"
},
- "es-en" :
- {
- "line1" : "Deshab. actual.",
- "textBody" : "Deshab. actual."
- },
"es-es" :
{
"line1" : "Desact. actual."
@@ -1190,18 +1084,10 @@
{
"line1" : "Enable Apps"
},
- "en-ie" :
- {
- "line1" : "Enable Apps"
- },
"en-us" :
{
"line1" : "Enable Apps"
},
- "es-en" :
- {
- "line1" : "Hab. aplic."
- },
"es-es" :
{
"line1" : "Activar apl."
@@ -1277,20 +1163,11 @@
{
"line1" : "Request update"
},
- "en-ie" :
- {
- "line1" : "Request update"
- },
"en-us" :
{
"line1" : "Request Update",
"textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
},
- "es-en" :
- {
- "line1" : "Solicit. actualiz.",
- "textBody" : "Solicit. actualiz."
- },
"es-es" :
{
"line1" : "Solicitar actual."
@@ -1368,20 +1245,11 @@
"line1" : "Update needed",
"textBody" : "Update needed"
},
- "en-ie" :
- {
- "line1" : "Update needed"
- },
"en-us" :
{
"line1" : "Update Needed",
"textBody" : "Update Needed"
},
- "es-en" :
- {
- "line1" : "Actualiz. neces.",
- "textBody" : "Actualiz. neces."
- },
"es-es" :
{
"line1" : "Actu. necesaria"
@@ -1459,20 +1327,11 @@
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "en-ie" :
- {
- "line1" : "Updating..."
- },
"en-us" :
{
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "es-en" :
- {
- "line1" : "Actualizando...",
- "textBody" : "Actualizando..."
- },
"es-es" :
{
"line1" : "Actualizando..."
@@ -1550,20 +1409,11 @@
"line1" : "Up-to-date",
"textBody" : "Up-to-date"
},
- "en-ie" :
- {
- "line1" : "Up-to-date"
- },
"en-us" :
{
"line1" : "Up-To-Date",
"textBody" : "Up-To-Date"
},
- "es-en" :
- {
- "line1" : "Actualizado",
- "textBody" : "Actualizado"
- },
"es-es" :
{
"line1" : "Actualizada"
@@ -1644,23 +1494,12 @@
"textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
"tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
},
- "en-ie" :
- {
- "label" : "Vehicle information",
- "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
- },
"en-us" :
{
"label" : "Vehicle Information",
"textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.",
"tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure."
},
- "es-en" :
- {
- "label" : "Información del vehículo",
- "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es" :
{
"label" : "Información del vehículo",
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 4d39e699b5..95fc783b2d 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
@@ -66,6 +66,7 @@ const int kServiceTypeInt = 0;
const std::string kDeviceNumber = "XXX123456789ZZZ";
const std::string kAppStorageFolder = "app_storage_folder";
const std::string kValidAppId = "1234";
+const std::vector<std::string> kDevices{kDeviceNumber};
} // namespace
class PolicyManagerImplTest : public ::testing::Test {
@@ -88,6 +89,7 @@ class PolicyManagerImplTest : public ::testing::Test {
ON_CALL(policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
+ ON_CALL(listener_, GetDevicesIds(_)).WillByDefault(Return(kDevices));
}
::testing::AssertionResult IsValid(const policy_table::Table& table) {
diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc
index 1ceb5ea1ef..09df17beb2 100644
--- a/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_storage_test.cc
@@ -38,8 +38,6 @@
#include "policy/mock_policy_settings.h"
#include "sqlite_wrapper/sql_query.h"
#include "utils/file_system.h"
-#include "utils/make_shared.h"
-#include "utils/shared_ptr.h"
using namespace ::policy;
diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
index 97613550f2..58f526d7d3 100644
--- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
@@ -38,12 +38,14 @@
#include <utility>
#include <vector>
#include "gtest/gtest.h"
+#include "json/reader.h"
#include "policy/mock_policy_settings.h"
#include "policy/policy_table/types.h"
#include "rpc_base/rpc_base.h"
#include "sqlite_wrapper/sql_query.h"
#include "utils/file_system.h"
#include "utils/gen_hash.h"
+#include "utils/jsoncpp_reader_wrapper.h"
using namespace ::policy;
namespace policy_table = rpc::policy_table_interface_base;
@@ -57,6 +59,44 @@ namespace test {
namespace components {
namespace policy_test {
+namespace {
+const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json";
+const std::string kHardwareVersion = "1.1.1.0";
+const std::string kSoftwareVersion = "4.1.3.B_EB355B";
+const std::string kWersCountryCode = "WAEGB";
+const std::string kLanguage = "EN-US";
+const std::string kFunctionalGroupWithParams = "Location-1";
+const std::string kUserConsentForGroupWithParams = "Location";
+const std::string kRpcForGroupWithParams = "GetVehicleData";
+} // namespace
+
+policy_table::Table LoadPreloadedPT(const std::string& filename) {
+ std::ifstream ifile(filename);
+ EXPECT_TRUE(ifile.good());
+ Json::CharReaderBuilder reader_builder;
+ Json::Value root(Json::objectValue);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
+ root["policy_table"]["module_config"].removeMember("preloaded_pt");
+ ifile.close();
+ policy_table::Table table(&root);
+ return table;
+}
+
+Json::Value GetDefaultSnapshotModuleMeta(policy_table::Table& policy_table) {
+ auto json_table = policy_table.ToJsonValue();
+
+ Json::Value default_module_meta = json_table["policy_table"]["module_meta"];
+ default_module_meta["ccpu_version"] = Json::Value("");
+ default_module_meta["hardware_version"] = Json::Value("");
+ default_module_meta["language"] = Json::Value("");
+ default_module_meta["wers_country_code"] = Json::Value("");
+ default_module_meta["pt_exchanged_at_odometer_x"] = Json::Value(0);
+ default_module_meta["pt_exchanged_x_days_after_epoch"] = Json::Value(0);
+ default_module_meta["ignition_cycles_since_last_exchange"] = Json::Value(0);
+ default_module_meta["vin"] = Json::Value("");
+ return default_module_meta;
+}
+
class SQLPTExtRepresentationTest : public ::testing::Test {
public:
// Collection of pairs of group alias and corresponding group name
@@ -264,163 +304,147 @@ SQLPTExtRepresentationTest::GetDataInternal(
}
TEST_F(SQLPTExtRepresentationTest,
- DISABLED_GenerateSnapshot_SetPolicyTable_SnapshotIsPresent) {
- // TODO(AKutsan): APPLINK-31526 Test requires initial preloaded pt for
- // preloaded date reading
- // Arrange
- Json::Value table(Json::objectValue);
- table["policy_table"] = Json::Value(Json::objectValue);
+ GenerateSnapshot_DefaultContentOfModuleMeta_MetaInfoPresentInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
- Json::Value& policy_table = table["policy_table"];
- policy_table["module_config"] = Json::Value(Json::objectValue);
- policy_table["functional_groupings"] = Json::Value(Json::objectValue);
- policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue);
- policy_table["app_policies"] = Json::Value(Json::objectValue);
-
- Json::Value& module_config = policy_table["module_config"];
- module_config["preloaded_date"] = Json::Value("");
- module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
- module_config["exchange_after_x_kilometers"] = Json::Value(100);
- module_config["exchange_after_x_days"] = Json::Value(5);
- module_config["timeout_after_x_seconds"] = Json::Value(500);
- module_config["seconds_between_retries"] = Json::Value(Json::arrayValue);
- module_config["seconds_between_retries"][0] = Json::Value(10);
- module_config["seconds_between_retries"][1] = Json::Value(20);
- module_config["seconds_between_retries"][2] = Json::Value(30);
- module_config["endpoints"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue);
- module_config["endpoints"]["0x00"]["default"][0] =
- Json::Value("http://ford.com/cloud/default");
- module_config["notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(1);
- module_config["notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(2);
- module_config["notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(3);
- module_config["notifications_per_minute_by_priority"]["communication"] =
- Json::Value(4);
- module_config["notifications_per_minute_by_priority"]["normal"] =
- Json::Value(5);
- module_config["notifications_per_minute_by_priority"]["none"] =
- Json::Value(6);
- module_config["subtle_notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["subtle_notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(7);
- module_config["subtle_notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(8);
- module_config["subtle_notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(9);
- module_config["subtle_notifications_per_minute_by_priority"]
- ["communication"] = Json::Value(10);
- module_config["subtle_notifications_per_minute_by_priority"]["normal"] =
- Json::Value(11);
- module_config["subtle_notifications_per_minute_by_priority"]["none"] =
- Json::Value(12);
- module_config["vehicle_make"] = Json::Value("MakeT");
- module_config["vehicle_model"] = Json::Value("ModelT");
- module_config["vehicle_year"] = Json::Value("2014");
- module_config["certificate"] = Json::Value("my_cert");
+ ASSERT_TRUE(IsValid(update));
+ EXPECT_TRUE(reps_->Save(update));
- Json::Value& functional_groupings = policy_table["functional_groupings"];
- functional_groupings["default"] = Json::Value(Json::objectValue);
- Json::Value& default_group = functional_groupings["default"];
- default_group["rpcs"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL");
- default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed");
-
- Json::Value& consumer_friendly_messages =
- policy_table["consumer_friendly_messages"];
- consumer_friendly_messages["version"] = Json::Value("1.2");
- consumer_friendly_messages["messages"] = Json::Value(Json::objectValue);
- consumer_friendly_messages["messages"]["MSG1"] =
- Json::Value(Json::objectValue);
- Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG1"];
- msg1["languages"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"]["tts"] = Json::Value("TTS message");
- msg1["languages"]["en-us"]["label"] = Json::Value("LABEL message");
- msg1["languages"]["en-us"]["line1"] = Json::Value("LINE1 message");
- msg1["languages"]["en-us"]["line2"] = Json::Value("LINE2 message");
- msg1["languages"]["en-us"]["textBody"] = Json::Value("TEXTBODY message");
-
- Json::Value& app_policies = policy_table["app_policies"];
- app_policies["default"] = Json::Value(Json::objectValue);
- app_policies["default"]["memory_kb"] = Json::Value(50);
- app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["default"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["default"]["groups"][0] = Json::Value("default");
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["default_hmi"] = Json::Value("FULL");
- app_policies["default"]["keep_context"] = Json::Value(true);
- app_policies["default"]["steal_focus"] = Json::Value(true);
- app_policies["pre_DataConsent"] = Json::Value(Json::objectValue);
- app_policies["pre_DataConsent"]["memory_kb"] = Json::Value(50);
- app_policies["pre_DataConsent"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["pre_DataConsent"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["pre_DataConsent"]["groups"][0] = Json::Value("default");
- app_policies["pre_DataConsent"]["priority"] = Json::Value("EMERGENCY");
- app_policies["pre_DataConsent"]["default_hmi"] = Json::Value("FULL");
- app_policies["pre_DataConsent"]["keep_context"] = Json::Value(true);
- app_policies["pre_DataConsent"]["steal_focus"] = Json::Value(true);
- app_policies["1234"] = Json::Value(Json::objectValue);
- app_policies["1234"]["memory_kb"] = Json::Value(50);
- app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["1234"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["1234"]["groups"][0] = Json::Value("default");
- app_policies["1234"]["priority"] = Json::Value("EMERGENCY");
- app_policies["1234"]["default_hmi"] = Json::Value("FULL");
- app_policies["1234"]["keep_context"] = Json::Value(true);
- app_policies["1234"]["steal_focus"] = Json::Value(true);
- app_policies["device"] = Json::Value(Json::objectValue);
- app_policies["device"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["device"]["groups"][0] = Json::Value("default");
- app_policies["device"]["priority"] = Json::Value("EMERGENCY");
- app_policies["device"]["default_hmi"] = Json::Value("FULL");
- app_policies["device"]["keep_context"] = Json::Value(true);
- app_policies["device"]["steal_focus"] = Json::Value(true);
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
+ std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot();
+
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
+}
+
+TEST_F(
+ SQLPTExtRepresentationTest,
+ GenerateSnapshot_SetMandatoryMetaInfo_MandatoryMetaInfoIsPresentInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
- // Assert
ASSERT_TRUE(IsValid(update));
ASSERT_TRUE(reps_->Save(update));
- // Act
+ EXPECT_TRUE(
+ reps_->SetMetaInfo(kSoftwareVersion, kWersCountryCode, kLanguage));
+
std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot();
- snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
- policy_table["module_meta"] = Json::Value(Json::objectValue);
- policy_table["usage_and_error_counts"] = Json::Value(Json::objectValue);
- policy_table["device_data"] = Json::Value(Json::objectValue);
- policy_table["module_config"]["preloaded_pt"] = Json::Value(false);
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ expected_module_meta["ccpu_version"] = Json::Value(kSoftwareVersion);
+ expected_module_meta["language"] = Json::Value(kLanguage);
+ expected_module_meta["wers_country_code"] = Json::Value(kWersCountryCode);
- Json::Value& module_meta = policy_table["module_meta"];
- module_meta["ccpu_version"] = Json::Value("");
- module_meta["language"] = Json::Value("");
- module_meta["wers_country_code"] = Json::Value("");
- module_meta["pt_exchanged_at_odometer_x"] = Json::Value(0);
- module_meta["pt_exchanged_x_days_after_epoch"] = Json::Value(0);
- module_meta["ignition_cycles_since_last_exchange"] = Json::Value(0);
- module_meta["vin"] = Json::Value("");
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
+}
- Json::Value& usage_and_error_counts = policy_table["usage_and_error_counts"];
- usage_and_error_counts["count_of_iap_buffer_full"] = Json::Value(0);
- usage_and_error_counts["count_sync_out_of_memory"] = Json::Value(0);
- usage_and_error_counts["count_of_sync_reboots"] = Json::Value(0);
+TEST_F(SQLPTExtRepresentationTest,
+ GenerateSnapshot_SetHardwareVersion_HardwareVersionIsPresentInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
- policy_table::Table expected(&table);
+ ASSERT_TRUE(IsValid(update));
+ EXPECT_TRUE(reps_->Save(update));
- // Assert
- EXPECT_EQ(expected.ToJsonValue().toStyledString(),
- snapshot->ToJsonValue().toStyledString());
+ reps_->SetHardwareVersion(kHardwareVersion);
+ std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot();
+
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ expected_module_meta["hardware_version"] = Json::Value(kHardwareVersion);
+
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
+}
+
+TEST_F(SQLPTExtRepresentationTest, Save_ParametersPresent_ParametersSaved) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
+ ASSERT_TRUE(IsValid(update));
+
+ policy_table::FunctionalGroupings func_groups;
+ ASSERT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+ EXPECT_TRUE(func_groups.empty());
+
+ EXPECT_TRUE(reps_->Save(update));
+ ASSERT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+
+ policy_table::FunctionalGroupings::iterator func_groups_iter =
+ func_groups.find(kFunctionalGroupWithParams);
+ ASSERT_TRUE(func_groups.end() != func_groups_iter);
+ policy_table::Rpcs& rpcs = func_groups_iter->second;
+ EXPECT_EQ(kUserConsentForGroupWithParams,
+ static_cast<std::string>(*rpcs.user_consent_prompt));
+ policy_table::Rpc& rpc = rpcs.rpcs;
+ policy_table::Rpc::const_iterator rpc_iter = rpc.find(kRpcForGroupWithParams);
+ EXPECT_TRUE(rpc.end() != rpc_iter);
+ const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
+ EXPECT_TRUE(!parameters.empty());
+}
+
+TEST_F(SQLPTExtRepresentationTest, Save_NoParameters_NoParametersSaved) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
+ ASSERT_TRUE(IsValid(update));
+
+ policy_table::FunctionalGroupings func_groups;
+ ASSERT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+ EXPECT_TRUE(func_groups.empty());
+
+ EXPECT_TRUE(reps_->Save(update));
+ ASSERT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+
+ const std::string func_group_without_params = "Notifications";
+ const std::string user_consent = "Notifications";
+ const std::string rpc_without_params = "Alert";
+
+ policy_table::FunctionalGroupings::iterator func_groups_iter =
+ func_groups.find(func_group_without_params);
+ ASSERT_TRUE(func_groups.end() != func_groups_iter);
+ policy_table::Rpcs& rpcs = func_groups_iter->second;
+ EXPECT_EQ(user_consent, static_cast<std::string>(*rpcs.user_consent_prompt));
+ policy_table::Rpc& rpc = rpcs.rpcs;
+ EXPECT_EQ(1u, rpc.size());
+ policy_table::Rpc::const_iterator rpc_iter = rpc.find(rpc_without_params);
+ EXPECT_TRUE(rpc.end() != rpc_iter);
+ // Check parameters
+ const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
+ EXPECT_FALSE(parameters.is_initialized());
+ EXPECT_TRUE(parameters.empty());
+}
+
+TEST_F(SQLPTExtRepresentationTest, Save_EmptyParameters_ParametersEmpty) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
+ ASSERT_TRUE(IsValid(update));
+
+ policy_table::FunctionalGroupings func_groups;
+ EXPECT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+ EXPECT_TRUE(func_groups.empty());
+
+ auto json_update = update.ToJsonValue();
+ json_update["policy_table"]["functional_groupings"]
+ [kFunctionalGroupWithParams]["rpcs"][kRpcForGroupWithParams]
+ ["parameters"] = Json::Value(Json::arrayValue);
+ policy_table::Table update_with_empty_param(&json_update);
+
+ EXPECT_TRUE(reps_->Save(update_with_empty_param));
+ EXPECT_TRUE(reps_->GetFunctionalGroupings(func_groups));
+
+ policy_table::FunctionalGroupings::iterator func_groups_iter =
+ func_groups.find(kFunctionalGroupWithParams);
+ ASSERT_TRUE(func_groups.end() != func_groups_iter);
+ policy_table::Rpcs& rpcs = func_groups_iter->second;
+ EXPECT_EQ(kUserConsentForGroupWithParams,
+ static_cast<std::string>(*rpcs.user_consent_prompt));
+ policy_table::Rpc& rpc = rpcs.rpcs;
+ policy_table::Rpc::const_iterator rpc_iter = rpc.find(kRpcForGroupWithParams);
+ EXPECT_TRUE(rpc.end() != rpc_iter);
+ // Check parameters
+ const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
+ // 'parameters' : [] - represented as initialized, but empty
+ // missing 'parameters' - represented as non-initialized and empty
+ EXPECT_TRUE(parameters.is_initialized());
+ EXPECT_TRUE(parameters.empty());
}
TEST_F(
@@ -1159,7 +1183,8 @@ TEST_F(
TEST_F(SQLPTExtRepresentationTest,
SetMetaInfo_SetMetaInfo_ExpectValuesSetInParams) {
// Arrange
- ASSERT_TRUE(reps_->SetMetaInfo("4.1.3.B_EB355B", "WAEGB", "ru-ru"));
+ ASSERT_TRUE(
+ reps_->SetMetaInfo(kSoftwareVersion, kWersCountryCode, kLanguage));
utils::dbms::SQLQuery query(reps_->db());
const std::string query_select_ccpu =
"SELECT `ccpu_version` FROM `module_meta`";
@@ -1171,13 +1196,13 @@ TEST_F(SQLPTExtRepresentationTest,
// Assert
query.Prepare(query_select_ccpu);
query.Next();
- EXPECT_EQ("4.1.3.B_EB355B", query.GetString(0));
+ EXPECT_EQ(kSoftwareVersion, query.GetString(0));
query.Prepare(query_select_wers_country_code);
query.Next();
- EXPECT_EQ("WAEGB", query.GetString(0));
+ EXPECT_EQ(kWersCountryCode, query.GetString(0));
query.Prepare(query_select_language);
query.Next();
- EXPECT_EQ("ru-ru", query.GetString(0));
+ EXPECT_EQ(kLanguage, query.GetString(0));
}
TEST_F(SQLPTExtRepresentationTest,
@@ -1203,6 +1228,17 @@ TEST_F(SQLPTExtRepresentationTest,
EXPECT_EQ("ru-ru", query.GetString(0));
}
+TEST_F(SQLPTExtRepresentationTest, SetHardwareVersion_ValueIsSetInModuleMeta) {
+ utils::dbms::SQLQuery query(reps_->db());
+ reps_->SetHardwareVersion(kHardwareVersion);
+ const std::string query_select_hardware_version =
+ "SELECT `hardware_version` FROM `module_meta`";
+
+ query.Prepare(query_select_hardware_version);
+ query.Next();
+ EXPECT_EQ(kHardwareVersion, query.GetString(0));
+}
+
TEST_F(
SQLPTExtRepresentationTest,
GetFunctionalGroupNames_SetGroupsManuallyThenGetGroupNames_ExpectAllGroupsReceived) {
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 224c663c52..548b6f3666 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
@@ -48,7 +48,6 @@
#include "policy/sql_wrapper.h"
#include "rpc_base/rpc_base.h"
#include "utils/file_system.h"
-#include "utils/system.h"
namespace policy_table = rpc::policy_table_interface_base;
using policy::CheckPermissionResult;
@@ -188,150 +187,6 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
StringsCompare(groups, app_groups);
}
- void PolicyTableUpdatePrepare(Json::Value& table) {
- PolicyTableUpdatePrepareNoParameters(table);
-
- table["policy_table"]["functional_groupings"]["default"]["rpcs"]["Update"]
- ["parameters"] = Json::Value(Json::arrayValue);
- table["policy_table"]["functional_groupings"]["default"]["rpcs"]["Update"]
- ["parameters"][0] = Json::Value("speed");
- }
-
- void PolicyTableUpdatePrepareEmptyParameters(Json::Value& table) {
- PolicyTableUpdatePrepareNoParameters(table);
-
- // Parameters are empty
- table["policy_table"]["functional_groupings"]["default"]["rpcs"]["Update"]
- ["parameters"] = Json::Value(Json::arrayValue);
- }
-
- void PolicyTableUpdatePrepareNoParameters(Json::Value& table) {
- table["policy_table"] = Json::Value(Json::objectValue);
- Json::Value& policy_table = table["policy_table"];
- policy_table["module_config"] = Json::Value(Json::objectValue);
- policy_table["functional_groupings"] = Json::Value(Json::objectValue);
- policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue);
- policy_table["app_policies"] = Json::Value(Json::objectValue);
-
- Json::Value& module_config = policy_table["module_config"];
- module_config["preloaded_date"] = Json::Value("25-04-2015");
- module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
- module_config["exchange_after_x_kilometers"] = Json::Value(100);
- module_config["exchange_after_x_days"] = Json::Value(5);
- module_config["timeout_after_x_seconds"] = Json::Value(500);
- module_config["seconds_between_retries"] = Json::Value(Json::arrayValue);
- Json::Value& seconds_between_retries =
- module_config["seconds_between_retries"];
- seconds_between_retries[0] = Json::Value(10);
- seconds_between_retries[1] = Json::Value(20);
- seconds_between_retries[2] = Json::Value(30);
- module_config["endpoints"] = Json::Value(Json::objectValue);
- Json::Value& endpoins = module_config["endpoints"];
- endpoins["0x00"] = Json::Value(Json::objectValue);
- endpoins["0x00"]["default"] = Json::Value(Json::arrayValue);
- endpoins["0x00"]["default"][0] =
- Json::Value("http://ford.com/cloud/default");
- module_config["notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(1);
- module_config["notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(2);
- module_config["notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(3);
- module_config["notifications_per_minute_by_priority"]["communication"] =
- Json::Value(4);
- module_config["notifications_per_minute_by_priority"]["normal"] =
- Json::Value(5);
- module_config["notifications_per_minute_by_priority"]["none"] =
- Json::Value(6);
- module_config["subtle_notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["subtle_notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(7);
- module_config["subtle_notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(8);
- module_config["subtle_notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(9);
- module_config["subtle_notifications_per_minute_by_priority"]
- ["communication"] = Json::Value(10);
- module_config["subtle_notifications_per_minute_by_priority"]["normal"] =
- Json::Value(11);
- module_config["subtle_notifications_per_minute_by_priority"]["none"] =
- Json::Value(12);
- module_config["vehicle_make"] = Json::Value("MakeT");
- module_config["vehicle_model"] = Json::Value("ModelT");
- module_config["vehicle_year"] = Json::Value("2014");
- module_config["certificate"] = Json::Value("my_cert");
-
- Json::Value& functional_groupings = policy_table["functional_groupings"];
- functional_groupings["default"] = Json::Value(Json::objectValue);
- Json::Value& default_group = functional_groupings["default"];
- default_group["rpcs"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"]["hmi_levels"] =
- Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL");
- // No parameters
-
- Json::Value& consumer_friendly_messages =
- policy_table["consumer_friendly_messages"];
- consumer_friendly_messages["version"] = Json::Value("1.2");
- consumer_friendly_messages["messages"] = Json::Value(Json::objectValue);
- consumer_friendly_messages["messages"]["MSG1"] =
- Json::Value(Json::objectValue);
- Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG1"];
- msg1["languages"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"]["tts"] = Json::Value("TTS message");
- msg1["languages"]["en-us"]["label"] = Json::Value("LABEL message");
- msg1["languages"]["en-us"]["line1"] = Json::Value("LINE1 message");
- msg1["languages"]["en-us"]["line2"] = Json::Value("LINE2 message");
- msg1["languages"]["en-us"]["textBody"] = Json::Value("TEXTBODY message");
-
- Json::Value& app_policies = policy_table["app_policies"];
- app_policies["default"] = Json::Value(Json::objectValue);
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["memory_kb"] = Json::Value(50);
- app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["default"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["default"]["groups"][0] = Json::Value("default");
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["is_revoked"] = Json::Value(true);
- app_policies["default"]["default_hmi"] = Json::Value("FULL");
- app_policies["default"]["keep_context"] = Json::Value(true);
- app_policies["default"]["steal_focus"] = Json::Value(true);
-
- app_policies["pre_DataConsent"] = Json::Value(Json::objectValue);
- app_policies["pre_DataConsent"]["memory_kb"] = Json::Value(40);
- app_policies["pre_DataConsent"]["heart_beat_timeout_ms"] = Json::Value(90);
- app_policies["pre_DataConsent"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["pre_DataConsent"]["groups"][0] = Json::Value("default");
- app_policies["pre_DataConsent"]["priority"] = Json::Value("EMERGENCY");
- app_policies["pre_DataConsent"]["default_hmi"] = Json::Value("FULL");
- app_policies["pre_DataConsent"]["is_revoked"] = Json::Value(false);
- app_policies["pre_DataConsent"]["keep_context"] = Json::Value(true);
- app_policies["pre_DataConsent"]["steal_focus"] = Json::Value(true);
- app_policies["1234"] = Json::Value(Json::objectValue);
- app_policies["1234"]["memory_kb"] = Json::Value(150);
- app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(200);
- app_policies["1234"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["1234"]["groups"][0] = Json::Value("default");
- app_policies["1234"]["priority"] = Json::Value("EMERGENCY");
- app_policies["1234"]["default_hmi"] = Json::Value("FULL");
- app_policies["1234"]["is_revoked"] = Json::Value(true);
- app_policies["1234"]["keep_context"] = Json::Value(false);
- app_policies["1234"]["steal_focus"] = Json::Value(false);
- app_policies["device"] = Json::Value(Json::objectValue);
- app_policies["device"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["device"]["groups"][0] = Json::Value("default");
- app_policies["device"]["priority"] = Json::Value("EMERGENCY");
- app_policies["device"]["is_revoked"] = Json::Value(true);
- app_policies["device"]["default_hmi"] = Json::Value("FULL");
- app_policies["device"]["keep_context"] = Json::Value(true);
- app_policies["device"]["steal_focus"] = Json::Value(true);
- }
-
::testing::AssertionResult IsValid(const policy_table::Table& table) {
if (table.is_valid()) {
return ::testing::AssertionSuccess();
@@ -1633,304 +1488,6 @@ TEST(SQLPTRepresentationTest3, RemoveDB_RemoveDB_ExpectFileDeleted) {
EXPECT_FALSE(file_system::FileExists(path));
}
-TEST_F(SQLPTRepresentationTest,
- DISABLED_GenerateSnapshot_SetPolicyTable_SnapshotIsPresent) {
- // TODO(AKutsan):APPLINK-31526 Test requires initial preloaded pt for
- // preloaded date reading
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepare(table);
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
-
- // Assert
- ASSERT_TRUE(IsValid(update));
- ASSERT_TRUE(reps->Save(update));
-
- // Act
- std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
- snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
- // Remove fields which must be absent in snapshot
- table["policy_table"]["consumer_friendly_messages"].removeMember("messages");
- table["policy_table"]["app_policies"]["1234"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["1234"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["1234"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["default"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["default"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["default"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "default_hmi");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "keep_context");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "steal_focus");
- table["policy_table"]["app_policies"]["device"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["device"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["device"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["device"].removeMember("groups");
- table["policy_table"]["device_data"] = Json::Value(Json::objectValue);
- table["policy_table"]["module_meta"] = Json::Value(Json::objectValue);
- table["policy_table"]["module_config"]["preloaded_pt"] = Json::Value(false);
- policy_table::Table expected(&table);
- Json::StreamWriterBuilder writer_builder;
- // Checks
- Json::Value snapshot_json_value = snapshot->ToJsonValue();
- EXPECT_EQ(Json::writeString(writer_builder, expected.ToJsonValue()),
- Json::writeString(writer_builder, snapshot_json_value));
- std::cout << Json::writeString(writer_builder, snapshot_json_value)
- << std::endl;
- EXPECT_EQ(expected.ToJsonValue().toStyledString(),
- snapshot_json_value.toStyledString());
-}
-
-TEST_F(SQLPTRepresentationTest,
- DISABLED_Save_SetPolicyTableThenSave_ExpectSavedToPT) {
- // TODO(AKutsan): APPLINK-31526 Test requires initial preloaded pt for
- // preloaded date reading
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepare(table);
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- // Checks PT before Save
- policy_table::FunctionalGroupings func_groups;
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Check functional groupings section
- EXPECT_EQ(0u, func_groups.size());
-
- policy_table::ApplicationPoliciesSection policies;
- GatherApplicationPoliciesSection(&policies);
- // Check ApplicationPoliciesSection
- EXPECT_EQ(0u, policies.apps.size());
- EXPECT_EQ(0u, (policies.device.preconsented_groups)->size());
- EXPECT_EQ(0u, policies.device.groups.size());
- EXPECT_EQ(policy_table::Priority::P_EMERGENCY, policies.device.priority);
- EXPECT_EQ(policy_table::HmiLevel::HL_BACKGROUND, policies.device.default_hmi);
- EXPECT_FALSE(policies.device.keep_context);
- EXPECT_FALSE(policies.device.steal_focus);
-
- policy_table::ModuleConfig config;
- GatherModuleConfig(&config);
- // Check Module config section
- EXPECT_TRUE(*config.preloaded_pt);
- EXPECT_EQ(0, config.exchange_after_x_ignition_cycles);
- EXPECT_EQ(0, config.exchange_after_x_kilometers);
- EXPECT_EQ(0, config.exchange_after_x_days);
- EXPECT_EQ(0, config.timeout_after_x_seconds);
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_make));
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_model));
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_year));
- EXPECT_EQ("", static_cast<std::string>(*config.preloaded_date));
- EXPECT_EQ("", static_cast<std::string>(*config.certificate));
- EXPECT_EQ(0u, config.seconds_between_retries.size());
- EXPECT_EQ(0u, config.endpoints.size());
- EXPECT_EQ(0u, config.notifications_per_minute_by_priority.size());
- EXPECT_EQ(0u, (*config.subtle_notifications_per_minute_by_priority).size());
-
- policy_table::ConsumerFriendlyMessages messages;
- GatherConsumerFriendlyMessages(&messages);
- EXPECT_EQ("0", static_cast<std::string>(messages.version));
- policy_table::DeviceData devices;
- GatherDeviceData(&devices);
- EXPECT_EQ(0u, devices.size());
- policy_table::UsageAndErrorCounts counts;
- GatherUsageAndErrorCounts(&counts);
- EXPECT_EQ(0u, counts.app_level->size());
- ASSERT_TRUE(IsValid(update));
- // Act
- ASSERT_TRUE(reps->Save(update));
-
- // Check Functional Groupings
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Checks
- EXPECT_EQ(1u, func_groups.size());
- policy_table::FunctionalGroupings::iterator func_groups_iter =
- func_groups.find("default");
- ASSERT_TRUE(func_groups.end() != func_groups_iter);
- policy_table::Rpcs& rpcs = func_groups_iter->second;
- EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
- policy_table::Rpc& rpc = rpcs.rpcs;
- EXPECT_EQ(1u, rpc.size());
- policy_table::Rpc::const_iterator rpc_iter = rpc.find("Update");
- EXPECT_TRUE(rpc.end() != rpc_iter);
- const policy_table::HmiLevels& hmi_levels = rpc_iter->second.hmi_levels;
- EXPECT_EQ(1u, hmi_levels.size());
- EXPECT_TRUE(hmi_levels.end() != std::find(hmi_levels.begin(),
- hmi_levels.end(),
- policy_table::HmiLevel::HL_FULL));
-
- const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
- EXPECT_EQ(1u, parameters.size());
- EXPECT_TRUE(parameters.end() !=
- std::find(parameters.begin(), parameters.end(), "P_SPEED"));
- // Check Application Policies Section
- GatherApplicationPoliciesSection(&policies);
- const uint32_t apps_size = 3u;
-
- rpc::String<1ul, 255ul> str("default");
- policy_table::Strings groups;
- groups.push_back(str);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "1234",
- 150u,
- 200u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "default",
- 50u,
- 100u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "pre_DataConsent",
- 40u,
- 90u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "device",
- 0u,
- 0u,
- groups);
- EXPECT_EQ(0u, (policies.device.preconsented_groups)->size());
- EXPECT_EQ(0u, policies.device.groups.size());
- EXPECT_EQ(policy_table::HmiLevel::HL_BACKGROUND, policies.device.default_hmi);
- EXPECT_FALSE(policies.device.keep_context);
- EXPECT_FALSE(policies.device.steal_focus);
-
- CheckAppGroups("1234", groups);
- CheckAppGroups("default", groups);
- CheckAppGroups("pre_DataConsent", groups);
- CheckAppGroups("device", groups);
-
- GatherModuleConfig(&config);
- // Check Module Config section
- ASSERT_FALSE(*config.preloaded_pt);
- ASSERT_EQ("my_cert", static_cast<std::string>(*config.certificate));
- ASSERT_EQ("25-04-2015", static_cast<std::string>(*config.preloaded_date));
- ASSERT_EQ("2014", static_cast<std::string>(*config.vehicle_year));
- ASSERT_EQ("ModelT", static_cast<std::string>(*config.vehicle_model));
- ASSERT_EQ("MakeT", static_cast<std::string>(*config.vehicle_make));
- ASSERT_EQ(10, config.exchange_after_x_ignition_cycles);
- ASSERT_EQ(100, config.exchange_after_x_kilometers);
- ASSERT_EQ(5, config.exchange_after_x_days);
- ASSERT_EQ(500, config.timeout_after_x_seconds);
- ASSERT_EQ(3u, config.seconds_between_retries.size());
- ASSERT_EQ(10, config.seconds_between_retries[0]);
- ASSERT_EQ(20, config.seconds_between_retries[1]);
- ASSERT_EQ(30, config.seconds_between_retries[2]);
- ASSERT_EQ(6u, config.notifications_per_minute_by_priority.size());
- ASSERT_EQ(1, config.notifications_per_minute_by_priority["emergency"]);
- ASSERT_EQ(2, config.notifications_per_minute_by_priority["navigation"]);
- ASSERT_EQ(3, config.notifications_per_minute_by_priority["VOICECOMM"]);
- ASSERT_EQ(4, config.notifications_per_minute_by_priority["communication"]);
- ASSERT_EQ(5, config.notifications_per_minute_by_priority["normal"]);
- ASSERT_EQ(6, config.notifications_per_minute_by_priority["none"]);
- ASSERT_EQ(6u, (*config.subtle_notifications_per_minute_by_priority).size());
- ASSERT_EQ(7,
- (*config.subtle_notifications_per_minute_by_priority)["emergency"]);
- ASSERT_EQ(
- 8, (*config.subtle_notifications_per_minute_by_priority)["navigation"]);
- ASSERT_EQ(9,
- (*config.subtle_notifications_per_minute_by_priority)["VOICECOMM"]);
- ASSERT_EQ(
- 10,
- (*config.subtle_notifications_per_minute_by_priority)["communication"]);
- ASSERT_EQ(11,
- (*config.subtle_notifications_per_minute_by_priority)["normal"]);
- ASSERT_EQ(12, (*config.subtle_notifications_per_minute_by_priority)["none"]);
- EXPECT_EQ(1u, config.endpoints.size());
- policy_table::ServiceEndpoints& service_endpoints = config.endpoints;
- EXPECT_EQ("0x00", service_endpoints.begin()->first);
- policy_table::URLList& url_list = service_endpoints.begin()->second;
- EXPECT_EQ("default", url_list.begin()->first);
- policy_table::URL& url = url_list.begin()->second;
- EXPECT_EQ("http://ford.com/cloud/default", static_cast<std::string>(url[0]));
- GatherConsumerFriendlyMessages(&messages);
- EXPECT_EQ("1.2", static_cast<std::string>(messages.version));
-}
-
-TEST_F(SQLPTRepresentationTest,
- Save_SavePolicyTable_EmptyParameters_ParametersEMPTY) {
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepareEmptyParameters(table);
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- // Checks PT before Save
- policy_table::FunctionalGroupings func_groups;
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Check functional groupings section
- EXPECT_EQ(0u, func_groups.size());
-
- // Act
- ASSERT_TRUE(reps->Save(update));
-
- // Check Functional Groupings
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Checks
- EXPECT_EQ(1u, func_groups.size());
- policy_table::FunctionalGroupings::iterator func_groups_iter =
- func_groups.find("default");
- ASSERT_TRUE(func_groups.end() != func_groups_iter);
- policy_table::Rpcs& rpcs = func_groups_iter->second;
- EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
- policy_table::Rpc& rpc = rpcs.rpcs;
- EXPECT_EQ(1u, rpc.size());
- policy_table::Rpc::const_iterator rpc_iter = rpc.find("Update");
- EXPECT_TRUE(rpc.end() != rpc_iter);
- // Check parameters
- const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
- // 'parameters' : [] - represented as initialized, but empty
- // missing 'parameters' - represented as non-initialized and empty
- EXPECT_TRUE(parameters.is_initialized());
- EXPECT_TRUE(parameters.empty());
-}
-
-TEST_F(SQLPTRepresentationTest,
- Save_SavePolicyTable_NoParameters_NoParametersSaved) {
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepareNoParameters(table);
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- // Checks PT before Save
- policy_table::FunctionalGroupings func_groups;
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Check functional groupings section
- EXPECT_EQ(0u, func_groups.size());
-
- // Act
- ASSERT_TRUE(reps->Save(update));
-
- // Check Functional Groupings
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Checks
- EXPECT_EQ(1u, func_groups.size());
- policy_table::FunctionalGroupings::iterator func_groups_iter =
- func_groups.find("default");
- ASSERT_TRUE(func_groups.end() != func_groups_iter);
- policy_table::Rpcs& rpcs = func_groups_iter->second;
- EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
- policy_table::Rpc& rpc = rpcs.rpcs;
- EXPECT_EQ(1u, rpc.size());
- policy_table::Rpc::const_iterator rpc_iter = rpc.find("Update");
- EXPECT_TRUE(rpc.end() != rpc_iter);
- // Check parameters
- const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
- EXPECT_EQ(0u, parameters.size());
-}
-
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/update_status_manager_test.cc b/src/components/policy/policy_external/test/update_status_manager_test.cc
index 29952bd18e..c5b8f78c77 100644
--- a/src/components/policy/policy_external/test/update_status_manager_test.cc
+++ b/src/components/policy/policy_external/test/update_status_manager_test.cc
@@ -37,6 +37,7 @@
#include "policy/policy_manager_impl.h"
#include "utils/conditional_variable.h"
+#include "utils/test_async_waiter.h"
namespace test {
namespace components {
@@ -78,44 +79,6 @@ class UpdateStatusManagerTest : public ::testing::Test {
void TearDown() OVERRIDE {}
};
-namespace {
-/**
- * @brief The WaitAsync class
- * can wait for a certain amount of function calls from different
- * threads, or a timeout expires.
- */
-class WaitAsync {
- public:
- WaitAsync(const uint32_t count, const uint32_t timeout)
- : count_(count), timeout_(timeout) {}
-
- void Notify() {
- count_--;
- cond_var_.NotifyOne();
- }
-
- bool Wait(sync_primitives::AutoLock& auto_lock) {
- while (count_ > 0) {
- sync_primitives::ConditionalVariable::WaitStatus wait_status =
- cond_var_.WaitFor(auto_lock, timeout_);
- if (wait_status == sync_primitives::ConditionalVariable::kTimeout) {
- return false;
- }
- }
- return true;
- }
-
- private:
- int count_;
- const uint32_t timeout_;
- sync_primitives::ConditionalVariable cond_var_;
-};
-} // namespace
-
-ACTION_P(NotifyAsync, waiter) {
- waiter->Notify();
-}
-
ACTION_P2(RetryFailed, manager, listener) {
manager->OnResetRetrySequence();
listener->OnPTUFinished(false);
@@ -124,18 +87,17 @@ ACTION_P2(RetryFailed, manager, listener) {
TEST_F(UpdateStatusManagerTest,
OnUpdateSentOut_WaitForTimeoutExpired_ExpectStatusUpdateNeeded) {
// Arrange
- sync_primitives::Lock lock;
- sync_primitives::AutoLock auto_lock(lock);
const uint32_t count = 3u;
const uint32_t timeout = 2u * k_timeout_;
- WaitAsync waiter(count, timeout);
+ auto waiter = TestAsyncWaiter::createInstance();
+
EXPECT_CALL(listener_, OnUpdateStatusChanged(_))
- .WillRepeatedly(NotifyAsync(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
manager_->ScheduleUpdate();
manager_->OnUpdateSentOut(k_timeout_);
status_ = manager_->GetLastUpdateStatus();
EXPECT_EQ(StatusUpdatePending, status_);
- EXPECT_TRUE(waiter.Wait(auto_lock));
+ EXPECT_TRUE(waiter->WaitFor(count, timeout));
status_ = manager_->GetLastUpdateStatus();
// Check
EXPECT_EQ(StatusUpdateRequired, status_);
@@ -148,9 +110,9 @@ TEST_F(
sync_primitives::AutoLock auto_lock(lock);
const uint32_t count = 3u;
const uint32_t timeout = 2u * k_timeout_;
- WaitAsync waiter(count, timeout);
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(listener_, OnUpdateStatusChanged(_))
- .WillRepeatedly(NotifyAsync(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
EXPECT_CALL(mock_ptu_retry_handler_, RetrySequenceFailed())
.WillOnce(RetryFailed(manager_, &listener_));
manager_->ScheduleUpdate();
@@ -167,7 +129,7 @@ TEST_F(
EXPECT_CALL(listener_, OnPTUFinished(false));
}
EXPECT_EQ(StatusUpdatePending, status_);
- EXPECT_TRUE(waiter.Wait(auto_lock));
+ EXPECT_TRUE(waiter->WaitFor(count, timeout));
status_ = manager_->GetLastUpdateStatus();
// Check
EXPECT_EQ(StatusUpdateRequired, status_);
diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt
index 3b71207760..6386e05210 100644
--- a/src/components/policy/policy_regular/CMakeLists.txt
+++ b/src/components/policy/policy_regular/CMakeLists.txt
@@ -85,7 +85,6 @@ generate_policy_types("${GENERATED_HMI_POLICY_TYPES}"
set(POLICY_TABLE_PATHS
${CMAKE_CURRENT_SOURCE_DIR}/include/policy/policy_table
${CMAKE_CURRENT_SOURCE_DIR}/src/policy_table
- ${CMAKE_CURRENT_BINARY_DIR}/
)
set(POLICY_TABLE_SOURCES
@@ -124,6 +123,7 @@ set(PATHS
${CMAKE_CURRENT_SOURCE_DIR}/src
${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc
)
+
collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
set(LIBRARIES
@@ -154,7 +154,7 @@ target_link_libraries(PolicyStatic ${LIBRARIES})
add_library(Policy SHARED "src/policy_manager_impl.cc")
target_link_libraries(Policy PolicyStatic)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
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 25b4a8bc18..473caef145 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -544,13 +544,11 @@ class CacheManager : public CacheManagerInterface {
*/
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
- /**
- * @brief Records information about head unit system to PT
- * @return bool Success of operation
- */
bool SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
- const std::string& language);
+ const std::string& language) OVERRIDE;
+
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
/**
* @brief Get information about last ccpu_version from PT
@@ -558,6 +556,8 @@ class CacheManager : public CacheManagerInterface {
*/
std::string GetCCPUVersionFromPT() const;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Checks, if specific head unit is present in PT
* @return boot Suceess, if present, otherwise - false
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 14130c0316..5e536ef315 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
@@ -586,7 +586,7 @@ class CacheManagerInterface {
virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
/**
- * @brief Records information about head unit system to PT
+ * @brief Records mandatory information about head unit system to PT
* @return bool Success of operation
*/
virtual bool SetMetaInfo(const std::string& ccpu_version,
@@ -594,12 +594,24 @@ class CacheManagerInterface {
const std::string& language) = 0;
/**
+ * @brief Records information about hardware version to PT
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return string representation of hardware version from PT, empty if absent
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Checks, if specific head unit is present in PT
* @return boot Suceess, if present, otherwise - false
*/
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 dff4802d82..0d1a61ec89 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
@@ -451,10 +451,14 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
+
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
std::string GetCCPUVersionFromPT() const OVERRIDE;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
@@ -869,7 +873,6 @@ class PolicyManagerImpl : public PolicyManager {
void ResetTimeout() OVERRIDE;
protected:
-#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE
/**
* @brief Parse policy table content and convert to PT object
* @param pt_content binary content of PT
@@ -877,15 +880,6 @@ class PolicyManagerImpl : public PolicyManager {
*/
virtual std::shared_ptr<policy_table::Table> Parse(
const BinaryMessage& pt_content);
-#else
- /**
- * @brief Parse policy table content and convert to PT object
- * @param pt_content binary content of PT
- * @return pointer to converted PT
- */
- virtual std::shared_ptr<policy_table::Table> ParseArray(
- const BinaryMessage& pt_content);
-#endif
/**
* @brief Getter for policy settings
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 314cba8571..5b2bf6dec4 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
@@ -430,6 +430,7 @@ struct ModuleMeta : CompositeType {
Optional<Integer<uint16_t, 0, 65535> > pt_exchanged_x_days_after_epoch;
Optional<Integer<uint16_t, 0, 65535> > ignition_cycles_since_last_exchange;
Optional<String<0, 500> > ccpu_version;
+ Optional<String<0, 500> > hardware_version;
public:
ModuleMeta();
@@ -563,7 +564,11 @@ struct VehicleDataItem : CompositeType {
VehicleDataItem(const VehicleDataItem& policy_table);
explicit VehicleDataItem(const Json::Value* value__);
+#ifdef __ANDROID__
bool operator==(const VehicleDataItem& vd) const;
+#else
+ bool operator==(const VehicleDataItem& vd);
+#endif
~VehicleDataItem();
diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h
index 7f95d9132b..fe54da6b18 100644
--- a/src/components/policy/policy_regular/include/policy/policy_types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_types.h
@@ -280,6 +280,7 @@ struct AppPermissions {
, appRevoked(false)
, appPermissionsConsentNeeded(false)
, appUnauthorized(false)
+ , isSDLAllowed(false)
, requestTypeChanged(false)
, requestSubTypeChanged(false) {}
diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h
index 895b4ea6b5..9a57ed21ad 100644
--- a/src/components/policy/policy_regular/include/policy/pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/pt_representation.h
@@ -152,12 +152,18 @@ class PTRepresentation {
virtual EndpointUrls GetUpdateUrls(int service_type) = 0;
/**
- * @brief Records information about head unit system to PT
+ * @brief Records mandatory information about head unit system to PT
* @return bool Success of operation
*/
virtual bool SetMetaInfo(const std::string& ccpu_version) = 0;
/**
+ * @brief Records information about hardware version to PT
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 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/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
index 5bf85a4bb5..fd7f879abf 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
@@ -145,6 +145,7 @@ extern const std::string kUpdateDBVersion;
extern const std::string kSaveModuleMeta;
extern const std::string kSelectModuleMeta;
extern const std::string kUpdateMetaParams;
+extern const std::string kUpdateMetaHardwareVersion;
extern const std::string kInsertVehicleDataItem;
extern const std::string kSelectVehicleDataItem;
extern const std::string kDeleteVehicleDataItems;
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 512bfd6326..18147c43f0 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
@@ -90,7 +90,8 @@ class SQLPTRepresentation : public virtual PTRepresentation {
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL);
bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups);
- bool SetMetaInfo(const std::string& ccpu_version);
+ bool SetMetaInfo(const std::string& ccpu_version) OVERRIDE;
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
#ifdef BUILD_TESTS
uint32_t open_counter() {
return open_counter_;
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 8f98996687..cf4164d133 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -1128,7 +1128,8 @@ bool CacheManager::GetPriority(const std::string& policy_app_id,
policy_table::ApplicationPolicies::const_iterator policy_iter =
policies.find(policy_app_id);
- const bool app_id_exists = policies.end() != policy_iter;
+ const bool app_id_exists =
+ policies.end() != policy_iter && !IsApplicationRevoked(policy_app_id);
if (app_id_exists) {
priority = EnumToJsonString((*policy_iter).second.priority);
}
@@ -1336,6 +1337,8 @@ void CacheManager::PersistData() {
}
backup_->SetMetaInfo(*(*copy_pt.policy_table.module_meta).ccpu_version);
+ backup_->SetHardwareVersion(
+ *(*copy_pt.policy_table.module_meta).hardware_version);
// In case of extended policy the meta info should be backuped as well.
backup_->WriteDb();
@@ -1489,13 +1492,35 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
return true;
}
+void CacheManager::SetHardwareVersion(const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ *pt_->policy_table.module_meta->hardware_version = hardware_version;
+ Backup();
+}
+
std::string CacheManager::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK(std::string(""));
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
rpc::Optional<policy_table::ModuleMeta>& module_meta =
pt_->policy_table.module_meta;
return *(module_meta->ccpu_version);
}
+std::string CacheManager::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ CACHE_MANAGER_CHECK(std::string(""));
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ rpc::Optional<policy_table::ModuleMeta>& module_meta =
+ pt_->policy_table.module_meta;
+ return *(module_meta->hardware_version);
+}
+
bool CacheManager::IsMetaInfoPresent() const {
CACHE_MANAGER_CHECK(false);
bool result = true;
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 059375322a..3a41cfa08b 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -87,8 +87,6 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) {
update_status_manager_.set_listener(listener);
}
-#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE
-
std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
const BinaryMessage& pt_content) {
std::string json(pt_content.begin(), pt_content.end());
@@ -96,23 +94,8 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
Json::Value value;
if (reader.parse(json, &value)) {
- return std::make_shared<policy_table::Table>(&value);
- } else {
- return std::make_shared<policy_table::Table>();
- }
-}
-
-#else
-
-std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray(
- const BinaryMessage& pt_content) {
- std::string json(pt_content.begin(), pt_content.end());
- utils::JsonReader reader;
- Json::Value value;
-
- if (reader.parse(json, &value)) {
// For PT Update received from SDL Server.
- if (value["data"].size() != 0) {
+ if (value.isObject() && value["data"].isArray() && !value["data"].empty()) {
Json::Value data = value["data"];
return std::make_shared<policy_table::Table>(&data[0]);
} else {
@@ -123,8 +106,6 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray(
}
}
-#endif
-
void PolicyManagerImpl::CheckTriggers() {
SDL_LOG_AUTO_TRACE();
const bool exceed_ignition_cycles = ExceededIgnitionCycles();
@@ -330,16 +311,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
SDL_LOG_DEBUG(
"PTU content is: " << std::string(pt_content.begin(), pt_content.end()));
-#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE
- // Assuemes Policy Table was parsed, formatted, and/or decrypted by
- // the HMI after system request before calling OnReceivedPolicyUpdate
- // Parse message into table struct
std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content);
-#else
- // Message Received from server unecnrypted with PTU in first element
- // of 'data' array. No Parsing was done by HMI.
- std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content);
-#endif
if (!pt_update) {
SDL_LOG_WARN("Parsed table pointer is NULL.");
;
@@ -1217,11 +1189,22 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
+void PolicyManagerImpl::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ cache_->SetHardwareVersion(hardware_version);
+}
+
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
+std::string PolicyManagerImpl::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ return cache_->GetHardwareVersionFromPT();
+}
+
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
SDL_LOG_AUTO_TRACE();
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 ff6af3c095..d4e36a70ee 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -19,7 +19,9 @@ std::string PolicyTableTypeToString(const PolicyTableType pt_type) {
case PT_SNAPSHOT: {
return "PT_SNAPSHOT";
}
- default: { return "INVALID_PT_TYPE"; }
+ default: {
+ return "INVALID_PT_TYPE";
+ }
}
}
@@ -1297,7 +1299,8 @@ ModuleMeta::ModuleMeta(const Json::Value* value__)
impl::ValueMember(value__, "pt_exchanged_x_days_after_epoch"))
, ignition_cycles_since_last_exchange(
impl::ValueMember(value__, "ignition_cycles_since_last_exchange"))
- , ccpu_version(impl::ValueMember(value__, "ccpu_version")) {}
+ , ccpu_version(impl::ValueMember(value__, "ccpu_version"))
+ , hardware_version(impl::ValueMember(value__, "hardware_version")) {}
Json::Value ModuleMeta::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -1319,6 +1322,9 @@ bool ModuleMeta::is_valid() const {
if (!ccpu_version.is_valid()) {
return false;
}
+ if (!hardware_version.is_valid()) {
+ return false;
+ }
if (!pt_exchanged_at_odometer_x.is_valid()) {
return false;
}
@@ -1339,6 +1345,9 @@ bool ModuleMeta::struct_empty() const {
if (ccpu_version.is_initialized()) {
return false;
}
+ if (hardware_version.is_initialized()) {
+ return false;
+ }
if (pt_exchanged_at_odometer_x.is_initialized()) {
return false;
}
@@ -1359,6 +1368,10 @@ void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const {
if (!ccpu_version.is_valid()) {
ccpu_version.ReportErrors(&report__->ReportSubobject("ccpu_version"));
}
+ if (!hardware_version.is_valid()) {
+ hardware_version.ReportErrors(
+ &report__->ReportSubobject("hardware_version"));
+ }
if (!pt_exchanged_at_odometer_x.is_valid()) {
pt_exchanged_at_odometer_x.ReportErrors(
&report__->ReportSubobject("pt_exchanged_at_odometer_x"));
@@ -1446,13 +1459,47 @@ AppLevel::AppLevel(const Json::Value* value__)
impl::ValueMember(value__, "count_of_rpcs_sent_in_hmi_none"))
, count_of_removals_for_bad_behavior(
impl::ValueMember(value__, "count_of_removals_for_bad_behavior"))
- , count_of_tls_errors(impl::ValueMember(value__, "count_of_tls_errors"))
+ , count_of_tls_errors(impl::ValueMember(value__, "count_of_TLS_errors"))
, count_of_run_attempts_while_revoked(
impl::ValueMember(value__, "count_of_run_attempts_while_revoked")) {}
Json::Value AppLevel::ToJsonValue() const {
Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("minutes_in_hmi_full", minutes_in_hmi_full, &result__);
+ impl::WriteJsonField("app_registration_language_gui",
+ app_registration_language_gui,
+ &result__);
+ impl::WriteJsonField("app_registration_language_vui",
+ app_registration_language_vui,
+ &result__);
+ impl::WriteJsonField(
+ "minutes_in_hmi_limited", minutes_in_hmi_limited, &result__);
+ impl::WriteJsonField(
+ "minutes_in_hmi_background", minutes_in_hmi_background, &result__);
+ impl::WriteJsonField("minutes_in_hmi_none", minutes_in_hmi_none, &result__);
+ impl::WriteJsonField(
+ "count_of_user_selections", count_of_user_selections, &result__);
+ impl::WriteJsonField("count_of_rejections_sync_out_of_memory",
+ count_of_rejections_sync_out_of_memory,
+ &result__);
+ impl::WriteJsonField("count_of_rejections_nickname_mismatch",
+ count_of_rejections_nickname_mismatch,
+ &result__);
+ impl::WriteJsonField("count_of_rejections_duplicate_name",
+ count_of_rejections_duplicate_name,
+ &result__);
+ impl::WriteJsonField(
+ "count_of_rejected_rpc_calls", count_of_rejected_rpc_calls, &result__);
+ impl::WriteJsonField("count_of_rpcs_sent_in_hmi_none",
+ count_of_rpcs_sent_in_hmi_none,
+ &result__);
+ impl::WriteJsonField("count_of_removals_for_bad_behavior",
+ count_of_removals_for_bad_behavior,
+ &result__);
impl::WriteJsonField("count_of_TLS_errors", count_of_tls_errors, &result__);
+ impl::WriteJsonField("count_of_run_attempts_while_revoked",
+ count_of_run_attempts_while_revoked,
+ &result__);
return result__;
}
@@ -1745,7 +1792,12 @@ Json::Value VehicleDataItem::ToJsonValue() const {
return ret;
}
-bool VehicleDataItem::operator==(const VehicleDataItem& vd) const {
+#ifdef __ANDROID__
+bool VehicleDataItem::operator==(const VehicleDataItem& vd) const
+#else
+bool VehicleDataItem::operator==(const VehicleDataItem& vd)
+#endif
+{
return (name == vd.name && type == vd.type && key == vd.key &&
mandatory == vd.mandatory && params == vd.params &&
array == vd.array && since == vd.since && until == vd.until &&
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 cf9167406f..a58867966c 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -60,7 +60,8 @@ const std::string kCreateSchema =
" `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, "
" `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, "
" `flag_update_required` BOOL NOT NULL, "
- " `ccpu_version` VARCHAR(45) "
+ " `ccpu_version` VARCHAR(45), "
+ " `hardware_version` VARCHAR(45) "
"); "
"CREATE TABLE IF NOT EXISTS `module_config`( "
" `preloaded_pt` BOOL NOT NULL, "
@@ -370,8 +371,8 @@ const std::string kCreateSchema =
/*endpoint properties*/
"CREATE TABLE IF NOT EXISTS `endpoint_properties`( "
- " `service` VARCHAR(100) NOT NULL, "
- " `version` VARCHAR(100) NOT NULL "
+ " `service` VARCHAR(100) PRIMARY KEY NOT NULL, "
+ " `version` VARCHAR(100) "
");"
"CREATE TABLE IF NOT EXISTS `message`( "
@@ -1076,10 +1077,16 @@ const std::string kSaveModuleMeta =
"`pt_exchanged_x_days_after_epoch` = ?, "
"`ignition_cycles_since_last_exchange` = ? ";
-const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
+const std::string kSelectModuleMeta =
+ "SELECT `ccpu_version`, `hardware_version`, `pt_exchanged_at_odometer_x`, "
+ "`pt_exchanged_x_days_after_epoch`, `ignition_cycles_since_last_exchange` "
+ "FROM `module_meta`";
const std::string kUpdateMetaParams =
"UPDATE `module_meta` SET "
"`ccpu_version` = ? ";
+
+const std::string kUpdateMetaHardwareVersion =
+ "UPDATE `module_meta` SET `hardware_version` = ? ";
} // namespace sql_pt
} // namespace policy
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 12c76b505c..458b75aa71 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -477,10 +477,11 @@ void SQLPTRepresentation::GatherModuleMeta(
SDL_LOG_INFO("Gather Module Meta Info");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) {
- *meta->pt_exchanged_at_odometer_x = query.GetInteger(0);
- *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(1);
- *meta->ignition_cycles_since_last_exchange = query.GetInteger(2);
- *meta->ccpu_version = query.GetString(4);
+ *meta->ccpu_version = query.GetString(0);
+ *meta->hardware_version = query.GetString(1);
+ *meta->pt_exchanged_at_odometer_x = query.GetInteger(2);
+ *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(3);
+ *meta->ignition_cycles_since_last_exchange = query.GetInteger(4);
}
}
@@ -523,9 +524,13 @@ void SQLPTRepresentation::GatherModuleConfig(
} else {
while (endpoint_properties.Next()) {
const std::string& service = endpoint_properties.GetString(0);
- const std::string& version = endpoint_properties.GetString(1);
auto& ep_properties = (*config->endpoint_properties);
- *ep_properties[service].version = version;
+ if (!endpoint_properties.IsNull(1)) {
+ const std::string& version = endpoint_properties.GetString(1);
+ *ep_properties[service].version = version;
+ } else {
+ ep_properties[service].version = rpc::Optional<rpc::String<0, 100> >();
+ }
}
}
@@ -721,6 +726,22 @@ bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) {
return true;
}
+void SQLPTRepresentation::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kUpdateMetaHardwareVersion)) {
+ SDL_LOG_WARN("Incorrect statement for insert to module meta.");
+ return;
+ }
+
+ query.Bind(0, hardware_version);
+
+ if (!query.Exec()) {
+ SDL_LOG_WARN("Incorrect insert to module meta.");
+ }
+}
+
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
SDL_LOG_INFO("Gather applications policies");
@@ -1534,7 +1555,9 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties(
for (auto& endpoint_property : endpoint_properties) {
query.Bind(0, endpoint_property.first);
- query.Bind(1, endpoint_property.second.version);
+ endpoint_property.second.version.is_initialized()
+ ? query.Bind(1, *endpoint_property.second.version)
+ : query.Bind(1);
if (!query.Exec() || !query.Reset()) {
SDL_LOG_WARN(
diff --git a/src/components/policy/policy_regular/test/CMakeLists.txt b/src/components/policy/policy_regular/test/CMakeLists.txt
index d2cd7be224..cdd6cc98da 100644
--- a/src/components/policy/policy_regular/test/CMakeLists.txt
+++ b/src/components/policy/policy_regular/test/CMakeLists.txt
@@ -49,6 +49,7 @@ file (GLOB POLICY_TEST_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/policy_manager_impl_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/access_remote_impl_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_representation_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/sql_pt_representation_storage_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/update_status_manager_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/vehicle_data_item_type_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/shared_library_test.cc
diff --git a/src/components/policy/policy_regular/test/boostlogconfig.ini b/src/components/policy/policy_regular/test/boostlogconfig.ini
new file mode 100644
index 0000000000..f33da81c93
--- /dev/null
+++ b/src/components/policy/policy_regular/test/boostlogconfig.ini
@@ -0,0 +1,51 @@
+# Core settings
+[Core]
+DisableLogging=false
+
+# Console Logging
+[Sinks.Console]
+DisableLogging=true
+Destination=Console
+Filter="%Severity% > trace"
+Format="%Severity% [%TimeStamp%][%Component%] %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# SDL log file
+[Sinks.AllMessages]
+DisableLogging=false
+Destination=TextFile
+FileName=SmartDeviceLinkCore.log
+Append=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for all TransportManager messages
+[Sinks.TransportManager]
+DisableLogging=false
+Destination=TextFile
+FileName=TransportManager.log
+Append=false
+Filter="%Component% = TransportManager"
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager)
+[Sinks.ProtocolFordHandling]
+DisableLogging=false
+Destination=TextFile
+FileName=ProtocolFordHandling.log
+Append=false
+Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager"
+Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+[Sinks.Telnet]
+DisableLogging=true
+Destination=Syslog
+Asynchronous=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file
diff --git a/src/components/policy/policy_regular/test/cache_manager_test.cc b/src/components/policy/policy_regular/test/cache_manager_test.cc
index 31166b8f43..00b632ac17 100644
--- a/src/components/policy/policy_regular/test/cache_manager_test.cc
+++ b/src/components/policy/policy_regular/test/cache_manager_test.cc
@@ -1235,6 +1235,18 @@ TEST_F(CacheManagerTest, IsApplicationRepresented_DeviceApp_ReturnTrue) {
EXPECT_TRUE(cache_manager_->IsApplicationRepresented(kDeviceId));
}
+TEST_F(CacheManagerTest, GetHardwareVersion_ValueWasSetBefore_ReturnValue) {
+ std::string hardware_version = "1.1.1.1";
+ cache_manager_->SetHardwareVersion(hardware_version);
+ EXPECT_EQ(hardware_version, cache_manager_->GetHardwareVersionFromPT());
+}
+
+TEST_F(CacheManagerTest,
+ GetHardwareVersion_ValueNotSettedBefore_ReturnEmptyString) {
+ std::string empty_string = "";
+ EXPECT_EQ(empty_string, cache_manager_->GetHardwareVersionFromPT());
+}
+
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json
index d17a4b82e4..066ed86727 100644
--- a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json
+++ b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json
@@ -56,12 +56,6 @@
"textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny."
},
- "en-ie" :
- {
- "line1" : "Grant requested",
- "line2" : "permission(s)?",
- "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
- },
"en-us" :
{
"line1" : "Grant Requested",
@@ -69,13 +63,6 @@
"textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.",
"tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny."
},
- "es-en" :
- {
- "line1" : "¿Otorgar permiso(s)",
- "line2" : "solicitado(s)?",
- "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.",
- "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
- },
"es-es" :
{
"line1" : "¿Conceder permisos",
@@ -180,18 +167,10 @@
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
},
- "en-ie" :
- {
- "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
"en-us" :
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en" :
- {
- "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es" :
{
"tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
@@ -266,18 +245,10 @@
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "en-ie" :
- {
- "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
"en-us" :
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en" :
- {
- "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es" :
{
"tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
@@ -356,23 +327,12 @@
"textBody" : "This version of %appName% is not authorized and will not work with SYNC.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "en-ie" :
- {
- "line1" : "not authorized",
- "tts" : "This version of %appName% is not authorized and will not work with SYNC."
- },
"en-us" :
{
"line1" : "Not Authorized",
"textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "es-en" :
- {
- "line1" : "no autorizada",
- "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es" :
{
"line1" : "No autorizada",
@@ -467,23 +427,12 @@
"textBody" : "This version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "en-ie" :
- {
- "line1" : "not supported",
- "tts" : "This version of %appName% is not supported by SYNC."
- },
"en-us" :
{
"line1" : "Not Supported",
"textBody" : "Your version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "es-en" :
- {
- "line1" : "no compatible",
- "textBody" : "Esta versión de %appName% no es compatible con SYNC.",
- "tts" : "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es" :
{
"line1" : "No compatible",
@@ -623,12 +572,6 @@
"textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
"tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
},
- "en-ie" :
- {
- "line1" : "Disable auto-updates",
- "line2" : "and Mobile Apps?",
- "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
"en-us" :
{
"line1" : "Disable Auto-Updates",
@@ -636,13 +579,6 @@
"textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.",
"tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
},
- "es-en" :
- {
- "line1" : "¿Deshab. actualiz.",
- "line2" : "autom. y aplic. móv.?",
- "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es" :
{
"line1" : "¿Desact. actual. auto",
@@ -751,23 +687,12 @@
"textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
"tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
},
- "en-ie" :
- {
- "label" : "Driving characteristics",
- "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
"en-us" :
{
"label" : "Driving Characteristics",
"textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.",
"tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM."
},
- "es-en" :
- {
- "label" : "Características del manejo",
- "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es" :
{
"label" : "Características de conducción",
@@ -863,23 +788,12 @@
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "en-ie" :
- {
- "label" : "GPS and speed",
- "tts" : "An app can access vehicle GPS and speed."
- },
"en-us" :
{
"label" : "GPS and Speed",
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "es-en" :
- {
- "label" : "GPS y velocidad",
- "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es" :
{
"label" : "GPS y velocidad",
@@ -974,23 +888,12 @@
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "en-ie" :
- {
- "label" : "Push notifications",
- "tts" : "An app can send notifications when running in the background."
- },
"en-us" :
{
"label" : "Push Notifications",
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "es-en" :
- {
- "label" : "Notificaciones tipo Push",
- "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es" :
{
"label" : "Notificaciones push",
@@ -1100,20 +1003,11 @@
{
"line1" : "Disable updates"
},
- "en-ie" :
- {
- "line1" : "Disable updates"
- },
"en-us" :
{
"line1" : "Disable Updates",
"textBody" : "Disable Updates"
},
- "es-en" :
- {
- "line1" : "Deshab. actual.",
- "textBody" : "Deshab. actual."
- },
"es-es" :
{
"line1" : "Desact. actual."
@@ -1190,18 +1084,10 @@
{
"line1" : "Enable Apps"
},
- "en-ie" :
- {
- "line1" : "Enable Apps"
- },
"en-us" :
{
"line1" : "Enable Apps"
},
- "es-en" :
- {
- "line1" : "Hab. aplic."
- },
"es-es" :
{
"line1" : "Activar apl."
@@ -1277,20 +1163,11 @@
{
"line1" : "Request update"
},
- "en-ie" :
- {
- "line1" : "Request update"
- },
"en-us" :
{
"line1" : "Request Update",
"textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
},
- "es-en" :
- {
- "line1" : "Solicit. actualiz.",
- "textBody" : "Solicit. actualiz."
- },
"es-es" :
{
"line1" : "Solicitar actual."
@@ -1368,20 +1245,11 @@
"line1" : "Update needed",
"textBody" : "Update needed"
},
- "en-ie" :
- {
- "line1" : "Update needed"
- },
"en-us" :
{
"line1" : "Update Needed",
"textBody" : "Update Needed"
},
- "es-en" :
- {
- "line1" : "Actualiz. neces.",
- "textBody" : "Actualiz. neces."
- },
"es-es" :
{
"line1" : "Actu. necesaria"
@@ -1459,20 +1327,11 @@
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "en-ie" :
- {
- "line1" : "Updating..."
- },
"en-us" :
{
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "es-en" :
- {
- "line1" : "Actualizando...",
- "textBody" : "Actualizando..."
- },
"es-es" :
{
"line1" : "Actualizando..."
@@ -1550,20 +1409,11 @@
"line1" : "Up-to-date",
"textBody" : "Up-to-date"
},
- "en-ie" :
- {
- "line1" : "Up-to-date"
- },
"en-us" :
{
"line1" : "Up-To-Date",
"textBody" : "Up-To-Date"
},
- "es-en" :
- {
- "line1" : "Actualizado",
- "textBody" : "Actualizado"
- },
"es-es" :
{
"line1" : "Actualizada"
@@ -1644,23 +1494,12 @@
"textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
"tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
},
- "en-ie" :
- {
- "label" : "Vehicle information",
- "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
- },
"en-us" :
{
"label" : "Vehicle Information",
"textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.",
"tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure."
},
- "es-en" :
- {
- "label" : "Información del vehículo",
- "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es" :
{
"label" : "Información del vehículo",
diff --git a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json
index 81c2093c72..43c16f18b8 100644
--- a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json
+++ b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json
@@ -56,12 +56,6 @@
"textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.",
"tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny."
},
- "en-ie" :
- {
- "line1" : "Grant requested",
- "line2" : "permission(s)?",
- "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
- },
"en-us" :
{
"line1" : "Grant Requested",
@@ -69,13 +63,6 @@
"textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.",
"tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny."
},
- "es-en" :
- {
- "line1" : "¿Otorgar permiso(s)",
- "line2" : "solicitado(s)?",
- "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.",
- "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
- },
"es-es" :
{
"line1" : "¿Conceder permisos",
@@ -180,18 +167,10 @@
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
},
- "en-ie" :
- {
- "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
"en-us" :
{
"tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
},
- "es-en" :
- {
- "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
"es-es" :
{
"tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
@@ -266,18 +245,10 @@
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "en-ie" :
- {
- "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
"en-us" :
{
"tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
},
- "es-en" :
- {
- "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
"es-es" :
{
"tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
@@ -356,23 +327,12 @@
"textBody" : "This version of %appName% is not authorized and will not work with SYNC.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "en-ie" :
- {
- "line1" : "not authorized",
- "tts" : "This version of %appName% is not authorized and will not work with SYNC."
- },
"en-us" :
{
"line1" : "Not Authorized",
"textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.",
"tts" : "This version of %appName% is not authorized and will not work with SYNC."
},
- "es-en" :
- {
- "line1" : "no autorizada",
- "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
"es-es" :
{
"line1" : "No autorizada",
@@ -467,23 +427,12 @@
"textBody" : "This version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "en-ie" :
- {
- "line1" : "not supported",
- "tts" : "This version of %appName% is not supported by SYNC."
- },
"en-us" :
{
"line1" : "Not Supported",
"textBody" : "Your version of %appName% is not supported by SYNC.",
"tts" : "This version of %appName% is not supported by SYNC."
},
- "es-en" :
- {
- "line1" : "no compatible",
- "textBody" : "Esta versión de %appName% no es compatible con SYNC.",
- "tts" : "Esta versión de %appName% no es compatible con SYNC."
- },
"es-es" :
{
"line1" : "No compatible",
@@ -623,12 +572,6 @@
"textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
"tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
},
- "en-ie" :
- {
- "line1" : "Disable auto-updates",
- "line2" : "and Mobile Apps?",
- "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
"en-us" :
{
"line1" : "Disable Auto-Updates",
@@ -636,13 +579,6 @@
"textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.",
"tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
},
- "es-en" :
- {
- "line1" : "¿Deshab. actualiz.",
- "line2" : "autom. y aplic. móv.?",
- "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
"es-es" :
{
"line1" : "¿Desact. actual. auto",
@@ -751,23 +687,12 @@
"textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
"tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
},
- "en-ie" :
- {
- "label" : "Driving characteristics",
- "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
"en-us" :
{
"label" : "Driving Characteristics",
"textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.",
"tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM."
},
- "es-en" :
- {
- "label" : "Características del manejo",
- "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
"es-es" :
{
"label" : "Características de conducción",
@@ -863,23 +788,12 @@
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "en-ie" :
- {
- "label" : "GPS and speed",
- "tts" : "An app can access vehicle GPS and speed."
- },
"en-us" :
{
"label" : "GPS and Speed",
"textBody" : "An app can access vehicle GPS and speed.",
"tts" : "An app can access vehicle GPS and speed."
},
- "es-en" :
- {
- "label" : "GPS y velocidad",
- "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
"es-es" :
{
"label" : "GPS y velocidad",
@@ -974,23 +888,12 @@
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "en-ie" :
- {
- "label" : "Push notifications",
- "tts" : "An app can send notifications when running in the background."
- },
"en-us" :
{
"label" : "Push Notifications",
"textBody" : "An app can send notifications when running in the background.",
"tts" : "An app can send notifications when running in the background."
},
- "es-en" :
- {
- "label" : "Notificaciones tipo Push",
- "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
"es-es" :
{
"label" : "Notificaciones push",
@@ -1100,20 +1003,11 @@
{
"line1" : "Disable updates"
},
- "en-ie" :
- {
- "line1" : "Disable updates"
- },
"en-us" :
{
"line1" : "Disable Updates",
"textBody" : "Disable Updates"
},
- "es-en" :
- {
- "line1" : "Deshab. actual.",
- "textBody" : "Deshab. actual."
- },
"es-es" :
{
"line1" : "Desact. actual."
@@ -1190,18 +1084,10 @@
{
"line1" : "Enable Apps"
},
- "en-ie" :
- {
- "line1" : "Enable Apps"
- },
"en-us" :
{
"line1" : "Enable Apps"
},
- "es-en" :
- {
- "line1" : "Hab. aplic."
- },
"es-es" :
{
"line1" : "Activar apl."
@@ -1277,20 +1163,11 @@
{
"line1" : "Request update"
},
- "en-ie" :
- {
- "line1" : "Request update"
- },
"en-us" :
{
"line1" : "Request Update",
"textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
},
- "es-en" :
- {
- "line1" : "Solicit. actualiz.",
- "textBody" : "Solicit. actualiz."
- },
"es-es" :
{
"line1" : "Solicitar actual."
@@ -1368,20 +1245,11 @@
"line1" : "Update needed",
"textBody" : "Update needed"
},
- "en-ie" :
- {
- "line1" : "Update needed"
- },
"en-us" :
{
"line1" : "Update Needed",
"textBody" : "Update Needed"
},
- "es-en" :
- {
- "line1" : "Actualiz. neces.",
- "textBody" : "Actualiz. neces."
- },
"es-es" :
{
"line1" : "Actu. necesaria"
@@ -1459,20 +1327,11 @@
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "en-ie" :
- {
- "line1" : "Updating..."
- },
"en-us" :
{
"line1" : "Updating...",
"textBody" : "Updating..."
},
- "es-en" :
- {
- "line1" : "Actualizando...",
- "textBody" : "Actualizando..."
- },
"es-es" :
{
"line1" : "Actualizando..."
@@ -1550,20 +1409,11 @@
"line1" : "Up-to-date",
"textBody" : "Up-to-date"
},
- "en-ie" :
- {
- "line1" : "Up-to-date"
- },
"en-us" :
{
"line1" : "Up-To-Date",
"textBody" : "Up-To-Date"
},
- "es-en" :
- {
- "line1" : "Actualizado",
- "textBody" : "Actualizado"
- },
"es-es" :
{
"line1" : "Actualizada"
@@ -1644,23 +1494,12 @@
"textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
"tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
},
- "en-ie" :
- {
- "label" : "Vehicle information",
- "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
- },
"en-us" :
{
"label" : "Vehicle Information",
"textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.",
"tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure."
},
- "es-en" :
- {
- "label" : "Información del vehículo",
- "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
"es-es" :
{
"label" : "Información del vehículo",
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 d5a66f4388..c456561328 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
@@ -599,20 +599,6 @@ TEST_F(PolicyManagerImplTest, GetHMITypes_ValidHmiTypes_ReturnTrue) {
EXPECT_TRUE(policy_manager_->GetHMITypes(kValidAppId, &app_types));
}
-TEST_F(PolicyManagerImplTest, SetMetaInfo_SetCCPUVersion_SUCCESS) {
- const std::string ccpu_version = "ccpu_version";
- const std::string wers_country_code = "wersCountryCode";
- const std::string language = "language";
-
- EXPECT_CALL(*mock_cache_manager_,
- SetMetaInfo(ccpu_version, wers_country_code, language));
- policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
-
- EXPECT_CALL(*mock_cache_manager_, GetCCPUVersionFromPT())
- .WillOnce(Return(ccpu_version));
- EXPECT_EQ(ccpu_version, policy_manager_->GetCCPUVersionFromPT());
-}
-
} // namespace policy_test
} // namespace components
} // namespace test
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 f4efa811b6..fb64dfe7d0 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
@@ -72,6 +72,35 @@ namespace policy_test {
using policy_handler_test::MockPolicySettings;
+namespace {
+const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json";
+const std::string kSoftwareVersion = "4.1.3.B_EB355B";
+const std::string kHardwareVersion = "1.1.1.0";
+} // namespace
+
+policy_table::Table LoadPreloadedPT(const std::string& filename) {
+ std::ifstream ifile(filename);
+ EXPECT_TRUE(ifile.good());
+ Json::CharReaderBuilder reader_builder;
+ Json::Value root(Json::objectValue);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
+ root["policy_table"]["module_config"].removeMember("preloaded_pt");
+ ifile.close();
+ policy_table::Table table(&root);
+ return table;
+}
+
+Json::Value GetDefaultSnapshotModuleMeta(policy_table::Table& policy_table) {
+ auto json_table = policy_table.ToJsonValue();
+
+ Json::Value default_module_meta = json_table["policy_table"]["module_meta"];
+ default_module_meta["pt_exchanged_at_odometer_x"] = Json::Value(0);
+ default_module_meta["pt_exchanged_x_days_after_epoch"] = Json::Value(0);
+ default_module_meta["ignition_cycles_since_last_exchange"] = Json::Value(0);
+
+ return default_module_meta;
+}
+
class SQLPTRepresentationTest : protected SQLPTRepresentation,
public ::testing::Test {
protected:
@@ -201,180 +230,6 @@ class SQLPTRepresentationTest : protected SQLPTRepresentation,
StringsCompare(groups, app_groups);
}
- void PolicyTableUpdatePrepare(Json::Value& table) {
- // Root
- table["policy_table"] = Json::Value(Json::objectValue);
-
- // 1st level
- Json::Value& policy_table = table["policy_table"];
- policy_table["module_config"] = Json::Value(Json::objectValue);
- policy_table["functional_groupings"] = Json::Value(Json::objectValue);
- policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue);
- policy_table["app_policies"] = Json::Value(Json::objectValue);
- policy_table["usage_and_error_counts"] = Json::Value(Json::objectValue);
- policy_table["device_data"] = Json::Value(Json::objectValue);
-
- // 'module_config' section start
- Json::Value& module_config = policy_table["module_config"];
- module_config["preloaded_pt"] = Json::Value(false);
- module_config["preloaded_date"] = Json::Value("");
- module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
- module_config["exchange_after_x_kilometers"] = Json::Value(100);
- module_config["exchange_after_x_days"] = Json::Value(5);
- module_config["timeout_after_x_seconds"] = Json::Value(500);
- module_config["seconds_between_retries"] = Json::Value(Json::arrayValue);
-
- Json::Value& seconds_between_retries =
- module_config["seconds_between_retries"];
- seconds_between_retries[0] = Json::Value(10);
- seconds_between_retries[1] = Json::Value(20);
- seconds_between_retries[2] = Json::Value(30);
- module_config["endpoints"] = Json::Value(Json::objectValue);
-
- Json::Value& endpoins = module_config["endpoints"];
- endpoins["0x00"] = Json::Value(Json::objectValue);
- endpoins["0x00"]["default"] = Json::Value(Json::arrayValue);
- endpoins["0x00"]["default"][0] =
- Json::Value("http://ford.com/cloud/default");
- module_config["notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(1);
- module_config["notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(2);
- module_config["notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(3);
- module_config["notifications_per_minute_by_priority"]["communication"] =
- Json::Value(4);
- module_config["notifications_per_minute_by_priority"]["normal"] =
- Json::Value(5);
- module_config["notifications_per_minute_by_priority"]["none"] =
- Json::Value(6);
- module_config["subtle_notifications_per_minute_by_priority"] =
- Json::Value(Json::objectValue);
- module_config["subtle_notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(7);
- module_config["subtle_notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(8);
- module_config["subtle_notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(9);
- module_config["subtle_notifications_per_minute_by_priority"]
- ["communication"] = Json::Value(10);
- module_config["subtle_notifications_per_minute_by_priority"]["normal"] =
- Json::Value(11);
- module_config["subtle_notifications_per_minute_by_priority"]["none"] =
- Json::Value(12);
- module_config["vehicle_make"] = Json::Value("");
- module_config["vehicle_model"] = Json::Value("");
- module_config["vehicle_year"] = Json::Value("");
- module_config["certificate"] = Json::Value("encrypted_certificate_content");
- // 'module_config' section end
-
- // 'functional_groupings' section start
- Json::Value& functional_groupings = policy_table["functional_groupings"];
- functional_groupings["default"] = Json::Value(Json::objectValue);
- Json::Value& default_group = functional_groupings["default"];
- default_group["rpcs"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"]["hmi_levels"] =
- Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL");
- default_group["rpcs"]["Update"]["parameters"] =
- Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed");
-
- Json::Value& consumer_friendly_messages =
- policy_table["consumer_friendly_messages"];
- consumer_friendly_messages["version"] = Json::Value("some_msg_version");
- consumer_friendly_messages["messages"] = Json::Value(Json::objectValue);
- consumer_friendly_messages["messages"]["MSG_CODE"] =
- Json::Value(Json::objectValue);
- Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG_CODE"];
- msg1["languages"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"] = Json::Value(Json::objectValue);
- // 'functional_groupings' section end
-
- // 'app_policies' section start
- Json::Value& app_policies = policy_table["app_policies"];
- app_policies["default"] = Json::Value(Json::objectValue);
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["memory_kb"] = Json::Value(50);
- app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["default"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["default"]["groups"][0] = Json::Value("default");
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["is_revoked"] = Json::Value(true);
- app_policies["default"]["default_hmi"] = Json::Value("FULL");
- app_policies["default"]["keep_context"] = Json::Value(true);
- app_policies["default"]["steal_focus"] = Json::Value(true);
- app_policies["default"]["RequestType"] = Json::Value(Json::arrayValue);
-
- app_policies["pre_DataConsent"] = Json::Value(Json::objectValue);
- app_policies["pre_DataConsent"]["memory_kb"] = Json::Value(40);
- app_policies["pre_DataConsent"]["heart_beat_timeout_ms"] = Json::Value(90);
- app_policies["pre_DataConsent"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["pre_DataConsent"]["groups"][0] = Json::Value("default");
- app_policies["pre_DataConsent"]["priority"] = Json::Value("EMERGENCY");
- app_policies["pre_DataConsent"]["default_hmi"] = Json::Value("FULL");
- app_policies["pre_DataConsent"]["is_revoked"] = Json::Value(false);
- app_policies["pre_DataConsent"]["keep_context"] = Json::Value(true);
- app_policies["pre_DataConsent"]["steal_focus"] = Json::Value(true);
- app_policies["pre_DataConsent"]["RequestType"] =
- Json::Value(Json::arrayValue);
-
- app_policies["1234"] = Json::Value(Json::objectValue);
- app_policies["1234"]["memory_kb"] = Json::Value(150);
- app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(200);
- app_policies["1234"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["1234"]["groups"][0] = Json::Value("default");
- app_policies["1234"]["priority"] = Json::Value("EMERGENCY");
- app_policies["1234"]["default_hmi"] = Json::Value("FULL");
- app_policies["1234"]["is_revoked"] = Json::Value(true);
- 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"]["icon_url"] =
- Json::Value("http:://www.sdl.com/image.png");
- 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);
- app_policies["device"]["groups"][0] = Json::Value("default");
- app_policies["device"]["priority"] = Json::Value("EMERGENCY");
- app_policies["device"]["is_revoked"] = Json::Value(true);
- app_policies["device"]["default_hmi"] = Json::Value("FULL");
- app_policies["device"]["keep_context"] = Json::Value(true);
- app_policies["device"]["steal_focus"] = Json::Value(true);
- // 'app_policies' section end
-
- Json::Value& usage_and_error_counts =
- policy_table["usage_and_error_counts"];
- usage_and_error_counts["app_level"] = Json::Value(Json::objectValue);
- usage_and_error_counts["app_level"]["some_app_id"] =
- Json::Value(Json::objectValue);
- usage_and_error_counts["app_level"]["some_app_id"]["count_of_tls_errors"] =
- Json::Value(5);
-
- Json::Value& device_data = policy_table["device_data"];
- device_data["device_id_hash_1"] = Json::Value(Json::objectValue);
- device_data["device_id_hash_2"] = Json::Value(Json::objectValue);
- device_data["device_id_hash_3"] = Json::Value(Json::objectValue);
- }
-
::testing::AssertionResult IsValid(const policy_table::Table& table) {
if (table.is_valid()) {
return ::testing::AssertionSuccess();
@@ -1812,252 +1667,77 @@ TEST_F(SQLPTRepresentationTest3, RemoveDB_RemoveDB_ExpectFileDeleted) {
EXPECT_FALSE(file_system::FileExists(path));
}
-// TODO {AKozoriz} : Snapshot must have module meta section, but test
-// generates snapshot without it.
TEST_F(SQLPTRepresentationTest,
- DISABLED_GenerateSnapshot_SetPolicyTable_SnapshotIsPresent) {
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepare(table);
+ GenerateSnapshot_DefaultContentOfModuleMeta_MetaInfoPresentInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
+ ASSERT_TRUE(IsValid(update));
+ EXPECT_TRUE(reps->Save(update));
- // Assert
- // ASSERT_TRUE(IsValid(update));
- ASSERT_TRUE(reps->Save(update));
+ std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
+
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ GenerateSnapshot_SetMetaInfo_NoSoftwareVersionInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
+
+ ASSERT_TRUE(IsValid(update));
+ EXPECT_TRUE(reps->Save(update));
+ EXPECT_TRUE(reps->SetMetaInfo(kSoftwareVersion));
- // Act
std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
- snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
- // Remove fields which must be absent in snapshot
- table["policy_table"]["consumer_friendly_messages"].removeMember("messages");
- table["policy_table"]["app_policies"]["1234"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["1234"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["1234"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["default"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["default"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["default"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "default_hmi");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "keep_context");
- table["policy_table"]["app_policies"]["pre_DataConsent"].removeMember(
- "steal_focus");
- table["policy_table"]["app_policies"]["device"].removeMember("default_hmi");
- table["policy_table"]["app_policies"]["device"].removeMember("keep_context");
- table["policy_table"]["app_policies"]["device"].removeMember("steal_focus");
- table["policy_table"]["app_policies"]["device"].removeMember("groups");
- table["policy_table"]["device_data"] = Json::Value(Json::objectValue);
- table["policy_table"]["module_meta"] = Json::Value(Json::objectValue);
- policy_table::Table expected(&table);
- Json::StreamWriterBuilder writer_builder;
- // Checks
- EXPECT_EQ(Json::writeString(writer_builder, expected.ToJsonValue()),
- Json::writeString(writer_builder, snapshot->ToJsonValue()));
- EXPECT_EQ(expected.ToJsonValue().toStyledString(),
- snapshot->ToJsonValue().toStyledString());
+
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
}
-TEST_F(SQLPTRepresentationTest, Save_SetPolicyTableThenSave_ExpectSavedToPT) {
- // Arrange
- Json::Value table(Json::objectValue);
- PolicyTableUpdatePrepare(table);
+TEST_F(SQLPTRepresentationTest,
+ GenerateSnapshot_SetHardwareVersion_NoHardwareVersionInSnapshot) {
+ policy_table::Table update = LoadPreloadedPT(kSdlPreloadedPtJson);
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- // Checks PT before Save
- policy_table::FunctionalGroupings func_groups;
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Check functional groupings section
- EXPECT_EQ(0u, func_groups.size());
-
- policy_table::ApplicationPoliciesSection policies;
- GatherApplicationPoliciesSection(&policies);
- // Check ApplicationPoliciesSection
- EXPECT_EQ(0u, policies.apps.size());
- EXPECT_EQ(policy_table::Priority::P_EMERGENCY, policies.device.priority);
-
- policy_table::ModuleConfig config;
- GatherModuleConfig(&config);
- // Check Module config section
- EXPECT_TRUE(*config.preloaded_pt);
- EXPECT_EQ(0, config.exchange_after_x_ignition_cycles);
- EXPECT_EQ(0, config.exchange_after_x_kilometers);
- EXPECT_EQ(0, config.exchange_after_x_days);
- EXPECT_EQ(0, config.timeout_after_x_seconds);
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_make));
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_model));
- EXPECT_EQ("", static_cast<std::string>(*config.vehicle_year));
- EXPECT_EQ("", static_cast<std::string>(*config.preloaded_date));
- EXPECT_EQ("", static_cast<std::string>(*config.certificate));
- EXPECT_EQ(0u, config.seconds_between_retries.size());
- EXPECT_EQ(0u, config.endpoints.size());
- EXPECT_EQ(0u, config.notifications_per_minute_by_priority.size());
- EXPECT_EQ(0u, (*config.subtle_notifications_per_minute_by_priority).size());
-
- policy_table::ConsumerFriendlyMessages messages;
- GatherConsumerFriendlyMessages(&messages);
- EXPECT_EQ("0", static_cast<std::string>(messages.version));
-
- policy_table::DeviceData devices;
- GatherDeviceData(&devices);
- EXPECT_EQ(0u, devices.size());
-
- policy_table::UsageAndErrorCounts counts;
- GatherUsageAndErrorCounts(&counts);
- EXPECT_TRUE(0u == counts.app_level->size());
-
- // ASSERT_TRUE(IsValid(update));
- // Act
- ASSERT_TRUE(reps->Save(update));
+ ASSERT_TRUE(IsValid(update));
+ EXPECT_TRUE(reps->Save(update));
+ reps->SetHardwareVersion(kHardwareVersion);
- // Check Functional Groupings
- ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
- // Checks
- EXPECT_EQ(1u, func_groups.size());
- policy_table::FunctionalGroupings::iterator func_groups_iter =
- func_groups.find("default");
- ASSERT_TRUE(func_groups.end() != func_groups_iter);
- policy_table::Rpcs& rpcs = func_groups_iter->second;
- EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
- policy_table::Rpc& rpc = rpcs.rpcs;
- EXPECT_EQ(1u, rpc.size());
- policy_table::Rpc::const_iterator rpc_iter = rpc.find("Update");
- EXPECT_TRUE(rpc.end() != rpc_iter);
- const policy_table::HmiLevels& hmi_levels = rpc_iter->second.hmi_levels;
- EXPECT_EQ(1u, hmi_levels.size());
- EXPECT_TRUE(hmi_levels.end() != std::find(hmi_levels.begin(),
- hmi_levels.end(),
- policy_table::HmiLevel::HL_FULL));
-
- const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
- EXPECT_EQ(1u, parameters.size());
- EXPECT_TRUE(parameters.end() !=
- std::find(parameters.begin(),
- parameters.end(),
- policy_table::EnumToJsonString(
- policy_table::Parameter::P_SPEED)));
- // Check Application Policies Section
- GatherApplicationPoliciesSection(&policies);
- const uint32_t apps_size = 3u;
-
- rpc::String<1ul, 255ul> str("default");
- policy_table::Strings groups;
- groups.push_back(str);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "1234",
- 150u,
- 200u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "default",
- 50u,
- 100u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "pre_DataConsent",
- 40u,
- 90u,
- groups);
- CheckAppPoliciesSection(policies,
- apps_size,
- policy_table::Priority::P_EMERGENCY,
- "device",
- 0u,
- 0u,
- groups);
-
- CheckAppGroups("1234", groups);
- CheckAppGroups("default", groups);
- CheckAppGroups("pre_DataConsent", groups);
-
- GatherModuleConfig(&config);
- // Check Module Config section
- ASSERT_FALSE(*config.preloaded_pt);
- ASSERT_EQ("encrypted_certificate_content",
- static_cast<std::string>(*config.certificate));
- ASSERT_EQ("", static_cast<std::string>(*config.preloaded_date));
- ASSERT_EQ("", static_cast<std::string>(*config.vehicle_year));
- ASSERT_EQ("", static_cast<std::string>(*config.vehicle_model));
- ASSERT_EQ("", static_cast<std::string>(*config.vehicle_make));
- ASSERT_EQ(10, config.exchange_after_x_ignition_cycles);
- ASSERT_EQ(100, config.exchange_after_x_kilometers);
- ASSERT_EQ(5, config.exchange_after_x_days);
- ASSERT_EQ(500, config.timeout_after_x_seconds);
- ASSERT_EQ(3u, config.seconds_between_retries.size());
- ASSERT_EQ(10, config.seconds_between_retries[0]);
- ASSERT_EQ(20, config.seconds_between_retries[1]);
- ASSERT_EQ(30, config.seconds_between_retries[2]);
- ASSERT_EQ(6u, config.notifications_per_minute_by_priority.size());
- ASSERT_EQ(1, config.notifications_per_minute_by_priority["emergency"]);
- ASSERT_EQ(2, config.notifications_per_minute_by_priority["navigation"]);
- ASSERT_EQ(3, config.notifications_per_minute_by_priority["VOICECOMM"]);
- ASSERT_EQ(4, config.notifications_per_minute_by_priority["communication"]);
- ASSERT_EQ(5, config.notifications_per_minute_by_priority["normal"]);
- ASSERT_EQ(6, config.notifications_per_minute_by_priority["none"]);
- ASSERT_EQ(6u, (*config.subtle_notifications_per_minute_by_priority).size());
- ASSERT_EQ(7,
- (*config.subtle_notifications_per_minute_by_priority)["emergency"]);
- ASSERT_EQ(
- 8, (*config.subtle_notifications_per_minute_by_priority)["navigation"]);
- ASSERT_EQ(9,
- (*config.subtle_notifications_per_minute_by_priority)["VOICECOMM"]);
- ASSERT_EQ(
- 10,
- (*config.subtle_notifications_per_minute_by_priority)["communication"]);
- ASSERT_EQ(11,
- (*config.subtle_notifications_per_minute_by_priority)["normal"]);
- ASSERT_EQ(12, (*config.subtle_notifications_per_minute_by_priority)["none"]);
- EXPECT_EQ(1u, config.endpoints.size());
- policy_table::ServiceEndpoints& service_endpoints = config.endpoints;
- EXPECT_EQ("0x00", service_endpoints.begin()->first);
- policy_table::URLList& url_list = service_endpoints.begin()->second;
- EXPECT_EQ("default", url_list.begin()->first);
- policy_table::URL& url = url_list.begin()->second;
- EXPECT_EQ("http://ford.com/cloud/default", static_cast<std::string>(url[0]));
-
- GatherConsumerFriendlyMessages(&messages);
- EXPECT_EQ("some_msg_version", static_cast<std::string>(messages.version));
- EXPECT_TRUE(0u != messages.messages->size());
- EXPECT_TRUE(0u != (*messages.messages)["MSG_CODE"].languages.size());
-
- GatherUsageAndErrorCounts(&counts);
- EXPECT_FALSE(0u == counts.app_level->size());
- EXPECT_EQ(5u, (*counts.app_level)["some_app_id"].count_of_tls_errors);
-
- 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);
-
- policy_table::ApplicationPolicies& apps = policies.apps;
- auto icon_url = *(apps[kAppId].icon_url);
-
- EXPECT_EQ(std::string(icon_url), "http:://www.sdl.com/image.png");
+ std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
+
+ auto expected_module_meta = GetDefaultSnapshotModuleMeta(update);
+ auto& snapshot_module_meta = snapshot->policy_table.module_meta;
+ EXPECT_EQ(expected_module_meta.toStyledString(),
+ snapshot_module_meta.ToJsonValue().toStyledString());
}
+TEST_F(SQLPTRepresentationTest,
+ SetMetaInfo_SetSoftwareVersion_ValueIsSetInModuleMeta) {
+ EXPECT_TRUE(reps->SetMetaInfo(kSoftwareVersion));
+
+ utils::dbms::SQLQuery query(reps->db());
+ const std::string query_select_ccpu =
+ "SELECT `ccpu_version` FROM `module_meta`";
+
+ query.Prepare(query_select_ccpu);
+ query.Next();
+ EXPECT_EQ(kSoftwareVersion, query.GetString(0));
+}
+
+TEST_F(SQLPTRepresentationTest, SetHardwareVersion_ValueIsSetInModuleMeta) {
+ reps->SetHardwareVersion(kHardwareVersion);
+
+ utils::dbms::SQLQuery query(reps->db());
+ const std::string query_select_hardware_version =
+ "SELECT `hardware_version` FROM `module_meta`";
+
+ query.Prepare(query_select_hardware_version);
+ query.Next();
+ EXPECT_EQ(kHardwareVersion, query.GetString(0));
+}
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/protocol/src/bson_object_keys.cc b/src/components/protocol/src/bson_object_keys.cc
index acafd3dbd2..7e1656955f 100644
--- a/src/components/protocol/src/bson_object_keys.cc
+++ b/src/components/protocol/src/bson_object_keys.cc
@@ -19,6 +19,12 @@ const char* tcp_ip_address = "tcpIpAddress";
const char* tcp_port = "tcpPort";
const char* reason = "reason";
const char* auth_token = "authToken";
+const char* vehicle_make = "make";
+const char* vehicle_model = "model";
+const char* vehicle_model_year = "modelYear";
+const char* vehicle_trim = "trim";
+const char* vehicle_system_software_version = "systemSoftwareVersion";
+const char* vehicle_system_hardware_version = "systemHardwareVersion";
} // namespace strings
diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt
index 8f3b33d519..91cb7af47e 100644
--- a/src/components/protocol_handler/CMakeLists.txt
+++ b/src/components/protocol_handler/CMakeLists.txt
@@ -57,12 +57,15 @@ collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
set(LIBRARIES
ProtocolLibrary
- HMI_API
Utils
bson -L${BSON_LIBS_DIRECTORY}
emhashmap -L${EMHASHMAP_LIBS_DIRECTORY}
)
+if(ANDROID)
+ list(APPEND LIBRARIES HMI_API)
+endif()
+
get_property(dirs DIRECTORY "" PROPERTY LIBRARIES)
foreach(dir ${dirs})
message(STATUS "libraries='${dir}'")
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 ba5e04b04b..bfc3dffc14 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
@@ -215,7 +215,7 @@ class ProtocolHandlerImpl
void ProcessFailedPTU() OVERRIDE;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify security manager that
* certificate decryption failed in the external flow
@@ -376,12 +376,15 @@ class ProtocolHandlerImpl
* \param protocol_version Version of protocol used for communication
* \param service_type Type of session: RPC or BULK Data. RPC by default
* \param reason String stating the reason for the rejecting the start service
+ * \param full_version full protocol version (major.minor.patch) used by the
+ * mobile proxy
*/
void SendStartSessionNAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
uint8_t service_type,
- const std::string& reason);
+ const std::string& reason,
+ utils::SemanticVersion& full_version);
/**
* \brief Sends fail of starting session to mobile application
@@ -391,13 +394,16 @@ class ProtocolHandlerImpl
* \param service_type Type of session: RPC or BULK Data. RPC by default
* \param rejected_params List of rejected params to send in payload
* \param reason String stating the reason for the rejecting the start service
+ * \param full_version full protocol version (major.minor.patch) used by the
+ * mobile proxy
*/
void SendStartSessionNAck(ConnectionID connection_id,
uint8_t session_id,
uint8_t protocol_version,
uint8_t service_type,
std::vector<std::string>& rejectedParams,
- const std::string& reason);
+ const std::string& reason,
+ utils::SemanticVersion& full_version);
/**
* \brief Sends acknowledgement of end session/service to mobile application
@@ -457,7 +463,7 @@ class ProtocolHandlerImpl
* Only valid when generated_session_id is 0. Note, even if
* generated_session_id is 0, the list may be empty.
*/
- void NotifySessionStarted(const SessionContext& context,
+ void NotifySessionStarted(SessionContext& context,
std::vector<std::string>& rejected_params,
const std::string err_reason) OVERRIDE;
@@ -734,6 +740,24 @@ class ProtocolHandlerImpl
const uint8_t session_id,
const bool protection) const;
+ /**
+ * @brief Writes available protocol vehicle data into structured bson
+ * @param params bson params to write into
+ * @param data data to write
+ */
+ void WriteProtocolVehicleData(
+ BsonObject& params, const connection_handler::ProtocolVehicleData& data);
+
+ /**
+ * \brief Parces full protocol version from start service message headers bson
+ * \param full_version full protocol version (major.minor.patch) used by the
+ * mobile proxy
+ * \param packet Sart service message
+ * \return true if version successfully parsed, otherwise false
+ */
+ bool ParseFullVersion(utils::SemanticVersion& full_version,
+ const ProtocolFramePtr& packet) const;
+
const ProtocolHandlerSettings& settings_;
/**
diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc
index 4d306fd330..87369c0793 100644
--- a/src/components/protocol_handler/src/handshake_handler.cc
+++ b/src/components/protocol_handler/src/handshake_handler.cc
@@ -149,8 +149,6 @@ bool HandshakeHandler::OnHandshakeDone(
return "Certificate is not signed";
case security_manager::SSLContext::Handshake_Result_AppIDMismatch:
return "Trying to run handshake with wrong app id";
- case security_manager::SSLContext::Handshake_Result_AppNameMismatch:
- return "Trying to run handshake with wrong app name";
case security_manager::SSLContext::Handshake_Result_AbnormalFail:
return "Error occurred during handshake";
case security_manager::SSLContext::Handshake_Result_Fail:
@@ -232,7 +230,8 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
context_.service_type_,
(is_service_already_protected)
? "Service is already protected"
- : "Service cannot be protected");
+ : "Service cannot be protected",
+ full_version_);
}
}
@@ -284,7 +283,8 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
context_.new_session_id_,
protocol_version_,
context_.service_type_,
- reason_msg + (err_reason.empty() ? "" : ": " + err_reason));
+ reason_msg + (err_reason.empty() ? "" : ": " + err_reason),
+ full_version_);
}
}
diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc
index 08997acaac..c7a3f095a8 100644
--- a/src/components/protocol_handler/src/incoming_data_handler.cc
+++ b/src/components/protocol_handler/src/incoming_data_handler.cc
@@ -63,8 +63,8 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData(
out_result = RESULT_FAIL;
return ProtocolFramePtrList();
}
- SDL_LOG_INFO("Processing incoming data of size "
- << tm_message_size << " for connection " << connection_id);
+ SDL_LOG_TRACE("Processing incoming data of size "
+ << tm_message_size << " for connection " << connection_id);
ConnectionsDataMap::iterator it = connections_data_.find(connection_id);
if (connections_data_.end() == it) {
SDL_LOG_WARN("ProcessData requested for unknown connection");
@@ -73,16 +73,16 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData(
}
std::vector<uint8_t>& connection_data = it->second;
connection_data.insert(connection_data.end(), data, data + tm_message_size);
- SDL_LOG_DEBUG("Total data size for connection " << connection_id << " is "
+ SDL_LOG_TRACE("Total data size for connection " << connection_id << " is "
<< connection_data.size());
ProtocolFramePtrList out_frames;
*malformed_occurrence = 0;
out_result = CreateFrame(
connection_data, out_frames, *malformed_occurrence, connection_id);
- SDL_LOG_DEBUG("New data size for connection " << connection_id << " is "
+ SDL_LOG_TRACE("New data size for connection " << connection_id << " is "
<< connection_data.size());
if (!out_frames.empty()) {
- SDL_LOG_INFO("Created and passed " << out_frames.size() << " packets");
+ SDL_LOG_TRACE("Created and passed " << out_frames.size() << " packets");
} else {
if (RESULT_DEFERRED == out_result) {
SDL_LOG_DEBUG(
@@ -156,7 +156,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
<< std::hex << static_cast<const void*>(&*data_it));
continue;
}
- SDL_LOG_DEBUG("Payload size " << header_.dataSize);
+ SDL_LOG_TRACE("Payload size " << header_.dataSize);
const uint32_t packet_size = GetPacketSize(header_);
if (packet_size == 0) {
SDL_LOG_WARN("Null packet size");
@@ -167,14 +167,14 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
continue;
}
if (data_size < packet_size) {
- SDL_LOG_DEBUG("Packet data is not available yet");
+ SDL_LOG_TRACE("Packet data is not available yet");
incoming_data.erase(incoming_data.begin(), data_it);
return RESULT_DEFERRED;
}
ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id));
const RESULT_CODE deserialize_result =
frame->deserializePacket(&*data_it, packet_size);
- SDL_LOG_DEBUG("Deserialized frame " << frame);
+ SDL_LOG_TRACE("Deserialized frame " << frame);
if (deserialize_result != RESULT_OK) {
SDL_LOG_WARN("Packet deserialization failed");
incoming_data.erase(incoming_data.begin(), data_it);
@@ -183,7 +183,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
out_frames.push_back(frame);
last_portion_of_data_was_malformed_ = false;
- SDL_LOG_DEBUG("Frame added. "
+ SDL_LOG_TRACE("Frame added. "
<< "Connection ID " << connection_id);
data_it += packet_size;
diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc
index 0cffe724c7..b66ce9b911 100644
--- a/src/components/protocol_handler/src/multiframe_builder.cc
+++ b/src/components/protocol_handler/src/multiframe_builder.cc
@@ -91,8 +91,8 @@ bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) {
ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(multiframes_map_lock_);
- SDL_LOG_DEBUG("Current state is: " << multiframes_map_);
- SDL_LOG_DEBUG("Current multiframe map size is: " << multiframes_map_.size());
+ SDL_LOG_TRACE("Current state is: " << multiframes_map_);
+ SDL_LOG_TRACE("Current multiframe map size is: " << multiframes_map_.size());
ProtocolFramePtrList outpute_frame_list;
for (MultiFrameMap::iterator connection_it = multiframes_map_.begin();
connection_it != multiframes_map_.end();
@@ -115,7 +115,7 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
if (frame && frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE &&
frame->payload_size() > 0u) {
- SDL_LOG_DEBUG("Ready frame: " << frame);
+ SDL_LOG_TRACE("Ready frame: " << frame);
outpute_frame_list.push_back(frame);
messageId_map.erase(messageId_it++);
continue;
@@ -136,7 +136,7 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
} // iteration over messageId_map
} // iteration over session_map
} // iteration over multiframes_map_
- SDL_LOG_DEBUG("Result frames count: " << outpute_frame_list.size());
+ SDL_LOG_TRACE("Result frames count: " << outpute_frame_list.size());
return outpute_frame_list;
}
@@ -164,8 +164,8 @@ RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) {
RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST, RESULT_FAIL);
sync_primitives::AutoLock lock(multiframes_map_lock_);
- SDL_LOG_DEBUG("Waiting : " << multiframes_map_);
- SDL_LOG_DEBUG("Handling FIRST frame: " << packet);
+ SDL_LOG_TRACE("Waiting : " << multiframes_map_);
+ SDL_LOG_TRACE("Handling FIRST frame: " << packet);
if (packet->payload_size() != 0u) {
SDL_LOG_ERROR("First frame shall have no data:" << packet);
return RESULT_FAIL;
@@ -193,10 +193,11 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
return RESULT_FAIL;
}
- SDL_LOG_DEBUG("Start waiting frames for connection_id: "
+ SDL_LOG_TRACE("Start waiting frames for connection_id: "
<< connection_id
<< ", session_id: " << static_cast<int>(session_id)
<< ", message_id: " << message_id);
+ packet->set_frame_data(FRAME_DATA_FIRST);
messageId_map[message_id] = {packet, date_time::getCurrentTime()};
return RESULT_OK;
}
@@ -240,7 +241,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
if (is_last_consecutive) {
// TODO(EZamakhov): implement count of frames and result size verification
- SDL_LOG_DEBUG("Last CONSECUTIVE frame");
+ SDL_LOG_TRACE("Last CONSECUTIVE frame");
} else {
uint8_t previous_frame_data = assembling_frame->frame_data();
if (previous_frame_data == std::numeric_limits<uint8_t>::max()) {
@@ -275,8 +276,8 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
SDL_LOG_ERROR("Failed to append frame for multiframe message.");
return RESULT_FAIL;
}
- SDL_LOG_INFO("Assembled frame with payload size: "
- << assembling_frame->payload_size());
+ SDL_LOG_TRACE("Assembled frame with payload size: "
+ << assembling_frame->payload_size());
frame_data.append_time = date_time::getCurrentTime();
return RESULT_OK;
}
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 144a84292f..7fc8ba330a 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -54,10 +54,11 @@ SDL_CREATE_LOG_VARIABLE("ProtocolHandler")
const size_t kStackSize = 131072;
-const utils::SemanticVersion default_protocol_version(5, 3, 0);
+const utils::SemanticVersion default_protocol_version(5, 4, 0);
const utils::SemanticVersion min_multiple_transports_version(5, 1, 0);
const utils::SemanticVersion min_cloud_app_version(5, 2, 0);
const utils::SemanticVersion min_reason_param_version(5, 3, 0);
+const utils::SemanticVersion min_vehicle_data_version(5, 4, 0);
ProtocolHandlerImpl::ProtocolHandlerImpl(
const ProtocolHandlerSettings& settings,
@@ -226,6 +227,39 @@ void ProtocolHandlerImpl::SendStartSessionAck(
bson_object_deinitialize(&empty_param);
}
+void ProtocolHandlerImpl::WriteProtocolVehicleData(
+ BsonObject& params, const connection_handler::ProtocolVehicleData& data) {
+ auto write_string_to_bson = [&params](const std::string& param_name,
+ const std::string& param_value) {
+ if (param_value.empty()) {
+ return;
+ }
+
+ const uint16_t max_string_length = 500;
+ char value_buffer[max_string_length + 1]; // extra byte for NULL symbol
+ strncpy(value_buffer, param_value.c_str(), sizeof(value_buffer));
+ value_buffer[max_string_length] = 0;
+
+ if (bson_object_put_string(&params, param_name.c_str(), value_buffer)) {
+ SDL_LOG_DEBUG("Parameter "
+ << param_name << " has been written to bson with value: "
+ << bson_object_get_string(&params, param_name.c_str()));
+ } else {
+ SDL_LOG_DEBUG("Failed to write parameter " << param_name
+ << " into bson structure");
+ }
+ };
+
+ write_string_to_bson(strings::vehicle_make, data.vehicle_make);
+ write_string_to_bson(strings::vehicle_model, data.vehicle_model);
+ write_string_to_bson(strings::vehicle_model_year, data.vehicle_year);
+ write_string_to_bson(strings::vehicle_trim, data.vehicle_trim);
+ write_string_to_bson(strings::vehicle_system_software_version,
+ data.vehicle_system_software_version);
+ write_string_to_bson(strings::vehicle_system_hardware_version,
+ data.vehicle_system_hardware_version);
+}
+
void ProtocolHandlerImpl::SendStartSessionAck(
ConnectionID connection_id,
uint8_t session_id,
@@ -289,6 +323,13 @@ void ProtocolHandlerImpl::SendStartSessionAck(
<< static_cast<int32_t>(bson_object_get_int64(&params, strings::mtu)));
if (serviceTypeValue == kRpc) {
+ SDL_LOG_DEBUG("Collecting protocol vehicle data");
+ connection_handler::ProtocolVehicleData data;
+ if (full_version >= min_vehicle_data_version &&
+ connection_handler_.GetProtocolVehicleData(data)) {
+ WriteProtocolVehicleData(params, data);
+ }
+
// Hash ID is only used in RPC case
const bool hash_written = bson_object_put_int32(
&params, strings::hash_id, static_cast<int32_t>(hash_id));
@@ -330,7 +371,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
BsonArray secondaryTransportsArr;
bson_array_initialize(&secondaryTransportsArr,
secondaryTransports.size());
- for (unsigned int i = 0; i < secondaryTransports.size(); i++) {
+ for (unsigned int i = 0; i < secondaryTransports.size(); ++i) {
char secondaryTransport[255];
strncpy(secondaryTransport,
secondaryTransports[i].c_str(),
@@ -348,7 +389,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
BsonArray audioServiceTransportsArr;
bson_array_initialize(&audioServiceTransportsArr,
audioServiceTransports.size());
- for (unsigned int i = 0; i < audioServiceTransports.size(); i++) {
+ for (unsigned int i = 0; i < audioServiceTransports.size(); ++i) {
SDL_LOG_DEBUG("Adding " << audioServiceTransports[i]
<< " to audioServiceTransports parameter "
"of StartSessionAck");
@@ -362,7 +403,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
BsonArray videoServiceTransportsArr;
bson_array_initialize(&videoServiceTransportsArr,
videoServiceTransports.size());
- for (unsigned int i = 0; i < videoServiceTransports.size(); i++) {
+ for (unsigned int i = 0; i < videoServiceTransports.size(); ++i) {
SDL_LOG_DEBUG("Adding " << videoServiceTransports[i]
<< " to videoServiceTransports parameter "
"of StartSessionAck");
@@ -418,6 +459,11 @@ void ProtocolHandlerImpl::SendStartSessionAck(
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
+ const uint32_t connection_key =
+ session_observer_.KeyFromPair(connection_id, session_id);
+ connection_handler_.BindProtocolVersionWithSession(connection_key,
+ ack_protocol_version);
+
SDL_LOG_DEBUG("SendStartSessionAck() for connection "
<< connection_id << " for service_type "
<< static_cast<int32_t>(service_type) << " session_id "
@@ -435,18 +481,21 @@ void ProtocolHandlerImpl::SendStartSessionAck(
}
}
-void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id,
- uint8_t session_id,
- uint8_t protocol_version,
- uint8_t service_type,
- const std::string& reason) {
+void ProtocolHandlerImpl::SendStartSessionNAck(
+ ConnectionID connection_id,
+ uint8_t session_id,
+ uint8_t protocol_version,
+ uint8_t service_type,
+ const std::string& reason,
+ utils::SemanticVersion& full_version) {
std::vector<std::string> rejectedParams;
SendStartSessionNAck(connection_id,
session_id,
protocol_version,
service_type,
rejectedParams,
- reason);
+ reason,
+ full_version);
}
void ProtocolHandlerImpl::SendStartSessionNAck(
@@ -455,9 +504,18 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
uint8_t protocol_version,
uint8_t service_type,
std::vector<std::string>& rejectedParams,
- const std::string& reason) {
+ const std::string& reason,
+ utils::SemanticVersion& full_version) {
SDL_LOG_AUTO_TRACE();
+ if (!full_version.isValid()) {
+ if (!session_observer_.ProtocolVersionUsed(
+ connection_id, session_id, full_version)) {
+ SDL_LOG_WARN("Connection: " << connection_id << " and/or session: "
+ << session_id << "no longer exist(s).");
+ }
+ }
+
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
@@ -471,14 +529,6 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
uint8_t maxProtocolVersion = SupportedSDLProtocolVersion();
- utils::SemanticVersion full_version;
- if (!session_observer_.ProtocolVersionUsed(
- connection_id, session_id, full_version)) {
- SDL_LOG_WARN("Connection: " << connection_id << " and/or session: "
- << session_id << "no longer exist(s).");
- return;
- }
-
if (protocol_version >= PROTOCOL_VERSION_5 &&
maxProtocolVersion >= PROTOCOL_VERSION_5) {
BsonObject payloadObj;
@@ -971,7 +1021,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
}
const uint32_t connection_key = tm_message->connection_key();
- SDL_LOG_DEBUG("Received data from TM with connection id "
+ SDL_LOG_TRACE("Received data from TM with connection id "
<< connection_key << " msg data_size "
<< tm_message->data_size());
@@ -980,7 +1030,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
const ProtocolFramePtrList protocol_frames =
incoming_data_handler_.ProcessData(
*tm_message, result, &malformed_occurs);
- SDL_LOG_DEBUG("Processed " << protocol_frames.size() << " frames");
+ SDL_LOG_TRACE("Processed " << protocol_frames.size() << " frames");
if (result != RESULT_OK) {
if (result == RESULT_MALFORMED_OCCURS) {
SDL_LOG_WARN("Malformed message occurs, connection id "
@@ -1164,7 +1214,7 @@ void ProtocolHandlerImpl::ProcessFailedPTU() {
#endif // ENABLE_SECURITY
}
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
void ProtocolHandlerImpl::ProcessFailedCertDecrypt() {
SDL_LOG_AUTO_TRACE();
security_manager_->ProcessFailedCertDecrypt();
@@ -1372,7 +1422,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
const ProtocolFramePtr firstPacket(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
- needs_encryption,
+ false,
FRAME_TYPE_FIRST,
service_type,
FRAME_DATA_FIRST,
@@ -1414,7 +1464,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) {
DCHECK_OR_RETURN(packet, RESULT_UNKNOWN);
- SDL_LOG_DEBUG("Handling message " << packet);
+ SDL_LOG_TRACE("Handling message " << packet);
switch (packet->frame_type()) {
case FRAME_TYPE_CONTROL:
SDL_LOG_TRACE("FRAME_TYPE_CONTROL");
@@ -1438,7 +1488,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
const ProtocolFramePtr packet) {
SDL_LOG_AUTO_TRACE();
- SDL_LOG_DEBUG(
+ SDL_LOG_TRACE(
"FRAME_TYPE_SINGLE message of size "
<< packet->data_size() << "; message "
<< utils::ConvertBinaryDataToString(packet->data(), packet->data_size()));
@@ -1732,8 +1782,17 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
reason += " Allowed only in unprotected mode";
}
- SendStartSessionNAck(
- connection_id, session_id, protocol_version, service_type, reason);
+ utils::SemanticVersion version;
+ if (packet->service_type() == kRpc && packet->data() != NULL) {
+ ParseFullVersion(version, packet);
+ }
+
+ SendStartSessionNAck(connection_id,
+ session_id,
+ protocol_version,
+ service_type,
+ reason,
+ version);
return RESULT_OK;
}
@@ -1809,8 +1868,34 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport(
return RESULT_OK;
}
+bool ProtocolHandlerImpl::ParseFullVersion(
+ utils::SemanticVersion& full_version,
+ const ProtocolFramePtr& packet) const {
+ SDL_LOG_AUTO_TRACE();
+
+ BsonObject request_params;
+ size_t request_params_size = bson_object_from_bytes_len(
+ &request_params, packet->data(), packet->total_data_bytes());
+ if (request_params_size > 0) {
+ char* version_param =
+ bson_object_get_string(&request_params, strings::protocol_version);
+ std::string version_string(version_param == NULL ? "" : version_param);
+ full_version = version_string;
+
+ // Constructed payloads added in Protocol v5
+ if (full_version.major_version_ < PROTOCOL_VERSION_5) {
+ return false;
+ }
+ bson_object_deinitialize(&request_params);
+ } else {
+ SDL_LOG_WARN("Failed to parse start service packet for version string");
+ }
+
+ return true;
+}
+
void ProtocolHandlerImpl::NotifySessionStarted(
- const SessionContext& context,
+ SessionContext& context,
std::vector<std::string>& rejected_params,
const std::string err_reason) {
SDL_LOG_AUTO_TRACE();
@@ -1830,8 +1915,23 @@ void ProtocolHandlerImpl::NotifySessionStarted(
const ServiceType service_type = ServiceTypeFromByte(packet->service_type());
const uint8_t protocol_version = packet->protocol_version();
+ utils::SemanticVersion full_version;
+
+ // Can't check protocol_version because the first packet is v1, but there
+ // could still be a payload, in which case we can get the real protocol
+ // version
+ if (packet->service_type() == kRpc && packet->data() != NULL) {
+ if (ParseFullVersion(full_version, packet)) {
+ const auto connection_key = session_observer_.KeyFromPair(
+ packet->connection_id(), context.new_session_id_);
+ connection_handler_.BindProtocolVersionWithSession(connection_key,
+ full_version);
+ } else {
+ rejected_params.push_back(std::string(strings::protocol_version));
+ }
+ }
- if (0 == context.new_session_id_) {
+ if (context.is_start_session_failed_ || !context.new_session_id_) {
SDL_LOG_WARN("Refused by session_observer to create service "
<< static_cast<int32_t>(service_type) << " type.");
const auto session_id = packet->session_id();
@@ -1846,7 +1946,8 @@ void ProtocolHandlerImpl::NotifySessionStarted(
protocol_version,
packet->service_type(),
rejected_params,
- err_reason);
+ err_reason,
+ full_version);
return;
}
@@ -1896,38 +1997,6 @@ void ProtocolHandlerImpl::NotifySessionStarted(
}
}
- std::shared_ptr<utils::SemanticVersion> fullVersion;
-
- // Can't check protocol_version because the first packet is v1, but there
- // could still be a payload, in which case we can get the real protocol
- // version
- if (packet->service_type() == kRpc && packet->data() != NULL) {
- BsonObject request_params;
- size_t request_params_size = bson_object_from_bytes_len(
- &request_params, packet->data(), packet->total_data_bytes());
- if (request_params_size > 0) {
- char* version_param =
- bson_object_get_string(&request_params, strings::protocol_version);
- std::string version_string(version_param == NULL ? "" : version_param);
- fullVersion = std::make_shared<utils::SemanticVersion>(version_string);
-
- const auto connection_key = session_observer_.KeyFromPair(
- packet->connection_id(), context.new_session_id_);
- connection_handler_.BindProtocolVersionWithSession(connection_key,
- *fullVersion);
- // Constructed payloads added in Protocol v5
- if (fullVersion->major_version_ < PROTOCOL_VERSION_5) {
- rejected_params.push_back(std::string(strings::protocol_version));
- }
- bson_object_deinitialize(&request_params);
- } else {
- SDL_LOG_WARN("Failed to parse start service packet for version string");
- fullVersion = std::make_shared<utils::SemanticVersion>();
- }
- } else {
- fullVersion = std::make_shared<utils::SemanticVersion>();
- }
-
#ifdef ENABLE_SECURITY
// for packet is encrypted and security plugin is enable
if (context.is_protected_ && security_manager_) {
@@ -1938,7 +2007,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
std::make_shared<HandshakeHandler>(
*this,
session_observer_,
- *fullVersion,
+ full_version,
context,
packet->protocol_version(),
start_session_ack_params,
@@ -1964,12 +2033,20 @@ void ProtocolHandlerImpl::NotifySessionStarted(
}
if (!rejected_params.empty()) {
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key,
+ context.service_type_,
+ ServiceStatus::SERVICE_START_FAILED);
SendStartSessionNAck(context.connection_id_,
packet->session_id(),
protocol_version,
packet->service_type(),
rejected_params,
- "SSL Handshake failed due to rejected parameters");
+ "SSL Handshake failed due to rejected parameters",
+ full_version);
+ if (packet->service_type() != kRpc) {
+ context.is_start_session_failed_ = true;
+ }
} else if (ssl_context->IsInitCompleted()) {
// mark service as protected
session_observer_.SetProtectionFlag(connection_key, service_type);
@@ -1984,7 +2061,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
context.hash_id_,
packet->service_type(),
PROTECTION_ON,
- *fullVersion,
+ full_version,
*start_session_ack_params);
} else {
SDL_LOG_DEBUG("Adding Handshake handler to listeners: " << handler.get());
@@ -1998,12 +2075,20 @@ void ProtocolHandlerImpl::NotifySessionStarted(
if (!security_manager_->IsSystemTimeProviderReady()) {
security_manager_->RemoveListener(listener);
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key,
+ context.service_type_,
+ ServiceStatus::SERVICE_START_FAILED);
SendStartSessionNAck(context.connection_id_,
packet->session_id(),
protocol_version,
packet->service_type(),
rejected_params,
- "System time provider is not ready");
+ "System time provider is not ready",
+ full_version);
+ if (packet->service_type() != kRpc) {
+ context.is_start_session_failed_ = true;
+ }
}
}
}
@@ -2024,7 +2109,7 @@ void ProtocolHandlerImpl::NotifySessionStarted(
context.hash_id_,
packet->service_type(),
PROTECTION_OFF,
- *fullVersion,
+ full_version,
*start_session_ack_params);
} else {
service_status_update_handler_->OnServiceUpdate(
@@ -2037,23 +2122,32 @@ void ProtocolHandlerImpl::NotifySessionStarted(
protocol_version,
packet->service_type(),
rejected_params,
- "Certain parameters in the StartService request were rejected");
+ "Certain parameters in the StartService request were rejected",
+ full_version);
+ context.is_start_session_failed_ = true;
}
}
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
const ProtocolPacket& packet) {
const ConnectionID connection_id = packet.connection_id();
+ const uint32_t session_id = packet.session_id();
SDL_LOG_DEBUG("Sending heart beat acknowledgment for connection "
- << connection_id);
+ << connection_id << " session " << session_id);
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
- connection_id, packet.session_id(), protocol_version)) {
+ connection_id, session_id, protocol_version)) {
// TODO(EZamakhov): investigate message_id for HeartBeatAck
if (protocol_version >= PROTOCOL_VERSION_3 &&
protocol_version <= PROTOCOL_VERSION_5) {
- return SendHeartBeatAck(
- connection_id, packet.session_id(), packet.message_id());
+ const uint32_t connection_key =
+ session_observer_.KeyFromPair(connection_id, session_id);
+ if (!connection_handler_.IsSessionHeartbeatTracked(connection_key)) {
+ SDL_LOG_DEBUG("Session heartbeat tracking is not started. "
+ << "Starting it for session " << session_id);
+ connection_handler_.StartSessionHeartBeat(connection_key);
+ }
+ return SendHeartBeatAck(connection_id, session_id, packet.message_id());
} else {
SDL_LOG_WARN("HeartBeat is not supported");
return RESULT_HEARTBEAT_IS_NOT_SUPPORTED;
@@ -2080,7 +2174,7 @@ void ProtocolHandlerImpl::PopValidAndExpiredMultiframes() {
const uint32_t connection_key = session_observer_.KeyFromPair(
frame->connection_id(), frame->session_id());
- SDL_LOG_DEBUG("Result frame" << frame << "for connection "
+ SDL_LOG_TRACE("Result frame" << frame << "for connection "
<< connection_key);
const RawMessagePtr rawMessage(new RawMessage(connection_key,
frame->protocol_version(),
@@ -2159,7 +2253,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
}
} break;
}
- SDL_LOG_DEBUG("Message : " << message.get());
+ SDL_LOG_TRACE("Message : " << message.get());
const uint8_t c_id = message->connection_id();
const uint32_t m_id = message->session_id();
@@ -2171,7 +2265,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
if (((0 != message->data()) && (0 != message->data_size())) ||
FRAME_TYPE_CONTROL == message->frame_type() ||
FRAME_TYPE_FIRST == message->frame_type()) {
- SDL_LOG_DEBUG("Packet: dataSize " << message->data_size());
+ SDL_LOG_TRACE("Packet: dataSize " << message->data_size());
HandleMessage(message);
PopValidAndExpiredMultiframes();
} else {
@@ -2346,7 +2440,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key,
int32_t number_of_frames) {
- SDL_LOG_DEBUG("SendFramesNumber MobileNaviAck for session "
+ SDL_LOG_TRACE("SendFramesNumber MobileNaviAck for session "
<< connection_key);
transport_manager::ConnectionUID connection_id = 0;
diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc
index db2f124c53..51b5e838b3 100644
--- a/src/components/protocol_handler/src/protocol_packet.cc
+++ b/src/components/protocol_handler/src/protocol_packet.cc
@@ -262,7 +262,7 @@ ProtocolPacket::ProtocolHeaderValidator::max_payload_size_by_service_type(
RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
const ProtocolHeader& header) const {
- SDL_LOG_DEBUG("Validating header - " << header);
+ SDL_LOG_TRACE("Validating header - " << header);
// expected payload size will be calculated depending
// on used protocol version and service type
size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE;
@@ -325,21 +325,8 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
break;
}
case FRAME_TYPE_SINGLE:
- if (header.frameData != FRAME_DATA_SINGLE) {
- SDL_LOG_WARN("FRAME_TYPE_SINGLE - Invalide frame data "
- << static_cast<int>(header.frameData));
- return RESULT_FAIL;
- }
- break;
case FRAME_TYPE_FIRST:
- if (header.frameData != FRAME_DATA_FIRST) {
- SDL_LOG_WARN("FRAME_TYPE_FIRST - Invalide frame data "
- << static_cast<int>(header.frameData));
- return RESULT_FAIL;
- }
- break;
case FRAME_TYPE_CONSECUTIVE:
- // Could have any FrameInfo value
break;
default:
SDL_LOG_WARN("Unknown frame type " << static_cast<int>(header.frameType));
@@ -390,7 +377,7 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
return RESULT_FAIL;
}
}
- SDL_LOG_DEBUG("Message header is completely correct.");
+ SDL_LOG_TRACE("Message header is completely correct.");
return RESULT_OK;
}
diff --git a/src/components/protocol_handler/src/service_status_update_handler.cc b/src/components/protocol_handler/src/service_status_update_handler.cc
index 71d11bcf5b..05f493c74b 100644
--- a/src/components/protocol_handler/src/service_status_update_handler.cc
+++ b/src/components/protocol_handler/src/service_status_update_handler.cc
@@ -19,7 +19,9 @@ hmi_apis::Common_ServiceType::eType GetHMIServiceType(
case SERVICE_TYPE_NAVI: {
return Common_ServiceType::VIDEO;
}
- default: { return Common_ServiceType::INVALID_ENUM; }
+ default: {
+ return Common_ServiceType::INVALID_ENUM;
+ }
}
}
diff --git a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
index a099cff225..cfbc5d6b53 100644
--- a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
@@ -32,6 +32,7 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_
+#include <iomanip>
#include <ios>
#include <string>
#include <vector>
@@ -153,7 +154,8 @@ MATCHER_P4(ControlMessage,
*result_listener << "Message with " << data_vector.size()
<< " byte data : 0x";
for (size_t i = 0u; i < data_vector.size(); ++i) {
- *result_listener << std::hex << static_cast<int>(data_vector[i]);
+ *result_listener << std::setw(2) << std::setfill('0') << std::hex
+ << static_cast<int>(data_vector[i]);
}
return false;
}
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 fa2fc07824..ae5b7fb1ae 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -47,6 +47,8 @@
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_ssl_context.h"
+#else
+#include "utils/byte_order.h"
#endif // ENABLE_SECURITY
#include "transport_manager/mock_transport_manager.h"
#include "utils/mock_system_time_handler.h"
@@ -240,6 +242,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const_cast<protocol_handler::impl::ToMobileQueue&>(
protocol_handler_impl->get_to_mobile_queue())
.WaitDumpQueue();
+ protocol_handler_impl->Stop();
}
// Emulate connection establish
@@ -270,7 +273,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
void AddSession(const std::shared_ptr<TestAsyncWaiter>& waiter,
uint32_t& times) {
using namespace protocol_handler;
- ASSERT_TRUE(NULL != waiter.get());
+ ASSERT_TRUE(NULL != waiter);
AddConnection();
const ServiceType start_service = kRpc;
@@ -284,7 +287,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const bool callback_protection_flag = PROTECTION_OFF;
#endif // ENABLE_SECURITY
- const protocol_handler::SessionContext context =
+ protocol_handler::SessionContext context =
GetSessionContext(connection_id,
NEW_SESSION_ID,
session_id,
@@ -318,11 +321,15 @@ class ProtocolHandlerImplTest : public ::testing::Test {
// Return sessions start success
WillOnce(DoAll(
NotifyTestAsyncWaiter(waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- context,
- ByRef(empty_rejected_param_),
- std::string())));
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// Expect send Ack with PROTECTION_OFF (on no Security Manager)
@@ -546,7 +553,7 @@ TEST_F(ProtocolHandlerImplTest,
const int call_times = 5;
AddConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
ServiceType service_type;
// Expect verification of allowed transport
@@ -567,6 +574,14 @@ TEST_F(ProtocolHandlerImplTest,
.Times(call_times)
.WillRepeatedly(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context =
+ GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ SESSION_START_REJECT,
+ service_type,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
+
// Expect ConnectionHandler check
EXPECT_CALL(
session_observer_mock,
@@ -578,19 +593,18 @@ TEST_F(ProtocolHandlerImplTest,
.Times(call_times)
.
// Return sessions start rejection
- WillRepeatedly(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- SaveArg<2>(&service_type),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- SESSION_START_REJECT,
- service_type,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillRepeatedly(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ SaveArg<2>(&service_type),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times += call_times;
// Expect send NAck
@@ -603,7 +617,7 @@ TEST_F(ProtocolHandlerImplTest,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
.Times(call_times)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times += call_times;
SendControlMessage(
@@ -617,7 +631,7 @@ TEST_F(ProtocolHandlerImplTest,
SendControlMessage(
PROTECTION_OFF, kBulk, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send NAck on session_observer rejection
@@ -638,7 +652,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
const bool callback_protection_flag = PROTECTION_OFF;
#endif // ENABLE_SECURITY
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
ServiceType service_type;
// Expect verification of allowed transport
@@ -659,6 +673,14 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
.Times(call_times)
.WillRepeatedly(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context =
+ GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ SESSION_START_REJECT,
+ service_type,
+ HASH_ID_WRONG,
+ callback_protection_flag);
+
// Expect ConnectionHandler check
EXPECT_CALL(
session_observer_mock,
@@ -671,18 +693,17 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
.
// Return sessions start rejection
WillRepeatedly(DoAll(
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
SaveArg<2>(&service_type),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- SESSION_START_REJECT,
- service_type,
- HASH_ID_WRONG,
- callback_protection_flag),
- ByRef(empty_rejected_param_),
- std::string())));
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times += call_times;
// Expect send NAck with encryption OFF
@@ -695,7 +716,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
.Times(call_times)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times += call_times;
SendControlMessage(
@@ -709,7 +730,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
SendControlMessage(
PROTECTION_ON, kBulk, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack on session_observer accept
@@ -721,7 +742,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
const ServiceType start_service = kRpc;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -738,6 +759,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -747,18 +775,17 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -766,13 +793,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack on session_observer accept
@@ -783,7 +810,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) {
SetProtocolVersion2();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -851,7 +878,7 @@ TEST_F(ProtocolHandlerImplTest,
std::string("BTMAC")),
connection_id2);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
@@ -894,7 +921,7 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
// don't call NotifySessionStartedContext() immediately, instead call it
// after second OnSessionStartedCallback()
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
BsonObject bson_params2;
@@ -913,6 +940,22 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(session_observer_mock,
ProtocolVersionUsed(_, _, An<utils::SemanticVersion&>()))
.WillOnce(Return(true));
+
+ protocol_handler::SessionContext rejected_context =
+ GetSessionContext(connection_id2,
+ session_id2,
+ SESSION_START_REJECT,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
+
+ protocol_handler::SessionContext context =
+ GetSessionContext(connection_id1,
+ session_id1,
+ generated_session_id1,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id2,
session_id2,
@@ -920,27 +963,25 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
An<const BsonObject*>()))
.WillOnce(DoAll(
- NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id2,
- session_id2,
- SESSION_START_REJECT,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(rejected_param_list),
- std::string()),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id1,
- session_id1,
- generated_session_id1,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- std::string())));
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(rejected_context),
+ ByRef(rejected_param_list),
+ std::string()),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
BsonObject bson_ack_params;
@@ -962,7 +1003,7 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
connection_id1,
Eq(ack_params))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
BsonArray bson_arr;
@@ -984,7 +1025,7 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
connection_id2,
Eq(nack_params))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendTMMessage(connection_id1,
@@ -1009,7 +1050,7 @@ TEST_F(ProtocolHandlerImplTest,
message_id,
params2.size() > 0 ? &params2[0] : NULL);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
bson_object_deinitialize(&bson_params1);
bson_object_deinitialize(&bson_params2);
@@ -1024,7 +1065,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Audio_RejectByTransportType) {
AddConnection();
const ServiceType start_service = kAudio;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1048,13 +1089,13 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Audio_RejectByTransportType) {
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
@@ -1066,7 +1107,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Video_RejectByTransportType) {
AddConnection();
const ServiceType start_service = kMobileNav;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1091,13 +1132,13 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Video_RejectByTransportType) {
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
// TODO(EZamakhov): add test for get_hash_id/set_hash_id from
@@ -1106,7 +1147,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Video_RejectByTransportType) {
* ProtocolHandler shall send NAck on session_observer rejection
*/
TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1146,7 +1187,7 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
* ProtocolHandler shall send NAck on wrong hash code
*/
TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1182,7 +1223,7 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
#ifdef ENABLE_SECURITY
TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
using namespace protocol_handler;
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1205,6 +1246,12 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1214,18 +1261,17 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1260,7 +1306,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
AddSecurityManager();
const ServiceType start_service = kRpc;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1277,6 +1323,13 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_OFF);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1286,18 +1339,17 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1305,13 +1357,13 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_OFF on fail SLL creation
@@ -1322,7 +1374,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
AddSecurityManager();
const ServiceType start_service = kRpc;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
protocol_handler::SessionContext context = GetSessionContext(connection_id,
@@ -1331,6 +1383,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
start_service,
HASH_ID_WRONG,
PROTECTION_ON);
+
context.is_new_service_ = true;
// Expect verification of allowed transport
@@ -1357,13 +1410,17 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- context,
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1374,20 +1431,20 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
ContextCreationStrategy::kUseExisting))
.
// Return fail protection
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), ReturnNull()));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), ReturnNull()));
times++;
// Expect send Ack with PROTECTION_OFF (on fail SLL creation)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_ON on already established and
@@ -1400,7 +1457,7 @@ TEST_F(ProtocolHandlerImplTest,
AddSecurityManager();
const ServiceType start_service = kRpc;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1417,6 +1474,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_ON);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1426,18 +1490,17 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_ON),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
SetProtocolVersion2();
@@ -1445,34 +1508,33 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key, _))
.
// Return new SSLContext
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(&ssl_context_mock)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(&ssl_context_mock)));
times++;
// Initilization check
EXPECT_CALL(ssl_context_mock, IsInitCompleted())
.
// emulate SSL is initilized
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect send Ack with PROTECTION_ON (on SSL is initilized)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_OFF on session handshhake fail
@@ -1484,7 +1546,7 @@ TEST_F(ProtocolHandlerImplTest,
AddSecurityManager();
const ServiceType start_service = kRpc;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
protocol_handler::SessionContext context = GetSessionContext(connection_id,
NEW_SESSION_ID,
@@ -1518,13 +1580,17 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- context,
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
std::vector<int> services;
@@ -1544,14 +1610,14 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(ssl_context_mock, IsInitCompleted())
.
// emulate SSL is not initilized
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(false)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
times++;
// Pending handshake check
EXPECT_CALL(ssl_context_mock, IsHandshakePending())
.
// emulate is pending
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Expect add listener for handshake result
@@ -1565,13 +1631,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_ON on session handshhake
@@ -1589,7 +1655,7 @@ TEST_F(ProtocolHandlerImplTest,
ON_CALL(protocol_handler_settings_mock, force_protected_service())
.WillByDefault(ReturnRefOfCopy(services));
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1606,6 +1672,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_ON);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1615,47 +1688,45 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_ON),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key, _))
.
// Return new SSLContext
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(&ssl_context_mock)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(&ssl_context_mock)));
times++;
// Initilization check
EXPECT_CALL(ssl_context_mock, IsInitCompleted())
.
// emulate SSL is not initilized
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(false)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
times++;
// Pending handshake check
EXPECT_CALL(ssl_context_mock, IsHandshakePending())
.
// emulate is pending
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Expect add listener for handshake result
EXPECT_CALL(security_manager_mock, AddListener(_))
// Emulate handshake fail
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
+ DoAll(NotifyTestAsyncWaiter(waiter),
Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success))));
@@ -1666,26 +1737,26 @@ TEST_F(ProtocolHandlerImplTest,
GetSSLContext(connection_key, start_service))
.
// Emulate protection for service is not enabled
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), ReturnNull()));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), ReturnNull()));
times++;
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_ON on session handshhake
@@ -1703,7 +1774,7 @@ TEST_F(
ON_CALL(protocol_handler_settings_mock, force_protected_service())
.WillByDefault(ReturnRefOfCopy(services));
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1720,6 +1791,13 @@ TEST_F(
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_ON);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1729,26 +1807,24 @@ TEST_F(
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_ON),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key, _))
.
// Return new SSLContext
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(&ssl_context_mock)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(&ssl_context_mock)));
times++;
// Initilization check
@@ -1761,14 +1837,14 @@ TEST_F(
EXPECT_CALL(ssl_context_mock, IsHandshakePending())
.
// emulate is pending
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Expect add listener for handshake result
EXPECT_CALL(security_manager_mock, AddListener(_))
// Emulate handshake fail
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
+ DoAll(NotifyTestAsyncWaiter(waiter),
Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success))));
@@ -1779,26 +1855,26 @@ TEST_F(
GetSSLContext(connection_key, start_service))
.
// Emulate protection for service is not enabled
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), ReturnNull()));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), ReturnNull()));
times++;
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* ProtocolHandler shall send Ack with PROTECTION_ON on session handshhake
@@ -1815,7 +1891,7 @@ TEST_F(ProtocolHandlerImplTest,
ON_CALL(protocol_handler_settings_mock, force_protected_service())
.WillByDefault(ReturnRefOfCopy(services));
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect verification of allowed transport
EXPECT_CALL(session_observer_mock,
@@ -1832,6 +1908,13 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
.WillOnce(ReturnRef(video_service_transports));
+ protocol_handler::SessionContext context = GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ session_id,
+ start_service,
+ HASH_ID_WRONG,
+ PROTECTION_ON);
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1841,18 +1924,17 @@ TEST_F(ProtocolHandlerImplTest,
An<const BsonObject*>()))
.
// Return sessions start success
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- InvokeMemberFuncWithArg3(protocol_handler_impl.get(),
- &ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- session_id,
- start_service,
- HASH_ID_WRONG,
- PROTECTION_ON),
- ByRef(empty_rejected_param_),
- std::string())));
+ WillOnce(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (ProtocolHandler::*)(SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ std::string())));
times++;
// call new SSLContext creation
@@ -1862,34 +1944,33 @@ TEST_F(ProtocolHandlerImplTest,
ContextCreationStrategy::kUseExisting))
.
// Return new SSLContext
- WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(&ssl_context_mock)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(&ssl_context_mock)));
times++;
// Initilization check
EXPECT_CALL(ssl_context_mock, IsInitCompleted())
.
// emulate SSL is not initilized
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(false)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
times++;
// Pending handshake check
EXPECT_CALL(ssl_context_mock, IsHandshakePending())
.
// emulate is pending
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(false)));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
times++;
// Wait restart handshake operation
EXPECT_CALL(security_manager_mock, StartHandshake(connection_key))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect add listener for handshake result
EXPECT_CALL(security_manager_mock, AddListener(_))
// Emulate handshake
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter),
+ DoAll(NotifyTestAsyncWaiter(waiter),
Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success))));
@@ -1900,30 +1981,30 @@ TEST_F(ProtocolHandlerImplTest,
GetSSLContext(connection_key, start_service))
.
// Emulate protection for service is not enabled
- WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), ReturnNull()));
+ WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), ReturnNull()));
times++;
EXPECT_CALL(security_manager_mock, IsSystemTimeProviderReady())
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect send Ack with PROTECTION_ON (on successfull handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(
ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(
PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
#endif // ENABLE_SECURITY
@@ -1943,7 +2024,7 @@ void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
.WillRepeatedly(Return(maximum_rpc_payload_size));
InitProtocolHandlerImpl(0u, 0u);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 5;
@@ -2048,14 +2129,14 @@ void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
transport_manager_mock,
SendMessageToDevice(ControlMessage(
FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .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));
+ .WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
.WillOnce(ReturnNull());
@@ -2069,7 +2150,7 @@ void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
false /* protection */,
full_version);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
@@ -2079,7 +2160,7 @@ void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
.WillRepeatedly(Return(maximum_rpc_payload_size));
InitProtocolHandlerImpl(0u, 0u);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 5;
@@ -2160,14 +2241,14 @@ void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
PROTECTION_OFF,
connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .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));
+ .WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
.WillOnce(ReturnNull());
@@ -2183,7 +2264,7 @@ void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
false /* protection */,
full_version);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
@@ -2547,7 +2628,7 @@ TEST_F(
// Secondary transport param should not be included for apps with v5.0.0
TEST_F(ProtocolHandlerImplTest,
StartSessionAck_Unprotected_NoSecondaryTransportParamsForV5) {
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 5;
@@ -2618,7 +2699,7 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
connection_handler::SessionTransports dummy_st = {0, 0};
@@ -2637,7 +2718,7 @@ TEST_F(ProtocolHandlerImplTest,
AddSecurityManager();
EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
- .WillOnce(Return(connection_key));
+ .WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
.WillOnce(ReturnNull());
@@ -2651,7 +2732,7 @@ TEST_F(ProtocolHandlerImplTest,
false /* protection */,
full_version);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, StartSessionAck_PrimaryTransportUSBHostMode) {
@@ -2719,7 +2800,7 @@ TEST_F(ProtocolHandlerImplTest, StartSessionAck_CloudAppAuthTokenAvailable) {
TEST_F(ProtocolHandlerImplTest,
TransportEventUpdate_afterVersionNegotiation_TCPEnabled) {
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 5;
@@ -2789,7 +2870,7 @@ TEST_F(ProtocolHandlerImplTest,
transport_manager_mock,
SendMessageToDevice(ControlMessage(
FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
@@ -2816,14 +2897,14 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .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));
+ .WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
.WillOnce(ReturnNull());
@@ -2837,12 +2918,12 @@ TEST_F(ProtocolHandlerImplTest,
false /* protection */,
full_version);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
TransportEventUpdate_afterVersionNegotiation_TCPDisabled) {
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 5;
@@ -2910,7 +2991,7 @@ TEST_F(ProtocolHandlerImplTest,
transport_manager_mock,
SendMessageToDevice(ControlMessage(
FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, An<uint8_t&>()))
@@ -2937,14 +3018,14 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .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));
+ .WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
.WillOnce(ReturnNull());
@@ -2958,7 +3039,7 @@ TEST_F(ProtocolHandlerImplTest,
false /* protection */,
full_version);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
@@ -2966,7 +3047,7 @@ TEST_F(ProtocolHandlerImplTest,
using connection_handler::SessionConnectionMap;
using connection_handler::SessionTransports;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
char tcp_address[] = "172.16.2.3";
@@ -3020,12 +3101,12 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
device2_primary_connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
tm_listener->OnTransportConfigUpdated(configs);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
@@ -3033,7 +3114,7 @@ TEST_F(ProtocolHandlerImplTest,
using connection_handler::SessionConnectionMap;
using connection_handler::SessionTransports;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
char tcp_address[] = "172.16.2.3";
@@ -3090,7 +3171,7 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
device1_primary_connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
EXPECT_CALL(
transport_manager_mock,
@@ -3098,18 +3179,18 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_OFF,
device3_primary_connection_id,
Eq(expected_param))))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
tm_listener->OnTransportConfigUpdated(configs);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_SUCCESS) {
AddConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
transport_manager::ConnectionUID primary_connection_id = 123;
@@ -3129,7 +3210,7 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_SUCCESS) {
PROTECTION_OFF,
connection_id,
_)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(PROTECTION_OFF,
@@ -3138,13 +3219,13 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_SUCCESS) {
FRAME_DATA_REGISTER_SECONDARY_TRANSPORT,
PROTOCOL_VERSION_5);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_FAILURE) {
AddConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
transport_manager::ConnectionUID primary_connection_id = 123;
@@ -3165,7 +3246,7 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_FAILURE) {
PROTECTION_OFF,
connection_id,
_)))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times++;
SendControlMessage(PROTECTION_OFF,
@@ -3174,16 +3255,16 @@ TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_FAILURE) {
FRAME_DATA_REGISTER_SECONDARY_TRANSPORT,
PROTOCOL_VERSION_5);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification) {
+TEST_F(ProtocolHandlerImplTest, FloodVerification) {
const size_t period_msec = 10000;
const size_t max_messages = 1000;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3222,13 +3303,13 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_ThresholdValue) {
+TEST_F(ProtocolHandlerImplTest, FloodVerification_ThresholdValue) {
const size_t period_msec = 10000;
const size_t max_messages = 1000;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3266,13 +3347,13 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_ThresholdValue) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_VideoFrameSkip) {
+TEST_F(ProtocolHandlerImplTest, FloodVerification_VideoFrameSkip) {
const size_t period_msec = 10000;
const size_t max_messages = 1000;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3302,13 +3383,13 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_VideoFrameSkip) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_AudioFrameSkip) {
+TEST_F(ProtocolHandlerImplTest, FloodVerification_AudioFrameSkip) {
const size_t period_msec = 10000;
const size_t max_messages = 1000;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3338,13 +3419,13 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_AudioFrameSkip) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerificationDisable) {
+TEST_F(ProtocolHandlerImplTest, FloodVerificationDisable) {
const size_t period_msec = 0;
const size_t max_messages = 0;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3380,7 +3461,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedVerificationDisable) {
InitProtocolHandlerImpl(0u, 0u, false, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3406,13 +3487,13 @@ TEST_F(ProtocolHandlerImplTest, MalformedVerificationDisable) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest, DISABLED_MalformedLimitVerification) {
+TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification) {
const size_t period_msec = 10000;
const size_t max_messages = 100;
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3460,14 +3541,13 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_MalformedLimitVerification) {
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest,
- DISABLED_MalformedLimitVerification_MalformedStock) {
+TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_MalformedStock) {
const size_t period_msec = 10000;
const size_t max_messages = 100;
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3546,7 +3626,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_MalformedOnly) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3606,7 +3686,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullTimePeriod) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3639,7 +3719,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullCount) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3729,10 +3809,9 @@ TEST_F(ProtocolHandlerImplTest,
protocol_handler_impl->SendEndSession(connection_id, session_id);
}
-TEST_F(ProtocolHandlerImplTest,
- DISABLED_SendEndServicePrivate_EndSession_MessageSent) {
+TEST_F(ProtocolHandlerImplTest, SendEndServicePrivate_EndSession_MessageSent) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3759,7 +3838,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendEndServicePrivate_ServiceTypeControl_MessageSent) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3798,7 +3877,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_NoConnection_NotSent) {
TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3823,7 +3902,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) {
TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3853,7 +3932,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) {
TEST_F(ProtocolHandlerImplTest,
SendHeartBeatAck_ProtocolVersionUsedFail_Cancelled) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3874,10 +3953,9 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
-TEST_F(ProtocolHandlerImplTest,
- DISABLED_SendHeartBeatAck_WrongProtocolVersion_NotSent) {
+TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_WrongProtocolVersion_NotSent) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3911,7 +3989,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendMessageToMobileApp_SendSingleControlMessage) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3952,7 +4030,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendMessageToMobileApp_SendSingleNonControlMessage) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -3997,7 +4075,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4056,7 +4134,7 @@ TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) {
TEST_F(ProtocolHandlerImplTest,
SendMessageToMobileApp_NullMessagePointer_Cancelled) {
// Arrange
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4072,6 +4150,7 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
+#ifdef ENABLE_SECURITY
TEST_F(ProtocolHandlerImplTest,
OnTMMessageSend_ReadyToCloseConnection_Disconnect) {
OnTMMessageSend();
@@ -4101,6 +4180,7 @@ TEST_F(ProtocolHandlerImplTest,
tm_listener->OnTMMessageSend(message);
}
+#endif
TEST_F(ProtocolHandlerImplTest, OnTMMessageSend_InvalidData_Cancelled) {
const uint8_t data_size = 8u;
@@ -4469,7 +4549,7 @@ TEST_F(ProtocolHandlerImplTest, GetHashId_ProtocolVersion5_ValidData) {
}
TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 3;
@@ -4486,8 +4566,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) {
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4500,6 +4580,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) {
full_version);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
ProtocolPacket protocol_packet;
RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(),
@@ -4512,7 +4593,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_CorrectHashId) {
}
TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 3;
@@ -4523,8 +4604,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) {
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4537,6 +4618,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) {
full_version);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
ProtocolPacket protocol_packet;
RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(),
@@ -4547,7 +4629,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_NOT_SUPPORTED) {
}
TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
const uint8_t input_protocol_version = 3;
@@ -4558,8 +4640,8 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) {
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4572,6 +4654,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) {
full_version);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
ProtocolPacket protocol_packet;
RESULT_CODE res = protocol_packet.deserializePacket(raw_message->data(),
@@ -4584,7 +4667,7 @@ TEST_F(ProtocolHandlerImplTest, SetHashId_HASH_ID_WRONG) {
TEST_F(ProtocolHandlerImplTest, PopValidAndExpiredMultiframes) {
using namespace protocol_handler;
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4628,7 +4711,7 @@ TEST_F(ProtocolHandlerImplTest, PopValidAndExpiredMultiframes) {
}
TEST_F(ProtocolHandlerImplTest, HandleFromMobile_FrameTypeSingle_Handled) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4655,7 +4738,7 @@ TEST_F(ProtocolHandlerImplTest, HandleFromMobile_FrameTypeSingle_Handled) {
#ifdef ENABLE_SECURITY
TEST_F(ProtocolHandlerImplTest, EncryptFrame_NoSecurityManagerSet_Cancelled) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4686,7 +4769,7 @@ TEST_F(ProtocolHandlerImplTest, EncryptFrame_NoSecurityManagerSet_Cancelled) {
TEST_F(ProtocolHandlerImplTest,
EncryptFrame_ControlFrameType_ContinueUnencrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4698,8 +4781,8 @@ TEST_F(ProtocolHandlerImplTest,
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4709,15 +4792,16 @@ TEST_F(ProtocolHandlerImplTest,
kFinalMessage);
handler->Handle(message);
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
+
EXPECT_EQ(data_value,
raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]);
-
- EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
EncryptFrame_SSLContextInitNotCompleted_ContinueUnencrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4737,8 +4821,8 @@ TEST_F(ProtocolHandlerImplTest,
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4748,15 +4832,16 @@ TEST_F(ProtocolHandlerImplTest,
kFinalMessage);
handler->Handle(message);
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
+
EXPECT_EQ(data_value,
raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]);
-
- EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
EncryptFrame_EncryptFailed_ContinueUnencrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4789,8 +4874,8 @@ TEST_F(ProtocolHandlerImplTest,
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4801,15 +4886,16 @@ TEST_F(ProtocolHandlerImplTest,
message->set_protection_flag(PROTECTION_ON);
handler->Handle(message);
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
+
EXPECT_EQ(data_value,
raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]);
-
- EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest,
EncryptFrame_EncryptSucceeded_ContinueEncrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4839,8 +4925,8 @@ TEST_F(ProtocolHandlerImplTest,
RawMessagePtr raw_message;
EXPECT_CALL(transport_manager_mock, SendMessageToDevice(_))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter),
- SaveArg<0>(&raw_message),
+ .WillOnce(DoAll(SaveArg<0>(&raw_message),
+ NotifyTestAsyncWaiter(waiter),
Return(transport_manager::E_SUCCESS)));
times++;
@@ -4851,14 +4937,15 @@ TEST_F(ProtocolHandlerImplTest,
message->set_protection_flag(PROTECTION_ON);
handler->Handle(message);
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+ ASSERT_NE(0, raw_message.use_count());
+
EXPECT_EQ(encrypted_data,
raw_message->data()[protocol_handler::PROTOCOL_HEADER_V2_SIZE]);
-
- EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, DecryptFrame_NoSecurityManager_Cancelled) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4889,28 +4976,29 @@ TEST_F(ProtocolHandlerImplTest, DecryptFrame_NoSecurityManager_Cancelled) {
}
TEST_F(ProtocolHandlerImplTest,
- DISABLED_DecryptFrame_ProtectionFlagOff_ContinueUndecrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ DecryptFrame_ProtectionFlagOff_ContinueUndecrypted) {
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
-
- const uint8_t data_size = 0u;
+ const uint8_t data_size = 1u;
+ const uint8_t data_value = 7u;
ProtocolFramePtr frame_ptr =
std::make_shared<ProtocolPacket>(connection_id,
PROTOCOL_VERSION_3,
PROTECTION_OFF,
- FRAME_TYPE_FIRST,
+ FRAME_TYPE_SINGLE,
kAudio,
- FRAME_DATA_FIRST,
+ FRAME_DATA_SINGLE,
session_id,
data_size,
message_id,
- null_data_);
+ &data_value);
EXPECT_CALL(ssl_context_mock, Decrypt(_, _, _, _)).Times(0);
protocol_handler_impl->SetTelemetryObserver(&telemetry_observer_mock);
EXPECT_CALL(telemetry_observer_mock, StartMessageProcess(message_id, _));
+ EXPECT_CALL(telemetry_observer_mock, EndMessageProcess(_));
connection_handler::SessionTransports st;
st.primary_transport = connection_id;
@@ -4923,8 +5011,8 @@ TEST_F(ProtocolHandlerImplTest,
}
TEST_F(ProtocolHandlerImplTest,
- DISABLED_DecryptFrame_FrameTypeControl_ContinueUndecrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ DecryptFrame_FrameTypeControl_ContinueUndecrypted) {
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4961,7 +5049,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
DecryptFrame_SSLContextInitNotCompleted_Cancelled) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -4995,7 +5083,7 @@ TEST_F(ProtocolHandlerImplTest,
}
TEST_F(ProtocolHandlerImplTest, DecryptFrame_DecryptFailed_Cancelled) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -5039,7 +5127,7 @@ TEST_F(ProtocolHandlerImplTest, DecryptFrame_DecryptFailed_Cancelled) {
TEST_F(ProtocolHandlerImplTest,
DecryptFrame_DecryptSucceeded_ContinueDecrypted) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -5106,7 +5194,7 @@ TEST_F(ProtocolHandlerImplTest, SendFrame_EncryptFailed_FAIL) {
#endif // ENABLE_SECURITY
TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -5133,7 +5221,7 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) {
}
TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -5166,7 +5254,6 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_DisallowedBySettings) {
const ServiceType service_type = kMobileNav;
const utils::SemanticVersion min_reason_param_version(5, 3, 0);
-
#ifdef ENABLE_SECURITY
AddSecurityManager();
@@ -5203,6 +5290,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_DisallowedBySettings) {
bson_object_put_string(&bson_nack_params,
protocol_handler::strings::reason,
const_cast<char*>(reason.c_str()));
+
std::vector<uint8_t> nack_params =
CreateVectorFromBsonObject(&bson_nack_params);
bson_object_deinitialize(&bson_nack_params);
@@ -5246,7 +5334,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
.WillRepeatedly(ReturnNull());
#endif // ENABLE_SECURITY
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
ServiceType service_type;
// Expect verification of allowed transport
@@ -5263,6 +5351,14 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
.Times(call_times)
.WillRepeatedly(ReturnRef(allowed_transports));
+ protocol_handler::SessionContext context =
+ GetSessionContext(connection_id,
+ NEW_SESSION_ID,
+ SESSION_START_REJECT,
+ service_type,
+ protocol_handler::HASH_ID_WRONG,
+ PROTECTION_OFF);
+
// Expect ConnectionHandler check
EXPECT_CALL(
session_observer_mock,
@@ -5274,20 +5370,19 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
.Times(call_times)
.
// Return sessions start rejection
- WillRepeatedly(
- DoAll(NotifyTestAsyncWaiter(&waiter),
- SaveArg<2>(&service_type),
- InvokeMemberFuncWithArg3(
- protocol_handler_impl.get(),
- &protocol_handler::ProtocolHandler::NotifySessionStarted,
- GetSessionContext(connection_id,
- NEW_SESSION_ID,
- SESSION_START_REJECT,
- service_type,
- protocol_handler::HASH_ID_WRONG,
- PROTECTION_OFF),
- ByRef(empty_rejected_param_),
- err_reason)));
+ WillRepeatedly(DoAll(
+ NotifyTestAsyncWaiter(waiter),
+ SaveArg<2>(&service_type),
+ InvokeMemberFuncWithArg3(
+ protocol_handler_impl.get(),
+ static_cast<void (protocol_handler::ProtocolHandler::*)(
+ protocol_handler::SessionContext&,
+ std::vector<std::string>&,
+ const std::string)>(
+ &protocol_handler::ProtocolHandler::NotifySessionStarted),
+ ByRef(context),
+ ByRef(empty_rejected_param_),
+ err_reason)));
times += call_times;
// Expect send NAck
@@ -5314,7 +5409,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
Eq(nack_params))))
.Times(call_times)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
times += call_times;
for (const ServiceType& service_type : service_types) {
@@ -5325,7 +5420,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_NACKReason_SessionObserverReject) {
PROTOCOL_VERSION_5);
}
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
@@ -5337,7 +5432,7 @@ TEST_F(ProtocolHandlerImplTest,
const utils::SemanticVersion min_reason_param_version(5, 3, 0);
std::string err_reason =
"Wrong hash_id for session " + std::to_string(session_id);
- std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
AddSession(waiter, times);
@@ -5409,6 +5504,140 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_ProtocolVehicleData_VehicleDataParamsForV5) {
+ auto waiter = TestAsyncWaiter::createInstance();
+
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillOnce(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillOnce(Return(PROTOCOL_VERSION_5));
+
+ std::map<std::string, std::string> vehicle_mapping = {
+ {protocol_handler::strings::vehicle_make, "TestMake"},
+ {protocol_handler::strings::vehicle_model, "TestModel"},
+ {protocol_handler::strings::vehicle_model_year, "2021"},
+ {protocol_handler::strings::vehicle_trim, "TestTrim"},
+ {protocol_handler::strings::vehicle_system_hardware_version, "TestHW"},
+ {protocol_handler::strings::vehicle_system_software_version, "TestSW"}};
+
+ connection_handler::ProtocolVehicleData data{
+ vehicle_mapping[protocol_handler::strings::vehicle_make],
+ vehicle_mapping[protocol_handler::strings::vehicle_model],
+ vehicle_mapping[protocol_handler::strings::vehicle_model_year],
+ vehicle_mapping[protocol_handler::strings::vehicle_trim],
+ vehicle_mapping
+ [protocol_handler::strings::vehicle_system_software_version],
+ vehicle_mapping
+ [protocol_handler::strings::vehicle_system_hardware_version]};
+
+ EXPECT_CALL(connection_handler_mock, GetProtocolVehicleData(_))
+ .WillOnce(DoAll(SetArgReferee<0>(data), Return(true)));
+
+ const uint32_t hash_id = 123456;
+ char full_version_string[] = "5.4.0";
+
+ 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);
+
+ // vehicle data
+ const uint16_t max_string_length = 500;
+ for (auto& data_pair : vehicle_mapping) {
+ char value_buffer[max_string_length + 1]; // extra byte for NULL symbol
+ strncpy(value_buffer, data_pair.second.c_str(), sizeof(value_buffer));
+ value_buffer[max_string_length] = 0;
+
+ bson_object_put_string(
+ &expected_obj, data_pair.first.c_str(), value_buffer);
+ }
+
+ // 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);
+
+ 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,
+ connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(E_SUCCESS)));
+
+ 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"));
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillRepeatedly(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ const uint8_t input_protocol_version = 5;
+ utils::SemanticVersion full_version(5, 4, 0);
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ kRpc,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
+}
+
} // namespace protocol_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/protocol_handler/test/service_status_update_handler_test.cc b/src/components/protocol_handler/test/service_status_update_handler_test.cc
index 7d4516a7ff..5db7f2be45 100644
--- a/src/components/protocol_handler/test/service_status_update_handler_test.cc
+++ b/src/components/protocol_handler/test/service_status_update_handler_test.cc
@@ -87,7 +87,9 @@ class ServiceStatusUpdateHandlerTest
case ServiceStatus::PROTECTION_ENFORCED: {
return Common_ServiceEvent::REQUEST_REJECTED;
}
- default: { return Common_ServiceEvent::INVALID_ENUM; }
+ default: {
+ return Common_ServiceEvent::INVALID_ENUM;
+ }
}
}
diff --git a/src/components/resumption/include/resumption/last_state_impl.h b/src/components/resumption/include/resumption/last_state_impl.h
index 5eb4050d2d..8495c39d04 100644
--- a/src/components/resumption/include/resumption/last_state_impl.h
+++ b/src/components/resumption/include/resumption/last_state_impl.h
@@ -57,9 +57,6 @@ class LastStateImpl : public LastState {
*/
~LastStateImpl();
- DEPRECATED
- void SaveStateToFileSystem();
-
/**
* @brief Saving dictionary to filesystem
*/
@@ -77,12 +74,6 @@ class LastStateImpl : public LastState {
Json::Value dictionary() const OVERRIDE;
/**
- * @brief Get the dictionary
- * @return Reference to the dictionary
- */
- DEPRECATED Json::Value& get_dictionary();
-
- /**
* @brief Resets internal dictionary
* @param dictionary New dictionary json value to be set
*/
diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc
index 185535c50d..dba84d748b 100644
--- a/src/components/resumption/src/last_state_impl.cc
+++ b/src/components/resumption/src/last_state_impl.cc
@@ -52,23 +52,6 @@ LastStateImpl::~LastStateImpl() {
SaveToFileSystem();
}
-void LastStateImpl::SaveStateToFileSystem() {
- SDL_LOG_AUTO_TRACE();
-
- std::string styled_string;
- {
- sync_primitives::AutoLock lock(dictionary_lock_);
- styled_string = dictionary_.toStyledString();
- }
-
- const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
- styled_string.end());
- DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
- SDL_LOG_INFO("LastState::SaveStateToFileSystem[DEPRECATED] "
- << app_info_storage_ << styled_string);
- DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
-}
-
void LastStateImpl::SaveToFileSystem() {
SDL_LOG_AUTO_TRACE();
@@ -78,17 +61,30 @@ void LastStateImpl::SaveToFileSystem() {
styled_string = dictionary_.toStyledString();
}
+#ifdef __ANDROID__
+ const std::string full_path = app_info_storage_;
+#else
+ const std::string full_path =
+ !app_storage_folder_.empty()
+ ? app_storage_folder_ + "/" + app_info_storage_
+ : app_info_storage_;
+#endif
+
const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
styled_string.end());
DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
SDL_LOG_INFO("LastState::SaveToFileSystem " << app_info_storage_
- << styled_string);
- DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
+ << full_path);
+ DCHECK(file_system::Write(full_path, char_vector_pdata));
}
void LastStateImpl::LoadFromFileSystem() {
+ const std::string full_path =
+ !app_storage_folder_.empty()
+ ? app_storage_folder_ + "/" + app_info_storage_
+ : app_info_storage_;
std::string buffer;
- const bool result = file_system::ReadFile(app_info_storage_, buffer);
+ const bool result = file_system::ReadFile(full_path, buffer);
utils::JsonReader reader;
if (result && reader.parse(buffer, &dictionary_)) {
@@ -110,11 +106,6 @@ Json::Value LastStateImpl::dictionary() const {
return dictionary_;
}
-Json::Value& LastStateImpl::get_dictionary() {
- sync_primitives::AutoLock lock(dictionary_lock_);
- return dictionary_;
-}
-
void LastStateImpl::set_dictionary(const Json::Value& dictionary) {
DCHECK(dictionary.type() == Json::objectValue ||
dictionary.type() == Json::nullValue);
diff --git a/src/components/resumption/test/last_state_test.cc b/src/components/resumption/test/last_state_test.cc
index 61c227bbf3..c242f18099 100644
--- a/src/components/resumption/test/last_state_test.cc
+++ b/src/components/resumption/test/last_state_test.cc
@@ -50,12 +50,15 @@ class LastStateTest : public ::testing::Test {
protected:
LastStateTest()
: empty_dictionary_("null\n")
- , app_info_dat_file_("app_info.dat")
+ , app_info_dat_file_(kAppStorageFolder + "/" + kAppInfoStorageFile)
, last_state_(kAppStorageFolder, kAppInfoStorageFile) {}
static void SetUpTestCase() {
- file_system::DeleteFile(kAppInfoStorageFile);
+ const std::string storage_file =
+ kAppStorageFolder + "/" + kAppInfoStorageFile;
+ file_system::DeleteFile(storage_file);
file_system::RemoveDirectory(kAppStorageFolder);
+ file_system::CreateDirectoryRecursively(kAppStorageFolder);
}
void SetUp() OVERRIDE {
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
index 9aa82d6c1b..a7b477c009 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
@@ -388,9 +388,7 @@ bool Array<T, minsize, maxsize>::operator==(const Array& that) {
if (this->size() != that.size())
return false;
- using It = decltype(std::begin(that));
-
- for (It i = std::begin(*this), j = std::begin(that); i != std::end(*this);
+ for (auto i = std::begin(*this), j = std::begin(that); i != std::end(*this);
++i, ++j) {
if (!(*i == *j)) {
return false;
diff --git a/src/components/security_manager/CMakeLists.txt b/src/components/security_manager/CMakeLists.txt
index 3ac614dd98..58afc8e2c5 100644
--- a/src/components/security_manager/CMakeLists.txt
+++ b/src/components/security_manager/CMakeLists.txt
@@ -57,8 +57,13 @@ set(LIBRARIES
ProtocolLibrary
)
-list(APPEND LIBRARIES crypto -L${OPENSSL_LIBS_DIRECTORY})
-list(APPEND LIBRARIES ssl -L${OPENSSL_LIBS_DIRECTORY})
+if(ANDROID)
+ list(APPEND LIBRARIES crypto -L${OPENSSL_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES ssl -L${OPENSSL_LIBS_DIRECTORY})
+else()
+ list(APPEND LIBRARIES crypto)
+ list(APPEND LIBRARIES ssl)
+endif()
add_library(SecurityManager ${SOURCES})
target_link_libraries(SecurityManager ${LIBRARIES})
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
index 109a14578b..e7cbf6c421 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
@@ -147,7 +147,8 @@ class CryptoManagerImpl : public CryptoManager {
void ReleaseSSLContext(SSLContext* context) OVERRIDE;
std::string LastError() const OVERRIDE;
bool IsCertificateUpdateRequired(
- const TIME_TYPE system_time, const TIME_TYPE certificates_time) const OVERRIDE;
+ const TIME_TYPE system_time,
+ const TIME_TYPE certificates_time) const OVERRIDE;
virtual const CryptoManagerSettings& get_settings() const OVERRIDE;
private:
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
index f170ef90a7..d6658a79bc 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
@@ -83,6 +83,10 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings {
return profile_.force_unprotected_service();
}
+ uint32_t security_level() const OVERRIDE {
+ return profile_.security_level();
+ }
+
private:
const profile::Profile& profile_;
const std::string certificate_data_;
diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h
index ff62942d9a..2c1e7b26b1 100644
--- a/src/components/security_manager/include/security_manager/security_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/security_manager_impl.h
@@ -121,12 +121,12 @@ class SecurityManagerImpl : public SecurityManager,
* \param connection_key Unique key used by other components as session
* identifier
* \param error_id unique error identifier
- * \param erorr_text SSL impelmentation error text
+ * \param error_text SSL impelmentation error text
* \param seq_number received from Mobile Application
*/
void SendInternalError(const uint32_t connection_key,
const uint8_t& error_id,
- const std::string& erorr_text,
+ const std::string& error_text,
const uint32_t seq_number) OVERRIDE;
using SecurityManager::SendInternalError;
@@ -216,7 +216,7 @@ class SecurityManagerImpl : public SecurityManager,
void ProcessFailedPTU() OVERRIDE;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify listeners that
* certificate decryption failed in the external flow
@@ -226,17 +226,24 @@ class SecurityManagerImpl : public SecurityManager,
private:
/**
+ * @brief NextSequentialNumber get next sequential number for request
+ * @return next sequential number
+ */
+ uint32_t NextSequentialNumber();
+
+ /**
* \brief Sends Handshake binary data to mobile application
* \param connection_key Unique key used by other components as session
* identifier
* \param data pointer to binary data array
* \param data_size size of binary data array
- * \param seq_number received from Mobile Application
+ * \param custom_seq_number specific sequential number of request. If omitted,
+ * this will be automatically generated
*/
void SendHandshakeBinData(const uint32_t connection_key,
const uint8_t* const data,
const size_t data_size,
- const uint32_t seq_number = 0);
+ const uint32_t custom_seq_number = 0);
/**
* \brief Parse SecurityMessage as HandshakeData request
* \param inMessage SecurityMessage with binary data of handshake
@@ -327,6 +334,8 @@ class SecurityManagerImpl : public SecurityManager,
std::set<uint32_t> awaiting_certificate_connections_;
std::set<uint32_t> awaiting_time_connections_;
+ uint32_t current_seq_number_;
+
mutable sync_primitives::Lock waiters_lock_;
volatile bool waiting_for_certificate_;
volatile bool waiting_for_time_;
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc
index c9c1e78fa5..9b25288654 100644
--- a/src/components/security_manager/src/crypto_manager_impl.cc
+++ b/src/components/security_manager/src/crypto_manager_impl.cc
@@ -39,10 +39,12 @@
#include <stdio.h>
#include <algorithm>
+#include <chrono>
#include <ctime>
#include <fstream>
#include <iostream>
-#include <chrono>
+
+#include "security_manager/security_manager.h"
#include "security_manager/security_manager.h"
#include "utils/atomic.h"
@@ -51,8 +53,6 @@
#include "utils/macro.h"
#include "utils/scope_guard.h"
-#define OPENSSL1_1_VERSION 0x1010000fL
-#define TLS1_1_MINIMAL_VERSION 0x1000103fL
#define CONST_SSL_METHOD_MINIMAL_VERSION 0x00909000L
namespace security_manager {
@@ -92,7 +92,7 @@ CryptoManagerImpl::CryptoManagerImpl(
: settings_(set), context_(NULL) {
SDL_LOG_AUTO_TRACE();
sync_primitives::AutoLock lock(instance_lock_);
- instance_count_++;
+ ++instance_count_;
if (instance_count_ == 1) {
SDL_LOG_DEBUG("Openssl engine initialization");
SSL_load_error_strings();
@@ -111,7 +111,7 @@ CryptoManagerImpl::~CryptoManagerImpl() {
} else {
SSL_CTX_free(context_);
}
- instance_count_--;
+ --instance_count_;
if (instance_count_ == 0) {
SDL_LOG_DEBUG("Openssl engine deinitialization");
EVP_cleanup();
@@ -166,58 +166,23 @@ bool CryptoManagerImpl::Init() {
#endif
switch (get_settings().security_manager_protocol_name()) {
case SSLv3:
-#ifdef OPENSSL_NO_SSL3
SDL_LOG_WARN("OpenSSL does not support SSL3 protocol");
return false;
-#else
- SDL_LOG_DEBUG("SSLv3 is used");
- method = is_server ? SSLv3_server_method() : SSLv3_client_method();
- SSL_CTX_set_max_proto_version(context_, SSL3_VERSION);
- break;
-#endif
case TLSv1:
- SDL_LOG_DEBUG("TLSv1 is used");
-#if OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION
- method = is_server ? TLSv1_server_method() : TLSv1_client_method();
-#else
- method = is_server ? TLS_server_method() : TLS_client_method();
- SSL_CTX_set_max_proto_version(context_, TLS1_VERSION);
-#endif
- break;
+ SDL_LOG_WARN("Protocol TLSv1 is unsupported");
+ return false;
case TLSv1_1:
- SDL_LOG_DEBUG("TLSv1_1 is used");
-#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION
- SDL_LOG_WARN(
- "OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0");
- method = is_server ? TLSv1_server_method() : TLSv1_client_method();
-#elif OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION
- method = is_server ? TLSv1_1_server_method() : TLSv1_1_client_method();
-#else
- method = is_server ? TLS_server_method() : TLS_client_method();
- SSL_CTX_set_max_proto_version(context_, TLS1_1_VERSION);
-#endif
- break;
+ SDL_LOG_WARN("Protocol TLSv1_1 is unsupported");
+ return false;
case TLSv1_2:
SDL_LOG_DEBUG("TLSv1_2 is used");
-#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION
- SDL_LOG_WARN(
- "OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0");
- method = is_server ? TLSv1_server_method() : TLSv1_client_method();
-#elif OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION
- method = is_server ? TLSv1_2_server_method() : TLSv1_2_client_method();
-#else
method = is_server ? TLS_server_method() : TLS_client_method();
SSL_CTX_set_max_proto_version(context_, TLS1_2_VERSION);
-#endif
break;
case DTLSv1:
SDL_LOG_DEBUG("DTLSv1 is used");
-#if OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION
- method = is_server ? DTLSv1_server_method() : DTLSv1_client_method();
-#else
method = is_server ? DTLS_server_method() : DTLS_client_method();
SSL_CTX_set_max_proto_version(context_, DTLS1_VERSION);
-#endif
break;
default:
SDL_LOG_ERROR("Unknown protocol: "
@@ -249,19 +214,20 @@ bool CryptoManagerImpl::Init() {
"Could not set cipher list: " << get_settings().ciphers_list());
return false;
}
-#if OPENSSL_VERSION_NUMBER > OPENSSL1_1_VERSION
+
auto sk = SSL_CTX_get_ciphers(context_);
const char* p;
- for (int i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
+ for (int i = 0; i < sk_SSL_CIPHER_num(sk); ++i) {
const SSL_CIPHER* c = sk_SSL_CIPHER_value(sk, i);
p = SSL_CIPHER_get_name(c);
if (p == NULL)
break;
SDL_LOG_DEBUG("Using Cipher: " << p);
}
-#endif
}
+ SSL_CTX_set_security_level(context_, get_settings().security_level());
+
if (get_settings().ca_cert_path().empty()) {
SDL_LOG_WARN("Setting up empty CA certificate location");
}
@@ -368,7 +334,8 @@ bool CryptoManagerImpl::IsCertificateUpdateRequired(
const TIME_TYPE system_time, const TIME_TYPE certificates_time) const {
SDL_LOG_AUTO_TRACE();
- const double seconds = get_duration_diff<std::chrono::seconds>(certificates_time, system_time);
+ const double seconds =
+ get_duration_diff<std::chrono::seconds>(certificates_time, system_time);
const size_t maxsize = 40;
char certificate_utc_time[maxsize];
std::strftime(
diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc
index 08fe82f6bd..810cb90471 100644
--- a/src/components/security_manager/src/security_manager_impl.cc
+++ b/src/components/security_manager/src/security_manager_impl.cc
@@ -54,6 +54,7 @@ SecurityManagerImpl::SecurityManagerImpl(
, crypto_manager_(NULL)
, protocol_handler_(NULL)
, system_time_handler_(std::move(system_time_handler))
+ , current_seq_number_(0)
, waiting_for_certificate_(false)
, waiting_for_time_(false) {
DCHECK(system_time_handler_);
@@ -425,7 +426,7 @@ void SecurityManagerImpl::ProcessFailedPTU() {
}
}
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
void SecurityManagerImpl::ProcessFailedCertDecrypt() {
SDL_LOG_AUTO_TRACE();
{
@@ -556,6 +557,7 @@ bool SecurityManagerImpl::ProcessHandshakeData(
// no handshake data to send
return false;
}
+
if (sslContext->IsInitCompleted()) {
// On handshake success
SDL_LOG_DEBUG("SSL initialization finished success.");
@@ -564,6 +566,29 @@ bool SecurityManagerImpl::ProcessHandshakeData(
} else if (handshake_result != SSLContext::Handshake_Result_Success) {
// On handshake fail
SDL_LOG_WARN("SSL initialization finished with fail.");
+ int32_t error_code = ERROR_HANDSHAKE_FAILED;
+ std::string error_text = "Handshake failed";
+ switch (handshake_result) {
+ case SSLContext::Handshake_Result_CertExpired:
+ error_code = ERROR_EXPIRED_CERT;
+ error_text = "Certificate is expired";
+ break;
+ case SSLContext::Handshake_Result_NotYetValid:
+ error_code = ERROR_INVALID_CERT;
+ error_text = "Certificate is not yet valid";
+ break;
+ case SSLContext::Handshake_Result_CertNotSigned:
+ error_code = ERROR_INVALID_CERT;
+ error_text = "Certificate is not signed";
+ break;
+ case SSLContext::Handshake_Result_AppIDMismatch:
+ error_code = ERROR_INVALID_CERT;
+ error_text = "App ID does not match certificate";
+ break;
+ default:
+ break;
+ }
+ SendInternalError(connection_key, error_code, error_text);
NotifyListenersOnHandshakeDone(connection_key, handshake_result);
}
@@ -596,13 +621,24 @@ bool SecurityManagerImpl::ProcessInternalError(
return true;
}
-void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key,
- const uint8_t* const data,
- const size_t data_size,
- const uint32_t seq_number) {
- const SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_HANDSHAKE_DATA,
- seq_number);
+uint32_t SecurityManagerImpl::NextSequentialNumber() {
+ if (current_seq_number_ >= std::numeric_limits<uint32_t>::max()) {
+ current_seq_number_ = 0;
+ }
+ current_seq_number_++;
+ return current_seq_number_;
+}
+
+void SecurityManagerImpl::SendHandshakeBinData(
+ const uint32_t connection_key,
+ const uint8_t* const data,
+ const size_t data_size,
+ const uint32_t custom_seq_number) {
+ uint32_t seq_number =
+ (0 == custom_seq_number) ? NextSequentialNumber() : custom_seq_number;
+
+ const SecurityQuery::QueryHeader header(
+ SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, seq_number);
DCHECK(data_size < 1024 * 1024 * 1024);
const SecurityQuery query =
SecurityQuery(header, connection_key, data, data_size);
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index 6eaf99dddb..83ae8ceeb5 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -131,6 +131,8 @@ CryptoManagerImpl::SSLContextImpl::create_max_block_sizes() {
rc.insert(std::make_pair("AES128-SHA", seed_sha_max_block_size));
rc.insert(
std::make_pair("AES256-GCM-SHA384", aes128_gcm_sha256_max_block_size));
+ rc.insert(std::make_pair("ECDHE-RSA-AES256-GCM-SHA384",
+ aes128_gcm_sha256_max_block_size));
rc.insert(std::make_pair("AES256-SHA256", aes128_sha256_max_block_size));
rc.insert(std::make_pair("AES256-SHA", seed_sha_max_block_size));
rc.insert(std::make_pair("CAMELLIA128-SHA", seed_sha_max_block_size));
@@ -238,8 +240,10 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
TIME_TYPE start = convert_asn1_time_to_time_t(notBefore);
TIME_TYPE end = convert_asn1_time_to_time_t(notAfter);
- const double start_seconds = get_duration_diff<std::chrono::seconds>(hsh_context_.system_time, start);
- const double end_seconds = get_duration_diff<std::chrono::seconds>(end, hsh_context_.system_time);
+ const double start_seconds =
+ get_duration_diff<std::chrono::seconds>(hsh_context_.system_time, start);
+ const double end_seconds =
+ get_duration_diff<std::chrono::seconds>(end, hsh_context_.system_time);
if (start_seconds < 0) {
SDL_LOG_ERROR("Certificate is not yet valid. Time before validity "
@@ -522,16 +526,15 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
size_t CryptoManagerImpl::SSLContextImpl::get_max_block_size(size_t mtu) const {
SDL_LOG_AUTO_TRACE();
+ const auto max_allowed_block_size =
+ mtu > SSL3_RT_MAX_PLAIN_LENGTH ? SSL3_RT_MAX_PLAIN_LENGTH : mtu;
if (!max_block_size_) {
// FIXME(EZamakhov): add correct logics for TLS1/1.2/SSL3
// For SSL3.0 set temporary value 90, old TLS1.2 value is 29
- assert(mtu > 90);
- return mtu - 90;
+ assert(max_allowed_block_size > 90);
+ return max_allowed_block_size - 90;
}
- const auto max_allowed_block_size =
- mtu > SSL3_RT_MAX_PLAIN_LENGTH ? SSL3_RT_MAX_PLAIN_LENGTH : mtu;
-
return max_block_size_(max_allowed_block_size);
}
diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc
index 85e1ad3129..44e24afe70 100644
--- a/src/components/security_manager/test/crypto_manager_impl_test.cc
+++ b/src/components/security_manager/test/crypto_manager_impl_test.cc
@@ -190,14 +190,6 @@ TEST_F(CryptoManagerTest, CorrectInit) {
// Recall init with other protocols
SetInitialValues(
- security_manager::CLIENT, security_manager::TLSv1_2, kFordCipher);
- EXPECT_TRUE(crypto_manager_->Init());
-
- SetInitialValues(
- security_manager::CLIENT, security_manager::TLSv1_1, kFordCipher);
- EXPECT_TRUE(crypto_manager_->Init());
-
- SetInitialValues(
security_manager::CLIENT, security_manager::DTLSv1, kFordCipher);
EXPECT_TRUE(crypto_manager_->Init());
diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc
index 4145334115..c2b0cda373 100644
--- a/src/components/security_manager/test/security_manager_test.cc
+++ b/src/components/security_manager/test/security_manager_test.cc
@@ -152,7 +152,7 @@ class SecurityManagerTest : public ::testing::Test {
void EmulateMobileMessageHandshake(const uint8_t* const data,
const uint32_t data_size,
const int repeat_count = 1) {
- const SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION,
+ const SecurityQuery::QueryHeader header(SecurityQuery::RESPONSE,
SecurityQuery::SEND_HANDSHAKE_DATA,
kSeqNumber);
for (int c = 0; c < repeat_count; ++c) {
@@ -284,7 +284,7 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
@@ -295,14 +295,14 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
InternalErrorWithErrId(SecurityManager::ERROR_NOT_SUPPORTED),
false,
kIsFinal))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
// It could be any query id
SecurityQuery::INVALID_QUERY_ID);
const uint8_t data = 0;
EmulateMobileMessage(header, &data, 1);
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
/*
* Shall skip all OnMobileMessageSent
@@ -377,14 +377,14 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Expect InternalError with ERROR_ID
@@ -394,14 +394,14 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_ID),
false,
kIsFinal))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
SecurityQuery::INVALID_QUERY_ID);
const uint8_t data = 0;
EmulateMobileMessage(header, &data, 1);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
/*
* Shall send Internall Error on call
@@ -577,7 +577,7 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_WrongDataSize) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _));
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
@@ -590,11 +590,11 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_WrongDataSize) {
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
false,
kIsFinal))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
EmulateMobileMessageHandshake(NULL, 0);
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
/*
* Shall send InternallError on
@@ -607,14 +607,14 @@ TEST_F(SecurityManagerTest, DISABLED_ProcessHandshakeData_ServiceNotProtected) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
EXPECT_CALL(
mock_protocol_handler,
@@ -622,24 +622,24 @@ TEST_F(SecurityManagerTest, DISABLED_ProcessHandshakeData_ServiceNotProtected) {
InternalErrorWithErrId(SecurityManager::ERROR_SERVICE_NOT_PROTECTED),
false,
kIsFinal))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
times++;
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Fail))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Emulate SessionObserver result
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), ReturnNull()));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), ReturnNull()));
times++;
const uint8_t data[] = {0x1, 0x2};
EmulateMobileMessageHandshake(data, sizeof(data) / sizeof(data[0]));
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
// Listener was destroyed after OnHandshakeDone call
mock_sm_listener.release();
@@ -658,16 +658,16 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _))
.Times(handshake_emulates)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
times += handshake_emulates;
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times += handshake_emulates;
// Expect InternalError with ERROR_ID
@@ -678,12 +678,12 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) {
false,
kIsFinal))
.Times(handshake_emulates)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
times += handshake_emulates;
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Fail))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Emulate SessionObserver and CryptoManager result
@@ -700,19 +700,19 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) {
_))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_AbnormalFail)))
.WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_AbnormalFail)))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(0),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_AbnormalFail)))
.WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
SetArgPointee<3>(0),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_AbnormalFail)));
times += 4; // matches to each single call above
@@ -723,34 +723,35 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) {
EmulateMobileMessageHandshake(
handshake_data, handshake_data_size, handshake_emulates);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
// Listener was destroyed after OnHandshakeDone call
mock_sm_listener.release();
}
/*
* Shall send HandshakeData on getting SEND_HANDSHAKE_DATA from mobile side
- * with correct handshake data Check Fail and sussecc states
+ * with correct handshake data Check Fail and success states
*/
TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) {
SetMockCryptoManager();
// Count handshake calls
const int handshake_emulates = 2;
+ const int internal_error_count = 1;
uint32_t connection_id = 0;
uint8_t session_id = 0;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _))
- .Times(handshake_emulates)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .Times(handshake_emulates + internal_error_count)
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
times += handshake_emulates;
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
- .Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
- times += handshake_emulates;
+ .Times(handshake_emulates + internal_error_count)
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
+ times += handshake_emulates + internal_error_count;
// Get size of raw message after
const size_t raw_message_size = 15;
@@ -758,23 +759,31 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) {
SendMessageToMobileApp(
RawMessageEqSize(raw_message_size), false, kIsFinal))
.Times(handshake_emulates)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
- times += handshake_emulates;
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
+ EXPECT_CALL(
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_HANDSHAKE_FAILED),
+ false,
+ kIsFinal))
+ .Times(internal_error_count)
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
+ times += handshake_emulates + internal_error_count;
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Fail))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Emulate SessionObserver and CryptoManager result
EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
.Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(false)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
times += handshake_emulates;
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
.Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter),
Return(&mock_ssl_context_exists)));
times += handshake_emulates;
@@ -787,18 +796,109 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) {
_))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Success)))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Fail)));
times += 2; // matches to each single call above
EmulateMobileMessageHandshake(
handshake_data, handshake_data_size, handshake_emulates);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
+
+ // Listener was destroyed after OnHandshakeDone call
+ mock_sm_listener.release();
+}
+/*
+ * Shall send HandshakeData on getting SEND_HANDSHAKE_DATA from mobile side
+ * with correct handshake data Check Fail and success states
+ */
+TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer_Invalid_Cert) {
+ SetMockCryptoManager();
+ // Count handshake calls
+ const int handshake_emulates = 4;
+
+ uint32_t connection_id = 0;
+ uint8_t session_id = 0;
+
+ auto waiter = TestAsyncWaiter::createInstance();
+ uint32_t times = 0;
+ // Each of these calls is run twice, once for the next handshake data request,
+ // once for the the internal error notification
+ EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _))
+ .Times(handshake_emulates)
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
+ times += handshake_emulates;
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
+ .Times(handshake_emulates)
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
+ times += handshake_emulates;
+
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_EXPIRED_CERT),
+ false,
+ kIsFinal))
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INVALID_CERT),
+ false,
+ kIsFinal))
+ .Times(3)
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
+ times += 4;
+
+ // Listener is erased after first call
+ EXPECT_CALL(*mock_sm_listener,
+ OnHandshakeDone(kKey, SSLContext::Handshake_Result_CertExpired))
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
+ times++;
+
+ // Emulate SessionObserver and CryptoManager result
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .Times(handshake_emulates)
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
+ times += handshake_emulates;
+ EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
+ .Times(handshake_emulates)
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter),
+ Return(&mock_ssl_context_exists)));
+ times += handshake_emulates;
+
+ // Emulate DoHandshakeStep correct logics
+ EXPECT_CALL(
+ mock_ssl_context_exists,
+ DoHandshakeStep(HandshakeStepEq(handshake_data, handshake_data_size),
+ handshake_data_size,
+ _,
+ _))
+ .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(0),
+ NotifyTestAsyncWaiter(waiter),
+ Return(SSLContext::Handshake_Result_CertExpired)))
+ .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(0),
+ NotifyTestAsyncWaiter(waiter),
+ Return(SSLContext::Handshake_Result_NotYetValid)))
+ .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(0),
+ NotifyTestAsyncWaiter(waiter),
+ Return(SSLContext::Handshake_Result_AppIDMismatch)))
+ .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(0),
+ NotifyTestAsyncWaiter(waiter),
+ Return(SSLContext::Handshake_Result_CertNotSigned)));
+ times += 4; // matches to each single call above
+
+ EmulateMobileMessageHandshake(
+ handshake_data, handshake_data_size, handshake_emulates);
+
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
// Listener was destroyed after OnHandshakeDone call
mock_sm_listener.release();
@@ -813,24 +913,24 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_HandshakeFinished) {
// Count handshake calls
const int handshake_emulates = 6;
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
uint32_t times = 0;
// Expect no errors
// Expect notifying listeners (success)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Success))
- .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times++;
// Emulate SessionObserver and CryptoManager result
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
.Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter),
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter),
Return(&mock_ssl_context_exists)));
times += handshake_emulates;
EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
.Times(handshake_emulates)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times += handshake_emulates;
EXPECT_CALL(
@@ -843,31 +943,31 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_HandshakeFinished) {
// two states with correct out data
WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Success)))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Fail)))
.
// two states with with null pointer data
WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Success)))
.WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
SetArgPointee<3>(handshake_data_out_size),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Fail)))
.
// two states with with null data size
WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(0),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Success)))
.WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
SetArgPointee<3>(0),
- NotifyTestAsyncWaiter(&waiter),
+ NotifyTestAsyncWaiter(waiter),
Return(SSLContext::Handshake_Result_Success)));
times += 6; // matches to each single call above
@@ -880,19 +980,19 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_HandshakeFinished) {
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, An<uint8_t&>()))
.Times(2)
- .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
times += 2; // matches to the number above
EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, false, kIsFinal))
.Times(2)
- .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter));
times += 2; // matches to the number above
// Expect NO InternalError with ERROR_ID
EmulateMobileMessageHandshake(
handshake_data, handshake_data_size, handshake_emulates);
- EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
// Listener was destroyed after OnHandshakeDone call
mock_sm_listener.release();
diff --git a/src/components/security_manager/test/security_query_test.cc b/src/components/security_manager/test/security_query_test.cc
index 6becddaaf9..60e3a20d77 100644
--- a/src/components/security_manager/test/security_query_test.cc
+++ b/src/components/security_manager/test/security_query_test.cc
@@ -53,7 +53,7 @@ class SecurityQueryTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
// init_header used for SecurityQuery initialization
- init_header.query_type = SecurityQuery::NOTIFICATION;
+ init_header.query_type = SecurityQuery::REQUEST;
init_header.query_id = SecurityQuery::SEND_HANDSHAKE_DATA;
init_header.seq_number = SEQ_NUMBER;
init_header.json_size = 0u;
@@ -107,18 +107,17 @@ TEST_F(SecurityQueryTest, QueryHeaderConstructor) {
* Security QueryHeader shall construct with correct fields
*/
TEST_F(SecurityQueryTest, QueryHeaderConstructor2) {
- SecurityQuery::QueryHeader new_header(SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_HANDSHAKE_DATA,
- SEQ_NUMBER);
- ASSERT_EQ(new_header.query_type, SecurityQuery::NOTIFICATION);
+ SecurityQuery::QueryHeader new_header(
+ SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, SEQ_NUMBER);
+ ASSERT_EQ(new_header.query_type, SecurityQuery::REQUEST);
ASSERT_EQ(new_header.query_id, SecurityQuery::SEND_HANDSHAKE_DATA);
ASSERT_EQ(new_header.seq_number, SEQ_NUMBER);
ASSERT_EQ(new_header.json_size, 0u);
- SecurityQuery::QueryHeader new_header2(SecurityQuery::RESPONSE,
+ SecurityQuery::QueryHeader new_header2(SecurityQuery::NOTIFICATION,
SecurityQuery::SEND_INTERNAL_ERROR,
SEQ_NUMBER + 1);
- ASSERT_EQ(new_header2.query_type, SecurityQuery::RESPONSE);
+ ASSERT_EQ(new_header2.query_type, SecurityQuery::NOTIFICATION);
ASSERT_EQ(new_header2.query_id, SecurityQuery::SEND_INTERNAL_ERROR);
ASSERT_EQ(new_header2.seq_number, SEQ_NUMBER + 1);
ASSERT_EQ(new_header2.json_size, 0u);
@@ -385,9 +384,7 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownId_Response) {
*/
TEST_F(SecurityQueryTest, Parse_Handshake) {
SecurityQuery::QueryHeader handshake_header(
- SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_HANDSHAKE_DATA,
- SEQ_NUMBER);
+ SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, SEQ_NUMBER);
// some sample data
uint8_t raw_data[] = {0x6, 0x7, 0x8};
const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]);
diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
index d1de81de73..9c21fba0bb 100644
--- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc
+++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
@@ -369,14 +369,12 @@ class SSLHandshakeTest : public testing::TestWithParam<Protocol> {
const std::vector<int> forced_unprotected_service_;
};
-INSTANTIATE_TEST_CASE_P(
- CorrectProtocol,
- SSLHandshakeTest,
- ::testing::Values(
- Protocol(security_manager::TLSv1, security_manager::TLSv1),
- Protocol(security_manager::TLSv1_1, security_manager::TLSv1_1),
- Protocol(security_manager::TLSv1_2, security_manager::TLSv1_2),
- Protocol(security_manager::DTLSv1, security_manager::DTLSv1)));
+INSTANTIATE_TEST_CASE_P(CorrectProtocol,
+ SSLHandshakeTest,
+ ::testing::Values(Protocol(security_manager::TLSv1_2,
+ security_manager::TLSv1_2),
+ Protocol(security_manager::DTLSv1,
+ security_manager::DTLSv1)));
TEST_P(SSLHandshakeTest, NoVerification) {
ASSERT_TRUE(InitServerManagers(GetParam().server_protocol,
diff --git a/src/components/smart_objects/CMakeLists.txt b/src/components/smart_objects/CMakeLists.txt
index d5475741e8..b3f6e34305 100644
--- a/src/components/smart_objects/CMakeLists.txt
+++ b/src/components/smart_objects/CMakeLists.txt
@@ -48,7 +48,7 @@ add_library("SmartObjects" ${SOURCES})
target_link_libraries("SmartObjects" Utils)
add_dependencies("SmartObjects" MOBILE_API)
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries("SmartObjects" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
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 8f9a179fff..43870ddb42 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
@@ -63,6 +63,13 @@ class CArraySchemaItem : public ISchemaItem {
const TSchemaItemParameter<size_t>& MaxSize =
TSchemaItemParameter<size_t>());
+ static std::shared_ptr<CArraySchemaItem> create(
+ ISchemaItem* ElementSchemaItem,
+ const TSchemaItemParameter<size_t>& MinSize =
+ TSchemaItemParameter<size_t>(),
+ const TSchemaItemParameter<size_t>& MaxSize =
+ TSchemaItemParameter<size_t>());
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
@@ -131,10 +138,16 @@ class CArraySchemaItem : public ISchemaItem {
const TSchemaItemParameter<size_t>& MinSize,
const TSchemaItemParameter<size_t>& MaxSize);
+ CArraySchemaItem(ISchemaItem* ElementSchemaItem,
+ const TSchemaItemParameter<size_t>& MinSize,
+ const TSchemaItemParameter<size_t>& MaxSize);
+
/**
* @brief SchemaItem for array elements.
**/
- const ISchemaItemPtr mElementSchemaItem;
+ ISchemaItem* mElementSchemaItem;
+ const ISchemaItemPtr mElementSchemaItemShared;
+
/**
* @brief Minimum allowed size.
**/
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 de4c3adcc8..07b4f38f62 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
@@ -296,7 +296,7 @@ template <typename EnumType>
const ElementSignature TEnumSchemaItem<EnumType>::getSignature(
const std::vector<ElementSignature>& signatures,
const utils::SemanticVersion& MessageVersion) {
- for (uint i = 0; i < signatures.size(); i++) {
+ for (uint i = 0; i < signatures.size(); ++i) {
ElementSignature signature = signatures[i];
// Check if signature matches message version
if (signature.mSince != boost::none &&
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 25b7684829..5fa9597db7 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
@@ -135,6 +135,7 @@ bool TNumberSchemaItem<NumberType>::isValidNumberType(SmartType type) {
typeid(int32_t),
typeid(uint32_t),
typeid(int64_t),
+ typeid(uint64_t),
typeid(double))) {
return true;
}
@@ -157,11 +158,26 @@ errors::eType TNumberSchemaItem<NumberType>::validate(
report->set_validation_info(validation_info);
return errors::INVALID_VALUE;
}
+
NumberType value(0);
if (typeid(int32_t) == typeid(value)) {
- value = utils::SafeStaticCast<int64_t, int32_t>(Object.asInt());
+ if (Object.asInt() < std::numeric_limits<int32_t>::min() ||
+ Object.asInt() > std::numeric_limits<int32_t>::max()) {
+ const std::string validation_info =
+ "Value " + Object.asString() + " out of int32 range";
+ report->set_validation_info(validation_info);
+ return errors::OUT_OF_RANGE;
+ }
+ value = Object.asInt();
} else if (typeid(uint32_t) == typeid(value)) {
- value = utils::SafeStaticCast<uint64_t, uint32_t>(Object.asUInt());
+ if (Object.asInt() < std::numeric_limits<uint32_t>::min() ||
+ Object.asInt() > std::numeric_limits<uint32_t>::max()) {
+ const std::string validation_info =
+ "Value " + Object.asString() + " out of uint32 range";
+ report->set_validation_info(validation_info);
+ return errors::OUT_OF_RANGE;
+ }
+ value = Object.asUInt();
} else if (typeid(double) == typeid(value)) {
value = Object.asDouble();
} else if (typeid(int64_t) == typeid(value)) {
@@ -231,6 +247,9 @@ template <>
SmartType TNumberSchemaItem<int64_t>::getSmartType() const;
template <>
+SmartType TNumberSchemaItem<uint64_t>::getSmartType() const;
+
+template <>
SmartType TNumberSchemaItem<double>::getSmartType() const;
} // namespace ns_smart_objects
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 d5c8a7f3e9..0a971d50ee 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
@@ -69,6 +69,14 @@ struct SMember {
const bool IsRemoved = false,
const std::vector<SMember>& history_vector = {});
+ SMember(ISchemaItem* SchemaItem,
+ const bool IsMandatory = true,
+ const std::string& Since = "",
+ const std::string& Until = "",
+ const bool IsDeprecated = false,
+ const bool IsRemoved = false,
+ const std::vector<SMember>& history_vector = {});
+
/**
* @brief Checks the version a parameter was removed (until)
* If the mobile's msg version is greater than or
@@ -79,7 +87,8 @@ struct SMember {
/**
* @brief Member schema item.
**/
- ISchemaItemPtr mSchemaItem;
+ ISchemaItem* mSchemaItem;
+ ISchemaItemPtr mSchemaItemShared;
/**
* @brief true if member is mandatory, false otherwise.
**/
diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc
index 3c28396213..6f1e65d2eb 100644
--- a/src/components/smart_objects/src/array_schema_item.cc
+++ b/src/components/smart_objects/src/array_schema_item.cc
@@ -44,6 +44,14 @@ std::shared_ptr<CArraySchemaItem> CArraySchemaItem::create(
new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize));
}
+std::shared_ptr<CArraySchemaItem> CArraySchemaItem::create(
+ ISchemaItem* ElementSchemaItem,
+ const TSchemaItemParameter<size_t>& MinSize,
+ const TSchemaItemParameter<size_t>& MaxSize) {
+ return std::shared_ptr<CArraySchemaItem>(
+ new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize));
+}
+
errors::eType CArraySchemaItem::validate(
const SmartObject& Object,
rpc::ValidationReport* report,
@@ -146,7 +154,7 @@ void CArraySchemaItem::BuildObjectBySchema(const SmartObject& pattern_object,
if (SmartType_Array == pattern_object.getType()) {
const size_t array_len = pattern_object.length();
if (array_len > 0) {
- for (size_t i = 0u; i < array_len; i++) {
+ for (size_t i = 0u; i < array_len; ++i) {
mElementSchemaItem->BuildObjectBySchema(pattern_object.getElement(i),
result_object[i]);
}
@@ -161,10 +169,19 @@ TypeID CArraySchemaItem::GetType() {
return TYPE_ARRAY;
}
-CArraySchemaItem::CArraySchemaItem(const ISchemaItemPtr ElementSchemaItem,
+CArraySchemaItem::CArraySchemaItem(ISchemaItem* ElementSchemaItem,
const TSchemaItemParameter<size_t>& MinSize,
const TSchemaItemParameter<size_t>& MaxSize)
: mElementSchemaItem(ElementSchemaItem)
+ , mElementSchemaItemShared(nullptr)
+ , mMinSize(MinSize)
+ , mMaxSize(MaxSize) {}
+
+CArraySchemaItem::CArraySchemaItem(const ISchemaItemPtr ElementSchemaItem,
+ const TSchemaItemParameter<size_t>& MinSize,
+ const TSchemaItemParameter<size_t>& MaxSize)
+ : mElementSchemaItem(ElementSchemaItem.get())
+ , mElementSchemaItemShared(ElementSchemaItem)
, mMinSize(MinSize)
, mMaxSize(MaxSize) {}
diff --git a/src/components/smart_objects/src/number_schema_item.cc b/src/components/smart_objects/src/number_schema_item.cc
index c383f6ecca..1874ff30a0 100644
--- a/src/components/smart_objects/src/number_schema_item.cc
+++ b/src/components/smart_objects/src/number_schema_item.cc
@@ -50,6 +50,11 @@ SmartType TNumberSchemaItem<int64_t>::getSmartType() const {
}
template <>
+SmartType TNumberSchemaItem<uint64_t>::getSmartType() const {
+ return SmartType_UInteger;
+}
+
+template <>
SmartType TNumberSchemaItem<double>::getSmartType() const {
return SmartType_Double;
}
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index 920d548c48..4b14d9e5a1 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -51,19 +51,21 @@ namespace ns_smart_device_link {
namespace ns_smart_objects {
SMember::SMember()
- : mSchemaItem(CAlwaysFalseSchemaItem::create())
- , mIsMandatory(true)
- , mIsDeprecated(false)
- , mIsRemoved(false) {}
+ : mIsMandatory(true), mIsDeprecated(false), mIsRemoved(false) {
+ mSchemaItemShared = CAlwaysFalseSchemaItem::create();
+ mSchemaItem = mSchemaItemShared.get();
+}
-SMember::SMember(const ISchemaItemPtr SchemaItem,
+SMember::SMember(ISchemaItem* SchemaItem,
const bool IsMandatory,
const std::string& Since,
const std::string& Until,
const bool IsDeprecated,
const bool IsRemoved,
const std::vector<SMember>& history_vector)
- : mSchemaItem(SchemaItem), mIsMandatory(IsMandatory) {
+ : mSchemaItem(SchemaItem)
+ , mSchemaItemShared(nullptr)
+ , mIsMandatory(IsMandatory) {
if (Since.size() > 0) {
utils::SemanticVersion since_struct(Since);
if (since_struct.isValid()) {
@@ -81,6 +83,23 @@ SMember::SMember(const ISchemaItemPtr SchemaItem,
mHistoryVector = history_vector;
}
+SMember::SMember(const ISchemaItemPtr SchemaItem,
+ const bool IsMandatory,
+ const std::string& Since,
+ const std::string& Until,
+ const bool IsDeprecated,
+ const bool IsRemoved,
+ const std::vector<SMember>& history_vector)
+ : SMember(SchemaItem.get(),
+ IsMandatory,
+ Since,
+ Until,
+ IsDeprecated,
+ IsRemoved,
+ history_vector) {
+ mSchemaItemShared = SchemaItem;
+}
+
bool SMember::CheckHistoryFieldVersion(
const utils::SemanticVersion& MessageVersion) const {
if (MessageVersion.isValid()) {
@@ -326,7 +345,7 @@ const SMember* CObjectSchemaItem::GetCorrectMember(
}
// Check for history tag items
if (!member.mHistoryVector.empty()) {
- for (uint i = 0; i < member.mHistoryVector.size(); i++) {
+ for (uint i = 0; i < member.mHistoryVector.size(); ++i) {
if (member.mHistoryVector[i].CheckHistoryFieldVersion(messageVersion)) {
return &member.mHistoryVector[i];
}
diff --git a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
index 1ce383e44d..2be93ae013 100644
--- a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
+++ b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
@@ -543,6 +543,7 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
};
} // namespace smart_object_test
} // namespace components
+} // namespace test
namespace ns_smart_device_link {
namespace ns_smart_objects {
diff --git a/src/components/telemetry_monitor/test/CMakeLists.txt b/src/components/telemetry_monitor/test/CMakeLists.txt
index 960985e45c..a66d3bdddc 100644
--- a/src/components/telemetry_monitor/test/CMakeLists.txt
+++ b/src/components/telemetry_monitor/test/CMakeLists.txt
@@ -74,4 +74,10 @@ endif()
create_test("telemetry_monitor_test" "${SOURCES}" "${LIBRARIES}")
-file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+if (${LOGGER_NAME} STREQUAL "LOG4CXX")
+ file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+
+if (${LOGGER_NAME} STREQUAL "BOOST")
+ file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+endif()
diff --git a/src/components/telemetry_monitor/test/boostlogconfig.ini b/src/components/telemetry_monitor/test/boostlogconfig.ini
new file mode 100644
index 0000000000..4ab6b6e473
--- /dev/null
+++ b/src/components/telemetry_monitor/test/boostlogconfig.ini
@@ -0,0 +1,22 @@
+# Core settings
+[Core]
+DisableLogging=false
+
+# Console Logging (Only ERROR and FATAL messages are logged to console)
+[Sinks.Console]
+DisableLogging=false
+Destination=Console
+Filter="%Severity% >= error"
+Format="%Severity% [%TimeStamp%][%Component%] %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# SDL log file
+[Sinks.AllMessages]
+DisableLogging=false
+Destination=TextFile
+FileName=SmartDeviceLinkCore.log
+Append=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
diff --git a/src/components/test_main.cc b/src/components/test_main.cc
index 62442cb64f..55b1f96aeb 100644
--- a/src/components/test_main.cc
+++ b/src/components/test_main.cc
@@ -3,7 +3,6 @@
#include "utils/custom_string.h"
#ifdef ENABLE_LOG
-#include "utils/logger/log4cxxlogger.h"
#include "utils/logger/logger_impl.h"
#endif // ENABLE_LOG
@@ -15,8 +14,6 @@ int main(int argc, char** argv) {
// --------------------------------------------------------------------------
// Logger initialization
// Redefine for each paticular logger implementation
- auto logger = std::unique_ptr<logger::Log4CXXLogger>(
- new logger::Log4CXXLogger("log4cxx.properties"));
auto logger_impl =
std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl(false));
logger::Logger::instance(logger_impl.get());
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index 5aafb9b841..a001c6cbae 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -38,6 +38,7 @@ include_directories (
${COMPONENTS_DIR}/connection_handler/include
${COMPONENTS_DIR}/config_profile/include
${COMPONENTS_DIR}/resumption/include
+ ${COMPONENTS_DIR}/smart_objects/include
${POLICY_GLOBAL_INCLUDE_PATH}/
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
@@ -176,7 +177,7 @@ endif()
add_library("TransportManager" ${SOURCES})
target_link_libraries("TransportManager" ${LIBRARIES})
-if(ENABLE_LOG AND NOT ANDROID)
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
target_link_libraries("TransportManager" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/transport_manager/include/transport_manager/android/android_connection_factory.h b/src/components/transport_manager/include/transport_manager/android/android_connection_factory.h
index a8b2a31dd1..5742a6d5f4 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_connection_factory.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_connection_factory.h
@@ -56,11 +56,11 @@ class AndroidConnectionFactory : public ServerConnectionFactory {
AndroidConnectionFactory(AndroidTransportAdapter* controller);
protected:
-
TransportAdapter::Error Init() override;
TransportAdapter::Error CreateConnection(
- const DeviceUID& device_uid, const ApplicationHandle& app_handle) override;
+ const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle) override;
void Terminate() override;
diff --git a/src/components/transport_manager/include/transport_manager/android/android_device_scanner.h b/src/components/transport_manager/include/transport_manager/android/android_device_scanner.h
index e573bbc78d..6964a85274 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_device_scanner.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_device_scanner.h
@@ -37,8 +37,8 @@
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_DEVICE_SCANNER_H_
#include "transport_manager/android/android_ipc_device.h"
-#include "transport_manager/transport_adapter/device_scanner.h"
#include "transport_manager/android/local_socket_receiver.h"
+#include "transport_manager/transport_adapter/device_scanner.h"
#include "utils/conditional_variable.h"
#include "utils/lock.h"
@@ -66,7 +66,6 @@ class AndroidDeviceScanner : public DeviceScanner {
~AndroidDeviceScanner();
protected:
-
void Terminate() override;
TransportAdapter::Error Init() override;
diff --git a/src/components/transport_manager/include/transport_manager/android/android_ipc_control_protocol.h b/src/components/transport_manager/include/transport_manager/android/android_ipc_control_protocol.h
index dcc05a749e..f11295e445 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_ipc_control_protocol.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_ipc_control_protocol.h
@@ -1,35 +1,33 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_IPC_CONTROL_PROTOCOL_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_IPC_CONTROL_PROTOCOL_H_
-#include <vector>
#include <stdint.h>
#include <string>
+#include <vector>
namespace transport_manager {
namespace transport_adapter {
enum class AndroidIpcProtocolActions {
- INVALID_ENUM = -1,
- ON_DEVICE_CONNECTED,
- ON_DEVICE_DISCONNECTED,
+ INVALID_ENUM = -1,
+ ON_DEVICE_CONNECTED,
+ ON_DEVICE_DISCONNECTED,
};
using MsgData = std::vector<uint8_t>;
struct AndroidIpcControlProtocol {
+ AndroidIpcControlProtocol() = delete;
- AndroidIpcControlProtocol() = delete;
-
- static AndroidIpcProtocolActions GetMessageActionType(const MsgData& message);
- static std::string GetAddress(const MsgData& message);
- static std::string GetName(const MsgData& message);
-
- static AndroidIpcProtocolActions GetActionFromString(const std::string& str);
- static std::string GetActionString(const AndroidIpcProtocolActions action);
+ static AndroidIpcProtocolActions GetMessageActionType(const MsgData& message);
+ static std::string GetAddress(const MsgData& message);
+ static std::string GetName(const MsgData& message);
+ static AndroidIpcProtocolActions GetActionFromString(const std::string& str);
+ static std::string GetActionString(const AndroidIpcProtocolActions action);
};
-}
-}
+} // namespace transport_adapter
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_IPC_CONTROL_PROTOCOL_H_
diff --git a/src/components/transport_manager/include/transport_manager/android/android_ipc_device.h b/src/components/transport_manager/include/transport_manager/android/android_ipc_device.h
index c2c31c89b2..c387c8b801 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_ipc_device.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_ipc_device.h
@@ -49,15 +49,13 @@ namespace transport_adapter {
*/
class AndroidIpcDevice : public Device {
public:
-
/**
* @brief Constructor.
*
* @param device_address Bluetooth address.
* @param device_name Human-readable device name.
**/
- AndroidIpcDevice(const std::string& device_address,
- const char* device_name);
+ AndroidIpcDevice(const std::string& device_address, const char* device_name);
bool IsSameAs(const Device* other) const override;
@@ -73,7 +71,6 @@ class AndroidIpcDevice : public Device {
* @brief List of available apps to interact with (only single app for now)
*/
ApplicationList applications_list_;
-
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/android_socket_connection.h b/src/components/transport_manager/include/transport_manager/android/android_socket_connection.h
index c90337c1ad..1c726a2112 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_socket_connection.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_socket_connection.h
@@ -36,10 +36,10 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_SOCKET_CONNECTION_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_ANDROID_SOCKET_CONNECTION_H_
-#include "transport_manager/transport_adapter/connection.h"
-#include "transport_manager/android/local_socket_sender.h"
-#include "transport_manager/android/local_socket_receiver.h"
#include "transport_manager/android/android_transport_adapter.h"
+#include "transport_manager/android/local_socket_receiver.h"
+#include "transport_manager/android/local_socket_sender.h"
+#include "transport_manager/transport_adapter/connection.h"
namespace transport_manager {
namespace transport_adapter {
@@ -59,13 +59,13 @@ class AndroidSocketConnection : public Connection {
* @param controller Pointer to the device adapter controller.
*/
AndroidSocketConnection(const DeviceUID& device_uid,
- const ApplicationHandle& app_handle,
- AndroidTransportAdapter* controller);
+ const ApplicationHandle& app_handle,
+ AndroidTransportAdapter* controller);
~AndroidSocketConnection() override;
TransportAdapter::Error SendData(
- ::protocol_handler::RawMessagePtr message) override;
+ ::protocol_handler::RawMessagePtr message) override;
TransportAdapter::Error Disconnect() override;
@@ -76,20 +76,19 @@ class AndroidSocketConnection : public Connection {
TransportAdapter::Error Start();
private:
- void ProcessMessage(const std::vector<uint8_t>& data);
- void OnMessageSent(protocol_handler::RawMessagePtr message);
- void OnClientConnectionDone(const bool is_connected);
-
- DeviceUID device_uid_;
- ApplicationHandle app_handle_;
- AndroidTransportAdapter* controller_;
+ void ProcessMessage(const std::vector<uint8_t>& data);
+ void OnMessageSent(protocol_handler::RawMessagePtr message);
+ void OnClientConnectionDone(const bool is_connected);
- std::unique_ptr<IpcSender> sender_;
- std::unique_ptr<IpcReceiver> receiver_;
+ DeviceUID device_uid_;
+ ApplicationHandle app_handle_;
+ AndroidTransportAdapter* controller_;
- std::thread receiver_thread_;
- std::thread sender_thread_;
+ std::unique_ptr<IpcSender> sender_;
+ std::unique_ptr<IpcReceiver> receiver_;
+ std::thread receiver_thread_;
+ std::thread sender_thread_;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/android_transport_adapter.h b/src/components/transport_manager/include/transport_manager/android/android_transport_adapter.h
index 9a17beaad4..7a58f43a20 100644
--- a/src/components/transport_manager/include/transport_manager/android/android_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/android/android_transport_adapter.h
@@ -41,20 +41,16 @@
namespace transport_manager {
namespace transport_adapter {
- enum class AndroidTransportType {
- BLE,
- BT
- };
+enum class AndroidTransportType { BLE, BT };
/**
* @brief Transport adapter that use bluetooth low energy transport.
*/
class AndroidTransportAdapter : public TransportAdapterImpl {
public:
-
AndroidTransportAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
- const TransportManagerSettings& settings,
- AndroidTransportType transport_type);
+ const TransportManagerSettings& settings,
+ AndroidTransportType transport_type);
~AndroidTransportAdapter() override;
@@ -65,7 +61,6 @@ class AndroidTransportAdapter : public TransportAdapterImpl {
std::string GetControlReceiverSocketName() const;
protected:
-
DeviceType GetDeviceType() const override;
void Store() const override;
@@ -77,11 +72,10 @@ class AndroidTransportAdapter : public TransportAdapterImpl {
void DisconnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) override;
- private:
- DeviceUID active_device_uid_;
- ApplicationHandle app_handle_;
- AndroidTransportType transport_type_;
-
+ private:
+ DeviceUID active_device_uid_;
+ ApplicationHandle app_handle_;
+ AndroidTransportType transport_type_;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/ipc_receiver.h b/src/components/transport_manager/include/transport_manager/android/ipc_receiver.h
index e9b7b12989..0d9236a547 100644
--- a/src/components/transport_manager/include/transport_manager/android/ipc_receiver.h
+++ b/src/components/transport_manager/include/transport_manager/android/ipc_receiver.h
@@ -6,26 +6,25 @@
namespace transport_manager {
namespace transport_adapter {
-class IpcReceiver
-{
-public:
- virtual ~IpcReceiver() {}
+class IpcReceiver {
+ public:
+ virtual ~IpcReceiver() {}
- /**
+ /**
* @brief Initialize receiver
* @param ipc_name local socket name
*/
- virtual void Init(const std::string& ipc_name) = 0;
+ virtual void Init(const std::string& ipc_name) = 0;
- /**
+ /**
* @brief Run receiving cycle
*/
- virtual void Run() = 0;
+ virtual void Run() = 0;
- /**
+ /**
* @brief Stop receiving
*/
- virtual void Stop() = 0;
+ virtual void Stop() = 0;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/ipc_sender.h b/src/components/transport_manager/include/transport_manager/android/ipc_sender.h
index 876532aa85..07bc3c9849 100644
--- a/src/components/transport_manager/include/transport_manager/android/ipc_sender.h
+++ b/src/components/transport_manager/include/transport_manager/android/ipc_sender.h
@@ -6,34 +6,31 @@
namespace transport_manager {
namespace transport_adapter {
-class IpcSender
-{
-public:
-
- virtual ~IpcSender() {}
-
- /**
- * @brief Initialize sender
- * @param ipc_name local socket name
- */
- virtual void Init(const std::string& ipc_name) = 0;
-
- /**
- * @brief Run sending cycle
- */
- virtual void Run() = 0;
-
- /**
- * @brief Run sending
- */
- virtual void Stop() = 0;
-
- /**
- * @brief Send message
- * @param message message to send
- */
- virtual void Send(::protocol_handler::RawMessagePtr message) = 0;
-
+class IpcSender {
+ public:
+ virtual ~IpcSender() {}
+
+ /**
+ * @brief Initialize sender
+ * @param ipc_name local socket name
+ */
+ virtual void Init(const std::string& ipc_name) = 0;
+
+ /**
+ * @brief Run sending cycle
+ */
+ virtual void Run() = 0;
+
+ /**
+ * @brief Run sending
+ */
+ virtual void Stop() = 0;
+
+ /**
+ * @brief Send message
+ * @param message message to send
+ */
+ virtual void Send(::protocol_handler::RawMessagePtr message) = 0;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/local_socket_receiver.h b/src/components/transport_manager/include/transport_manager/android/local_socket_receiver.h
index 87cb8cb829..d717319987 100644
--- a/src/components/transport_manager/include/transport_manager/android/local_socket_receiver.h
+++ b/src/components/transport_manager/include/transport_manager/android/local_socket_receiver.h
@@ -1,28 +1,29 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_LOCAL_SOCKET_RECEIVER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_LOCAL_SOCKET_RECEIVER_H_
+#include <atomic>
+#include <functional>
#include "transport_manager/android/ipc_receiver.h"
namespace transport_manager {
namespace transport_adapter {
-class LocalSocketReceiver: public IpcReceiver
-{
-public:
- using MessageDelegate = std::function<void(const std::vector<uint8_t>&)>;
+class LocalSocketReceiver : public IpcReceiver {
+ public:
+ using MessageDelegate = std::function<void(const std::vector<uint8_t>&)>;
- LocalSocketReceiver(MessageDelegate&& callback);
- ~LocalSocketReceiver();
- void Init(const std::string& socket_name) override;
- void Run() override;
- void Stop() override;
+ LocalSocketReceiver(MessageDelegate&& callback);
+ ~LocalSocketReceiver();
+ void Init(const std::string& socket_name) override;
+ void Run() override;
+ void Stop() override;
-private:
- int server_sock_;
- int client_sock_;
- bool connected_;
- std::atomic_bool stop_requested_;
- MessageDelegate callback_;
+ private:
+ int server_sock_;
+ int client_sock_;
+ bool connected_;
+ std::atomic_bool stop_requested_;
+ MessageDelegate callback_;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/android/local_socket_sender.h b/src/components/transport_manager/include/transport_manager/android/local_socket_sender.h
index 2765cbbac1..bd3d5ee628 100644
--- a/src/components/transport_manager/include/transport_manager/android/local_socket_sender.h
+++ b/src/components/transport_manager/include/transport_manager/android/local_socket_sender.h
@@ -4,38 +4,40 @@
#include <sys/socket.h>
#include <sys/un.h>
-#include "protocol/raw_message.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include <utils/threads/message_loop_thread.h>
+#include "protocol/raw_message.h"
#include "transport_manager/android/ipc_sender.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
namespace transport_manager {
namespace transport_adapter {
-typedef threads::MessageQueue<protocol_handler::RawMessagePtr> RawMessageLoopQueue;
+typedef threads::MessageQueue<protocol_handler::RawMessagePtr>
+ RawMessageLoopQueue;
-class LocalSocketSender: public IpcSender
-{
-public:
- using OnDataSentCallback = std::function<void(protocol_handler::RawMessagePtr)>;
- using OnConnectedCallback = std::function<void(const bool)>;
+class LocalSocketSender : public IpcSender {
+ public:
+ using OnDataSentCallback =
+ std::function<void(protocol_handler::RawMessagePtr)>;
+ using OnConnectedCallback = std::function<void(const bool)>;
- LocalSocketSender(OnDataSentCallback&& sent_callback, OnConnectedCallback&& connected_callback);
- ~LocalSocketSender();
+ LocalSocketSender(OnDataSentCallback&& sent_callback,
+ OnConnectedCallback&& connected_callback);
+ ~LocalSocketSender();
- void Init(const std::string& socket_name) override;
- void Run() override;
- void Stop() override;
- void Send(::protocol_handler::RawMessagePtr message) override;
+ void Init(const std::string& socket_name) override;
+ void Run() override;
+ void Stop() override;
+ void Send(::protocol_handler::RawMessagePtr message) override;
-private:
- int socket_id_;
- bool connected_;
- RawMessageLoopQueue message_queue_;
- OnConnectedCallback connected_callback_;
- OnDataSentCallback sent_callback_;
+ private:
+ int socket_id_;
+ bool connected_;
+ RawMessageLoopQueue message_queue_;
+ OnConnectedCallback connected_callback_;
+ OnDataSentCallback sent_callback_;
- bool TryToConnect(sockaddr_un &addr, socklen_t len);
+ bool TryToConnect(sockaddr_un& addr, socklen_t len);
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
index 768d9ebb54..9bfe05758f 100644
--- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
+++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
@@ -171,16 +171,16 @@ class BluetoothDeviceScanner : public DeviceScanner {
TransportAdapterController* controller_;
threads::Thread* thread_;
- bool shutdown_requested_;
+ std::atomic<bool> shutdown_requested_;
bool ready_;
bool device_scan_requested_;
sync_primitives::Lock device_scan_requested_lock_;
+ sync_primitives::Lock terminate_lock_;
sync_primitives::ConditionalVariable device_scan_requested_cv_;
std::vector<bdaddr_t> paired_devices_;
DeviceVector paired_devices_with_sdl_;
- DeviceVector found_devices_with_sdl_;
/**
* @brief UUID of SmartDeviceLink service.
diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
index 5429f50f7f..6e36877e2d 100644
--- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
@@ -52,10 +52,6 @@ class BluetoothTransportAdapter : public TransportAdapterImpl {
BluetoothTransportAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- BluetoothTransportAdapter(resumption::LastState&,
- const TransportManagerSettings& settings);
-
protected:
/**
* @brief Return type of device.
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
index 76c8ca73cd..0465effa94 100644
--- 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
@@ -183,7 +183,6 @@ class WebsocketClientConnection
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_;
diff --git a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
index 3dabfb39ca..4525f6b5d9 100644
--- a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
@@ -63,11 +63,6 @@ class IAP2BluetoothEmulationTransportAdapter : public TcpTransportAdapter {
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- IAP2BluetoothEmulationTransportAdapter(
- const uint16_t port,
- resumption::LastState& last_state_wrapper,
- const TransportManagerSettings& settings);
/**
* @brief DeviceSwitched is called during switching from iAP2 Bluetooth to
* iAP2 USB transport.
@@ -113,12 +108,6 @@ class IAP2USBEmulationTransportAdapter : public TcpTransportAdapter {
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- IAP2USBEmulationTransportAdapter(const uint16_t port,
- resumption::LastState&,
- const TransportManagerSettings& settings) =
- delete;
-
/**
* Destructor
*/
diff --git a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/LocalArray.h b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/LocalArray.h
index c9443e6c21..4b6af59d12 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/LocalArray.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/LocalArray.h
@@ -27,40 +27,49 @@
*/
template <size_t STACK_BYTE_COUNT>
class LocalArray {
-public:
- /**
- * Allocates a new fixed-size array of the given size. If this size is
- * less than or equal to the template parameter STACK_BYTE_COUNT, an
- * internal on-stack buffer will be used. Otherwise a heap buffer will
- * be allocated.
- */
- LocalArray(size_t desiredByteCount) : mSize(desiredByteCount) {
- if (desiredByteCount > STACK_BYTE_COUNT) {
- mPtr = new char[mSize];
- } else {
- mPtr = &mOnStackBuffer[0];
- }
+ public:
+ /**
+ * Allocates a new fixed-size array of the given size. If this size is
+ * less than or equal to the template parameter STACK_BYTE_COUNT, an
+ * internal on-stack buffer will be used. Otherwise a heap buffer will
+ * be allocated.
+ */
+ LocalArray(size_t desiredByteCount) : mSize(desiredByteCount) {
+ if (desiredByteCount > STACK_BYTE_COUNT) {
+ mPtr = new char[mSize];
+ } else {
+ mPtr = &mOnStackBuffer[0];
}
- /**
- * Frees the heap-allocated buffer, if there was one.
- */
- ~LocalArray() {
- if (mPtr != &mOnStackBuffer[0]) {
- delete[] mPtr;
- }
+ }
+ /**
+ * Frees the heap-allocated buffer, if there was one.
+ */
+ ~LocalArray() {
+ if (mPtr != &mOnStackBuffer[0]) {
+ delete[] mPtr;
}
- // Capacity.
- size_t size() { return mSize; }
- bool empty() { return mSize == 0; }
- // Element access.
- char& operator[](size_t n) { return mPtr[n]; }
- const char& operator[](size_t n) const { return mPtr[n]; }
-private:
- char mOnStackBuffer[STACK_BYTE_COUNT];
- char* mPtr;
- size_t mSize;
- // Disallow copy and assignment.
- LocalArray(const LocalArray&);
- void operator=(const LocalArray&);
+ }
+ // Capacity.
+ size_t size() {
+ return mSize;
+ }
+ bool empty() {
+ return mSize == 0;
+ }
+ // Element access.
+ char& operator[](size_t n) {
+ return mPtr[n];
+ }
+ const char& operator[](size_t n) const {
+ return mPtr[n];
+ }
+
+ private:
+ char mOnStackBuffer[STACK_BYTE_COUNT];
+ char* mPtr;
+ size_t mSize;
+ // Disallow copy and assignment.
+ LocalArray(const LocalArray&);
+ void operator=(const LocalArray&);
};
-#endif // LOCAL_ARRAY_H_included \ No newline at end of file
+#endif // LOCAL_ARRAY_H_included \ No newline at end of file
diff --git a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ScopedFd.h b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ScopedFd.h
index 1096e936b0..d2b842df1f 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ScopedFd.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ScopedFd.h
@@ -20,19 +20,19 @@
// Use this when the fd is incidental to the purpose of your function,
// but needs to be cleaned up on exit.
class ScopedFd {
-public:
- explicit ScopedFd(int fd) : fd(fd) {
- }
- ~ScopedFd() {
- close(fd);
- }
- int get() const {
- return fd;
- }
-private:
- int fd;
- // Disallow copy and assignment.
- ScopedFd(const ScopedFd&);
- void operator=(const ScopedFd&);
+ public:
+ explicit ScopedFd(int fd) : fd(fd) {}
+ ~ScopedFd() {
+ close(fd);
+ }
+ int get() const {
+ return fd;
+ }
+
+ private:
+ int fd;
+ // Disallow copy and assignment.
+ ScopedFd(const ScopedFd&);
+ void operator=(const ScopedFd&);
};
#endif // SCOPED_FD_H_included \ No newline at end of file
diff --git a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ifaddrs-android.h b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ifaddrs-android.h
index 157beee2c6..068af87951 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ifaddrs-android.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/ifaddrs_android/ifaddrs-android.h
@@ -17,17 +17,17 @@
#ifndef IFADDRS_ANDROID_H_included
#define IFADDRS_ANDROID_H_included
#include <arpa/inet.h>
-#include <cstring>
#include <errno.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <new>
+#include <stdio.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/socket.h>
-#include <stdio.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
+#include <sys/types.h>
+#include <cstring>
+#include <new>
#include "LocalArray.h"
#include "ScopedFd.h"
// Android (bionic) doesn't have getifaddrs(3)/freeifaddrs(3).
@@ -35,169 +35,172 @@
// with all the non-portable code being in this file.
// Source-compatible subset of the BSD struct.
struct ifaddrs {
- // Pointer to next struct in list, or NULL at end.
- ifaddrs* ifa_next;
- // Interface name.
- char* ifa_name;
- // Interface flags.
- unsigned int ifa_flags;
- // Interface network address.
- sockaddr* ifa_addr;
- // Interface netmask.
- sockaddr* ifa_netmask;
- ifaddrs(ifaddrs* next)
- : ifa_next(next), ifa_name(NULL), ifa_flags(0), ifa_addr(NULL), ifa_netmask(NULL)
- {
- }
- ~ifaddrs() {
- delete ifa_next;
- delete[] ifa_name;
- delete ifa_addr;
- delete ifa_netmask;
+ // Pointer to next struct in list, or NULL at end.
+ ifaddrs* ifa_next;
+ // Interface name.
+ char* ifa_name;
+ // Interface flags.
+ unsigned int ifa_flags;
+ // Interface network address.
+ sockaddr* ifa_addr;
+ // Interface netmask.
+ sockaddr* ifa_netmask;
+ ifaddrs(ifaddrs* next)
+ : ifa_next(next)
+ , ifa_name(NULL)
+ , ifa_flags(0)
+ , ifa_addr(NULL)
+ , ifa_netmask(NULL) {}
+ ~ifaddrs() {
+ delete ifa_next;
+ delete[] ifa_name;
+ delete ifa_addr;
+ delete ifa_netmask;
+ }
+ // Sadly, we can't keep the interface index for portability with BSD.
+ // We'll have to keep the name instead, and re-query the index when
+ // we need it later.
+ bool setNameAndFlagsByIndex(int interfaceIndex) {
+ // Get the name.
+ char buf[IFNAMSIZ];
+ char* name = if_indextoname(interfaceIndex, buf);
+ if (name == NULL) {
+ return false;
}
- // Sadly, we can't keep the interface index for portability with BSD.
- // We'll have to keep the name instead, and re-query the index when
- // we need it later.
- bool setNameAndFlagsByIndex(int interfaceIndex) {
- // Get the name.
- char buf[IFNAMSIZ];
- char* name = if_indextoname(interfaceIndex, buf);
- if (name == NULL) {
- return false;
- }
- ifa_name = new char[strlen(name) + 1];
- strcpy(ifa_name, name);
- // Get the flags.
- ScopedFd fd(socket(AF_INET, SOCK_DGRAM, 0));
- if (fd.get() == -1) {
- return false;
- }
- ifreq ifr;
- memset(&ifr, 0, sizeof(ifr));
- strcpy(ifr.ifr_name, name);
- int rc = ioctl(fd.get(), SIOCGIFFLAGS, &ifr);
- if (rc == -1) {
- return false;
- }
- ifa_flags = ifr.ifr_flags;
- return true;
+ ifa_name = new char[strlen(name) + 1];
+ strcpy(ifa_name, name);
+ // Get the flags.
+ ScopedFd fd(socket(AF_INET, SOCK_DGRAM, 0));
+ if (fd.get() == -1) {
+ return false;
}
- // Netlink gives us the address family in the header, and the
- // sockaddr_in or sockaddr_in6 bytes as the payload. We need to
- // stitch the two bits together into the sockaddr that's part of
- // our portable interface.
- void setAddress(int family, void* data, size_t byteCount) {
- // Set the address proper...
- sockaddr_storage* ss = new sockaddr_storage;
- memset(ss, 0, sizeof(*ss));
- ifa_addr = reinterpret_cast<sockaddr*>(ss);
- ss->ss_family = family;
- uint8_t* dst = sockaddrBytes(family, ss);
- memcpy(dst, data, byteCount);
+ ifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
+ strcpy(ifr.ifr_name, name);
+ int rc = ioctl(fd.get(), SIOCGIFFLAGS, &ifr);
+ if (rc == -1) {
+ return false;
}
- // Netlink gives us the prefix length as a bit count. We need to turn
- // that into a BSD-compatible netmask represented by a sockaddr*.
- void setNetmask(int family, size_t prefixLength) {
- // ...and work out the netmask from the prefix length.
- sockaddr_storage* ss = new sockaddr_storage;
- memset(ss, 0, sizeof(*ss));
- ifa_netmask = reinterpret_cast<sockaddr*>(ss);
- ss->ss_family = family;
- uint8_t* dst = sockaddrBytes(family, ss);
- memset(dst, 0xff, prefixLength / 8);
- if ((prefixLength % 8) != 0) {
- dst[prefixLength/8] = (0xff << (8 - (prefixLength % 8)));
- }
+ ifa_flags = ifr.ifr_flags;
+ return true;
+ }
+ // Netlink gives us the address family in the header, and the
+ // sockaddr_in or sockaddr_in6 bytes as the payload. We need to
+ // stitch the two bits together into the sockaddr that's part of
+ // our portable interface.
+ void setAddress(int family, void* data, size_t byteCount) {
+ // Set the address proper...
+ sockaddr_storage* ss = new sockaddr_storage;
+ memset(ss, 0, sizeof(*ss));
+ ifa_addr = reinterpret_cast<sockaddr*>(ss);
+ ss->ss_family = family;
+ uint8_t* dst = sockaddrBytes(family, ss);
+ memcpy(dst, data, byteCount);
+ }
+ // Netlink gives us the prefix length as a bit count. We need to turn
+ // that into a BSD-compatible netmask represented by a sockaddr*.
+ void setNetmask(int family, size_t prefixLength) {
+ // ...and work out the netmask from the prefix length.
+ sockaddr_storage* ss = new sockaddr_storage;
+ memset(ss, 0, sizeof(*ss));
+ ifa_netmask = reinterpret_cast<sockaddr*>(ss);
+ ss->ss_family = family;
+ uint8_t* dst = sockaddrBytes(family, ss);
+ memset(dst, 0xff, prefixLength / 8);
+ if ((prefixLength % 8) != 0) {
+ dst[prefixLength / 8] = (0xff << (8 - (prefixLength % 8)));
}
- // Returns a pointer to the first byte in the address data (which is
- // stored in network byte order).
- uint8_t* sockaddrBytes(int family, sockaddr_storage* ss) {
- if (family == AF_INET) {
- sockaddr_in* ss4 = reinterpret_cast<sockaddr_in*>(ss);
- return reinterpret_cast<uint8_t*>(&ss4->sin_addr);
- } else if (family == AF_INET6) {
- sockaddr_in6* ss6 = reinterpret_cast<sockaddr_in6*>(ss);
- return reinterpret_cast<uint8_t*>(&ss6->sin6_addr);
- }
- return NULL;
+ }
+ // Returns a pointer to the first byte in the address data (which is
+ // stored in network byte order).
+ uint8_t* sockaddrBytes(int family, sockaddr_storage* ss) {
+ if (family == AF_INET) {
+ sockaddr_in* ss4 = reinterpret_cast<sockaddr_in*>(ss);
+ return reinterpret_cast<uint8_t*>(&ss4->sin_addr);
+ } else if (family == AF_INET6) {
+ sockaddr_in6* ss6 = reinterpret_cast<sockaddr_in6*>(ss);
+ return reinterpret_cast<uint8_t*>(&ss6->sin6_addr);
}
-private:
- // Disallow copy and assignment.
- ifaddrs(const ifaddrs&);
- void operator=(const ifaddrs&);
+ return NULL;
+ }
+
+ private:
+ // Disallow copy and assignment.
+ ifaddrs(const ifaddrs&);
+ void operator=(const ifaddrs&);
};
// FIXME: use iovec instead.
struct addrReq_struct {
- nlmsghdr netlinkHeader;
- ifaddrmsg msg;
+ nlmsghdr netlinkHeader;
+ ifaddrmsg msg;
};
inline bool sendNetlinkMessage(int fd, const void* data, size_t byteCount) {
- ssize_t sentByteCount = TEMP_FAILURE_RETRY(send(fd, data, byteCount, 0));
- return (sentByteCount == static_cast<ssize_t>(byteCount));
+ ssize_t sentByteCount = TEMP_FAILURE_RETRY(send(fd, data, byteCount, 0));
+ return (sentByteCount == static_cast<ssize_t>(byteCount));
}
inline ssize_t recvNetlinkMessage(int fd, char* buf, size_t byteCount) {
- return TEMP_FAILURE_RETRY(recv(fd, buf, byteCount, 0));
+ return TEMP_FAILURE_RETRY(recv(fd, buf, byteCount, 0));
}
// Source-compatible with the BSD function.
inline int getifaddrs(ifaddrs** result) {
- // Simplify cleanup for callers.
- *result = NULL;
- // Create a netlink socket.
- ScopedFd fd(socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE));
- if (fd.get() < 0) {
- return -1;
- }
- // Ask for the address information.
- addrReq_struct addrRequest;
- memset(&addrRequest, 0, sizeof(addrRequest));
- addrRequest.netlinkHeader.nlmsg_flags = NLM_F_REQUEST | NLM_F_MATCH;
- addrRequest.netlinkHeader.nlmsg_type = RTM_GETADDR;
- addrRequest.netlinkHeader.nlmsg_len = NLMSG_ALIGN(NLMSG_LENGTH(sizeof(addrRequest)));
- addrRequest.msg.ifa_family = AF_UNSPEC; // All families.
- addrRequest.msg.ifa_index = 0; // All interfaces.
- if (!sendNetlinkMessage(fd.get(), &addrRequest, addrRequest.netlinkHeader.nlmsg_len)) {
- return -1;
- }
- // Read the responses.
- LocalArray<0> buf(65536); // We don't necessarily have std::vector.
- ssize_t bytesRead;
- while ((bytesRead = recvNetlinkMessage(fd.get(), &buf[0], buf.size())) > 0) {
- nlmsghdr* hdr = reinterpret_cast<nlmsghdr*>(&buf[0]);
- for (; NLMSG_OK(hdr, (size_t)bytesRead); hdr = NLMSG_NEXT(hdr, bytesRead)) {
- switch (hdr->nlmsg_type) {
- case NLMSG_DONE:
- return 0;
- case NLMSG_ERROR:
- return -1;
- case RTM_NEWADDR:
- {
- ifaddrmsg* address = reinterpret_cast<ifaddrmsg*>(NLMSG_DATA(hdr));
- rtattr* rta = IFA_RTA(address);
- size_t ifaPayloadLength = IFA_PAYLOAD(hdr);
- while (RTA_OK(rta, ifaPayloadLength)) {
- if (rta->rta_type == IFA_LOCAL) {
- int family = address->ifa_family;
- if (family == AF_INET || family == AF_INET6) {
- *result = new ifaddrs(*result);
- if (!(*result)->setNameAndFlagsByIndex(address->ifa_index)) {
- return -1;
- }
- (*result)->setAddress(family, RTA_DATA(rta), RTA_PAYLOAD(rta));
- (*result)->setNetmask(family, address->ifa_prefixlen);
- }
- }
- rta = RTA_NEXT(rta, ifaPayloadLength);
- }
+ // Simplify cleanup for callers.
+ *result = NULL;
+ // Create a netlink socket.
+ ScopedFd fd(socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE));
+ if (fd.get() < 0) {
+ return -1;
+ }
+ // Ask for the address information.
+ addrReq_struct addrRequest;
+ memset(&addrRequest, 0, sizeof(addrRequest));
+ addrRequest.netlinkHeader.nlmsg_flags = NLM_F_REQUEST | NLM_F_MATCH;
+ addrRequest.netlinkHeader.nlmsg_type = RTM_GETADDR;
+ addrRequest.netlinkHeader.nlmsg_len =
+ NLMSG_ALIGN(NLMSG_LENGTH(sizeof(addrRequest)));
+ addrRequest.msg.ifa_family = AF_UNSPEC; // All families.
+ addrRequest.msg.ifa_index = 0; // All interfaces.
+ if (!sendNetlinkMessage(
+ fd.get(), &addrRequest, addrRequest.netlinkHeader.nlmsg_len)) {
+ return -1;
+ }
+ // Read the responses.
+ LocalArray<0> buf(65536); // We don't necessarily have std::vector.
+ ssize_t bytesRead;
+ while ((bytesRead = recvNetlinkMessage(fd.get(), &buf[0], buf.size())) > 0) {
+ nlmsghdr* hdr = reinterpret_cast<nlmsghdr*>(&buf[0]);
+ for (; NLMSG_OK(hdr, (size_t)bytesRead); hdr = NLMSG_NEXT(hdr, bytesRead)) {
+ switch (hdr->nlmsg_type) {
+ case NLMSG_DONE:
+ return 0;
+ case NLMSG_ERROR:
+ return -1;
+ case RTM_NEWADDR: {
+ ifaddrmsg* address = reinterpret_cast<ifaddrmsg*>(NLMSG_DATA(hdr));
+ rtattr* rta = IFA_RTA(address);
+ size_t ifaPayloadLength = IFA_PAYLOAD(hdr);
+ while (RTA_OK(rta, ifaPayloadLength)) {
+ if (rta->rta_type == IFA_LOCAL) {
+ int family = address->ifa_family;
+ if (family == AF_INET || family == AF_INET6) {
+ *result = new ifaddrs(*result);
+ if (!(*result)->setNameAndFlagsByIndex(address->ifa_index)) {
+ return -1;
}
- break;
+ (*result)->setAddress(family, RTA_DATA(rta), RTA_PAYLOAD(rta));
+ (*result)->setNetmask(family, address->ifa_prefixlen);
+ }
}
- }
+ rta = RTA_NEXT(rta, ifaPayloadLength);
+ }
+ } break;
+ }
}
- // We only get here if recv fails before we see a NLMSG_DONE.
- return -1;
+ }
+ // We only get here if recv fails before we see a NLMSG_DONE.
+ return -1;
}
// Source-compatible with the BSD function.
inline void freeifaddrs(ifaddrs* addresses) {
- delete addresses;
+ delete addresses;
}
#endif // IFADDRS_ANDROID_H_included \ No newline at end of file
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
index c5948062c9..1cd5c1cb7b 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
@@ -53,11 +53,6 @@ class TcpTransportAdapter : public TransportAdapterImpl {
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- TcpTransportAdapter(uint16_t port,
- resumption::LastState&,
- const TransportManagerSettings& settings) = delete;
-
/**
* @brief Destructor.
*/
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 cfc886cb15..58dd4b16db 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
@@ -85,13 +85,6 @@ class TransportAdapterImpl : public TransportAdapter,
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- TransportAdapterImpl(DeviceScanner* device_scanner,
- ServerConnectionFactory* server_connection_factory,
- ClientConnectionListener* client_connection_listener,
- resumption::LastState& last_state,
- const TransportManagerSettings& settings) = delete;
-
/**
* @brief Destructor.
**/
@@ -677,10 +670,6 @@ class TransportAdapterImpl : public TransportAdapter,
TMTelemetryObserver* metric_observer_;
#endif // TELEMETRY_MONITOR
- resumption::LastState& last_state() const {
- return last_state_wrapper_->get_accessor().GetMutableData();
- }
-
/**
* @brief Pointer to the device scanner.
*/
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_default.h b/src/components/transport_manager/include/transport_manager/transport_manager_default.h
index 58b59409f6..792f4525a2 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_default.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_default.h
@@ -90,9 +90,6 @@ class TransportManagerDefault : public TransportManagerImpl {
*/
int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
- DEPRECATED
- int Init(resumption::LastState& last_state) OVERRIDE;
-
/**
* @brief Destructor.
*/
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 85d96bac55..b45d7cc379 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
@@ -126,9 +126,6 @@ class TransportManagerImpl
*/
int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
- DEPRECATED
- int Init(resumption::LastState& last_state) OVERRIDE;
-
/**
* Reinitializes transport manager
* @return Error code
diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
index 45c6d4c0e4..12516e769e 100644
--- a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
@@ -47,10 +47,6 @@ class UsbAoaAdapter : public TransportAdapterImpl {
UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
- DEPRECATED
- UsbAoaAdapter(resumption::LastState&,
- const TransportManagerSettings& settings) = delete;
-
virtual ~UsbAoaAdapter();
protected:
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h
index 10c6e54424..84235eefa4 100644
--- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h
@@ -38,8 +38,10 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_DEVICE_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_DEVICE_H_
+#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/websocket.hpp>
#include <string>
+
#include "transport_manager/transport_adapter/device.h"
namespace transport_manager {
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
index f1be1a3b54..009d2fe07c 100644
--- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
@@ -32,7 +32,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SESSION_H_
#include <boost/asio/bind_executor.hpp>
-#include <boost/asio/strand.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <functional>
@@ -99,7 +98,6 @@ class WebSocketSession
protected:
tcp::socket socket_;
websocket::stream<ExecutorType> ws_;
- boost::asio::strand<boost::asio::io_context::executor_type> strand_;
boost::beast::flat_buffer buffer_;
DataReceiveCallback data_receive_;
DataSendDoneCallback data_send_done_;
diff --git a/src/components/transport_manager/src/android/android_connection_factory.cc b/src/components/transport_manager/src/android/android_connection_factory.cc
index 4e68a5e7ad..e53205a82c 100644
--- a/src/components/transport_manager/src/android/android_connection_factory.cc
+++ b/src/components/transport_manager/src/android/android_connection_factory.cc
@@ -60,7 +60,8 @@ TransportAdapter::Error AndroidConnectionFactory::CreateConnection(
controller_->ConnectionCreated(connection, device_uid, app_handle);
TransportAdapter::Error error = connection->Start();
if (TransportAdapter::OK != error) {
- SDL_LOG_ERROR("Android Ipc connection::Start() failed with error: " << error);
+ SDL_LOG_ERROR(
+ "Android Ipc connection::Start() failed with error: " << error);
}
return error;
}
diff --git a/src/components/transport_manager/src/android/android_device_scanner.cc b/src/components/transport_manager/src/android/android_device_scanner.cc
index 860337c2f2..6afe0b65e9 100644
--- a/src/components/transport_manager/src/android/android_device_scanner.cc
+++ b/src/components/transport_manager/src/android/android_device_scanner.cc
@@ -43,9 +43,9 @@
#include <sstream>
#include <vector>
+#include "transport_manager/android/android_ipc_control_protocol.h"
#include "transport_manager/android/android_ipc_device.h"
#include "transport_manager/android/android_transport_adapter.h"
-#include "transport_manager/android/android_ipc_control_protocol.h"
#include "utils/logger.h"
@@ -58,12 +58,15 @@ AndroidDeviceScanner::AndroidDeviceScanner(
TransportAdapterController* controller)
: controller_(controller)
, ipc_control_receiver_(new LocalSocketReceiver(
- std::bind(&AndroidDeviceScanner::ProcessMessage, this, std::placeholders::_1))) {
-
+ std::bind(&AndroidDeviceScanner::ProcessMessage,
+ this,
+ std::placeholders::_1))) {
ipc_control_receiver_thread_ = std::thread([&]() {
- ipc_control_receiver_->Init(static_cast<AndroidTransportAdapter*>(controller_)->GetControlReceiverSocketName());
+ ipc_control_receiver_->Init(
+ static_cast<AndroidTransportAdapter*>(controller_)
+ ->GetControlReceiverSocketName());
ipc_control_receiver_->Run();
- });
+ });
}
AndroidDeviceScanner::~AndroidDeviceScanner() {
@@ -82,7 +85,7 @@ void AndroidDeviceScanner::UpdateTotalDeviceList() {
void AndroidDeviceScanner::Terminate() {
SDL_LOG_AUTO_TRACE();
ipc_control_receiver_->Stop();
- if(ipc_control_receiver_thread_.joinable()) {
+ if (ipc_control_receiver_thread_.joinable()) {
ipc_control_receiver_thread_.join();
}
}
@@ -92,7 +95,8 @@ TransportAdapter::Error AndroidDeviceScanner::Init() {
}
TransportAdapter::Error AndroidDeviceScanner::Scan() {
- return ipc_control_receiver_thread_.joinable() ? TransportAdapter::OK : TransportAdapter::FAIL;
+ return ipc_control_receiver_thread_.joinable() ? TransportAdapter::OK
+ : TransportAdapter::FAIL;
}
bool AndroidDeviceScanner::IsInitialised() const {
@@ -105,39 +109,37 @@ void AndroidDeviceScanner::ProcessMessage(const std::vector<uint8_t>& data) {
const auto action = AndroidIpcControlProtocol::GetMessageActionType(data);
- switch(action){
- case AndroidIpcProtocolActions::ON_DEVICE_CONNECTED:
- {
+ switch (action) {
+ case AndroidIpcProtocolActions::ON_DEVICE_CONNECTED: {
DeviceSptr device_ptr(new AndroidIpcDevice(
- AndroidIpcControlProtocol::GetAddress(data),
- AndroidIpcControlProtocol::GetName(data).c_str() ));
+ AndroidIpcControlProtocol::GetAddress(data),
+ AndroidIpcControlProtocol::GetName(data).c_str()));
found_devices_with_sdl_.push_back(device_ptr);
UpdateTotalDeviceList();
- }
- break;
+ } break;
- case AndroidIpcProtocolActions::ON_DEVICE_DISCONNECTED:
- {
+ case AndroidIpcProtocolActions::ON_DEVICE_DISCONNECTED: {
const auto addr = AndroidIpcControlProtocol::GetAddress(data);
- auto it_device = std::find_if(found_devices_with_sdl_.begin(),
- found_devices_with_sdl_.end(), [&addr](DeviceSptr d){
- AndroidIpcDevice tDevice(addr, "");
- return d->IsSameAs(static_cast<Device*>(&tDevice));
- });
+ auto it_device =
+ std::find_if(found_devices_with_sdl_.begin(),
+ found_devices_with_sdl_.end(),
+ [&addr](DeviceSptr d) {
+ AndroidIpcDevice tDevice(addr, "");
+ return d->IsSameAs(static_cast<Device*>(&tDevice));
+ });
if (it_device != found_devices_with_sdl_.end()) {
DeviceSptr device = *it_device;
found_devices_with_sdl_.erase(it_device);
controller_->DisconnectDone(device->unique_device_id(), 0);
}
- }
- break;
+ } break;
default:
SDL_LOG_ERROR("Undefined BLE action " << static_cast<uint32_t>(action));
- break;
+ break;
}
} else {
diff --git a/src/components/transport_manager/src/android/android_ipc_control_protocol.cc b/src/components/transport_manager/src/android/android_ipc_control_protocol.cc
index 2d528a90b5..e7ec6c9d3a 100644
--- a/src/components/transport_manager/src/android/android_ipc_control_protocol.cc
+++ b/src/components/transport_manager/src/android/android_ipc_control_protocol.cc
@@ -1,11 +1,11 @@
#include "transport_manager/android/android_ipc_control_protocol.h"
-#include "utils/logger.h"
-#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
+#include "utils/logger.h"
-#include <map>
#include <algorithm>
+#include <map>
namespace transport_manager {
namespace transport_adapter {
@@ -13,70 +13,77 @@ namespace transport_adapter {
SDL_CREATE_LOG_VARIABLE("TransportManager")
namespace {
- std::map<AndroidIpcProtocolActions, std::string> mapActionNames = {
+std::map<AndroidIpcProtocolActions, std::string> mapActionNames = {
{AndroidIpcProtocolActions::ON_DEVICE_CONNECTED, "ON_DEVICE_CONNECTED"},
- {AndroidIpcProtocolActions::ON_DEVICE_DISCONNECTED, "ON_DEVICE_DISCONNECTED"}};
-
- const char cActionKey[] = "action";
- const char cNameKey[] = "name";
- const char cAddressKey[] = "address";
- const char cParamsKey[] = "params";
-
- Json::Value GetParsedJson(const MsgData& message) {
- utils::JsonReader reader_;
- Json::Value value;
- if (reader_.parse((char*)(message.data()), &value)) {
- return value;
- }
- return Json::Value::null;
- }
-
- std::string GetStrFromJson(const Json::Value& value, const std::string& key) {
- if (value == Json::Value::null) {
- return std::string();
- }
- auto params = value.get(key, Json::Value::null);
- if (params == Json::Value::null) {
- return std::string();
- }
- return params.asString();
- }
+ {AndroidIpcProtocolActions::ON_DEVICE_DISCONNECTED,
+ "ON_DEVICE_DISCONNECTED"}};
+
+const char cActionKey[] = "action";
+const char cNameKey[] = "name";
+const char cAddressKey[] = "address";
+const char cParamsKey[] = "params";
+
+Json::Value GetParsedJson(const MsgData& message) {
+ utils::JsonReader reader_;
+ Json::Value value;
+ if (reader_.parse((char*)(message.data()), &value)) {
+ return value;
+ }
+ return Json::Value::null;
+}
+std::string GetStrFromJson(const Json::Value& value, const std::string& key) {
+ if (value == Json::Value::null) {
+ return std::string();
+ }
+ auto params = value.get(key, Json::Value::null);
+ if (params == Json::Value::null) {
+ return std::string();
+ }
+ return params.asString();
}
-AndroidIpcProtocolActions AndroidIpcControlProtocol::GetMessageActionType(const MsgData& message) {
- const auto json = GetParsedJson(message);
- return GetActionFromString(GetStrFromJson(json, cActionKey));
+} // namespace
+
+AndroidIpcProtocolActions AndroidIpcControlProtocol::GetMessageActionType(
+ const MsgData& message) {
+ const auto json = GetParsedJson(message);
+ return GetActionFromString(GetStrFromJson(json, cActionKey));
}
-AndroidIpcProtocolActions AndroidIpcControlProtocol::GetActionFromString(const std::string& str) {
- AndroidIpcProtocolActions result = AndroidIpcProtocolActions::INVALID_ENUM;
+AndroidIpcProtocolActions AndroidIpcControlProtocol::GetActionFromString(
+ const std::string& str) {
+ AndroidIpcProtocolActions result = AndroidIpcProtocolActions::INVALID_ENUM;
- const auto findResult = std::find_if(mapActionNames.begin(), mapActionNames.end(),
- [&str](const std::pair<AndroidIpcProtocolActions, std::string> &pair) {
- return pair.second == str;});
+ const auto findResult = std::find_if(
+ mapActionNames.begin(),
+ mapActionNames.end(),
+ [&str](const std::pair<AndroidIpcProtocolActions, std::string>& pair) {
+ return pair.second == str;
+ });
- if(findResult != mapActionNames.end()) {
- result = findResult->first;
- }
+ if (findResult != mapActionNames.end()) {
+ result = findResult->first;
+ }
- return result;
+ return result;
}
-std::string AndroidIpcControlProtocol::GetActionString(const AndroidIpcProtocolActions action) {
- auto it = mapActionNames.find(action);
- return it != mapActionNames.end() ? it->second : "UNKNOWN";
+std::string AndroidIpcControlProtocol::GetActionString(
+ const AndroidIpcProtocolActions action) {
+ auto it = mapActionNames.find(action);
+ return it != mapActionNames.end() ? it->second : "UNKNOWN";
}
std::string AndroidIpcControlProtocol::GetAddress(const MsgData& message) {
- const auto json = GetParsedJson(message);
- return GetStrFromJson(json.get(cParamsKey, Json::Value::null), cAddressKey);
+ const auto json = GetParsedJson(message);
+ return GetStrFromJson(json.get(cParamsKey, Json::Value::null), cAddressKey);
}
std::string AndroidIpcControlProtocol::GetName(const MsgData& message) {
- const auto json = GetParsedJson(message);
- return GetStrFromJson(json.get(cParamsKey, Json::Value::null), cNameKey);
+ const auto json = GetParsedJson(message);
+ return GetStrFromJson(json.get(cParamsKey, Json::Value::null), cNameKey);
}
-}
-}
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/android/android_ipc_device.cc b/src/components/transport_manager/src/android/android_ipc_device.cc
index 4edd0dfd7f..26a4b60262 100644
--- a/src/components/transport_manager/src/android/android_ipc_device.cc
+++ b/src/components/transport_manager/src/android/android_ipc_device.cc
@@ -42,34 +42,34 @@ SDL_CREATE_LOG_VARIABLE("TransportManager")
const ApplicationHandle kDefaultAppHandle = 1u;
- /**
- * @brief Constructor.
- *
- * @param device_address Bluetooth address.
- * @param device_name Human-readable device name.
- **/
- AndroidIpcDevice::AndroidIpcDevice(const std::string& device_address,
- const char* device_name)
+/**
+ * @brief Constructor.
+ *
+ * @param device_address Bluetooth address.
+ * @param device_name Human-readable device name.
+ **/
+AndroidIpcDevice::AndroidIpcDevice(const std::string& device_address,
+ const char* device_name)
: Device(device_name, device_address)
, address_(device_address)
- , applications_list_({kDefaultAppHandle}) { }
+ , applications_list_({kDefaultAppHandle}) {}
- bool AndroidIpcDevice::IsSameAs(const Device* other) const {
- SDL_LOG_AUTO_TRACE();
- const AndroidIpcDevice* other_bluetooth_device =
+bool AndroidIpcDevice::IsSameAs(const Device* other) const {
+ SDL_LOG_AUTO_TRACE();
+ const AndroidIpcDevice* other_bluetooth_device =
dynamic_cast<const AndroidIpcDevice*>(other);
- if(other_bluetooth_device) {
- return other_bluetooth_device->address_ == address_;
- }
-
- SDL_LOG_TRACE("Compare with no Android Ipc device !");
-
- return false;
+ if (other_bluetooth_device) {
+ return other_bluetooth_device->address_ == address_;
}
- ApplicationList AndroidIpcDevice::GetApplicationList() const {
- return applications_list_;
- }
+ SDL_LOG_TRACE("Compare with no Android Ipc device !");
+ return false;
}
+
+ApplicationList AndroidIpcDevice::GetApplicationList() const {
+ return applications_list_;
}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/android/android_socket_connection.cc b/src/components/transport_manager/src/android/android_socket_connection.cc
index 8915c26079..b6810b5f6f 100644
--- a/src/components/transport_manager/src/android/android_socket_connection.cc
+++ b/src/components/transport_manager/src/android/android_socket_connection.cc
@@ -34,8 +34,8 @@
#include "transport_manager/android/android_socket_connection.h"
#include "transport_manager/android/android_ipc_device.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/android/android_transport_adapter.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "utils/logger.h"
@@ -51,80 +51,90 @@ AndroidSocketConnection::AndroidSocketConnection(
, device_uid_(device_uid)
, app_handle_(app_handle)
, controller_(controller)
- , sender_(new LocalSocketSender(std::bind(&AndroidSocketConnection::OnMessageSent, this, std::placeholders::_1),
- std::bind(&AndroidSocketConnection::OnClientConnectionDone, this, std::placeholders::_1)))
+ , sender_(new LocalSocketSender(
+ std::bind(&AndroidSocketConnection::OnMessageSent,
+ this,
+ std::placeholders::_1),
+ std::bind(&AndroidSocketConnection::OnClientConnectionDone,
+ this,
+ std::placeholders::_1)))
, receiver_(new LocalSocketReceiver(
- std::bind(&AndroidSocketConnection::ProcessMessage, this, std::placeholders::_1)))
- {}
+ std::bind(&AndroidSocketConnection::ProcessMessage,
+ this,
+ std::placeholders::_1))) {}
AndroidSocketConnection::~AndroidSocketConnection() {}
void AndroidSocketConnection::ProcessMessage(const std::vector<uint8_t>& data) {
- if (data.size() > 0) {
- SDL_LOG_DEBUG("Received " << data.size() << " bytes from Java adapter");
- ::protocol_handler::RawMessagePtr frame(
- new protocol_handler::RawMessage(0, 0, data.data(), data.size(), false));
- controller_->DataReceiveDone(device_uid_, app_handle_, frame);
- } else {
- controller_->DataReceiveFailed(device_uid_, app_handle_, DataReceiveError());
- }
+ if (data.size() > 0) {
+ SDL_LOG_DEBUG("Received " << data.size() << " bytes from Java adapter");
+ ::protocol_handler::RawMessagePtr frame(new protocol_handler::RawMessage(
+ 0, 0, data.data(), data.size(), false));
+ controller_->DataReceiveDone(device_uid_, app_handle_, frame);
+ } else {
+ controller_->DataReceiveFailed(
+ device_uid_, app_handle_, DataReceiveError());
+ }
}
-void AndroidSocketConnection::OnMessageSent(protocol_handler::RawMessagePtr msg) {
- if (msg) {
- SDL_LOG_DEBUG("Successfully sent " << msg->data_size() << " bytes to Java adapter");
- controller_->DataSendDone(device_uid_, app_handle_, msg);
- } else {
- SDL_LOG_ERROR("Failed to send " << msg->data_size() << " bytes to Java adapter");
- controller_->DataSendFailed(device_uid_, app_handle_, msg, DataSendError());
- }
+void AndroidSocketConnection::OnMessageSent(
+ protocol_handler::RawMessagePtr msg) {
+ if (msg) {
+ SDL_LOG_DEBUG("Successfully sent " << msg->data_size()
+ << " bytes to Java adapter");
+ controller_->DataSendDone(device_uid_, app_handle_, msg);
+ } else {
+ SDL_LOG_ERROR("Failed to send " << msg->data_size()
+ << " bytes to Java adapter");
+ controller_->DataSendFailed(device_uid_, app_handle_, msg, DataSendError());
+ }
}
void AndroidSocketConnection::OnClientConnectionDone(const bool is_connected) {
- if (is_connected) {
- SDL_LOG_DEBUG("Successfully connected to Java adapter");
- controller_->ConnectDone(device_uid_, app_handle_);
- } else {
- SDL_LOG_ERROR("Failed to connect to Java adapter");
- controller_->ConnectFailed(device_uid_, app_handle_, ConnectError());
- }
+ if (is_connected) {
+ SDL_LOG_DEBUG("Successfully connected to Java adapter");
+ controller_->ConnectDone(device_uid_, app_handle_);
+ } else {
+ SDL_LOG_ERROR("Failed to connect to Java adapter");
+ controller_->ConnectFailed(device_uid_, app_handle_, ConnectError());
+ }
}
-TransportAdapter::Error
-AndroidSocketConnection::SendData(::protocol_handler::RawMessagePtr message) {
- SDL_LOG_AUTO_TRACE();
- sender_->Send(message);
- return TransportAdapter::OK;
+TransportAdapter::Error AndroidSocketConnection::SendData(
+ ::protocol_handler::RawMessagePtr message) {
+ SDL_LOG_AUTO_TRACE();
+ sender_->Send(message);
+ return TransportAdapter::OK;
}
TransportAdapter::Error AndroidSocketConnection::Disconnect() {
- SDL_LOG_DEBUG("Disconnecting from Java adapter");
- sender_->Stop();
- if (sender_thread_.joinable()) {
- sender_thread_.join();
- }
-
- receiver_->Stop();
- if (receiver_thread_.joinable()) {
- receiver_thread_.join();
- }
-
- return TransportAdapter::OK;
+ SDL_LOG_DEBUG("Disconnecting from Java adapter");
+ sender_->Stop();
+ if (sender_thread_.joinable()) {
+ sender_thread_.join();
+ }
+
+ receiver_->Stop();
+ if (receiver_thread_.joinable()) {
+ receiver_thread_.join();
+ }
+
+ return TransportAdapter::OK;
}
TransportAdapter::Error AndroidSocketConnection::Start() {
- SDL_LOG_DEBUG("Initializing Android IPC connection threads");
-
- receiver_thread_ = std::thread([&]() {
- receiver_->Init(controller_->GetReceiverSocketName());
- receiver_->Run();
- });
- sender_thread_ = std::thread([&]() {
- sender_->Init(controller_->GetSenderSocketName());
- sender_->Run();
- });
-
- return TransportAdapter::OK;
+ SDL_LOG_DEBUG("Initializing Android IPC connection threads");
+
+ receiver_thread_ = std::thread([&]() {
+ receiver_->Init(controller_->GetReceiverSocketName());
+ receiver_->Run();
+ });
+ sender_thread_ = std::thread([&]() {
+ sender_->Init(controller_->GetSenderSocketName());
+ sender_->Run();
+ });
+
+ return TransportAdapter::OK;
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/android/android_transport_adapter.cc b/src/components/transport_manager/src/android/android_transport_adapter.cc
index db8adcc96b..54544f987b 100644
--- a/src/components/transport_manager/src/android/android_transport_adapter.cc
+++ b/src/components/transport_manager/src/android/android_transport_adapter.cc
@@ -41,9 +41,9 @@
#include <iomanip>
#include <set>
-#include "transport_manager/android/android_transport_adapter.h"
-#include "transport_manager/android/android_device_scanner.h"
#include "transport_manager/android/android_connection_factory.h"
+#include "transport_manager/android/android_device_scanner.h"
+#include "transport_manager/android/android_transport_adapter.h"
#include "utils/logger.h"
@@ -53,154 +53,152 @@ namespace transport_adapter {
SDL_CREATE_LOG_VARIABLE("TransportManager")
namespace {
- std::string getTransportName(AndroidTransportType transport_type)
- {
- switch(transport_type) {
- case AndroidTransportType::BLE:
- return "Bluetooth Low Energy";
- break;
-
- case AndroidTransportType::BT:
- return "Bluetooth";
- break;
-
- default:
- SDL_LOG_ERROR("Unknown android transport type");
- break;
- }
-
- return "Unknown";
- }
+std::string getTransportName(AndroidTransportType transport_type) {
+ switch (transport_type) {
+ case AndroidTransportType::BLE:
+ return "Bluetooth Low Energy";
+ break;
+
+ case AndroidTransportType::BT:
+ return "Bluetooth";
+ break;
+
+ default:
+ SDL_LOG_ERROR("Unknown android transport type");
+ break;
+ }
+
+ return "Unknown";
}
+} // namespace
AndroidTransportAdapter::AndroidTransportAdapter(
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings,
AndroidTransportType transport_type)
- : TransportAdapterImpl(
- new AndroidDeviceScanner(this),
- new AndroidConnectionFactory(this),
- NULL,
- last_state_wrapper,
- settings)
+ : TransportAdapterImpl(new AndroidDeviceScanner(this),
+ new AndroidConnectionFactory(this),
+ NULL,
+ last_state_wrapper,
+ settings)
, active_device_uid_()
, app_handle_(0)
, transport_type_(transport_type) {
- SDL_LOG_DEBUG("AndroidTransportAdapter created for transport type : " << getTransportName(transport_type));
- }
+ SDL_LOG_DEBUG("AndroidTransportAdapter created for transport type : "
+ << getTransportName(transport_type));
+}
DeviceType AndroidTransportAdapter::GetDeviceType() const {
- switch(transport_type_)
- {
- case AndroidTransportType::BLE:
- return DeviceType::BLUETOOTH_LE;
- break;
-
- case AndroidTransportType::BT:
- return DeviceType::BLUETOOTH;
- break;
- }
-
- SDL_LOG_ERROR("Unknown android transport type");
- return DeviceType::UNKNOWN;
+ switch (transport_type_) {
+ case AndroidTransportType::BLE:
+ return DeviceType::BLUETOOTH_LE;
+ break;
+
+ case AndroidTransportType::BT:
+ return DeviceType::BLUETOOTH;
+ break;
+ }
+
+ SDL_LOG_ERROR("Unknown android transport type");
+ return DeviceType::UNKNOWN;
}
-void AndroidTransportAdapter::Store() const {
-}
+void AndroidTransportAdapter::Store() const {}
bool AndroidTransportAdapter::Restore() {
return true;
}
-AndroidTransportAdapter::~AndroidTransportAdapter(){
- SDL_LOG_DEBUG("Destroying Android transport adapter");
+AndroidTransportAdapter::~AndroidTransportAdapter() {
+ SDL_LOG_DEBUG("Destroying Android transport adapter");
}
void AndroidTransportAdapter::SearchDeviceDone(const DeviceVector& devices) {
- for (const DeviceSptr& device : devices) {
- if (dynamic_cast<AndroidIpcDevice*>(device.get()) != nullptr) {
- active_device_uid_ = device->unique_device_id();
- SDL_LOG_DEBUG("New active Android Ipc device found: " << active_device_uid_);
-
-
- const auto apps_list = device->GetApplicationList();
- if (!apps_list.empty()) {
- app_handle_ = apps_list.front();
- SDL_LOG_DEBUG("New active Android ipc device app handle: " << app_handle_);
- }
-
- break;
- }
+ for (const DeviceSptr& device : devices) {
+ if (dynamic_cast<AndroidIpcDevice*>(device.get()) != nullptr) {
+ active_device_uid_ = device->unique_device_id();
+ SDL_LOG_DEBUG(
+ "New active Android Ipc device found: " << active_device_uid_);
+
+ const auto apps_list = device->GetApplicationList();
+ if (!apps_list.empty()) {
+ app_handle_ = apps_list.front();
+ SDL_LOG_DEBUG(
+ "New active Android ipc device app handle: " << app_handle_);
+ }
+
+ break;
}
+ }
- TransportAdapterImpl::SearchDeviceDone(devices);
+ TransportAdapterImpl::SearchDeviceDone(devices);
}
-void AndroidTransportAdapter::DisconnectDone(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle) {
- if (active_device_uid_ == device_handle ) {
- const auto disconnect_result =
- TransportAdapterImpl::Disconnect(active_device_uid_, app_handle_);
- if (TransportAdapter::OK == disconnect_result) {
- TransportAdapterImpl::DisconnectDone(active_device_uid_, app_handle_);
- active_device_uid_.clear();
- app_handle_ = 0;
- }
-
- return;
+void AndroidTransportAdapter::DisconnectDone(
+ const DeviceUID& device_handle, const ApplicationHandle& app_handle) {
+ if (active_device_uid_ == device_handle) {
+ const auto disconnect_result =
+ TransportAdapterImpl::Disconnect(active_device_uid_, app_handle_);
+ if (TransportAdapter::OK == disconnect_result) {
+ TransportAdapterImpl::DisconnectDone(active_device_uid_, app_handle_);
+ active_device_uid_.clear();
+ app_handle_ = 0;
}
- TransportAdapterImpl::DisconnectDone(device_handle, app_handle);
+ return;
+ }
+
+ TransportAdapterImpl::DisconnectDone(device_handle, app_handle);
}
bool AndroidTransportAdapter::ToBeAutoConnected(DeviceSptr device) const {
- if (!active_device_uid_.empty()) {
- // Android Ipc device connection is established on the Java side
- return device->unique_device_id() == active_device_uid_;
- }
+ if (!active_device_uid_.empty()) {
+ // Android Ipc device connection is established on the Java side
+ return device->unique_device_id() == active_device_uid_;
+ }
- return false;
+ return false;
}
std::string AndroidTransportAdapter::GetSenderSocketName() const {
- switch(transport_type_) {
- case AndroidTransportType::BLE:
- return "./localBleReader";
- break;
-
- case AndroidTransportType::BT:
- return "./localBtReader";
- break;
- }
+ switch (transport_type_) {
+ case AndroidTransportType::BLE:
+ return "./localBleReader";
+ break;
- return "";
+ case AndroidTransportType::BT:
+ return "./localBtReader";
+ break;
+ }
+
+ return "";
}
-std::string AndroidTransportAdapter::GetReceiverSocketName() const{
- switch(transport_type_) {
- case AndroidTransportType::BLE:
- return "./localBleWriter";
- break;
+std::string AndroidTransportAdapter::GetReceiverSocketName() const {
+ switch (transport_type_) {
+ case AndroidTransportType::BLE:
+ return "./localBleWriter";
+ break;
- case AndroidTransportType::BT:
- return "./localBtWriter";
- break;
- }
+ case AndroidTransportType::BT:
+ return "./localBtWriter";
+ break;
+ }
- return "";
+ return "";
}
-std::string AndroidTransportAdapter::GetControlReceiverSocketName() const{
- switch(transport_type_) {
- case AndroidTransportType::BLE:
- return "./localBleControl";
- break;
-
- case AndroidTransportType::BT:
- return "./localBtControl";
- break;
- }
- return "";
+std::string AndroidTransportAdapter::GetControlReceiverSocketName() const {
+ switch (transport_type_) {
+ case AndroidTransportType::BLE:
+ return "./localBleControl";
+ break;
+
+ case AndroidTransportType::BT:
+ return "./localBtControl";
+ break;
+ }
+ return "";
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/android/local_socket_receiver.cc b/src/components/transport_manager/src/android/local_socket_receiver.cc
index 0ac18b35bc..84fafeda28 100644
--- a/src/components/transport_manager/src/android/local_socket_receiver.cc
+++ b/src/components/transport_manager/src/android/local_socket_receiver.cc
@@ -2,111 +2,110 @@
#include <thread>
#include "utils/logger.h"
+#include <netdb.h>
+#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <sys/un.h>
-#include <netinet/in.h>
-#include <netdb.h>
+#include <unistd.h>
SDL_CREATE_LOG_VARIABLE("Ble_Server")
-namespace{
- const int buffer_size = 131072; // Copied from INI file
- std::vector<uint8_t> buffer(buffer_size);
-}
+namespace {
+const int buffer_size = 131072; // Copied from INI file
+std::vector<uint8_t> buffer(buffer_size);
+} // namespace
namespace transport_manager {
namespace transport_adapter {
-LocalSocketReceiver::LocalSocketReceiver( MessageDelegate&& callback)
- : callback_(callback)
-{}
-
-void LocalSocketReceiver::Init(const std::string& socket_name)
-{
- SDL_LOG_AUTO_TRACE();
- connected_ = false;
- stop_requested_ = false;
-
- struct sockaddr_un server_sockaddr;
- struct sockaddr_un client_sockaddr;
- socklen_t len;
- server_sockaddr.sun_family = AF_LOCAL;
- server_sockaddr.sun_path[0] = '\0';
- strcpy(&server_sockaddr.sun_path[1], socket_name.c_str() );
- len = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&server_sockaddr.sun_path[1]);
- int err;
-
- server_sock_ = socket(PF_LOCAL, SOCK_STREAM, 0);
- if (server_sock_ < 0) {
- err = errno;
- SDL_LOG_ERROR("Cannot open socket: " << strerror(err) << " " << socket_name);
- return;
- }
-
- unlink(socket_name.c_str());
- int rc = bind(server_sock_, (struct sockaddr *) &server_sockaddr, len);
- if (rc < 0){
- err = errno;
- SDL_LOG_ERROR("BIND ERROR: " << strerror(err) << " " << socket_name);
- close(server_sock_);
- return;
- }
-
- int backlog = 1;
- rc = listen(server_sock_, backlog);
- if (rc < 0){
- err = errno;
- SDL_LOG_ERROR("LISTEN ERROR: " << strerror(err) << " " << socket_name);
- close(server_sock_);
- return;
- }
+LocalSocketReceiver::LocalSocketReceiver(MessageDelegate&& callback)
+ : callback_(callback) {}
+
+void LocalSocketReceiver::Init(const std::string& socket_name) {
+ SDL_LOG_AUTO_TRACE();
+ connected_ = false;
+ stop_requested_ = false;
+
+ struct sockaddr_un server_sockaddr;
+ struct sockaddr_un client_sockaddr;
+ socklen_t len;
+ server_sockaddr.sun_family = AF_LOCAL;
+ server_sockaddr.sun_path[0] = '\0';
+ strcpy(&server_sockaddr.sun_path[1], socket_name.c_str());
+ len = offsetof(struct sockaddr_un, sun_path) + 1 +
+ strlen(&server_sockaddr.sun_path[1]);
+ int err;
+
+ server_sock_ = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (server_sock_ < 0) {
+ err = errno;
+ SDL_LOG_ERROR("Cannot open socket: " << strerror(err) << " "
+ << socket_name);
+ return;
+ }
+
+ unlink(socket_name.c_str());
+ int rc = bind(server_sock_, (struct sockaddr*)&server_sockaddr, len);
+ if (rc < 0) {
+ err = errno;
+ SDL_LOG_ERROR("BIND ERROR: " << strerror(err) << " " << socket_name);
+ close(server_sock_);
+ return;
+ }
+
+ int backlog = 1;
+ rc = listen(server_sock_, backlog);
+ if (rc < 0) {
+ err = errno;
+ SDL_LOG_ERROR("LISTEN ERROR: " << strerror(err) << " " << socket_name);
+ close(server_sock_);
+ return;
+ }
- SDL_LOG_INFO("Socket listening... " << socket_name);
+ SDL_LOG_INFO("Socket listening... " << socket_name);
- client_sock_ = accept(server_sock_, (struct sockaddr *) &client_sockaddr, &len);
- if (client_sock_ < 0){
- err = errno;
- SDL_LOG_ERROR("ACCEPT ERROR: " << strerror(err) << " " << socket_name);
- close(server_sock_);
- close(client_sock_);
- return;
- }
+ client_sock_ = accept(server_sock_, (struct sockaddr*)&client_sockaddr, &len);
+ if (client_sock_ < 0) {
+ err = errno;
+ SDL_LOG_ERROR("ACCEPT ERROR: " << strerror(err) << " " << socket_name);
+ close(server_sock_);
+ close(client_sock_);
+ return;
+ }
- connected_ = true;
+ connected_ = true;
}
-void LocalSocketReceiver::Run()
-{
- SDL_LOG_AUTO_TRACE();
-
- while (connected_ && !stop_requested_) {
- buffer.resize(buffer_size);
- const int n = read(client_sock_, buffer.data(), buffer_size - 1);
- if(n > 0) {
- buffer.resize(n);
- callback_(buffer);
- }
+void LocalSocketReceiver::Run() {
+ SDL_LOG_AUTO_TRACE();
+
+ while (connected_ && !stop_requested_) {
+ buffer.resize(buffer_size);
+ const int n = read(client_sock_, buffer.data(), buffer_size - 1);
+ if (n > 0) {
+ buffer.resize(n);
+ callback_(buffer);
}
+ }
}
void LocalSocketReceiver::Stop() {
- SDL_LOG_DEBUG("Requesting server to stop");
- stop_requested_ = true;
- close(client_sock_);
- close(server_sock_);
- connected_ = false;
+ SDL_LOG_DEBUG("Requesting server to stop");
+ stop_requested_ = true;
+ close(client_sock_);
+ close(server_sock_);
+ connected_ = false;
}
-LocalSocketReceiver::~LocalSocketReceiver(){
- if(connected_){
- close(client_sock_);
- close(server_sock_);
- }
+LocalSocketReceiver::~LocalSocketReceiver() {
+ if (connected_) {
+ close(client_sock_);
+ close(server_sock_);
+ }
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/android/local_socket_sender.cc b/src/components/transport_manager/src/android/local_socket_sender.cc
index 409f84479e..6c0381ae7c 100644
--- a/src/components/transport_manager/src/android/local_socket_sender.cc
+++ b/src/components/transport_manager/src/android/local_socket_sender.cc
@@ -4,13 +4,13 @@
#include <utility>
#include "utils/logger.h"
+#include <netdb.h>
+#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
+#include <unistd.h>
#include <atomic>
SDL_CREATE_LOG_VARIABLE("local_socket_sender")
@@ -18,99 +18,97 @@ SDL_CREATE_LOG_VARIABLE("local_socket_sender")
namespace transport_manager {
namespace transport_adapter {
-LocalSocketSender::LocalSocketSender(OnDataSentCallback&& sent_callback, OnConnectedCallback&& connected_callback)
+LocalSocketSender::LocalSocketSender(OnDataSentCallback&& sent_callback,
+ OnConnectedCallback&& connected_callback)
: socket_id_(-1)
, connected_(false)
, message_queue_()
, connected_callback_(connected_callback)
- , sent_callback_(sent_callback)
-{}
-
-void LocalSocketSender::Init(const std::string& socket_name)
-{
- SDL_LOG_AUTO_TRACE();
-
- struct sockaddr_un addr{};
- addr.sun_family = AF_LOCAL;
- addr.sun_path[0] = '\0';
- strcpy(&addr.sun_path[1], socket_name.c_str() );
- socklen_t len = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&addr.sun_path[1]);
- int err;
-
- SDL_LOG_DEBUG("Creating local socket...");
- socket_id_ = socket(PF_LOCAL, SOCK_STREAM, 0);
- if (socket_id_ < 0) {
- err = errno;
- SDL_LOG_ERROR("Cannot open socket: " << strerror(err));
- return;
- }
+ , sent_callback_(sent_callback) {}
+
+void LocalSocketSender::Init(const std::string& socket_name) {
+ SDL_LOG_AUTO_TRACE();
+
+ struct sockaddr_un addr {};
+ addr.sun_family = AF_LOCAL;
+ addr.sun_path[0] = '\0';
+ strcpy(&addr.sun_path[1], socket_name.c_str());
+ socklen_t len =
+ offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&addr.sun_path[1]);
+ int err;
+
+ SDL_LOG_DEBUG("Creating local socket...");
+ socket_id_ = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (socket_id_ < 0) {
+ err = errno;
+ SDL_LOG_ERROR("Cannot open socket: " << strerror(err));
+ return;
+ }
+
+ if (!TryToConnect(addr, len)) {
+ SDL_LOG_ERROR("Failed to connect");
+ close(socket_id_);
+ } else {
+ connected_ = true;
+ }
+
+ connected_callback_(connected_);
+}
- if (!TryToConnect(addr, len)) {
- SDL_LOG_ERROR("Failed to connect");
- close(socket_id_);
- } else {
- connected_ = true;
+void LocalSocketSender::Run() {
+ SDL_LOG_AUTO_TRACE();
+ while (connected_ && !message_queue_.IsShuttingDown()) {
+ if (message_queue_.empty()) {
+ message_queue_.wait();
}
- connected_callback_(connected_);
-}
-
-void LocalSocketSender::Run()
-{
- SDL_LOG_AUTO_TRACE();
- while(connected_ && !message_queue_.IsShuttingDown()) {
- if (message_queue_.empty()) {
- message_queue_.wait();
- }
-
- protocol_handler::RawMessagePtr message;
- if (message_queue_.pop(message)) {
- int n = write(socket_id_, message->data(), message->data_size());
- if (n > 0) {
- sent_callback_(message);
- } else {
- sent_callback_(nullptr);
- }
- }
+ protocol_handler::RawMessagePtr message;
+ if (message_queue_.pop(message)) {
+ int n = write(socket_id_, message->data(), message->data_size());
+ if (n > 0) {
+ sent_callback_(message);
+ } else {
+ sent_callback_(nullptr);
+ }
}
+ }
}
-LocalSocketSender::~LocalSocketSender()
-{
- if(connected_){
- close(socket_id_);
- }
+LocalSocketSender::~LocalSocketSender() {
+ if (connected_) {
+ close(socket_id_);
+ }
}
bool LocalSocketSender::TryToConnect(sockaddr_un& addr, socklen_t len) {
- const int connect_attempts = 10;
- const int attempt_interval_ms = 500;
-
- for (int i = 0; i < connect_attempts; ++i) {
- SDL_LOG_DEBUG("Attempt #" << i + 1 << " to connect to socket...");
+ const int connect_attempts = 10;
+ const int attempt_interval_ms = 500;
- if (connect(socket_id_, (struct sockaddr *) &addr, len) < 0) {
- SDL_LOG_ERROR("Connect() failed: " << strerror(errno)
- << ". Retry in " << attempt_interval_ms << "ms");
- usleep(attempt_interval_ms);
- continue;
- }
+ for (int i = 0; i < connect_attempts; ++i) {
+ SDL_LOG_DEBUG("Attempt #" << i + 1 << " to connect to socket...");
- SDL_LOG_DEBUG("Successfully connected to socket");
- return true;
+ if (connect(socket_id_, (struct sockaddr*)&addr, len) < 0) {
+ SDL_LOG_ERROR("Connect() failed: " << strerror(errno) << ". Retry in "
+ << attempt_interval_ms << "ms");
+ usleep(attempt_interval_ms);
+ continue;
}
- SDL_LOG_ERROR("Connection attempts exceeded. Can't connect to socket");
- return false;
+ SDL_LOG_DEBUG("Successfully connected to socket");
+ return true;
+ }
+
+ SDL_LOG_ERROR("Connection attempts exceeded. Can't connect to socket");
+ return false;
}
void LocalSocketSender::Stop() {
- SDL_LOG_DEBUG("Requesting client to stop");
- message_queue_.Shutdown();
+ SDL_LOG_DEBUG("Requesting client to stop");
+ message_queue_.Shutdown();
}
void LocalSocketSender::Send(::protocol_handler::RawMessagePtr message) {
- message_queue_.push(message);
+ message_queue_.push(message);
}
} // namespace transport_adapter
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
index f152f1f78d..ce0c2900b7 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
@@ -95,10 +95,10 @@ int FindPairedDevs(std::vector<bdaddr_t>* result) {
delete[] buffer;
buffer = new char[1028];
}
- pclose(pipe);
+ int status = pclose(pipe);
SDL_LOG_TRACE("exit with 0");
delete[] buffer;
- return 0;
+ return status;
}
} // namespace
@@ -112,6 +112,7 @@ BluetoothDeviceScanner::BluetoothDeviceScanner(
, ready_(true)
, device_scan_requested_(false)
, device_scan_requested_lock_()
+ , terminate_lock_()
, device_scan_requested_cv_()
, auto_repeat_search_(auto_repeat_search)
, auto_repeat_pause_sec_(auto_repeat_pause_sec) {
@@ -148,6 +149,7 @@ BluetoothDeviceScanner::BluetoothDeviceScanner(
, ready_(true)
, device_scan_requested_(false)
, device_scan_requested_lock_()
+ , terminate_lock_()
, device_scan_requested_cv_()
, auto_repeat_search_(auto_repeat_search)
, auto_repeat_pause_sec_(auto_repeat_pause_sec) {
@@ -173,9 +175,6 @@ void BluetoothDeviceScanner::UpdateTotalDeviceList() {
devices.insert(devices.end(),
paired_devices_with_sdl_.begin(),
paired_devices_with_sdl_.end());
- devices.insert(devices.end(),
- found_devices_with_sdl_.begin(),
- found_devices_with_sdl_.end());
controller_->SearchDeviceDone(devices);
}
@@ -212,38 +211,9 @@ void BluetoothDeviceScanner::DoInquiry() {
paired_devices_, device_handle, &paired_devices_with_sdl_);
UpdateTotalDeviceList();
- SDL_LOG_INFO("Starting hci_inquiry on device " << device_id);
- const uint8_t inquiry_time = 8u; // Time unit is 1.28 seconds
- const size_t max_devices = 256u;
- inquiry_info* inquiry_info_list = new inquiry_info[max_devices];
-
- const int number_of_devices = hci_inquiry(device_id,
- inquiry_time,
- max_devices,
- 0,
- &inquiry_info_list,
- IREQ_CACHE_FLUSH);
-
- if (number_of_devices >= 0) {
- SDL_LOG_INFO("hci_inquiry: found " << number_of_devices << " devices");
- std::vector<bdaddr_t> found_devices(number_of_devices);
- for (int i = 0; i < number_of_devices; ++i) {
- found_devices[i] = inquiry_info_list[i].bdaddr;
- }
- found_devices_with_sdl_.clear();
- CheckSDLServiceOnDevices(
- found_devices, device_handle, &found_devices_with_sdl_);
- }
- UpdateTotalDeviceList();
controller_->FindNewApplicationsRequest();
close(device_handle);
- delete[] inquiry_info_list;
-
- if (number_of_devices < 0) {
- SDL_LOG_DEBUG("number_of_devices < 0");
- controller_->SearchDeviceFailed(SearchDeviceError());
- }
}
void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
@@ -424,7 +394,10 @@ void BluetoothDeviceScanner::Thread() {
if (auto_repeat_search_) {
while (!shutdown_requested_) {
DoInquiry();
- device_scan_requested_ = false;
+ {
+ sync_primitives::AutoLock auto_lock(device_scan_requested_lock_);
+ device_scan_requested_ = false;
+ }
TimedWaitForDeviceScanRequest();
}
} else { // search only on demand
@@ -452,12 +425,22 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() {
return;
}
+ if (shutdown_requested_) {
+ SDL_LOG_INFO("Bluetooth scanner Condition: shutdown_requested_ == true");
+ return;
+ }
+
{
sync_primitives::AutoLock auto_lock(device_scan_requested_lock_);
while (!(device_scan_requested_ || shutdown_requested_)) {
+ if (!terminate_lock_.Try()) {
+ // Lock is taken by terminate thread, return
+ return;
+ }
const sync_primitives::ConditionalVariable::WaitStatus wait_status =
device_scan_requested_cv_.WaitFor(auto_lock,
auto_repeat_pause_sec_ * 1000);
+ terminate_lock_.Release();
if (wait_status == sync_primitives::ConditionalVariable::kTimeout) {
SDL_LOG_INFO("Bluetooth scanner timeout, performing scan");
device_scan_requested_ = true;
@@ -478,13 +461,16 @@ TransportAdapter::Error BluetoothDeviceScanner::Init() {
void BluetoothDeviceScanner::Terminate() {
SDL_LOG_AUTO_TRACE();
+ if (shutdown_requested_)
+ return;
shutdown_requested_ = true;
if (thread_) {
+ device_scan_requested_cv_.NotifyOne();
{
sync_primitives::AutoLock auto_lock(device_scan_requested_lock_);
device_scan_requested_ = false;
- device_scan_requested_cv_.NotifyOne();
}
+ sync_primitives::AutoLock auto_lock(terminate_lock_);
SDL_LOG_INFO("Waiting for bluetooth device scanner thread termination");
thread_->Stop(threads::Thread::kThreadStopDelegate);
SDL_LOG_INFO("Bluetooth device scanner thread stopped");
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
index abeb50e798..88a219f57e 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
@@ -58,7 +58,7 @@ BluetoothTransportAdapter::BluetoothTransportAdapter(
resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
: TransportAdapterImpl(
- new BluetoothDeviceScanner(this, true, 0, settings.bluetooth_uuid()),
+ new BluetoothDeviceScanner(this, true, 15, settings.bluetooth_uuid()),
new BluetoothConnectionFactory(this),
NULL,
last_state_wrapper,
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
index 402a103910..98c51d4aab 100644
--- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -105,7 +105,7 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
SDL_LOG_DEBUG("#Results: " << results.size());
std::string results_str;
- for (size_t i = 0; i < results.size(); i++) {
+ for (size_t i = 0; i < results.size(); ++i) {
results_str += " R[" + std::to_string(i) + "]:";
results_str +=
(results[i].length() != 0) ? results[i] : std::string("<EMPTY>");
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
index b190e73cb6..a84723d2a1 100644
--- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -240,7 +240,7 @@ void WebsocketClientConnection::OnRead(boost::system::error_code ec,
if (ec) {
std::string str_err = "ErrorMessage: " + ec.message();
SDL_LOG_ERROR(str_err);
- ws_.lowest_layer().close();
+ boost::beast::get_lowest_layer(ws_).close();
ioc_.stop();
Shutdown();
return;
diff --git a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
index ba2956413a..4dd95d606f 100644
--- a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
+++ b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
@@ -9,7 +9,7 @@
#include "transport_manager/tcp/ifaddrs_android/ifaddrs-android.h"
#else
#include <ifaddrs.h>
-#endif // __ANDROID__
+#endif // __ANDROID__
#include <net/if.h>
#include <sys/select.h>
diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
index 3918ced78c..660861a2f7 100644
--- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc
+++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
@@ -57,7 +57,7 @@
#include "transport_manager/tcp/ifaddrs_android/ifaddrs-android.h"
#else
#include <ifaddrs.h>
-#endif // __ANDROID__
+#endif // __ANDROID__
#include <sstream>
diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
index eb92599ae5..61562d88c0 100644
--- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
+++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
@@ -237,13 +237,13 @@ void ThreadedSocketConnection::Transmit() {
poll_fds[1].fd = read_fd_;
poll_fds[1].events = POLLIN | POLLPRI;
- SDL_LOG_DEBUG("poll " << this);
+ SDL_LOG_TRACE("poll " << this);
if (-1 == poll(poll_fds, kPollFdsSize, -1)) {
SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this);
Abort();
return;
}
- SDL_LOG_DEBUG("poll is ok " << this << " revents0: " << std::hex
+ SDL_LOG_TRACE("poll is ok " << this << " revents0: " << std::hex
<< poll_fds[0].revents << " revents1:" << std::hex
<< poll_fds[1].revents);
// error check
@@ -307,7 +307,7 @@ bool ThreadedSocketConnection::Receive() {
bytes_read = recv(socket_, buffer, sizeof(buffer), MSG_DONTWAIT);
if (bytes_read > 0) {
- SDL_LOG_DEBUG("Received " << bytes_read << " bytes for connection "
+ SDL_LOG_TRACE("Received " << bytes_read << " bytes for connection "
<< this);
::protocol_handler::RawMessagePtr frame(
new protocol_handler::RawMessage(0, 0, buffer, bytes_read, false));
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 1b3758ef63..4129a63647 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
@@ -86,7 +86,7 @@ TransportAdapterImpl::TransportAdapterImpl(
, connections_lock_()
#ifdef TELEMETRY_MONITOR
, metric_observer_(NULL)
-
+
#endif // TELEMETRY_MONITOR
, server_connection_factory_(server_connection_factory)
, client_connection_listener_(client_connection_listener)
@@ -1253,9 +1253,9 @@ void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) {
DeviceMap::iterator i = devices_.find(device_handle);
if (i != devices_.end()) {
DeviceSptr device = i->second;
- const bool is_cloud_device = (GetDeviceType() == DeviceType::CLOUD_WEBSOCKET);
- const bool is_ble_device = (GetDeviceType() == DeviceType::BLUETOOTH_LE);
- if (!device->keep_on_disconnect() || is_cloud_device || is_ble_device) {
+ const 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_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index c0ab9454b1..2c7aa6b42a 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -72,18 +72,24 @@ TransportAdapterFactory::TransportAdapterFactory() {
};
#endif
#ifdef BLUETOOTH_LE_SUPPORT
- ta_bluetooth_le_creator_ = [](resumption::LastStateWrapperPtr last_state_wrapper,
- const TransportManagerSettings& settings) {
- return new transport_adapter::AndroidTransportAdapter(last_state_wrapper,
- settings, transport_adapter::AndroidTransportType::BLE);
- };
+ ta_bluetooth_le_creator_ =
+ [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::AndroidTransportAdapter(
+ last_state_wrapper,
+ settings,
+ transport_adapter::AndroidTransportType::BLE);
+ };
#endif
#ifdef ANDROID_BT_SUPPORT
- ta_android_bt_creator_ = [](resumption::LastStateWrapperPtr last_state_wrapper,
- const TransportManagerSettings& settings) {
- return new transport_adapter::AndroidTransportAdapter(last_state_wrapper,
- settings, transport_adapter::AndroidTransportType::BT);
- };
+ ta_android_bt_creator_ =
+ [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::AndroidTransportAdapter(
+ last_state_wrapper,
+ settings,
+ transport_adapter::AndroidTransportType::BT);
+ };
#endif
ta_tcp_creator_ = [](const uint16_t port,
resumption::LastStateWrapperPtr last_state_wrapper,
@@ -230,10 +236,6 @@ int TransportManagerDefault::Init(
return E_SUCCESS;
}
-int TransportManagerDefault::Init(resumption::LastState&) {
- return 1;
-}
-
TransportManagerDefault::~TransportManagerDefault() {}
} // namespace transport_manager
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index ee6398db44..5f4ddc9d7e 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -582,15 +582,6 @@ int TransportManagerImpl::Init(
return E_SUCCESS;
}
-int TransportManagerImpl::Init(resumption::LastState& last_state) {
- // Last state required to initialize Transport adapters
- UNUSED(last_state);
- SDL_LOG_TRACE("enter");
- is_initialized_ = true;
- SDL_LOG_TRACE("exit with E_SUCCESS");
- return E_SUCCESS;
-}
-
void TransportManagerImpl::Deinit() {
SDL_LOG_AUTO_TRACE();
DisconnectAllDevices();
@@ -768,7 +759,7 @@ void TransportManagerImpl::PostMessage(
void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) {
SDL_LOG_AUTO_TRACE();
- SDL_LOG_DEBUG("TransportAdapterEvent: " << &event);
+ SDL_LOG_TRACE("TransportAdapterEvent: " << &event);
event_queue_.PostMessage(event);
}
@@ -823,12 +814,12 @@ void TransportManagerImpl::DeactivateDeviceConnections(
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
const ConnectionUID id) {
SDL_LOG_AUTO_TRACE();
- SDL_LOG_DEBUG("ConnectionUID: " << id);
+ SDL_LOG_TRACE("ConnectionUID: " << id);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
if (it->id == id) {
- SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it);
+ SDL_LOG_TRACE("ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
@@ -838,13 +829,13 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
const DeviceUID& device, const ApplicationHandle& application) {
SDL_LOG_AUTO_TRACE();
- SDL_LOG_DEBUG("DeviceUID: " << device
+ SDL_LOG_TRACE("DeviceUID: " << device
<< "ApplicationHandle: " << application);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
if (it->device == device && it->application == application) {
- SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it);
+ SDL_LOG_TRACE("ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
@@ -1297,7 +1288,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
#endif // TELEMETRY_MONITOR
RaiseEvent(&TransportManagerListener::OnTMMessageReceived,
event.event_data);
- SDL_LOG_DEBUG("event_type = ON_RECEIVED_DONE");
+ SDL_LOG_TRACE("event_type = ON_RECEIVED_DONE");
break;
}
case EventTypeEnum::ON_RECEIVED_FAIL: {
diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
index 278a1b1f05..865784e9a5 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
@@ -81,7 +81,6 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid,
UsbConnection::~UsbConnection() {
SDL_LOG_TRACE("enter with this" << this);
Finalise();
- libusb_free_transfer(in_transfer_);
delete[] in_buffer_;
SDL_LOG_TRACE("exit");
}
@@ -97,6 +96,12 @@ void OutTransferCallback(libusb_transfer* transfer) {
bool UsbConnection::PostInTransfer() {
SDL_LOG_TRACE("enter");
+
+ if (nullptr == in_transfer_) {
+ SDL_LOG_TRACE("exit with FALSE. Condition: nullptr == in_transfer_");
+ return false;
+ }
+
libusb_fill_bulk_transfer(in_transfer_,
device_handle_,
in_endpoint_,
@@ -129,28 +134,40 @@ std::string hex_data(const unsigned char* const buffer,
void UsbConnection::OnInTransfer(libusb_transfer* transfer) {
SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer);
- if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
- SDL_LOG_DEBUG("USB incoming transfer, size:"
- << transfer->actual_length << ", data:"
- << hex_data(transfer->buffer, transfer->actual_length));
- ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage(
- 0, 0, in_buffer_, transfer->actual_length, false));
- controller_->DataReceiveDone(device_uid_, app_handle_, data);
- } else {
- SDL_LOG_ERROR("USB incoming transfer failed: "
- << libusb_error_name(transfer->status));
- controller_->DataReceiveFailed(
- device_uid_, app_handle_, DataReceiveError());
+ switch (transfer->status) {
+ case LIBUSB_TRANSFER_COMPLETED: {
+ SDL_LOG_DEBUG("USB incoming transfer, size:"
+ << transfer->actual_length << ", data:"
+ << hex_data(transfer->buffer, transfer->actual_length));
+ ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage(
+ 0, 0, in_buffer_, transfer->actual_length, false));
+ controller_->DataReceiveDone(device_uid_, app_handle_, data);
+ break;
+ }
+
+ case LIBUSB_TRANSFER_CANCELLED: {
+ SDL_LOG_DEBUG("Free already canceled transfer.");
+ break;
+ }
+
+ default: {
+ SDL_LOG_ERROR("USB incoming transfer failed: "
+ << libusb_error_name(transfer->status));
+ controller_->DataReceiveFailed(
+ device_uid_, app_handle_, DataReceiveError());
+ }
}
- if (disconnecting_) {
+
+ if (waiting_in_transfer_cancel_) {
+ libusb_free_transfer(in_transfer_);
+ in_transfer_ = nullptr;
waiting_in_transfer_cancel_ = false;
- } else {
- if (!PostInTransfer()) {
- SDL_LOG_ERROR("USB incoming transfer failed with "
- << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection.");
- AbortConnection();
- }
+ } else if (!PostInTransfer()) {
+ SDL_LOG_ERROR("USB incoming transfer failed with "
+ << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection.");
+ AbortConnection();
}
+
SDL_LOG_TRACE("exit");
}
@@ -200,38 +217,49 @@ TransportAdapter::Error UsbConnection::PostOutTransfer() {
}
void UsbConnection::OnOutTransfer(libusb_transfer* transfer) {
+ SDL_LOG_AUTO_TRACE();
SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer);
auto error_code = TransportAdapter::OK;
{
sync_primitives::AutoLock locker(out_messages_mutex_);
- if (LIBUSB_TRANSFER_COMPLETED == transfer->status) {
- bytes_sent_ += transfer->actual_length;
- if (current_out_message_->data_size() == bytes_sent_) {
- SDL_LOG_DEBUG(
- "USB out transfer, data sent: " << current_out_message_.get());
- controller_->DataSendDone(
- device_uid_, app_handle_, current_out_message_);
+ switch (transfer->status) {
+ case LIBUSB_TRANSFER_COMPLETED: {
+ bytes_sent_ += transfer->actual_length;
+ if (current_out_message_->data_size() == bytes_sent_) {
+ SDL_LOG_DEBUG(
+ "USB out transfer, data sent: " << current_out_message_.get());
+ controller_->DataSendDone(
+ device_uid_, app_handle_, current_out_message_);
+ error_code = PopOutMessage();
+ }
+ break;
+ }
+
+ case LIBUSB_TRANSFER_CANCELLED: {
+ SDL_LOG_DEBUG("Free already canceled transfer.");
+ break;
+ }
+
+ default: {
+ SDL_LOG_ERROR(
+ "USB out transfer failed: " << libusb_error_name(transfer->status));
+ controller_->DataSendFailed(
+ device_uid_, app_handle_, current_out_message_, DataSendError());
error_code = PopOutMessage();
}
- } else {
- SDL_LOG_ERROR(
- "USB out transfer failed: " << libusb_error_name(transfer->status));
- controller_->DataSendFailed(
- device_uid_, app_handle_, current_out_message_, DataSendError());
- error_code = PopOutMessage();
}
- if (current_out_message_.use_count() == 0) {
+
+ if (waiting_out_transfer_cancel_ || current_out_message_.use_count() == 0) {
libusb_free_transfer(transfer);
out_transfer_ = nullptr;
waiting_out_transfer_cancel_ = false;
+ return;
}
}
if (TransportAdapter::FAIL == error_code) {
AbortConnection();
}
-
- SDL_LOG_TRACE("exit");
}
TransportAdapter::Error UsbConnection::SendData(
diff --git a/src/components/transport_manager/src/websocket_server/websocket_connection.cc b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
index 482a9908e6..a2427537b6 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_connection.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
@@ -99,10 +99,10 @@ WebSocketConnection<Session>::~WebSocketConnection() {
#ifdef ENABLE_SECURITY
template <>
-WebSocketConnection<WebSocketSecureSession<>>::~WebSocketConnection() {
- if (!IsShuttingDown()) {
- Shutdown();
- }
+WebSocketConnection<WebSocketSecureSession<> >::~WebSocketConnection() {
+ if (!IsShuttingDown()) {
+ Shutdown();
+ }
}
#endif // ENABLE_SECURITY
@@ -176,7 +176,7 @@ void WebSocketConnection<WebSocketSecureSession<> >::Run() {
SDL_LOG_AUTO_TRACE();
session_->AsyncAccept();
}
-#endif // ENABLE_SECURITY
+#endif // ENABLE_SECURITY
template <typename Session>
void WebSocketConnection<Session>::Shutdown() {
diff --git a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
index a533bdcffc..699d2757fd 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
@@ -60,11 +60,9 @@ void WebSocketSecureSession<ExecutorType>::AsyncAccept() {
// Perform the SSL handshake
WebSocketSecureSession<ExecutorType>::ws_.next_layer().async_handshake(
ssl::stream_base::server,
- boost::asio::bind_executor(
- WebSocketSecureSession<ExecutorType>::strand_,
- std::bind(&WebSocketSecureSession::AsyncHandshake,
- this->shared_from_this(),
- std::placeholders::_1)));
+ std::bind(&WebSocketSecureSession::AsyncHandshake,
+ this->shared_from_this(),
+ std::placeholders::_1));
}
template <typename ExecutorType>
diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
index 68f23a6326..9c02b78872 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
@@ -100,7 +100,10 @@ TransportAdapter::Error WebSocketServerTransportAdapter::Init() {
void WebSocketServerTransportAdapter::Store() const {
SDL_LOG_AUTO_TRACE();
if (webengine_device_) {
- Json::Value& dictionary = last_state().get_dictionary();
+ resumption::LastStateAccessor accessor =
+ last_state_wrapper_->get_accessor();
+ resumption::LastState& data = accessor.GetMutableData();
+ Json::Value dictionary = data.dictionary();
if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) {
SDL_LOG_DEBUG(
"WebsocketServerAdapter already exists. Storing is skipped");
@@ -114,12 +117,15 @@ void WebSocketServerTransportAdapter::Store() const {
ws_adapter_dictionary["device"] = device_dictionary;
dictionary["TransportManager"]["WebsocketServerAdapter"] =
ws_adapter_dictionary;
+
+ data.set_dictionary(dictionary);
}
}
bool WebSocketServerTransportAdapter::Restore() {
SDL_LOG_AUTO_TRACE();
- const Json::Value& dictionary = last_state().get_dictionary();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
const Json::Value ws_adapter_dictionary =
dictionary["TransportManager"]["WebsocketServerAdapter"];
webengine_device_id_ =
diff --git a/src/components/transport_manager/src/websocket_server/websocket_session.cc b/src/components/transport_manager/src/websocket_server/websocket_session.cc
index 8a05b9d9aa..020da580f9 100644
--- a/src/components/transport_manager/src/websocket_server/websocket_session.cc
+++ b/src/components/transport_manager/src/websocket_server/websocket_session.cc
@@ -48,7 +48,6 @@ WebSocketSession<tcp::socket&>::WebSocketSession(
OnIOErrorCallback on_error)
: socket_(std::move(socket))
, ws_(socket_)
- , strand_(ws_.get_executor())
, data_receive_(data_receive)
, data_send_done_(data_send_done)
, data_send_failed_(data_send_failed)
@@ -67,7 +66,6 @@ WebSocketSession<ssl::stream<tcp::socket&> >::WebSocketSession(
OnIOErrorCallback on_error)
: socket_(std::move(socket))
, ws_(socket_, ctx)
- , strand_(ws_.get_executor())
, data_receive_(data_receive)
, data_send_done_(data_send_done)
, data_send_failed_(data_send_failed)
@@ -83,11 +81,9 @@ WebSocketSession<ExecutorType>::~WebSocketSession() {}
template <typename ExecutorType>
void WebSocketSession<ExecutorType>::AsyncAccept() {
SDL_LOG_AUTO_TRACE();
- ws_.async_accept(
- boost::asio::bind_executor(strand_,
- std::bind(&WebSocketSession::AsyncRead,
- this->shared_from_this(),
- std::placeholders::_1)));
+ ws_.async_accept(std::bind(&WebSocketSession::AsyncRead,
+ this->shared_from_this(),
+ std::placeholders::_1));
}
template <typename ExecutorType>
@@ -96,15 +92,16 @@ void WebSocketSession<ExecutorType>::AsyncRead(boost::system::error_code ec) {
if (ec) {
auto str_err = "ErrorMessage: " + ec.message();
SDL_LOG_ERROR(str_err);
+ buffer_.consume(buffer_.size());
+ on_io_error_();
return;
}
ws_.async_read(buffer_,
- boost::asio::bind_executor(strand_,
- std::bind(&WebSocketSession::Read,
- this->shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2)));
+ std::bind(&WebSocketSession::Read,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2));
}
template <typename ExecutorType>
diff --git a/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h b/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h
index e29f182059..d1bbde05a8 100644
--- a/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h
+++ b/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h
@@ -38,7 +38,6 @@
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/placeholders.hpp>
#include <boost/asio/ssl/stream.hpp>
-#include <boost/asio/strand.hpp>
#include <boost/asio/thread_pool.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
@@ -80,7 +79,6 @@ class WSSession : public std::enable_shared_from_this<WSSession> {
websocket::stream<tcp::socket> ws_;
beast::flat_buffer buffer_;
- boost::asio::strand<boost::asio::io_context::executor_type> strand_;
http::request<http::string_body> req_;
std::set<std::string> url_routes_;
};
diff --git a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
index 5aedfd58aa..4f5cbf71eb 100644
--- a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
+++ b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
@@ -54,10 +54,6 @@ using namespace ::protocol_handler;
class RawMessageMatcher : public MatcherInterface<RawMessagePtr> {
public:
explicit RawMessageMatcher(RawMessagePtr ptr);
-
- DEPRECATED
- virtual bool MatchAndExplain(const RawMessagePtr msg,
- MatchResultListener* listener) const;
virtual void DescribeTo(std::ostream* os) const;
virtual void DescribeNegationTo(std::ostream* os) const;
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 7b1d720ba2..4be51431d7 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
@@ -66,13 +66,6 @@ class MockTransportAdapterImpl : public TransportAdapterImpl {
last_state_wrapper,
settings) {}
- DEPRECATED
- MockTransportAdapterImpl(DeviceScanner*,
- ServerConnectionFactory*,
- ClientConnectionListener*,
- resumption::LastState&,
- const transport_manager::TransportManagerSettings&);
-
ConnectionSPtr FindStatedConnection(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) {
return this->FindEstablishedConnection(device_handle, app_handle);
diff --git a/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h b/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h
index 138502e02c..0a447a118d 100644
--- a/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h
+++ b/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h
@@ -39,7 +39,6 @@
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ssl/stream.hpp>
-#include <boost/asio/strand.hpp>
#include <boost/asio/thread_pool.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
diff --git a/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
index befba30fbd..73cc8a5e9a 100644
--- a/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
+++ b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
@@ -119,10 +119,10 @@ TEST_F(NetworkInterfaceListenerTest, Start_success) {
// after stated, it is expected that the listener notifies current IP address
// (if it's available)
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(mock_tcp_client_listener_,
OnIPAddressUpdated(entries[0].ipv4_address, ""))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
EXPECT_TRUE(interface_listener_impl_->Start());
@@ -131,7 +131,7 @@ TEST_F(NetworkInterfaceListenerTest, Start_success) {
EXPECT_TRUE(interface_listener_impl_->GetThread()->IsRunning());
- EXPECT_TRUE(waiter.WaitFor(1, kStartNotificationTimeoutMsec));
+ EXPECT_TRUE(waiter->WaitFor(1, kStartNotificationTimeoutMsec));
Deinit();
}
diff --git a/src/components/transport_manager/test/sample_websocket_server.cc b/src/components/transport_manager/test/sample_websocket_server.cc
index 9b0e5b59d5..bd153adad4 100644
--- a/src/components/transport_manager/test/sample_websocket_server.cc
+++ b/src/components/transport_manager/test/sample_websocket_server.cc
@@ -42,8 +42,7 @@ void Fail(char const* tag, boost::system::error_code ec) {
namespace sample {
namespace websocket {
-WSSession::WSServer::WSServer(tcp::socket&& socket)
- : ws_(std::move(socket)), strand_(ws_.get_executor()) {}
+WSSession::WSServer::WSServer(tcp::socket&& socket) : ws_(std::move(socket)) {}
void WSSession::WSServer::AddURLRoute(const std::string& target) {
url_routes_.insert(ParseRouteFromTarget(target));
@@ -76,10 +75,8 @@ void WSSession::WSServer::OnWebsocketHandshake(
// Accept the websocket handshake
ws_.async_accept(
req_,
- boost::asio::bind_executor(strand_,
- std::bind(&WSServer::OnAccept,
- shared_from_this(),
- std::placeholders::_1)));
+ std::bind(
+ &WSServer::OnAccept, shared_from_this(), std::placeholders::_1));
}
}
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 d71db3e770..e29028b562 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -250,7 +250,7 @@ TEST_P(TcpClientListenerTest, ClientConnection) {
int s = socket(AF_INET, SOCK_STREAM, 0);
EXPECT_TRUE(0 <= s);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
// controller should be notified of AddDevice event
DeviceSptr mock_device = std::make_shared<MockTCPDevice>(
@@ -258,7 +258,7 @@ TEST_P(TcpClientListenerTest, ClientConnection) {
EXPECT_CALL(adapter_controller_mock_, AddDevice(_))
.WillOnce(Return(mock_device));
EXPECT_CALL(adapter_controller_mock_, ConnectionCreated(_, _, _))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
// adapter_controller_mock_ may also receive ConnectDone() and
// ConnectionFinished() from ThreadedSocketConnection. Ignore them as hey are
@@ -273,7 +273,7 @@ TEST_P(TcpClientListenerTest, ClientConnection) {
client_addr_len));
// since the connection is handled on another thread, wait for some time
- EXPECT_TRUE(waiter.WaitFor(1, kConnectionCreatedTimeoutMsec));
+ EXPECT_TRUE(waiter->WaitFor(1, kConnectionCreatedTimeoutMsec));
close(s);
diff --git a/src/components/transport_manager/test/transport_manager_default_test.cc b/src/components/transport_manager/test/transport_manager_default_test.cc
index 67b4a0a8ba..66cfa85ef9 100644
--- a/src/components/transport_manager/test/transport_manager_default_test.cc
+++ b/src/components/transport_manager/test/transport_manager_default_test.cc
@@ -210,8 +210,6 @@ void TestTransportManagerDefault::ExpectationsSettings_TM(
.WillByDefault(ReturnRef(kWSServerCACertPath));
ON_CALL(*mock_last_state_, dictionary())
.WillByDefault(Return(custom_dictionary_));
- ON_CALL(*mock_last_state_, get_dictionary())
- .WillByDefault(ReturnRef(custom_dictionary_));
EXPECT_CALL(transport_manager_settings_, use_last_state())
.WillRepeatedly(Return(use_last_state));
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 227367e750..52ef63f874 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -555,11 +555,11 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice) {
// Arrange
HandleConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(TransportAdapter::OK)));
+ DoAll(NotifyTestAsyncWaiter(waiter), Return(TransportAdapter::OK)));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StartRawMsg(test_message_.get()));
@@ -567,7 +567,7 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice) {
EXPECT_EQ(E_SUCCESS, tm_.SendMessageToDevice(test_message_));
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, SendMessageToDevice_SendingFailed) {
@@ -578,30 +578,30 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_SendingFailed) {
EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
#endif // TELEMETRY_MONITOR
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::FAIL));
EXPECT_CALL(*tm_listener_, OnTMMessageSendFailed(_, test_message_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
EXPECT_EQ(E_SUCCESS, tm_.SendMessageToDevice(test_message_));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StopRawMsg(_)).Times(0);
#endif // TELEMETRY_MONITOR
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, SendMessageToDevice_StartTimeObserver) {
// Arrange
HandleConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(TransportAdapter::OK)));
+ DoAll(NotifyTestAsyncWaiter(waiter), Return(TransportAdapter::OK)));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
@@ -609,18 +609,18 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_StartTimeObserver) {
EXPECT_EQ(E_SUCCESS, tm_.SendMessageToDevice(test_message_));
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, SendMessageToDevice_SendDone) {
// Arrange
HandleConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(TransportAdapter::OK)));
+ DoAll(NotifyTestAsyncWaiter(waiter), Return(TransportAdapter::OK)));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StartRawMsg(test_message_.get()));
@@ -630,7 +630,7 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_SendDone) {
HandleSendDone();
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(
@@ -639,11 +639,11 @@ TEST_F(
// Arrange
HandleConnection();
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_,
SendData(mac_address_, application_id_, test_message_))
.WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), Return(TransportAdapter::OK)));
+ DoAll(NotifyTestAsyncWaiter(waiter), Return(TransportAdapter::OK)));
#ifdef TELEMETRY_MONITOR
EXPECT_CALL(mock_metric_observer_, StartRawMsg(test_message_.get()));
@@ -654,7 +654,7 @@ TEST_F(
HandleSendFailed();
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, RemoveDevice_DeviceWasAdded) {
@@ -749,7 +749,7 @@ TEST_F(TransportManagerImplTest, UpdateDeviceList_RemoveDevice) {
* Tests which check correct handling and receiving events
*/
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceDone) {
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_DONE,
mock_adapter_,
mac_address_,
@@ -758,15 +758,15 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceDone) {
error_);
EXPECT_CALL(*tm_listener_, OnScanDevicesFinished())
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
tm_.ReceiveEventFromDevice(test_event);
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceFail) {
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_FAIL,
mock_adapter_,
mac_address_,
@@ -775,11 +775,11 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceFail) {
error_);
EXPECT_CALL(*tm_listener_, OnScanDevicesFailed(_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
tm_.ReceiveEventFromDevice(test_event);
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_DeviceListUpdated) {
@@ -793,7 +793,7 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_DeviceListUpdated) {
std::vector<DeviceInfo> vector_dev_info;
vector_dev_info.push_back(dev_info_);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*mock_adapter_, GetDeviceList())
.Times(AtLeast(1))
.WillRepeatedly(Return(device_list_));
@@ -805,14 +805,14 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_DeviceListUpdated) {
.WillRepeatedly(Return(dev_info_.connection_type()));
EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
tm_.ReceiveEventFromDevice(test_event);
device_list_.pop_back();
- EXPECT_TRUE(waiter.WaitFor(2, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(2, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, CheckEvents) {
@@ -972,13 +972,13 @@ TEST_F(TransportManagerImplTest, HandleMessage_ConnectionNotExist) {
SendData(mac_address_, application_id_, test_message_))
.Times(0);
- TestAsyncWaiter waiter;
+ auto waiter = TestAsyncWaiter::createInstance();
EXPECT_CALL(*tm_listener_, OnTMMessageSendFailed(_, test_message_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
tm_.TestHandle(test_message_);
- EXPECT_TRUE(waiter.WaitFor(1, kAsyncExpectationsTimeout));
+ EXPECT_TRUE(waiter->WaitFor(1, kAsyncExpectationsTimeout));
}
TEST_F(TransportManagerImplTest, SearchDevices_TMIsNotInitialized) {
diff --git a/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc b/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc
index 6c2ff12bfd..8cf3cb38f1 100644
--- a/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc
+++ b/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc
@@ -113,7 +113,8 @@ bool WSSampleClient<WS>::Connect(tcp::resolver::results_type& results) {
template <>
bool WSSampleClient<WSS>::Connect(tcp::resolver::results_type& results) {
boost::system::error_code ec;
- boost::asio::connect(ws_->lowest_layer(), results.begin(), results.end(), ec);
+ boost::asio::connect(
+ boost::beast::get_lowest_layer(*ws_), results.begin(), results.end(), ec);
if (ec) {
return false;
}
@@ -134,7 +135,7 @@ bool WSSampleClient<WS>::Handshake(const std::string& host,
template <>
void WSSampleClient<WS>::Stop() {
ioc_.stop();
- ws_->lowest_layer().close();
+ boost::beast::get_lowest_layer(*ws_).close();
io_pool_.stop();
io_pool_.join();
@@ -165,7 +166,7 @@ void WSSampleClient<WSS>::Stop() {
ioc_.stop();
ws_->next_layer().next_layer().shutdown(
boost::asio::ip::tcp::socket::shutdown_both);
- ws_->lowest_layer().close();
+ boost::beast::get_lowest_layer(*ws_).close();
io_pool_.stop();
io_pool_.join();
diff --git a/src/components/transport_manager/test/websocket_server_listener_test.cc b/src/components/transport_manager/test/websocket_server_listener_test.cc
index 7991c6f1cb..6e1af1ee1b 100644
--- a/src/components/transport_manager/test/websocket_server_listener_test.cc
+++ b/src/components/transport_manager/test/websocket_server_listener_test.cc
@@ -128,6 +128,7 @@ TEST_F(WebSocketListenerTest, StartListening_ClientConnect_SUCCESS) {
ws_client->Stop();
}
+#ifdef ENABLE_SECURITY
TEST_F(WebSocketListenerTest, StartListening_ClientConnectSecure_SUCCESS) {
const auto ws_listener = std::make_shared<WebSocketListener>(
&mock_ta_controller_, mock_tm_settings_, kNumThreads);
@@ -254,6 +255,7 @@ TEST_F(WebSocketListenerTest, StartListening_AcceptorIsOpen_SUCCESS) {
EXPECT_EQ(TransportAdapter::Error::OK, ws_listener->StartListening());
ws_client->Stop();
}
+#endif
} // namespace transport_manager_test
} // namespace components
diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt
index 1a7e303491..d766363b88 100644
--- a/src/components/utils/CMakeLists.txt
+++ b/src/components/utils/CMakeLists.txt
@@ -76,26 +76,33 @@ if(NOT BUILD_BACKTRACE_SUPPORT)
)
endif()
-if(ENABLE_LOG)
+if (ENABLE_LOG)
if(ANDROID)
list(APPEND EXCLUDE_PATHS
logger/log4cxxlogger.cc
)
- else()
+ elseif(${LOGGER_NAME} STREQUAL "LOG4CXX")
+ list(APPEND EXCLUDE_PATHS
+ logger/boostlogger.cc
+ logger/androidlogger.cc
+ )
list(APPEND LIBRARIES
- log4cxx -L${LOG4CXX_LIBS_DIRECTORY}
- apr-1 -L${APR_LIBS_DIRECTORY}
- aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}
- ConfigProfile
+ log4cxx -L${LOG4CXX_LIBS_DIRECTORY}
+ apr-1 -L${APR_LIBS_DIRECTORY}
+ aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}
+ ConfigProfile
)
+ else()
list(APPEND EXCLUDE_PATHS
- logger/androidlogger.cc
+ logger/log4cxxlogger.cc
+ logger/androidlogger.cc
)
endif()
-else() #(ENABLE_LOG)
+else()
list(APPEND EXCLUDE_PATHS
auto_trace.cc
logger/log4cxxlogger.cc
+ logger/boostlogger.cc
logger/androidlogger.cc
)
endif() #(ENABLE_LOG)
@@ -141,6 +148,11 @@ list(APPEND LIBRARIES boost_system -L${BOOST_LIBS_DIRECTORY})
list(APPEND LIBRARIES boost_thread -L${BOOST_LIBS_DIRECTORY})
list(APPEND LIBRARIES boost_date_time -L${BOOST_LIBS_DIRECTORY})
list(APPEND LIBRARIES boost_filesystem -L${BOOST_LIBS_DIRECTORY})
+if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST")
+ list(APPEND LIBRARIES boost_log_setup -L${BOOST_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES boost_log -L${BOOST_LIBS_DIRECTORY})
+endif ()
+list(APPEND LIBRARIES boost_regex -L${BOOST_LIBS_DIRECTORY})
target_link_libraries("Utils" ${LIBRARIES})
add_dependencies("Utils" Boost)
@@ -151,7 +163,11 @@ target_link_libraries("Utils"
endif()
if(ENABLE_LOG AND NOT ANDROID)
- add_dependencies("Utils" install-3rd_party_logger Boost)
+ if (${LOGGER_NAME} STREQUAL "LOG4CXX")
+ add_dependencies("Utils" install-3rd_party_logger Boost)
+ else()
+ add_dependencies("Utils" Boost)
+ endif()
endif()
if(BUILD_TESTS)
diff --git a/src/components/utils/include/utils/convert_utils.h b/src/components/utils/include/utils/convert_utils.h
index ba23b620dc..670e104677 100644
--- a/src/components/utils/include/utils/convert_utils.h
+++ b/src/components/utils/include/utils/convert_utils.h
@@ -70,18 +70,14 @@ unsigned long long int ConvertUInt64ToLongLongUInt(const uint64_t value);
uint64_t ConvertLongLongUIntToUInt64(const unsigned long long int value);
/**
- * @brief Convert one number value to another type value
- * @param value to be converted
+ * @brief Convert binary data to a string value
+ * @param data raw binary data
+ * @param data_size string length. Required to check whether the data is a
+ * printable string.
* @return conversion result
*/
-template <typename InputType, typename OutputType>
-OutputType SafeStaticCast(const InputType value) {
- DCHECK_OR_RETURN(value >= std::numeric_limits<OutputType>::min(),
- std::numeric_limits<OutputType>::min());
- DCHECK_OR_RETURN(value <= std::numeric_limits<OutputType>::max(),
- std::numeric_limits<OutputType>::max());
- return static_cast<OutputType>(value);
-}
+std::string ConvertBinaryDataToString(const uint8_t* data,
+ const size_t data_size);
/**
* @brief Convert binary data to a string value
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index f06ca15281..382f38e520 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -40,6 +40,7 @@
#include <iostream>
#include <string>
#include <vector>
+#include "utils/macro.h"
namespace file_system {
@@ -257,14 +258,6 @@ bool ReadBinaryFile(const std::string& name,
bool ReadFile(const std::string& name, std::string& result);
/**
- * @brief Convert special symbols in system path to percent-encoded
- *
- * @param name path to file
- * @return returns converted path.
- */
-const std::string ConvertPathForURL(const std::string& path);
-
-/**
* @brief Create empty file
*
* @param name path to file
diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/include/utils/logger/boostlogger.h
index 466bd98dc5..b7eeb7ab61 100644
--- a/src/components/utils/src/threads/thread_manager.cc
+++ b/src/components/utils/include/utils/logger/boostlogger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2020, Livio
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,26 +29,31 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#pragma once
-#include "utils/threads/thread_manager.h"
-#include "utils/conditional_variable.h"
-#include "utils/lock.h"
-#include "utils/logger.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
+#define BOOST_LOG_DYN_LINK 1
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include "utils/ilogger.h"
-#include <pthread.h>
+namespace logger {
-#include <list>
-#include <sstream>
+class BoostLogger : public ThirdPartyLoggerInterface {
+ public:
+ BoostLogger(const std::string& filename);
+ void Init() override;
+ void DeInit() override;
+ bool IsEnabledFor(const std::string& component,
+ LogLevel log_level) const override;
+ void PushLog(const LogMessage& log_message) override;
-#if defined(OS_LINUX)
-#include <sys/syscall.h>
-#include <unistd.h>
-#endif
+ private:
+ boost::posix_time::ptime GetLocalPosixTime(
+ const logger::TimePoint& timestamp);
-namespace threads {
+ std::string GetFilteredFunctionTrace(
+ const std::string& full_function_signature);
-SDL_CREATE_LOG_VARIABLE("Utils")
+ std::string filename_;
+};
-} // namespace threads
+} // namespace logger
diff --git a/src/components/utils/include/utils/resource_usage.h b/src/components/utils/include/utils/resource_usage.h
index 4cfe68b8bf..1c22ac5dc2 100644
--- a/src/components/utils/include/utils/resource_usage.h
+++ b/src/components/utils/include/utils/resource_usage.h
@@ -61,7 +61,8 @@ class Resources {
#if defined(__QNXNTO__)
typedef procfs_info PidStats;
-#else
+#elif defined(OS_LINUX) || defined(__ANDROID__)
+
struct PidStats {
int pid;
char comm[MAX_COMM_LEN];
@@ -108,6 +109,8 @@ class Resources {
unsigned long guest_time;
long int cguest_time;
};
+#else
+
#endif
public:
/*
diff --git a/src/components/utils/include/utils/threads/pulse_thread_delegate.h b/src/components/utils/include/utils/threads/pulse_thread_delegate.h
deleted file mode 100644
index ad6df6fca7..0000000000
--- a/src/components/utils/include/utils/threads/pulse_thread_delegate.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_
-
-#include <sys/neutrino.h>
-
-#include "utils/threads/thread_delegate.h"
-
-namespace threads {
-
-/**
- * @brief This ThreadDelegate derivative is designed
- * to implement threads waiting for QNX Pulse messages
- * When constucted, an instance of this class creates QNX channel and connects
- * to it
- * In exitThreadMain() channel is disconnected and destroyed
- * In threadMain() endless loop event is armed via pure virtual method
- * ArmEvent()
- * and thread blocks on MsgReceivePulse() waiting for Pulse
- * When Pulse comes, OnPulse() pure virtual method is invoked
- * Subclassed must implement ArmEvent() for events of interest
- * and OnPulse() for reaction on such events
- */
-class PulseThreadDelegate : public ThreadDelegate {
- public:
- /**
- * @brief default constructor
- */
- PulseThreadDelegate();
- virtual void threadMain();
- virtual void exitThreadMain();
-
- protected:
- /**
- * @brief This method is to be implemented to arm events of interest
- * @param event pointer to structure sigevent
- * @return If this method returns true, thread is blocked on
- * MsgReceivePulse() waiting for Pulse
- */
- virtual bool ArmEvent(struct sigevent* event) = 0;
- /**
- * @brief This method is invoked from threadMain() when Pulse comes
- */
- virtual void OnPulse() = 0;
-
- /**
- * This method is to be initialize child class
- * @return If this method returns false, thread will be stopped
- */
- virtual bool Init() {
- return true;
- }
-
- /**
- * Finalizes thread
- * Can free resources
- */
- virtual void Finalize() {}
-
- private:
- enum { PULSE_CODE = _PULSE_CODE_MINAVAIL + 1 };
-
- volatile bool run_;
- int chid_;
- int coid_;
-};
-
-} // namespace threads
-
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_
diff --git a/src/components/utils/include/utils/threads/thread_manager.h b/src/components/utils/include/utils/threads/thread_manager.h
deleted file mode 100644
index 4f28d0cb15..0000000000
--- a/src/components/utils/include/utils/threads/thread_manager.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_
-
-#include "utils/threads/thread.h"
-
-#include <pthread.h>
-
-#include <list>
-#include <map>
-#include <set>
-#include <string>
-
-#include "utils/conditional_variable.h"
-#include "utils/lock.h"
-#include "utils/macro.h"
-#include "utils/message_queue.h"
-#include "utils/singleton.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
-
-namespace threads {
-class Thread;
-
-/*
- * This class is here currently to remember names associated to threads.
- * It manages raw impl::PlatformHandles because Thread::Id's do not provide
- * comparison operator. Current linux implementation relies on fact that
- * pthread_t is just an integer and every thread has single unique value
- * associated with it.
- * OS provides it's own facilities to name threads but
- */
-class ThreadManager : public utils::Singleton<ThreadManager> {
- public:
- struct ThreadDesc {
- pthread_t handle;
- ThreadDelegate* delegate;
- };
- ThreadManager() {}
- MessageQueue<ThreadDesc> threads_to_terminate;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ThreadManager);
-
- FRIEND_BASE_SINGLETON_CLASS(ThreadManager);
-};
-
-} // namespace threads
-
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_
diff --git a/src/components/utils/src/back_trace.cc b/src/components/utils/src/back_trace.cc
index 048d5d0ae3..7c6d52f669 100644
--- a/src/components/utils/src/back_trace.cc
+++ b/src/components/utils/src/back_trace.cc
@@ -36,8 +36,10 @@
#include <sstream>
#include <vector>
-//#include <cxxabi.h>
-//#include <execinfo.h>
+#ifndef __ANDROID__
+#include <cxxabi.h>
+#include <execinfo.h>
+#endif
#include "utils/macro.h"
@@ -48,44 +50,50 @@ using threads::Thread;
namespace utils {
-//namespace {
-//string demangle(const char* symbol) {
-// char temp[2048];
-// if (1 == sscanf(symbol, "%*[^(]%*[^_]%2047[^)+]", temp)) {
-// size_t size;
-// int32_t status;
-// char* demangled = abi::__cxa_demangle(temp, NULL, &size, &status);
-// if (demangled != NULL) {
-// string result(demangled);
-// free(demangled);
-// return result;
-// }
-// }
-// return symbol;
-//}
-//} // namespace
+#ifndef __ANDROID__
+namespace {
+string demangle(const char* symbol) {
+ char temp[2048];
+ if (1 == sscanf(symbol, "%*[^(]%*[^_]%2047[^)+]", temp)) {
+ size_t size;
+ int32_t status;
+ char* demangled = abi::__cxa_demangle(temp, NULL, &size, &status);
+ if (demangled != NULL) {
+ string result(demangled);
+ free(demangled);
+ return result;
+ }
+ }
+ return symbol;
+}
+} // namespace
+#endif
Backtrace::Backtrace(int32_t count, int32_t skip_top)
: thread_id_(threads::Thread::CurrentId()) {
int32_t skip = skip_top + 1; // Skip this constructor
vector<void*> full_trace(count + skip);
-// int32_t captured = backtrace(&full_trace.front(), count + skip);
-// int32_t first_call = std::min(captured, skip);
-// int32_t last_call = std::min(first_call + count, captured);
-// backtrace_.assign(full_trace.begin() + first_call,
-// full_trace.begin() + last_call);
+#ifndef __ANDROID__
+ int32_t captured = backtrace(&full_trace.front(), count + skip);
+ int32_t first_call = std::min(captured, skip);
+ int32_t last_call = std::min(first_call + count, captured);
+ backtrace_.assign(full_trace.begin() + first_call,
+ full_trace.begin() + last_call);
+#endif
}
Backtrace::~Backtrace() {}
vector<string> Backtrace::CallStack() const {
vector<string> callstack;
-// callstack.reserve(backtrace_.size());
-// char** mangled = backtrace_symbols(&backtrace_.front(), backtrace_.size());
-// for (size_t i = 0; i != backtrace_.size(); ++i) {
-// callstack.push_back(demangle(mangled[i]));
-// }
-// free(mangled);
+#ifndef __ANDROID__
+ callstack.reserve(backtrace_.size());
+ char** mangled = backtrace_symbols(&backtrace_.front(), backtrace_.size());
+ for (size_t i = 0; i != backtrace_.size(); ++i) {
+ callstack.push_back(demangle(mangled[i]));
+ }
+ free(mangled);
+#endif
return callstack;
}
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index f0c838a7f9..b2c1f44c53 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -458,25 +458,6 @@ bool file_system::ReadFile(const std::string& name, std::string& result) {
return true;
}
-const std::string file_system::ConvertPathForURL(const std::string& path) {
- SDL_LOG_AUTO_TRACE();
- const std::string reserved_symbols = "!#$&'()*+,:;=?@[] ";
- std::string converted_path;
-
- for (const auto symbol : path) {
- size_t pos = reserved_symbols.find_first_of(symbol);
- if (pos != std::string::npos) {
- const size_t size = 100;
- char percent_value[size];
- snprintf(percent_value, size, "%%%x", symbol);
- converted_path += percent_value;
- } else {
- converted_path += symbol;
- }
- }
- return converted_path;
-}
-
bool file_system::CreateFile(const std::string& path) {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/utils/src/lock_boost.cc b/src/components/utils/src/lock_boost.cc
index 735b31d882..53b8dc3ace 100644
--- a/src/components/utils/src/lock_boost.cc
+++ b/src/components/utils/src/lock_boost.cc
@@ -72,7 +72,7 @@ void Lock::AssertFreeAndMarkTaken() {
SDL_LOG_FATAL("Locking already taken not recursive mutex");
NOTREACHED();
}
- lock_taken_++;
+ ++lock_taken_;
}
void Lock::AssertTakenAndMarkFree() {
@@ -80,7 +80,7 @@ void Lock::AssertTakenAndMarkFree() {
SDL_LOG_FATAL("Unlocking a mutex that is not taken");
NOTREACHED();
}
- lock_taken_--;
+ --lock_taken_;
}
// Recursive lock looks the same on the surface, some code duplication is
@@ -112,7 +112,7 @@ bool RecursiveLock::Try() {
}
void RecursiveLock::AssertFreeAndMarkTaken() {
- lock_taken_++;
+ ++lock_taken_;
}
void RecursiveLock::AssertTakenAndMarkFree() {
@@ -120,7 +120,7 @@ void RecursiveLock::AssertTakenAndMarkFree() {
SDL_LOG_FATAL("Unlocking a recursive mutex that is not taken");
NOTREACHED();
}
- lock_taken_--;
+ --lock_taken_;
}
} // namespace sync_primitives
diff --git a/src/components/utils/src/logger/androidlogger.cc b/src/components/utils/src/logger/androidlogger.cc
index 80ae3bd698..0cbca33ad8 100644
--- a/src/components/utils/src/logger/androidlogger.cc
+++ b/src/components/utils/src/logger/androidlogger.cc
@@ -34,24 +34,22 @@
#include <android/log.h>
-namespace{
- std::chrono::high_resolution_clock::time_point init_time_point;
+namespace {
+std::chrono::high_resolution_clock::time_point init_time_point;
}
namespace logger {
-AndroidLogger::AndroidLogger(){
-}
+AndroidLogger::AndroidLogger() {}
void AndroidLogger::Init() {
- init_time_point = std::chrono::high_resolution_clock::now();
+ init_time_point = std::chrono::high_resolution_clock::now();
}
-void AndroidLogger::DeInit() {
-}
+void AndroidLogger::DeInit() {}
android_LogPriority getLogLevel(LogLevel log_level) {
- switch (log_level) {
+ switch (log_level) {
case LogLevel::TRACE_LEVEL:
return android_LogPriority::ANDROID_LOG_VERBOSE;
case LogLevel::DEBUG_LEVEL:
@@ -75,27 +73,24 @@ bool AndroidLogger::IsEnabledFor(const std::string& component,
}
void AndroidLogger::PushLog(const LogMessage& log_message) {
-
- auto timeInMicroSec =
- std::chrono::duration_cast<std::chrono::microseconds>
- (log_message.timestamp_ - init_time_point).count();
+ auto timeInMicroSec = std::chrono::duration_cast<std::chrono::microseconds>(
+ log_message.timestamp_ - init_time_point)
+ .count();
std::string time_stamp;
- time_stamp += std::to_string((timeInMicroSec % 1000000000) / 1000000 ); // sec
+ time_stamp += std::to_string((timeInMicroSec % 1000000000) / 1000000); // sec
time_stamp += "::";
- time_stamp += std::to_string((timeInMicroSec % 1000000) / 1000 ); // mls
+ time_stamp += std::to_string((timeInMicroSec % 1000000) / 1000); // mls
time_stamp += "::";
- time_stamp += std::to_string(timeInMicroSec % 1000); // mcs
+ time_stamp += std::to_string(timeInMicroSec % 1000); // mcs
- __android_log_print(
- getLogLevel(log_message.log_level_),
- time_stamp.c_str(),
- "%s: %s:%d %s",
- log_message.log_event_.c_str(),
- log_message.location_.file_name.c_str(),
- log_message.location_.line_number,
- log_message.location_.function_name.c_str()
- );
+ __android_log_print(getLogLevel(log_message.log_level_),
+ time_stamp.c_str(),
+ "%s: %s:%d %s",
+ log_message.log_event_.c_str(),
+ log_message.location_.file_name.c_str(),
+ log_message.location_.line_number,
+ log_message.location_.function_name.c_str());
}
} // namespace logger
diff --git a/src/components/utils/src/logger/boostlogger.cc b/src/components/utils/src/logger/boostlogger.cc
new file mode 100644
index 0000000000..ea85186aae
--- /dev/null
+++ b/src/components/utils/src/logger/boostlogger.cc
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2020, 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 "utils/logger/boostlogger.h"
+
+#include <boost/format.hpp>
+#include <boost/log/core.hpp>
+#include <boost/log/expressions.hpp>
+#include <boost/log/sinks/sync_frontend.hpp>
+#include <boost/log/sinks/text_file_backend.hpp>
+#include <boost/log/sinks/text_ostream_backend.hpp>
+#include <boost/log/sources/logger.hpp>
+#include <boost/log/sources/record_ostream.hpp>
+#include <boost/log/sources/severity_channel_logger.hpp>
+#include <boost/log/sources/severity_logger.hpp>
+#include <boost/log/support/date_time.hpp>
+#include <boost/log/trivial.hpp>
+#include <boost/log/utility/setup/common_attributes.hpp>
+#include <boost/log/utility/setup/file.hpp>
+#include <boost/log/utility/setup/from_settings.hpp>
+#include <boost/log/utility/setup/settings_parser.hpp>
+#include <fstream>
+
+#include <boost/date_time/c_local_time_adjustor.hpp>
+#include <boost/date_time/local_time_adjustor.hpp>
+
+#include <boost/regex.hpp>
+
+namespace logger {
+
+namespace logging = boost::log;
+namespace src = boost::log::sources;
+namespace sinks = boost::log::sinks;
+namespace keywords = boost::log::keywords;
+namespace expr = boost::log::expressions;
+namespace attrs = boost::log::attributes;
+
+BoostLogger::BoostLogger(const std::string& filename) : filename_(filename) {}
+
+void BoostLogger::Init() {
+ // Add formatting parameters to INI file
+ // Allows %Severity% to be used in ini config file for property Format.
+ boost::log::register_simple_formatter_factory<
+ boost::log::trivial::severity_level,
+ char>("Severity");
+ boost::log::register_simple_formatter_factory<std::string, char>("Component");
+ boost::log::register_simple_formatter_factory<boost::posix_time::ptime, char>(
+ "TimeStamp");
+ boost::log::register_simple_formatter_factory<std::thread::id, char>(
+ "ThreadId");
+ boost::log::register_simple_formatter_factory<std::string, char>("FileName");
+ boost::log::register_simple_formatter_factory<int, char>("LineNum");
+ boost::log::register_simple_formatter_factory<std::string, char>("Trace");
+
+ // Add filter parameters to INI file
+ // Allows %Severity% to be used in ini config file for property Filter.
+ boost::log::
+ register_simple_filter_factory<boost::log::trivial::severity_level, char>(
+ "Severity");
+ boost::log::register_simple_filter_factory<std::string, char>("Component");
+ boost::log::register_simple_filter_factory<std::string, char>("Trace");
+
+ std::ifstream file(filename_);
+ boost::log::settings settings = boost::log::parse_settings(file);
+
+ // Custom Settings
+
+ if (settings.has_section("Sinks")) {
+ auto& sinks = settings.property_tree().get_child("Sinks");
+
+ for (auto it = sinks.begin(); it != sinks.end();) {
+ bool to_be_removed = false;
+ std::string sink_name = "Sinks." + it->first;
+
+ // Disable logging for particular sinks
+ if (boost::optional<std::string> param =
+ settings[sink_name]["DisableLogging"]) {
+ to_be_removed = (param.get() == "true");
+ }
+
+ if (to_be_removed) {
+ it = sinks.erase(it);
+ } else {
+ it++;
+ }
+ }
+ }
+
+ logging::init_from_settings(settings);
+}
+
+void BoostLogger::DeInit() {
+ logging::core::get()->remove_all_sinks();
+}
+
+logging::trivial::severity_level getBoostLogLevel(LogLevel log_level) {
+ switch (log_level) {
+ case LogLevel::TRACE_LEVEL:
+ return logging::trivial::severity_level::trace;
+ case LogLevel::DEBUG_LEVEL:
+ return logging::trivial::severity_level::debug;
+ case LogLevel::INFO_LEVEL:
+ return logging::trivial::severity_level::info;
+ case LogLevel::WARNING_LEVEL:
+ return logging::trivial::severity_level::warning;
+ case LogLevel::ERROR_LEVEL:
+ return logging::trivial::severity_level::error;
+ case LogLevel::FATAL_LEVEL:
+ return logging::trivial::severity_level::fatal;
+ default:
+ assert(false);
+ return logging::trivial::severity_level::trace;
+ }
+}
+
+boost::posix_time::ptime BoostLogger::GetLocalPosixTime(
+ const logger::TimePoint& timestamp) {
+ auto time = std::chrono::duration_cast<std::chrono::microseconds>(
+ timestamp.time_since_epoch())
+ .count();
+
+ boost::posix_time::ptime time_epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::ptime utc_time =
+ time_epoch + boost::posix_time::microseconds(time);
+
+ typedef boost::date_time::c_local_adjustor<boost::posix_time::ptime>
+ local_adj;
+ auto local_time = local_adj::utc_to_local(utc_time);
+
+ return local_time;
+}
+
+std::string BoostLogger::GetFilteredFunctionTrace(
+ const std::string& full_function_signature) {
+ boost::regex function_pattern("([^\\s]*)\\((.*)\\)");
+ boost::smatch results;
+
+ if (!boost::regex_search(
+ full_function_signature, results, function_pattern)) {
+ // Invalid pattern
+ return std::string(full_function_signature);
+ }
+
+ // Get the function name(including namespaces) from the function signature
+ return std::string(results[1]);
+}
+
+bool BoostLogger::IsEnabledFor(const std::string& component,
+ LogLevel log_level) const {
+ // Basic filtering based on component name and log level is currently handled
+ // using the Filter attribute. This function should be implemented if we add
+ // custom attributes for filtering or additional logic for filtering based on
+ // component name and log level.
+ return true;
+}
+
+void BoostLogger::PushLog(const LogMessage& log_message) {
+ auto local_time = GetLocalPosixTime(log_message.timestamp_);
+ std::string func_name =
+ GetFilteredFunctionTrace(log_message.location_.function_name);
+
+ src::severity_logger<logging::trivial::severity_level> slg;
+ slg.add_attribute("TimeStamp",
+ attrs::constant<boost::posix_time::ptime>(local_time));
+ slg.add_attribute("ThreadId",
+ attrs::constant<std::thread::id>(log_message.thread_id_));
+ slg.add_attribute("Component",
+ attrs::constant<std::string>(log_message.component_));
+ slg.add_attribute(
+ "FileName",
+ attrs::constant<std::string>(log_message.location_.file_name));
+ slg.add_attribute("LineNum",
+ attrs::constant<int>(log_message.location_.line_number));
+ slg.add_attribute("Trace", attrs::constant<std::string>(func_name));
+
+ BOOST_LOG_SEV(slg, getBoostLogLevel(log_message.log_level_))
+ << log_message.log_event_;
+}
+
+} // namespace logger
diff --git a/src/components/utils/src/logger/log4cxxlogger.cc b/src/components/utils/src/logger/log4cxxlogger.cc
index 7d43892073..1e87d8cc53 100644
--- a/src/components/utils/src/logger/log4cxxlogger.cc
+++ b/src/components/utils/src/logger/log4cxxlogger.cc
@@ -90,6 +90,7 @@ log4cxx::LevelPtr getLogLevel(LogLevel log_level) {
return log4cxx::Level::getFatal();
default:
assert(false);
+ return log4cxx::Level::getTrace();
}
}
diff --git a/src/components/utils/src/logger/logger_impl.cc b/src/components/utils/src/logger/logger_impl.cc
index 4019220ec3..1439f7327a 100644
--- a/src/components/utils/src/logger/logger_impl.cc
+++ b/src/components/utils/src/logger/logger_impl.cc
@@ -36,8 +36,6 @@
namespace logger {
-Logger* Logger::instance_ = nullptr;
-
LoggerImpl::LoggerImpl(bool use_message_loop_thread)
: impl_(nullptr), use_message_loop_thread_(use_message_loop_thread) {}
@@ -70,8 +68,6 @@ void LoggerImpl::DeInit() {
if (impl_) {
impl_->DeInit();
}
-
- instance_ = nullptr;
}
void LoggerImpl::Flush() {
@@ -100,6 +96,7 @@ void LoggerImpl::PushLog(const LogMessage& log_message) {
}
Logger& Logger::instance(Logger* pre_init) {
+ static Logger* instance_;
if (pre_init) {
assert(instance_ == nullptr);
instance_ = pre_init;
diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc
deleted file mode 100644
index 79174ae693..0000000000
--- a/src/components/utils/src/threads/pulse_thread_delegate.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 <sys/netmgr.h>
-
-#include "utils/logger.h"
-#include "utils/threads/pulse_thread_delegate.h"
-
-namespace threads {
-
-SDL_CREATE_LOG_VARIABLE("Utils")
-
-PulseThreadDelegate::PulseThreadDelegate() : run_(false) {
- SDL_LOG_TRACE("Creating QNX channel");
- chid_ = ChannelCreate(0);
- if (chid_ == -1) {
- SDL_LOG_ERROR("Failed to create QNX channel");
- return;
- }
- SDL_LOG_DEBUG("Created QNX channel " << chid_);
-
- SDL_LOG_TRACE("Connecting to QNX channel " << chid_);
- coid_ = ConnectAttach(ND_LOCAL_NODE, 0, chid_, _NTO_SIDE_CHANNEL, 0);
- if (coid_ == -1) {
- SDL_LOG_ERROR("Failed to connect to QNX channel " << chid_);
- return;
- }
- SDL_LOG_DEBUG("Connected to QNX channel " << chid_);
-
- run_ = true;
-}
-
-void PulseThreadDelegate::threadMain() {
- if (!Init()) {
- SDL_LOG_ERROR("Failed to initialize thread for QNX channel " << chid_);
- return;
- }
- while (run_) {
- struct sigevent event;
- SIGEV_PULSE_INIT(&event, coid_, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE, 0);
- if (ArmEvent(&event)) {
- struct _pulse pulse;
- SDL_LOG_INFO("Waiting for pulse on QNX channel " << chid_);
- if (MsgReceivePulse(chid_, &pulse, sizeof(pulse), 0) != -1) {
- SDL_LOG_INFO("Received pulse on QNX channel " << chid_);
- switch (pulse.code) {
- case PULSE_CODE:
- OnPulse();
- break;
- }
- } else {
- if (run_) {
- SDL_LOG_WARN("Error occurred while waiting for pulse on QNX channel "
- << chid_);
- } else {
- SDL_LOG_INFO("QNX channel " << chid_ << " is apparently destroyed");
- }
- }
- }
- }
- Finalize();
-}
-
-void PulseThreadDelegate::exitThreadMain() {
- run_ = false;
-
- SDL_LOG_TRACE("Disconnecting from QNX channel " << chid_);
- if (ConnectDetach(coid_) != -1) {
- SDL_LOG_DEBUG("Disconnected from QNX channel " << chid_);
- } else {
- SDL_LOG_WARN("Failed to disconnect from QNX channel " << chid_);
- }
-
- SDL_LOG_TRACE("Destroying QNX channel " << chid_);
- if (ChannelDestroy(chid_) != -1) { // unblocks MsgReceivePulse()
- SDL_LOG_DEBUG("QNX channel " << chid_ << " destroyed");
- } else {
- SDL_LOG_WARN("Failed to destroy QNX channel " << chid_);
- }
-}
-
-} // namespace threads
diff --git a/src/components/utils/src/threads/thread_delegate.cc b/src/components/utils/src/threads/thread_delegate.cc
index 22fc4c3f18..d298ab9f0b 100644
--- a/src/components/utils/src/threads/thread_delegate.cc
+++ b/src/components/utils/src/threads/thread_delegate.cc
@@ -39,7 +39,7 @@
#ifdef __ANDROID__
#include "utils/threads/pthread_android.h"
-#endif // __ANDROID__
+#endif // __ANDROID__
namespace threads {
diff --git a/src/components/utils/src/threads/thread_posix.cc b/src/components/utils/src/threads/thread_posix.cc
index f935ffc612..2db1496c96 100644
--- a/src/components/utils/src/threads/thread_posix.cc
+++ b/src/components/utils/src/threads/thread_posix.cc
@@ -45,7 +45,7 @@
#ifdef __ANDROID__
#include "utils/threads/pthread_android.h"
-#endif // __ANDROID__
+#endif // __ANDROID__
#ifndef __QNXNTO__
const int EOK = 0;
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index 6c4a7b06ef..855a1bc169 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -87,7 +87,9 @@ void timer::Timer::Start(const Milliseconds timeout,
single_shot_ = false;
break;
}
- default: { ASSERT("timer_type should be kSingleShot or kPeriodic"); }
+ default: {
+ ASSERT("timer_type should be kSingleShot or kPeriodic");
+ }
};
StartDelegate(timeout);
StartThread();
@@ -153,7 +155,7 @@ void timer::Timer::StopThread() {
thread_->Stop(threads::Thread::kThreadSoftStop);
#else
thread_->Stop(threads::Thread::kThreadStopDelegate);
-#endif // __ANDROID__
+#endif // __ANDROID__
}
delegate_->set_finalized_flag(false);
}
diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt
index 2db7d72d84..c09d2d7ce6 100644
--- a/src/components/utils/test/CMakeLists.txt
+++ b/src/components/utils/test/CMakeLists.txt
@@ -93,7 +93,12 @@ set(LIBRARIES
create_test(utils_test "${SOURCES}" "${LIBRARIES}")
file(COPY testscript.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+if (${LOGGER_NAME} STREQUAL "LOG4CXX")
+ file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+else()
+ file(COPY boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+
file(COPY smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(test_generator)
diff --git a/src/components/utils/test/boostlogconfig.ini b/src/components/utils/test/boostlogconfig.ini
new file mode 100644
index 0000000000..f33da81c93
--- /dev/null
+++ b/src/components/utils/test/boostlogconfig.ini
@@ -0,0 +1,51 @@
+# Core settings
+[Core]
+DisableLogging=false
+
+# Console Logging
+[Sinks.Console]
+DisableLogging=true
+Destination=Console
+Filter="%Severity% > trace"
+Format="%Severity% [%TimeStamp%][%Component%] %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# SDL log file
+[Sinks.AllMessages]
+DisableLogging=false
+Destination=TextFile
+FileName=SmartDeviceLinkCore.log
+Append=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for all TransportManager messages
+[Sinks.TransportManager]
+DisableLogging=false
+Destination=TextFile
+FileName=TransportManager.log
+Append=false
+Filter="%Component% = TransportManager"
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager)
+[Sinks.ProtocolFordHandling]
+DisableLogging=false
+Destination=TextFile
+FileName=ProtocolFordHandling.log
+Append=false
+Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager"
+Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%"
+AutoFlush=true
+Asynchronous=true
+
+[Sinks.Telnet]
+DisableLogging=true
+Destination=Syslog
+Asynchronous=true
+Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%"
+LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file
diff --git a/src/components/utils/test/file_system_test.cc b/src/components/utils/test/file_system_test.cc
index 3d518e599f..9d4e943df6 100644
--- a/src/components/utils/test/file_system_test.cc
+++ b/src/components/utils/test/file_system_test.cc
@@ -47,8 +47,8 @@ typedef std::vector<std::string> StringArray;
using namespace file_system;
namespace {
-StringArray MergeStringsToArray(const std::string& first,
- const std::string& second) {
+StringArray MergeStringsToArray(const std::string first,
+ const std::string second) {
StringArray array_of_strings;
array_of_strings.reserve(2);
@@ -1113,15 +1113,6 @@ TEST(FileSystemTest, GetAvailableDiskSpace) {
EXPECT_FALSE(DirectoryExists("./Test directory"));
}
-TEST(FileSystemTest, ConvertPathForURL) {
- std::string path = "./Test directory";
- EXPECT_NE(path, ConvertPathForURL(path));
- std::string path_brackets = "./Test_directory_with(brackets)";
- EXPECT_NE(path_brackets, ConvertPathForURL(path));
- std::string another_path = "./Test_directory/new_directory_without_spaces";
- EXPECT_EQ(another_path, ConvertPathForURL(another_path));
-}
-
TEST(FileSystemTest, DirectorySize) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectory("./Test directory");
diff --git a/src/components/utils/test/policy.sql b/src/components/utils/test/policy.sql
index d588d695a6..ed627b5fdc 100644
--- a/src/components/utils/test/policy.sql
+++ b/src/components/utils/test/policy.sql
@@ -22,6 +22,7 @@ BEGIN TRANSACTION;
`ccpu_version` VARCHAR(45),
`language` VARCHAR(45),
`wers_country_code` VARCHAR(45),
+ `hardware_version` VARCHAR(45),
`pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0,
`pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0,
`ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0,
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index cd518c1cb7..26e721bc5f 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -28,6 +28,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-if(ENABLE_LOG AND NOT ANDROID)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX" AND NOT ANDROID)
add_subdirectory(appenders)
endif()
diff --git a/src/plugins/appenders/CMakeLists.txt b/src/plugins/appenders/CMakeLists.txt
index 60220037bf..119ec0d0db 100644
--- a/src/plugins/appenders/CMakeLists.txt
+++ b/src/plugins/appenders/CMakeLists.txt
@@ -30,15 +30,19 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+if (${LOGGER_NAME} STREQUAL "LOG4CXX")
include_directories(
${LOG4CXX_INCLUDE_DIRECTORY}
)
+endif()
collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
+if (${LOGGER_NAME} STREQUAL "LOG4CXX")
set(LIBRARIES
log4cxx -L${LOG4CXX_LIBS_DIRECTORY}
)
+endif()
add_library(appenders SHARED ${SOURCES})
target_link_libraries(appenders ${LIBRARIES})
diff --git a/tools/InterfaceGenerator/generator/generators/PolicyTypes.py b/tools/InterfaceGenerator/generator/generators/PolicyTypes.py
index 53c3062f30..116273d82c 100644
--- a/tools/InterfaceGenerator/generator/generators/PolicyTypes.py
+++ b/tools/InterfaceGenerator/generator/generators/PolicyTypes.py
@@ -441,7 +441,7 @@ class CodeGenerator(object):
is True else u"// {0}\n").format(x)
for x in self._normalize_multiline_comments(
interface_item_base.description)])
- if description is not u"":
+ if description != u"":
description = u"".join([u" *\n" if use_doxygen
is True else u"//\n", description])
@@ -451,7 +451,7 @@ class CodeGenerator(object):
self._normalize_multiline_comments(
interface_item_base.
design_description)])
- if design_description is not u"":
+ if design_description != u"":
design_description = u"".join([u" *\n" if use_doxygen is
True else "//\n",
design_description])
@@ -460,7 +460,7 @@ class CodeGenerator(object):
True else u"// Note: {0}\n").format(x)
for x in self._normalize_multiline_comments(
[x.value for x in interface_item_base.issues])])
- if issues is not u"":
+ if issues != u"":
issues = u"".join([u" *\n" if use_doxygen is
True else u"//\n", issues])
@@ -468,7 +468,7 @@ class CodeGenerator(object):
True else u"// ToDo: {0}\n").format(x)
for x in self._normalize_multiline_comments(
interface_item_base.todos)])
- if todos is not u"":
+ if todos != u"":
todos = u"".join([u" *\n" if use_doxygen is
True else u"//\n", todos])
@@ -505,7 +505,7 @@ class CodeGenerator(object):
return u"".join(
[u"{0}{1}\n".format(
self._indent_template * indent_level,
- x) if x is not u"" else u"\n" for x in code_lines])
+ x) if x != u"" else u"\n" for x in code_lines])
@staticmethod
def _normalize_multiline_comments(initial_strings):
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
index 73ab03f205..dffaa6c1b5 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
@@ -564,6 +564,7 @@ class CodeGenerator(object):
struct_name=struct.name,
code=self._indent_code(
self._struct_impl_code_tempate.substitute(
+ struct_name=struct.name,
schema_loc_decl=self._gen_schema_loc_decls(
struct.members.values(), processed_enums),
schema_items_decl=self._gen_schema_items_decls(
@@ -758,7 +759,7 @@ class CodeGenerator(object):
result_array = []
result_array.append(self._impl_code_shared_ptr_vector_template.substitute(var_name = name))
result = u"\n".join(result_array)
- if result is not "":
+ if result != "":
result += u"\n\n"
return result
@@ -784,12 +785,13 @@ class CodeGenerator(object):
result_array.append(self._impl_code_item_decl_template.substitute(
comment="",
var_name=self._gen_schema_item_var_name(item),
+ var_type="std::shared_ptr<ISchemaItem>",
item_decl=self._impl_function_schema))
result_array.append(self._gen_function_history_vector_item_fill(item, member.name))
count += 1
result = u"\n\n".join(result_array)
- if result is not "":
+ if result != "":
result += u"\n\n"
return result
@@ -810,6 +812,7 @@ class CodeGenerator(object):
return self._impl_code_item_decl_template.substitute(
comment=self._gen_comment(member, False),
var_name=self._gen_schema_item_var_name(member),
+ var_type="ISchemaItem*" if type(member.param_type) is Struct else "std::shared_ptr<ISchemaItem>",
item_decl=self._gen_schema_item_decl_code(
member.param_type,
member.name,
@@ -837,22 +840,37 @@ class CodeGenerator(object):
[[u"bool", None if param.default_value is None
else u"true" if param.default_value is True else u"false"]]))
elif type(param) is Integer:
- if not param.max_value or param.max_value and param.max_value < 2 ** 31:
+ if param.min_value is not None and param.min_value >= 0:
+ if param.max_value is None or param.max_value >= 2 ** 32:
+ code = self._impl_code_integer_item_template.substitute(
+ type=u"uint64_t",
+ params=self._gen_schema_item_param_values(
+ [[u"uint64_t", param.min_value],
+ [u"uint64_t", param.max_value],
+ [u"uint64_t", param.default_value]]))
+ else:
+ code = self._impl_code_integer_item_template.substitute(
+ type=u"uint32_t",
+ params=self._gen_schema_item_param_values(
+ [[u"uint32_t", param.min_value],
+ [u"uint32_t", param.max_value],
+ [u"uint32_t", param.default_value]]))
+ elif (param.min_value is not None and param.min_value >= -(2 ** 31)) and (param.max_value is not None and param.max_value < 2 ** 31):
code = self._impl_code_integer_item_template.substitute(
type=u"int32_t",
params=self._gen_schema_item_param_values(
[[u"int32_t", param.min_value],
[u"int32_t", param.max_value],
[u"int32_t", param.default_value]]))
- elif param.max_value < 2 ** 63:
+ elif (param.min_value is None or param.min_value >= -(2 ** 63)) and (param.max_value is None or param.max_value < 2 ** 63):
code = self._impl_code_integer_item_template.substitute(
type=u"int64_t",
params=self._gen_schema_item_param_values(
[[u"int64_t", param.min_value],
- [u"int64_t", str(param.max_value) + u"LL"],
+ [u"int64_t", param.max_value],
[u"int64_t", param.default_value]]))
else:
- raise GenerateError("Parameter value too large: " + str(param.max_value))
+ raise GenerateError("Parameter value too large/small: " + str(param.min_value) + "/" + str(param.max_value))
elif type(param) is Float:
code = self._impl_code_integer_item_template.substitute(
type=u"double",
@@ -1415,7 +1433,7 @@ class CodeGenerator(object):
is True else u"// {0}\n").format(x)
for x in self._normalize_multiline_comments(
interface_item_base.description)])
- if description is not u"":
+ if description != u"":
description = u"".join([u" *\n" if use_doxygen
is True else u"//\n", description])
@@ -1425,7 +1443,7 @@ class CodeGenerator(object):
self._normalize_multiline_comments(
interface_item_base.
design_description)])
- if design_description is not u"":
+ if design_description != u"":
design_description = u"".join([u" *\n" if use_doxygen is
True else "//\n",
design_description])
@@ -1434,7 +1452,7 @@ class CodeGenerator(object):
True else u"// Note: {0}\n").format(x)
for x in self._normalize_multiline_comments(
[x.value for x in interface_item_base.issues])])
- if issues is not u"":
+ if issues != u"":
issues = u"".join([u" *\n" if use_doxygen is
True else u"//\n", issues])
@@ -1442,7 +1460,7 @@ class CodeGenerator(object):
True else u"// ToDo: {0}\n").format(x)
for x in self._normalize_multiline_comments(
interface_item_base.todos)])
- if todos is not u"":
+ if todos != u"":
todos = u"".join([u" *\n" if use_doxygen is
True else u"//\n", todos])
@@ -1479,7 +1497,7 @@ class CodeGenerator(object):
return u"".join(
[u"{0}{1}\n".format(
self._indent_template * indent_level,
- x) if x is not u"" else u"\n" for x in code_lines])
+ x) if x != u"" else u"\n" for x in code_lines])
@staticmethod
def _normalize_multiline_comments(initial_strings):
@@ -1723,11 +1741,11 @@ class CodeGenerator(object):
u'''\n'''
u'''using namespace ns_smart_device_link::ns_smart_objects;\n'''
u'''\n'''
+ u'''$namespace::$class_name::TStructsSchemaItems $namespace::$class_name::struct_schema_items = {};\n\n'''
u'''$namespace::$class_name::$class_name()\n'''
u''' : ns_smart_device_link::ns_json_handler::CSmartFactory<FunctionID::eType, '''
u'''messageType::eType, StructIdentifiers::eType>() {\n'''
- u''' TStructsSchemaItems struct_schema_items;\n'''
- u''' InitStructSchemes(struct_schema_items);\n'''
+ u''' InitStructSchemes();\n'''
u'''\n'''
u''' std::set<FunctionID::eType> function_id_items;\n'''
u'''${function_id_items}'''
@@ -1735,7 +1753,7 @@ class CodeGenerator(object):
u''' std::set<messageType::eType> message_type_items;\n'''
u'''${message_type_items}'''
u'''\n'''
- u''' InitFunctionSchemes(struct_schema_items, function_id_items, '''
+ u''' InitFunctionSchemes(function_id_items, '''
u'''message_type_items);\n'''
u'''}\n'''
u'''\n'''
@@ -1779,13 +1797,11 @@ class CodeGenerator(object):
u''' InitFunctionSchema(function_id, message_type);\n'''
u'''}\n'''
u'''\n'''
- u'''void $namespace::$class_name::InitStructSchemes(\n'''
- u''' TStructsSchemaItems &struct_schema_items) {'''
+ u'''void $namespace::$class_name::InitStructSchemes() {'''
u'''$struct_schema_items'''
u'''}\n'''
u'''\n'''
u'''void $namespace::$class_name::InitFunctionSchemes(\n'''
- u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const std::set<FunctionID::eType> &function_id_items,\n'''
u''' const std::set<messageType::eType> &message_type_items) {\n'''
u'''$pre_function_schemas'''
@@ -1796,8 +1812,6 @@ class CodeGenerator(object):
u''' const FunctionID::eType &function_id,\n'''
u''' const messageType::eType &message_type) {\n'''
u'''\n'''
- u''' TStructsSchemaItems struct_schema_items;\n'''
- u''' InitStructSchemes(struct_schema_items);\n'''
u'''\n'''
u''' std::set<FunctionID::eType> function_id_items { function_id };\n'''
u''' std::set<messageType::eType> message_type_items { message_type };\n'''
@@ -1872,18 +1886,16 @@ class CodeGenerator(object):
u''' ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType> shema_key(function_id, message_type);\n'''
u''' functions_schemes_[shema_key] = '''
u'''InitFunction_${function_id}_${message_type}('''
- u'''struct_schema_items, function_id_items, message_type_items);\n'''
+ u'''function_id_items, message_type_items);\n'''
u''' break;\n'''
u'''}\n''')
_struct_schema_item_template = string.Template(
u'''std::shared_ptr<ISchemaItem> struct_schema_item_${name} = '''
- u'''InitStructSchemaItem_${name}(struct_schema_items);\n'''
- u'''struct_schema_items.insert(std::make_pair('''
- u'''StructIdentifiers::${name}, struct_schema_item_${name}));\n'''
+ u'''InitStructSchemaItem_${name}();\n'''
u'''structs_schemes_.insert(std::make_pair('''
u'''StructIdentifiers::${name}, CSmartSchema('''
- u'''struct_schema_item_${name})));''')
+ u'''struct_schema_item_${name})));\n''')
_function_schema_template = string.Template(
u'''functions_schemes_.insert(std::make_pair(ns_smart_device_link::'''
@@ -1891,22 +1903,25 @@ class CodeGenerator(object):
u'''SmartSchemaKey<FunctionID::eType, messageType::eType>'''
u'''(FunctionID::$function_id, messageType::$message_type), '''
u'''InitFunction_${function_id}_${message_type}('''
- u'''struct_schema_items, function_id_items, message_type_items)));''')
+ u'''function_id_items, message_type_items)));''')
_struct_impl_template = string.Template(
u'''std::shared_ptr<ISchemaItem> $namespace::$class_name::'''
- u'''InitStructSchemaItem_${struct_name}(\n'''
- u''' const TStructsSchemaItems &struct_schema_items) {\n'''
+ u'''InitStructSchemaItem_${struct_name}() {\n'''
u'''$code'''
u'''}\n''')
_struct_impl_code_tempate = string.Template(
+ u'''Members '''
+ u'''schema_members;\n'''
+ u'''std::shared_ptr<ISchemaItem> struct_schema = CObjectSchemaItem::create(schema_members);\n'''
+ u'''struct_schema_items.insert(std::make_pair(StructIdentifiers::${struct_name}, CObjectSchemaItem::create(schema_members)));\n'''
+ u'''struct_schema_items[StructIdentifiers::${struct_name}] = struct_schema;\n\n'''
u'''${schema_loc_decl}'''
u'''${schema_items_decl}'''
- u'''Members '''
- u'''schema_members;\n\n'''
u'''${schema_item_fill}'''
- u'''return CObjectSchemaItem::create(schema_members);''')
+ u'''for(auto& member : schema_members) {struct_schema->AddMemberSchemaItem(member.first, member.second);}\n'''
+ u'''return struct_schema;''')
_impl_code_loc_decl_enum_template = string.Template(
u'''std::set<${type}::eType> ${var_name};''')
@@ -1929,7 +1944,7 @@ class CodeGenerator(object):
_impl_code_item_decl_template = string.Template(
u'''${comment}'''
- u'''std::shared_ptr<ISchemaItem> ${var_name} = ${item_decl};''')
+ u'''${var_type} ${var_name} = ${item_decl};''')
_impl_code_shared_ptr_vector_template = string.Template(
u'''std::vector<SMember> ${var_name}_history_vector;''')
@@ -1951,7 +1966,7 @@ class CodeGenerator(object):
_impl_code_struct_item_template = string.Template(
u'''ProvideObjectSchemaItemForStruct(struct_schema_items, '''
- u'''StructIdentifiers::${name})''')
+ u'''StructIdentifiers::${name}).get()''')
_impl_code_enum_item_template = string.Template(
u'''TEnumSchemaItem<${type}::eType>::create(${params})''')
@@ -1985,7 +2000,6 @@ class CodeGenerator(object):
_function_impl_template = string.Template(
u'''CSmartSchema $namespace::$class_name::'''
u'''InitFunction_${function_id}_${message_type}(\n'''
- u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const std::set<FunctionID::eType> &function_id_items,\n'''
u''' const std::set<messageType::eType> &message_type_items) {\n'''
u'''$code'''
@@ -2063,20 +2077,17 @@ class CodeGenerator(object):
u''' /**\n'''
u''' * @brief Initializes all struct schemes.\n'''
u''' */\n'''
- u''' void InitStructSchemes('''
- u'''TStructsSchemaItems &struct_schema_items);\n'''
+ u''' void InitStructSchemes();\n'''
u'''\n'''
u''' /**\n'''
u''' * @brief Initializes all function schemes.\n'''
u''' *\n'''
- u''' * @param struct_schema_items Struct schema items.\n'''
u''' * @param function_id_items Set of all elements '''
u'''of FunctionID enum.\n'''
u''' * @param message_type_items Set of all elements '''
u'''of messageType enum.\n'''
u''' */\n'''
u''' void InitFunctionSchemes(\n'''
- u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const std::set<FunctionID::eType> &function_id_items,\n'''
u''' const std::set<messageType::eType> '''
u'''&message_type_items);\n'''
@@ -2094,6 +2105,7 @@ class CodeGenerator(object):
u'''$init_function_decls'''
u'''\n'''
u''' public:\n'''
+ u''' static TStructsSchemaItems struct_schema_items;\n'''
u'''$init_struct_decls'''
u'''};''')
@@ -2104,7 +2116,6 @@ class CodeGenerator(object):
u'''$comment\n'''
u'''static ns_smart_device_link::ns_smart_objects::CSmartSchema '''
u'''InitFunction_${function_id}_${message_type}(\n'''
- u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const std::set<FunctionID::eType> &function_id_items,\n'''
u''' const std::set<messageType::eType> &message_type_items);''')
@@ -2112,8 +2123,7 @@ class CodeGenerator(object):
u'''$comment\n'''
u'''static '''
u'''std::shared_ptr<ns_smart_device_link::ns_smart_objects::ISchemaItem> '''
- u'''InitStructSchemaItem_${struct_name}(\n'''
- u''' const TStructsSchemaItems &struct_schema_items);''')
+ u'''InitStructSchemaItem_${struct_name}();\n''')
_class_comment_template = string.Template(
u'''/**\n'''
diff --git a/tools/infrastructure/api_compare.py b/tools/infrastructure/api_compare.py
index 0129119673..ca1279ab61 100644..100755
--- a/tools/infrastructure/api_compare.py
+++ b/tools/infrastructure/api_compare.py
@@ -1,4 +1,5 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
import json
import sys
@@ -7,11 +8,6 @@ import argparse
import xml.etree.ElementTree as ElementTree
from collections import namedtuple
-reload(sys)
-# Enable Utf-8 support. Needed if script will be run under Windows
-sys.setdefaultencoding('utf-8')
-
-
class colors:
"""Class defining colorful output.
Works under UNIX ONLY as Windows does not support ANSI escape sequences
@@ -206,53 +202,53 @@ def print_parameters(common_params, hmi_params, mob_params):
"""Function which prints parameters in mobile, hmi api
and common parameters
"""
- print "Parameters to check: ", common_params, "\n"
+ print("Parameters to check: ", common_params, "\n")
for param in common_params:
mob_items = sorted(mob_params[param].items())
hmi_items = sorted(hmi_params[param].items())
- print colors.UNDERLINE + colors.BOLD + param + colors.ENDC, ":"
- print "In Mobile API :\t", dict(mob_items)
- print "In HMI API :\t", dict(hmi_items)
+ print(colors.UNDERLINE + colors.BOLD + param + colors.ENDC, ":")
+ print("In Mobile API :\t", dict(mob_items))
+ print("In HMI API :\t", dict(hmi_items))
def print_full_info(hmi_absent_params, hmi_params,
mob_absent_params, mob_params, rpc_name):
"""Function prints full detailed info about every rpc"""
- print "\n" + "---" * 60 + "\n"
+ print("\n" + "---" * 60 + "\n")
rpc_color = colors.BOLD + colors.HEADER
- print rpc_color + rpc_name + colors.ENDC
- print colors.BOLD + "\nMobile API: " + colors.ENDC
- print "Parameters quantity: ", len(mob_params)
- print "Parameters list: ", sorted(mob_params.keys())
- print colors.BOLD + "HMI API: " + colors.ENDC
- print "Parameters quantity: ", len(hmi_params)
- print "Parameters list: ", sorted(hmi_params.keys())
- print "\n"
+ print(rpc_color + rpc_name + colors.ENDC)
+ print(colors.BOLD + "\nMobile API: " + colors.ENDC)
+ print("Parameters quantity: ", len(mob_params))
+ print("Parameters list: ", sorted(mob_params.keys()))
+ print(colors.BOLD + "HMI API: " + colors.ENDC)
+ print("Parameters quantity: ", len(hmi_params))
+ print("Parameters list: ", sorted(hmi_params.keys()))
+ print("\n")
print("{}Parameters absent in Mobile APIs: {}{}".
format(colors.WARN, mob_absent_params, colors.ENDC))
print("{}Parameters absent in HMI APIs: {}{}".
format(colors.WARN, hmi_absent_params, colors.ENDC))
- print "\n"
+ print("\n")
def console_print(summary_result):
"""Function which prints summary result to console"""
for rpc_name in sorted(summary_result.keys()):
- print "\n" + "---" * 60
- print colors.HEADER + rpc_name + colors.ENDC
+ print("\n" + "---" * 60)
+ print(colors.HEADER + rpc_name + colors.ENDC)
for problematic_item in summary_result[rpc_name]:
item = summary_result[rpc_name][problematic_item]
if len(item) > 0:
- print colors.UNDERLINE + problematic_item + colors.ENDC
+ print(colors.UNDERLINE + problematic_item + colors.ENDC)
if type(item) is not dict:
print("{}{}{}".format(colors.WARN, item, colors.ENDC))
elif type(item) is dict:
for param in item.keys():
item_print = colors.UNDERLINE + param + colors.ENDC
- print "{} {}".format("Parameter name: ", item_print)
+ print("{} {}".format("Parameter name: ", item_print))
res_val = item[param]
for key in res_val:
- print key, ":", colors.FAIL, res_val[key], colors.ENDC
+ print(key, ":", colors.FAIL, res_val[key], colors.ENDC)
def print_summary_info(summary_result, args):
@@ -260,21 +256,21 @@ def print_summary_info(summary_result, args):
Output type depends on command line args
"""
summary_color = colors.UNDERLINE + colors.BOLD + colors.BLUE
- print "\n"
- print summary_color, "SUMMARY COMPARISON RESULT:\n", colors.ENDC
+ print("\n")
+ print(summary_color, "SUMMARY COMPARISON RESULT:\n", colors.ENDC)
if len(summary_result) == 0:
- print colors.BOLD + " === NO PROBLEMS FOUND ===" + colors.ENDC
+ print(colors.BOLD + " === NO PROBLEMS FOUND ===" + colors.ENDC)
return
if args.output == "console":
console_print(summary_result)
if args.output == "json":
json_summary_result = dict_to_json(summary_result)
- print json_summary_result
+ print(json_summary_result)
if args.output == "xml":
json_summary_result = dict_to_json(summary_result)
temp = json.loads(json_summary_result)
xml_summary_result = json_to_xml(temp)
- print xml_summary_result
+ print(xml_summary_result)
def handle_absent_params(area, absent_params, rpc_name, summary_result):
@@ -365,7 +361,7 @@ def all_compare_rule(mob_param_attributes, hmi_param_attributes):
"""Function used for all common arrtibutes comparison"""
mobile_result = {}
hmi_result = {}
- attr_names = mob_param_attributes.keys() + hmi_param_attributes.keys()
+ attr_names = [*mob_param_attributes] + [*hmi_param_attributes]
attr_names = set(attr_names)
for attr_name in attr_names:
mobile_attribute_value = None
@@ -393,8 +389,8 @@ global_compare_rules = [
mob_param_attributes["type"] == "String", string_compare_rule),
# Comparison rule when attribute "array" = "true"
(lambda mob_param_attributes, hmi_param_attributes:
- 'array' in mob_param_attributes.keys() +
- hmi_param_attributes.keys(), array_compare_rule),
+ 'array' in [*mob_param_attributes] +
+ [*hmi_param_attributes], array_compare_rule),
# Common comparison function for all attributes
(lambda mob_param_attributes, hmi_param_attributes:
True, all_compare_rule)
diff --git a/tools/infrastructure/check_style.sh b/tools/infrastructure/check_style.sh
index 006dd340d9..139d7952ee 100755
--- a/tools/infrastructure/check_style.sh
+++ b/tools/infrastructure/check_style.sh
@@ -27,7 +27,7 @@
# 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.
-FORMATER=clang-format-6.0
+FORMATER=clang-format-8
INSTALL_CMD="sudo apt-get install -f $FORMATER"
if [ "$1" = "--help" ]
diff --git a/tools/infrastructure/format_src.py b/tools/infrastructure/format_src.py
deleted file mode 100644
index b7927b2708..0000000000
--- a/tools/infrastructure/format_src.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Format all sources with clang-format. All *.cc and *h in the src dir
-are affected. Excluded from formatting sources in the "3rd_party" and
-in the "3rd_party-static" dirs. For the formatting used ".clang-format"
-in the project root.
-"""
-
-import os
-from utils import setup_working_dir, walk_dir, run_cmd
-import re
-
-
-INCLUDE_PATTERNS = ['^.*\.cc$', '^.*\.h$', '^.*\.cpp$', '^.*\.hpp$']
-EXCLUDE_PATTERNS = ['^.*3rd_party.*$']
-FORMAT_CMD = 'clang-format -i -style=file {}'
-
-
-def main():
- ''' Main logic '''
- setup_working_dir()
- print 'Current working dir is {}'.format(os.getcwd())
-
- def action(file_path):
- if re.match('|'.join(INCLUDE_PATTERNS), file_path, re.M | re.I):
- if not re.match('|'.join(EXCLUDE_PATTERNS),
- file_path,
- re.M | re.I):
- print 'Formatting file {}'.format(file_path)
- run_cmd(FORMAT_CMD.format(file_path))
- walk_dir('src', action)
-
-
-if __name__ == '__main__':
- main()
diff --git a/tools/infrastructure/git-hooks/pre-commit b/tools/infrastructure/git-hooks/pre-commit
index 710f0656c3..57fe1ae887 100755
--- a/tools/infrastructure/git-hooks/pre-commit
+++ b/tools/infrastructure/git-hooks/pre-commit
@@ -72,10 +72,10 @@ if [ "$?" -ne "0" ]; then
exit 1
fi
-# Auto update c++ files with clang-format-6.0
-CLANG_FORMAT=clang-format-6.0
+# Auto update c++ files with clang-format-8
+CLANG_FORMAT=clang-format-8
# Verify clang-format
-CLANG_FORMAT_REQUIRED_VERSION=6.0
+CLANG_FORMAT_REQUIRED_VERSION=8.0
CLANG_FORMAT_CURRENT_VERSION=$($CLANG_FORMAT -version)
if [[ $CLANG_FORMAT_CURRENT_VERSION != *$CLANG_FORMAT_REQUIRED_VERSION* ]]
then
diff --git a/tools/infrastructure/install_hooks.py b/tools/infrastructure/install_hooks.py
index 6f93e02c41..1e1f63de43 100644
--- a/tools/infrastructure/install_hooks.py
+++ b/tools/infrastructure/install_hooks.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@@ -12,14 +12,14 @@ from utils import setup_working_dir
def uninstall_hooks(hooks_dir):
- print 'Deleting existing pre-commit hooks from {}'.format(hooks_dir)
+ print('Deleting existing pre-commit hooks from {}'.format(hooks_dir))
files = glob.glob(os.path.join(hooks_dir, 'pre-commit*'))
for item in files:
os.remove(item)
def install_hooks(src_dir, dst_dir):
- print 'Installing pre-commit hooks'
+ print('Installing pre-commit hooks')
src_files = glob.glob(os.path.join(src_dir, 'pre-commit*'))
for item in src_files:
shutil.copy(item, dst_dir)
@@ -28,7 +28,7 @@ def install_hooks(src_dir, dst_dir):
def main():
''' Main logic '''
setup_working_dir()
- print 'Current working dir is {}'.format(os.getcwd())
+ print('Current working dir is {}'.format(os.getcwd()))
hooks_src_dir = os.path.join(
os.getcwd(), 'tools', 'infrastructure', 'git-hooks')
hooks_dst_dir = os.path.join(os.getcwd(), '.git', 'hooks')
diff --git a/tools/intergen/test/test_hmi_interface.xml b/tools/intergen/test/test_hmi_interface.xml
index 7573d35ef9..c5978c543c 100644
--- a/tools/intergen/test/test_hmi_interface.xml
+++ b/tools/intergen/test/test_hmi_interface.xml
@@ -456,9 +456,6 @@
<element name="totalDistance">
<description> Total distance to destination for navigation</description>
</element>
- <element name="navigationText">
- <description>Navigation text for UpdateTurnList.</description>
- </element>
<element name="audioPassThruDisplayText1">
<description> First line of text for audio pass thru</description>
</element>
@@ -471,9 +468,6 @@
<element name="sliderFooter">
<description> Footer text for slider</description>
</element>
- <element name="notificationText">
- <description>Text of notification to be displayed on screen.</description>
- </element>
<element name="menuName">
<description> Primary text for Choice</description>
</element>
diff --git a/tools/policy_table_validator/main.cpp b/tools/policy_table_validator/main.cpp
index 7e099c7ae1..cc1318d215 100644
--- a/tools/policy_table_validator/main.cpp
+++ b/tools/policy_table_validator/main.cpp
@@ -6,8 +6,13 @@
#include "utils/file_system.h"
#ifdef ENABLE_LOG
-#include "utils/logger/logger_impl.h"
+#ifdef LOG4CXX_LOGGER
#include "utils/logger/log4cxxlogger.h"
+#else // LOG4CXX_LOGGER
+#include "utils/logger/boostlogger.h"
+#endif // LOG4CXX_LOGGER
+
+#include "utils/logger/logger_impl.h"
#endif // ENABLE_LOG
#include "utils/logger.h"
@@ -55,7 +60,13 @@ int main(int argc, char** argv) {
// --------------------------------------------------------------------------
// Logger initialization
// Redefine for each paticular logger implementation
- auto logger = std::unique_ptr<logger::Log4CXXLogger>(new logger::Log4CXXLogger("log4cxx.properties"));
+#ifdef LOG4CXX_LOGGER
+ auto logger = std::unique_ptr<logger::Log4CXXLogger>(
+ new logger::Log4CXXLogger("log4cxx.properties"));
+#else // LOG4CXX_LOGGER
+ auto logger = std::unique_ptr<logger::BoostLogger>(
+ new logger::BoostLogger("boostlogconfig.ini"));
+#endif // LOG4CXX_LOGGER
auto logger_impl = std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl());
logger::Logger::instance(logger_impl.get());
logger_impl->Init(std::move(logger));
diff --git a/tools/rpc_spec b/tools/rpc_spec
-Subproject 762489ca140f246923e8bb8f54e96364e9d0101
+Subproject 12c2d1dacc4315be22bbc1f5e655f4464d9fae4