summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShobhitAd <adlakhashobhit@gmail.com>2020-08-13 14:52:10 -0400
committerShobhitAd <adlakhashobhit@gmail.com>2020-08-13 14:52:10 -0400
commit099bc5d94768812dbdd2d0cda8f211b82a002372 (patch)
treeb29853939901b526b590dea6f7ff1193ff9a271e
parente630938b2b5a012d0c9f8cb9fa4f73a7e7d4a198 (diff)
parentcb42c627b837df0ce184ba849c232dd36bd92c91 (diff)
downloadsdl_core-099bc5d94768812dbdd2d0cda8f211b82a002372.tar.gz
Merge branch 'develop' into feature/supported_character_sets
-rw-r--r--src/3rd_party/CMakeLists.txt3
-rwxr-xr-xsrc/appMain/hmi_capabilities.json1123
-rw-r--r--src/appMain/sdl_preloaded_pt.json227
-rw-r--r--src/appMain/smartDeviceLink.ini2
-rw-r--r--src/components/application_manager/include/application_manager/application.h3
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_to_hmi.h31
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h521
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h4
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h11
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc102
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc42
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc96
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc116
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc106
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc117
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc115
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc252
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc115
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc115
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc27
-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/update_sdl_response_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc115
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc115
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc38
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h7
-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/src/commands/hmi/vi_get_vehicle_type_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc109
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_response_test.cc142
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc105
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc344
-rw-r--r--src/components/application_manager/src/application_data_impl.cc7
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc79
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc20
-rw-r--r--src/components/application_manager/src/commands/request_to_hmi.cc84
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc1313
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc74
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc10
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc19
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc21
-rwxr-xr-xsrc/components/application_manager/test/CMakeLists.txt3
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc60
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json731
-rw-r--r--src/components/application_manager/test/hmi_capabilities_sc2.json6
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc1629
-rw-r--r--src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h56
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h3
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h49
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc206
-rw-r--r--src/components/application_manager/test/sdl_preloaded_pt.json12
-rw-r--r--src/components/application_manager/test/sdl_pt_update.json12
-rw-r--r--src/components/config_profile/include/config_profile/profile.h7
-rw-r--r--src/components/config_profile/src/profile.cc33
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h4
-rw-r--r--src/components/hmi_message_handler/src/mb_controller.cc64
-rw-r--r--src/components/include/application_manager/application_manager.h15
-rw-r--r--src/components/include/application_manager/application_manager_settings.h1
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h286
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h12
-rw-r--r--src/components/include/media_manager/media_manager.h16
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h12
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h12
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h4
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h1
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.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.h2
-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/interfaces/HMI_API.xml302
-rw-r--r--src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h16
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h10
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h17
-rw-r--r--src/components/media_manager/include/media_manager/media_manager_impl.h15
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_adapter.cc21
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc63
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc18
-rw-r--r--src/components/media_manager/test/media_manager_impl_test.cc21
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h12
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h12
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h4
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h2
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml3
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc13
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc10
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json24
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json12
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h12
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h12
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h4
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_regular/include/policy/pt_representation.h6
-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.h2
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc22
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc11
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc12
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc7
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc18
-rw-r--r--src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json12
-rw-r--r--src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json12
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc142
m---------tools/rpc_spec0
199 files changed, 8431 insertions, 3139 deletions
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index 4415a1bd7b..0fdc0ba013 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -235,7 +235,8 @@ if (NOT ${Boost_FOUND})
include(ExternalProject)
ExternalProject_Add(
Boost
- URL https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
+ URL https://mirror.bazel.build/dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
+ URL_HASH SHA256=da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf
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}
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index fbe9a9bb0a..99a2e4c0cc 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -325,611 +325,617 @@
"pixelPerInch": 117,
"scale": 1
},
- "seatLocationCapability": {
- "rows": 2,
- "columns": 3,
- "levels": 1,
- "seats": [
- {
- "row": 0,
- "col": 0,
- "level": 0,
- "rowspan": 1,
- "levelspan": 1,
- "colspan": 1
- }
- ]
- },
- "remoteControlCapability": {
- "buttonCapabilities": [
- {
- "longPressAvailable": true,
- "name": "AC_MAX",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "driverDistractionCapability": {
+ "menuLength": 10,
+ "subMenuDepth": 3
+ }
+ }
+ },
+ "RC" : {
+ "remoteControlCapability" : {
+ "buttonCapabilities": [
+ {
+ "longPressAvailable": true,
+ "name": "AC_MAX",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "AC",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "AC",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "RECIRCULATE",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "RECIRCULATE",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "FAN_UP",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "FAN_UP",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "FAN_DOWN",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "FAN_DOWN",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "TEMP_UP",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "TEMP_UP",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "TEMP_DOWN",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "DEFROST_MAX",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "TEMP_DOWN",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "DEFROST",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "DEFROST_MAX",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "DEFROST_REAR",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "UPPER_VENT",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "DEFROST",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "LOWER_VENT",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "DEFROST_REAR",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "VOLUME_UP",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "UPPER_VENT",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "VOLUME_DOWN",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "LOWER_VENT",
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "EJECT",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "VOLUME_UP",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "SOURCE",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "VOLUME_DOWN",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "SHUFFLE",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "EJECT",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ },
+ {
+ "longPressAvailable": true,
+ "name": "REPEAT",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "SOURCE",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "shortPressAvailable": true,
+ "upDownAvailable": false
+ }
+ ],
+ "climateControlCapabilities": [
+ {
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
},
- {
- "longPressAvailable": true,
- "name": "SHUFFLE",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
+ "acEnableAvailable": true,
+ "acMaxEnableAvailable": true,
+ "autoModeEnableAvailable": true,
+ "circulateAirEnableAvailable": true,
+ "climateEnableAvailable": true,
+ "currentTemperatureAvailable": true,
+ "defrostZone": [
+ "FRONT",
+ "REAR",
+ "ALL",
+ "NONE"
+ ],
+ "defrostZoneAvailable": true,
+ "desiredTemperatureAvailable": true,
+ "dualModeEnableAvailable": true,
+ "heatedMirrorsAvailable":true,
+ "heatedRearWindowAvailable":true,
+ "heatedSteeringWheelAvailable":true,
+ "heatedWindshieldAvailable":true,
+ "fanSpeedAvailable": true,
+ "moduleName": "primary_climate",
+ "ventilationMode": [
+ "UPPER",
+ "LOWER",
+ "BOTH",
+ "NONE"
+ ],
+ "ventilationModeAvailable": true
+ }
+ ],
+ "radioControlCapabilities": [
+ {
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": true
},
- {
- "longPressAvailable": true,
- "name": "REPEAT",
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": false
- },
- "shortPressAvailable": true,
- "upDownAvailable": false
- }
- ],
- "climateControlCapabilities": [
- {
- "moduleInfo": {
- "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
- "allowMultipleAccess": false
- },
- "acEnableAvailable": true,
- "acMaxEnableAvailable": true,
- "autoModeEnableAvailable": true,
- "circulateAirEnableAvailable": true,
- "climateEnableAvailable": true,
- "currentTemperatureAvailable": true,
- "defrostZone": [
- "FRONT",
- "REAR",
- "ALL",
- "NONE"
- ],
- "defrostZoneAvailable": true,
- "desiredTemperatureAvailable": true,
- "dualModeEnableAvailable": true,
- "heatedMirrorsAvailable":true,
- "heatedRearWindowAvailable":true,
- "heatedSteeringWheelAvailable":true,
- "heatedWindshieldAvailable":true,
- "fanSpeedAvailable": true,
- "moduleName": "primary_climate",
- "ventilationMode": [
- "UPPER",
- "LOWER",
- "BOTH",
- "NONE"
- ],
- "ventilationModeAvailable": true
- }
- ],
- "radioControlCapabilities": [
- {
- "moduleInfo": {
- "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
- "allowMultipleAccess": true
- },
- "availableHdChannelsAvailable": true,
- "hdChannelAvailable": true,
- "moduleName": "radio",
- "radioBandAvailable": true,
- "radioEnableAvailable": true,
- "radioFrequencyAvailable": true,
- "rdsDataAvailable": true,
- "signalChangeThresholdAvailable": true,
- "signalStrengthAvailable": true,
- "hdRadioEnableAvailable" : true,
- "siriusxmRadioAvailable" : true,
- "sisDataAvailable":true,
- "stateAvailable": true
- }
- ],
- "audioControlCapabilities": [
- {
- "moduleName": "audio",
- "moduleInfo": {
- "moduleId": "a279fe12-4587-4d12-8514-50f4ea9e9537",
- "allowMultipleAccess": true
- },
- "sourceAvailable": true,
- "volumeAvailable": true,
- "equalizerAvailable": true,
- "keepContextAvailable" : true,
- "equalizerMaxChannelId": 10
- }
- ],
- "seatControlCapabilities": [
- {
- "moduleName": "driver_seat",
- "moduleInfo": {
- "moduleId": "06cdec22-920e-4865-bf2e-9518463edc68",
- "allowMultipleAccess": false
- },
- "heatingEnabledAvailable" : true,
- "coolingEnabledAvailable": true,
- "heatingLevelAvailable": true,
- "coolingLevelAvailable": true,
- "horizontalPositionAvailable": true,
- "verticalPositionAvailable" : true,
- "frontVerticalPositionAvailable": true,
- "backVerticalPositionAvailable": true,
- "backTiltAngleAvailable": true,
- "headSupportHorizontalPositionAvailable": true,
- "headSupportVerticalPositionAvailable" : true,
- "massageEnabledAvailable": true,
- "massageModeAvailable": true,
- "massageCushionFirmnessAvailable": true,
- "memoryAvailable": true
- }
- ],
- "lightControlCapabilities": {
- "moduleName": "light",
- "moduleInfo": {
- "moduleId": "8d73e369-6a1f-4459-ab5a-6e432631881d",
- "allowMultipleAccess": false
- },
- "supportedLights":[
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_HIGH_BEAM",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_HIGH_BEAM",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_LOW_BEAM",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_LOW_BEAM",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_PARKING_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_PARKING_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_FOG_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_FOG_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_DAYTIME_RUNNING_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_LEFT_TURN_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FRONT_RIGHT_TURN_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_LEFT_FOG_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_RIGHT_FOG_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_LEFT_TAIL_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_RIGHT_TAIL_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_LEFT_BRAKE_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_RIGHT_BRAKE_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_LEFT_TURN_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_RIGHT_TURN_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_REGISTRATION_PLATE_LIGHT",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"HIGH_BEAMS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"LOW_BEAMS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"FOG_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"RUNNING_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"PARKING_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"BRAKE_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"REAR_REVERSING_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"SIDE_MARKER_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"LEFT_TURN_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"RIGHT_TURN_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"HAZARD_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"AMBIENT_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"OVERHEAD_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"READING_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"TRUNK_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"EXTERIOR_FRONT_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"EXTERIOR_REAR_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"EXTERIOR_LEFT_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
- "statusAvailable":true,
- "densityAvailable":true,
- "name":"EXTERIOR_RIGHT_LIGHTS",
- "rgbColorSpaceAvailable":true
- },
- {
+ "availableHdChannelsAvailable": true,
+ "hdChannelAvailable": true,
+ "moduleName": "radio",
+ "radioBandAvailable": true,
+ "radioEnableAvailable": true,
+ "radioFrequencyAvailable": true,
+ "rdsDataAvailable": true,
+ "signalChangeThresholdAvailable": true,
+ "signalStrengthAvailable": true,
+ "hdRadioEnableAvailable" : true,
+ "siriusxmRadioAvailable" : true,
+ "sisDataAvailable":true,
+ "stateAvailable": true
+ }
+ ],
+ "audioControlCapabilities": [
+ {
+ "moduleName": "audio",
+ "moduleInfo": {
+ "moduleId": "a279fe12-4587-4d12-8514-50f4ea9e9537",
+ "allowMultipleAccess": true
+ },
+ "sourceAvailable": true,
+ "volumeAvailable": true,
+ "equalizerAvailable": true,
+ "keepContextAvailable" : true,
+ "equalizerMaxChannelId": 10
+ }
+ ],
+ "seatControlCapabilities": [
+ {
+ "moduleName": "driver_seat",
+ "moduleInfo": {
+ "moduleId": "06cdec22-920e-4865-bf2e-9518463edc68",
+ "allowMultipleAccess": false
+ },
+ "heatingEnabledAvailable" : true,
+ "coolingEnabledAvailable": true,
+ "heatingLevelAvailable": true,
+ "coolingLevelAvailable": true,
+ "horizontalPositionAvailable": true,
+ "verticalPositionAvailable" : true,
+ "frontVerticalPositionAvailable": true,
+ "backVerticalPositionAvailable": true,
+ "backTiltAngleAvailable": true,
+ "headSupportHorizontalPositionAvailable": true,
+ "headSupportVerticalPositionAvailable" : true,
+ "massageEnabledAvailable": true,
+ "massageModeAvailable": true,
+ "massageCushionFirmnessAvailable": true,
+ "memoryAvailable": true
+ }
+ ],
+ "lightControlCapabilities": {
+ "moduleName": "light",
+ "moduleInfo": {
+ "moduleId": "8d73e369-6a1f-4459-ab5a-6e432631881d",
+ "allowMultipleAccess": false
+ },
+ "supportedLights":[
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_HIGH_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_HIGH_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_LOW_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_LOW_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_PARKING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_PARKING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_DAYTIME_RUNNING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_TAIL_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_TAIL_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_BRAKE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_BRAKE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_REGISTRATION_PLATE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"HIGH_BEAMS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"LOW_BEAMS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FOG_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"RUNNING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"PARKING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"BRAKE_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_REVERSING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"SIDE_MARKER_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"LEFT_TURN_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"RIGHT_TURN_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"HAZARD_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"AMBIENT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"OVERHEAD_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"READING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"TRUNK_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_FRONT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_REAR_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_LEFT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_RIGHT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"REAR_CARGO_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"REAR_TRUCK_BED_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"REAR_TRAILER_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"LEFT_SPOT_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"RIGHT_SPOT_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"LEFT_PUDDLE_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":false,
"densityAvailable":false,
"name":"RIGHT_PUDDLE_LIGHTS",
"rgbColorSpaceAvailable":false
- },
- {
+ },
+ {
"statusAvailable":true,
"densityAvailable":false,
"name":"EXTERIOR_ALL_LIGHTS",
"rgbColorSpaceAvailable":false
- }
- ]
- },
- "hmiSettingsControlCapabilities": {
- "moduleName": "hmiSettings",
- "moduleInfo": {
- "moduleId": "c8cace3c-d482-4be1-8862-624a21e34563",
- "allowMultipleAccess": true
- },
- "distanceUnitAvailable": true,
- "temperatureUnitAvailable": true,
- "displayModeUnitAvailable": true
- }
+ }
+ ]
+ },
+ "hmiSettingsControlCapabilities": {
+ "moduleName": "hmiSettings",
+ "moduleInfo": {
+ "moduleId": "c8cace3c-d482-4be1-8862-624a21e34563",
+ "allowMultipleAccess": true
+ },
+ "distanceUnitAvailable": true,
+ "temperatureUnitAvailable": true,
+ "displayModeUnitAvailable": true
}
+ },
+ "seatLocationCapability": {
+ "rows": 2,
+ "columns": 3,
+ "levels": 1,
+ "seats": [
+ {
+ "row": 0,
+ "col": 0,
+ "level": 0,
+ "rowspan": 1,
+ "levelspan": 1,
+ "colspan": 1
+ }
+ ]
}
},
"VR": {
- "capabilities": ["TEXT"],
+ "vrCapabilities": ["TEXT"],
"language": "EN-US",
"languages": [
"EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "ZH-TW",
@@ -937,7 +943,8 @@
]
},
"TTS": {
- "capabilities": ["TEXT"],
+ "speechCapabilities": ["TEXT"],
+ "prerecordedSpeechCapabilities": ["HELP_JINGLE"],
"language": "EN-US",
"languages": [
"EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "ZH-TW",
@@ -1047,10 +1054,12 @@
}
},
"VehicleInfo": {
- "make": "SDL",
- "model": "Generic",
- "modelYear": "2019",
- "trim": "SE"
+ "vehicleType": {
+ "make": "SDL",
+ "model": "Generic",
+ "modelYear": "2019",
+ "trim": "SE"
+ }
},
"SyncMessageVersion": {
"majorVersion": 3,
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 4f97d90b09..e07a5eeab0 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -506,7 +506,9 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "gearStatus",
+ "handsOffSteering"
]
},
"OnVehicleData": {
@@ -523,7 +525,9 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "gearStatus",
+ "handsOffSteering"
]
},
"SubscribeVehicleData": {
@@ -540,7 +544,9 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "gearStatus",
+ "handsOffSteering"
]
},
"UnsubscribeVehicleData": {
@@ -557,7 +563,9 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "gearStatus",
+ "handsOffSteering"
]
}
}
@@ -587,7 +595,9 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus",
+ "windowStatus"
]
},
"OnVehicleData": {
@@ -612,7 +622,9 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus",
+ "windowStatus"
]
},
"SubscribeVehicleData": {
@@ -636,7 +648,9 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus",
+ "windowStatus"
]
},
"UnsubscribeVehicleData": {
@@ -660,7 +674,9 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus",
+ "windowStatus"
]
}
}
@@ -3334,13 +3350,17 @@
"type": "Float",
"mandatory": false,
"minvalue": -6,
- "maxvalue": 106
+ "maxvalue": 106,
+ "deprecated": true,
+ "since": "7.0"
},
{
"name": "fuelLevel_State",
"key": "OEM_REF_FUEL_LEV_ST",
"type": "ComponentVolumeStatus",
- "mandatory": false
+ "mandatory": false,
+ "deprecated": true,
+ "since": "7.0"
},
{
"name": "instantFuelConsumption",
@@ -3366,6 +3386,38 @@
"mandatory": false,
"minvalue": 0,
"maxvalue": 10000
+ },
+ {
+ "name": "level",
+ "key": "OEM_REF_FUEL_RAN_LVL",
+ "type": "Float",
+ "minvalue": -6,
+ "maxvalue": 1000000,
+ "mandatory": false,
+ "since": "7.0"
+ },
+ {
+ "name": "levelState",
+ "key": "OEM_REF_FUEL_RAN_LVL_STATE",
+ "type": "ComponentVolumeStatus",
+ "mandatory": false,
+ "since": "7.0"
+ },
+ {
+ "name": "capacity",
+ "key": "OEM_REF_FUEL_RAN_CAP",
+ "type": "Float",
+ "minvalue": 0,
+ "maxvalue": 1000000,
+ "mandatory": false,
+ "since": "7.0"
+ },
+ {
+ "name": "capacityUnit",
+ "key": "OEM_REF_FUEL_RAN_CAP_UNIT",
+ "type": "CapacityUnit",
+ "mandatory": false,
+ "since": "7.0"
}
],
"key": "OEM_REF_FUEL_RAN",
@@ -3403,7 +3455,36 @@
"name": "prndl",
"key": "OEM_REF_PRNDL",
"type": "PRNDL",
- "mandatory": false
+ "mandatory": false,
+ "since": "2.0",
+ "until": "7.0"
+ },
+ {
+ "name": "gearStatus",
+ "params": [
+ {
+ "name": "userSelectedGear",
+ "key": "OEM_REF_USER_GEAR",
+ "type": "PRNDL",
+ "mandatory": false
+ },
+ {
+ "name": "actualGear",
+ "key": "OEM_REF_ACT_GEAR",
+ "type": "PRNDL",
+ "mandatory": false
+ },
+ {
+ "name": "transmissionType",
+ "key": "OEM_REF_TR_TYPE",
+ "type": "TransmissionType",
+ "mandatory": false
+ }
+ ],
+ "key": "OEM_REF_GEAR_STATUS",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "7.0"
},
{
"name": "tirePressure",
@@ -3908,6 +3989,27 @@
"since": "5.0"
},
{
+ "name": "stabilityControlsStatus",
+ "params": [
+ {
+ "name": "escSystem",
+ "key": "OEM_REF_ESC_SYSTEM",
+ "type": "VehicleDataStatus",
+ "mandatory": false
+ },
+ {
+ "name": "trailerSwayControl",
+ "key": "OEM_REF_TRAIL_SW_CTRL",
+ "type": "VehicleDataStatus",
+ "mandatory": false
+ }
+ ],
+ "key": "OEM_REF_STAB_CTRLS_ST",
+ "type": "Struct",
+ "mandatory": false,
+ "since": "7.0"
+ },
+ {
"name": "cloudAppVehicleID",
"key": "OEM_REF_CL_APP_VEH_ID",
"type": "String",
@@ -3915,6 +4017,102 @@
"since": "5.1"
},
{
+ "name": "windowStatus",
+ "params": [
+ {
+ "name": "location",
+ "params": [
+ {
+ "name": "col",
+ "key": "OEM_REF_WND_LOC_COL",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": -1,
+ "maxvalue": 100
+ },
+ {
+ "name": "row",
+ "key": "OEM_REF_WND_LOC_ROW",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": -1,
+ "maxvalue": 100
+ },
+ {
+ "name": "level",
+ "key": "OEM_REF_WND_LOC_LVL",
+ "type": "Integer",
+ "mandatory": false,
+ "defvalue" : 0,
+ "minvalue": -1,
+ "maxvalue": 100
+ },
+ {
+ "name": "colspan",
+ "key": "OEM_REF_WND_LOC_COLSPN",
+ "type": "Integer",
+ "mandatory": false,
+ "defvalue" : 1,
+ "minvalue": 1,
+ "maxvalue": 100
+ },
+ {
+ "name": "rowspan",
+ "key": "OEM_REF_WND_LOC_ROWSPN",
+ "type": "Integer",
+ "mandatory": false,
+ "defvalue" : 1,
+ "minvalue": 1,
+ "maxvalue": 100
+ },
+ {
+ "name": "levelspan",
+ "key": "OEM_REF_WND_LOC_LVLSPN",
+ "type": "Integer",
+ "mandatory": false,
+ "defvalue" : 1,
+ "minvalue": 1,
+ "maxvalue": 100
+ }
+ ],
+ "key": "OEM_REF_WND_LOC",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "state",
+ "params": [
+ {
+ "name": "approximatePosition",
+ "key": "OEM_REF_WND_STATE_APRPOS",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 100
+ },
+ {
+ "name": "deviation",
+ "key": "OEM_REF_WND_STATE_DEV",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 100
+ }
+ ],
+ "key": "OEM_REF_WND_STATE",
+ "type": "Struct",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_WND_STATUS",
+ "array": true,
+ "type": "Struct",
+ "mandatory": false,
+ "minsize": 0,
+ "maxsize": 100,
+ "since": "7.0"
+ },
+ {
"name": "eCallInfo",
"params": [
{
@@ -4082,6 +4280,13 @@
"key": "OEM_REF_MY_KEY",
"type": "Struct",
"mandatory": false
+ },
+ {
+ "name": "handsOffSteering",
+ "key": "OEM_REF_HANDS_OFF_STRNG",
+ "type": "Boolean",
+ "mandatory": false,
+ "since": "7.0"
}
]
}
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index 31302f24c6..bd23e5b90c 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -51,6 +51,8 @@ ThreadStackSize = 20480
MixingAudioSupported = true
; In case HMI doesn’t send some capabilities to SDL, the values from the file are used by SDL
HMICapabilities = hmi_capabilities.json
+; Path to file containing cached response for UI.GetCapabilities/GetSupportedLanguages
+HMICapabilitiesCacheFile = hmi_capabilities_cache.json
; Maximum cmdId of VR command which may be registered on SDL
; Bigger value used for system VR commands processing by SDL
MaxCmdID = 2000000000
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index e9dcf2bcb0..a595fc7379 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -369,7 +369,8 @@ class DynamicApplicationData {
/*
* @brief Returns true if sub menu with such name already exist
*/
- virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0;
+ virtual bool IsSubMenuNameAlreadyExist(const std::string& name,
+ const uint32_t parent_id) = 0;
/*
* @brief Adds a interaction choice set to the application
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 5f62c8d5b5..f04d3122fa 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
@@ -194,7 +194,8 @@ class DynamicApplicationDataImpl : public virtual Application {
/*
* @brief Returns true if sub menu with such name already exist
*/
- bool IsSubMenuNameAlreadyExist(const std::string& name);
+ bool IsSubMenuNameAlreadyExist(const std::string& name,
+ const uint32_t parent_id);
void SetWindowInfo(const WindowID window_id,
const smart_objects::SmartObject& window_info) OVERRIDE;
@@ -329,7 +330,7 @@ class DynamicApplicationDataImpl : public virtual Application {
CommandsMap commands_;
mutable std::shared_ptr<sync_primitives::RecursiveLock> commands_lock_ptr_;
SubMenuMap sub_menu_;
- mutable std::shared_ptr<sync_primitives::Lock> sub_menu_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock> sub_menu_lock_ptr_;
ChoiceSetMap choice_set_map_;
mutable std::shared_ptr<sync_primitives::Lock> choice_set_map_lock_ptr_;
PerformChoiceSetMap performinteraction_choice_set_map_;
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 633bea87be..5bdebc441e 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
@@ -423,7 +423,10 @@ class ApplicationManagerImpl
mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app);
void ConnectToDevice(const std::string& device_mac) OVERRIDE;
- void OnHMIStartedCooperation() OVERRIDE;
+
+ void OnHMIReady() OVERRIDE;
+
+ void RequestForInterfacesAvailability() OVERRIDE;
void DisconnectCloudApp(ApplicationSharedPtr app) OVERRIDE;
@@ -957,6 +960,7 @@ class ApplicationManagerImpl
*/
bool IsHMICooperating() const OVERRIDE;
+ void SetHMICooperating(const bool hmi_cooperating) OVERRIDE;
/**
* @brief Method used to send default app tts globalProperties
* in case they were not provided from mobile side after defined time
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 e8850fbe8d..3057476937 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
@@ -74,6 +74,21 @@ class RequestToHMI : public CommandImpl {
virtual void Run();
void SendRequest();
+ /**
+ * @brief Updates required requests that should be send to the HMI to get
+ * required HMI capabilities
+ * @param interface_name Interface name (e.g. UI, TTS, VR, RC or VehicleInfo)
+ */
+ void UpdateRequiredInterfaceCapabilitiesRequests(
+ const std::string& interface_name);
+
+ /**
+ * @brief According to the specified interface sends appropriate requests to
+ * HMI for fetching of capabilities
+ * @param interface_name Interface name (e.g. UI, TTS, VR, RC or VehicleInfo)
+ */
+ void RequestInterfaceCapabilities(const char* interface_name);
+
/*
* @brief Retrieves application ID
*/
@@ -83,6 +98,22 @@ class RequestToHMI : public CommandImpl {
private:
DISALLOW_COPY_AND_ASSIGN(RequestToHMI);
+
+ /**
+ * @brief Updates required requests that should be send to
+ * the HMI to get required HMI capabilities according to the passed function
+ * ids
+ * @param requests_to_send_to_hmi Collection of the function ids
+ */
+ void UpdateRequestsRequiredForCapabilities(
+ const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi);
+
+ /**
+ * @brief Sends request to HMI for fetching of capabilities according to the
+ * passed function ids
+ */
+ void RequestCapabilities(
+ const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi);
};
} // namespace commands
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 b7f41ca297..1e75499a07 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
@@ -38,7 +38,6 @@
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
-#include "smart_objects/smart_object.h"
#include "utils/macro.h"
namespace application_manager {
@@ -46,32 +45,19 @@ class ApplicationManager;
class HMICapabilitiesImpl : public HMICapabilities {
public:
- /*
+ /**
* @ Class constructor
- *
* @param app_mngr Application manager pointer
*/
explicit HMICapabilitiesImpl(ApplicationManager& app_mngr);
- /*
+ /**
* @brief Class destructor
- *
*/
virtual ~HMICapabilitiesImpl();
- /*
- * @brief Checks is image type(Static/Dynamic) requested by
- * Mobile Device is supported on current HMI.
- * @param image_type recieved type of image from Enum.
- * @return Bool true if supported
- */
bool VerifyImageType(const int32_t image_type) const OVERRIDE;
- /**
- * @brief Checks if all HMI capabilities received
- *
- * @return TRUE if all information received, otherwise FALSE
- */
bool is_vr_cooperating() const OVERRIDE;
void set_is_vr_cooperating(const bool value) OVERRIDE;
@@ -90,365 +76,139 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool is_rc_cooperating() const OVERRIDE;
void set_is_rc_cooperating(const bool value) OVERRIDE;
- /*
- * @brief Interface used to store information about software version of the
- *target
- *
- * @param ccpu_version Received system/hmi software version
- */
void set_ccpu_version(const std::string& ccpu_version) OVERRIDE;
- /*
- * @brief Returns software version of the target
- *
- * @return TRUE if it supported, otherwise FALSE
- */
const std::string& ccpu_version() const OVERRIDE;
- /*
- * @brief Retrieves if mixing audio is supported by HMI
- * (ie recording TTS command and playing audio)
- *
- * @return Current state of the mixing audio flag
- */
bool attenuated_supported() const OVERRIDE;
- /*
- * @brief Sets state for mixing audio
- *
- * @param state New state to be set
- */
void set_attenuated_supported(const bool state) OVERRIDE;
- /*
- * @brief Retrieves currently active UI language
- *
- * @return Currently active UI language
- */
const hmi_apis::Common_Language::eType active_ui_language() const OVERRIDE;
- /*
- * @brief Sets currently active UI language
- *
- * @param language Currently active UI language
- */
void set_active_ui_language(
const hmi_apis::Common_Language::eType language) OVERRIDE;
- /*
- * @brief Retrieves UI supported languages
- *
- * @return Currently supported UI languages
- */
- const smart_objects::SmartObject* ui_supported_languages() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr ui_supported_languages() const OVERRIDE;
- /*
- * @brief Sets supported UI languages
- *
- * @param supported_languages Supported UI languages
- */
void set_ui_supported_languages(
const smart_objects::SmartObject& supported_languages) OVERRIDE;
- /*
- * @brief Retrieves currently active VR language
- *
- * @return Currently active VR language
- */
const hmi_apis::Common_Language::eType active_vr_language() const OVERRIDE;
- /*
- * @brief Sets currently active VR language
- *
- * @param language Currently active VR language
- */
void set_active_vr_language(
const hmi_apis::Common_Language::eType language) OVERRIDE;
- /*
- * @brief Retrieves VR supported languages
- *
- * @return Currently supported VR languages
- */
- const smart_objects::SmartObject* vr_supported_languages() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr vr_supported_languages() const OVERRIDE;
- /*
- * @brief Sets supported VR languages
- *
- * @param supported_languages Supported VR languages
- */
void set_vr_supported_languages(
const smart_objects::SmartObject& supported_languages) OVERRIDE;
- /*
- * @brief Retrieves currently active TTS language
- *
- * @return Currently active TTS language
- */
const hmi_apis::Common_Language::eType active_tts_language() const OVERRIDE;
- /*
- * @brief Sets currently active TTS language
- *
- * @param language Currently active TTS language
- */
void set_active_tts_language(
const hmi_apis::Common_Language::eType language) OVERRIDE;
- /*
- * @brief Retrieves TTS supported languages
- *
- * @return Currently supported TTS languages
- */
- const smart_objects::SmartObject* tts_supported_languages() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr tts_supported_languages() const OVERRIDE;
- /*
- * @brief Sets supported TTS languages
- *
- * @param supported_languages Supported TTS languages
- */
void set_tts_supported_languages(
const smart_objects::SmartObject& supported_languages) OVERRIDE;
- /*
- * @brief Retrieves information about the display capabilities
- *
- * @return Currently supported display capabilities
- */
const smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE;
- /*
- * @brief Sets supported display capabilities
- *
- * @param display_capabilities supported display capabilities
- */
void set_display_capabilities(
const smart_objects::SmartObject& display_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the display capability
- * @return Currently supported display capability
- */
const smart_objects::SmartObjectSPtr system_display_capabilities()
const OVERRIDE;
- /*
- * @brief Sets supported display capability
- * @param display_capabilities supported display capability
- */
void set_system_display_capabilities(
const smart_objects::SmartObject& display_capabilities);
- /*
- * @brief Retrieves information about the HMI zone capabilities
- *
- * @return Currently supported HMI zone capabilities
- */
const smart_objects::SmartObjectSPtr hmi_zone_capabilities() const OVERRIDE;
- /*
- * @brief Sets supported HMI zone capabilities
- *
- * @param hmi_zone_capabilities supported HMI zone capabilities
- */
void set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the SoftButton's capabilities
- *
- * @return Currently supported SoftButton's capabilities
- */
const smart_objects::SmartObjectSPtr soft_button_capabilities()
const OVERRIDE;
- /*
- * @brief Sets supported SoftButton's capabilities
- *
- * @param soft_button_capabilities supported SoftButton's capabilities
- */
void set_soft_button_capabilities(
const smart_objects::SmartObject& soft_button_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the Button's capabilities
- *
- * @return Currently supported Button's capabilities
- */
const smart_objects::SmartObjectSPtr button_capabilities() const OVERRIDE;
- /*
- * @brief Sets supported Button's capabilities
- *
- * @param soft_button_capabilities supported Button's capabilities
- */
void set_button_capabilities(
const smart_objects::SmartObject& button_capabilities) OVERRIDE;
- /*
- * @brief Sets supported speech capabilities
- *
- * @param speech_capabilities supported speech capabilities
- */
void set_speech_capabilities(
const smart_objects::SmartObject& speech_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the speech capabilities
- *
- * @return Currently supported speech capabilities
- */
const smart_objects::SmartObjectSPtr speech_capabilities() const OVERRIDE;
- /*
- * @brief Sets supported VR capabilities
- *
- * @param vr_capabilities supported VR capabilities
- */
void set_vr_capabilities(
const smart_objects::SmartObject& vr_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the VR capabilities
- *
- * @return Currently supported VR capabilities
- */
const smart_objects::SmartObjectSPtr vr_capabilities() const OVERRIDE;
- /*
- * @brief Sets supported audio_pass_thru capabilities
- *
- * @param vr_capabilities supported audio_pass_thru capabilities
- */
void set_audio_pass_thru_capabilities(
const smart_objects::SmartObject& audio_pass_thru_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the audio_pass_thru capabilities
- *
- * @return Currently supported audio_pass_thru capabilities
- */
const smart_objects::SmartObjectSPtr audio_pass_thru_capabilities()
const OVERRIDE;
- /*
- * @brief Sets supported pcm_stream capabilities
- *
- * @param supported pcm_stream capabilities
- */
void set_pcm_stream_capabilities(
const smart_objects::SmartObject& pcm_stream_capabilities) OVERRIDE;
- /*
- * @brief Retrieves information about the pcm_stream capabilities
- *
- * @return Currently supported pcm_streaming capabilities
- */
const smart_objects::SmartObjectSPtr pcm_stream_capabilities() const OVERRIDE;
- /*
- * @brief Retrieves information about the preset bank capabilities
- *
- * @return Currently supported preset bank capabilities
- */
const smart_objects::SmartObjectSPtr preset_bank_capabilities()
const OVERRIDE;
- /*
- * @brief Sets supported preset bank capabilities
- *
- * @param soft_button_capabilities supported preset bank capabilities
- */
void set_preset_bank_capabilities(
const smart_objects::SmartObject& preset_bank_capabilities) OVERRIDE;
- /*
- * @brief Sets vehicle information(make, model, modelYear)
- *
- * @param vehicle_type Cuurent vehicle information
- */
void set_vehicle_type(
const smart_objects::SmartObject& vehicle_type) OVERRIDE;
- /*
- * @brief Retrieves vehicle information(make, model, modelYear)
- *
- * @param vehicle_type Cuurent vehicle information
- */
const smart_objects::SmartObjectSPtr vehicle_type() const OVERRIDE;
- /*
- * @brief Retrieves information about the prerecorded speech
- *
- * @return Currently supported prerecorded speech
- */
const smart_objects::SmartObjectSPtr prerecorded_speech() const OVERRIDE;
- /*
- * @brief Sets supported prerecorded speech
- *
- * @param prerecorded_speech supported prerecorded speech
- */
void set_prerecorded_speech(
const smart_objects::SmartObject& prerecorded_speech) OVERRIDE;
- /*
- * @brief Interface used to store information if navigation
- * supported by the system
- *
- * @param supported Indicates if navigation supported by the system
- */
void set_navigation_supported(const bool supported) OVERRIDE;
- /*
- * @brief Retrieves information if navi supported by the system
- *
- * @return TRUE if it supported, otherwise FALSE
- */
bool navigation_supported() const OVERRIDE;
- /*
- * @brief Interface used to store information if phone call
- * supported by the system
- *
- * @param supported Indicates if navigation supported by the sustem
- */
void set_phone_call_supported(const bool supported) OVERRIDE;
- /*
- * @brief Retrieves information if phone call supported by the system
- *
- * @return TRUE if it supported, otherwise FALSE
- */
bool phone_call_supported() const OVERRIDE;
- /*
- * @brief Interface to store whether HMI supports video streaming
- *
- * @param supported Indicates whether video streaming is supported by HMI
- */
void set_video_streaming_supported(const bool supported) OVERRIDE;
- /*
- * @brief Retrieves whether HMI supports video streaming
- *
- * @return TRUE if it supported, otherwise FALSE
- */
bool video_streaming_supported() const OVERRIDE;
+ void set_rc_supported(const bool supported) OVERRIDE;
+
+ bool rc_supported() const OVERRIDE;
+
/*
- * @brief Interface to store whether HMI supports remote control
+ * @brief Interface to store whether HMI supports driver distraction menu
+ * limits
*
- * @param supported Indicates whether video streaming is supported by HMI
+ * @param supported Indicates whether driver distraction menu limits is
+ * supported by HMI
*/
- void set_rc_supported(const bool supported) OVERRIDE;
+ void set_driver_distraction_supported(const bool supported) OVERRIDE;
/*
- * @brief Retrieves whether HMI supports remote control
+ * @brief Retrieves whether HMI supports driver distraction menu limits
*
* @return TRUE if it supported, otherwise FALSE
*/
- bool rc_supported() const OVERRIDE;
+ bool driver_distraction_supported() const OVERRIDE;
/*
* @brief Interface used to store information regarding
@@ -460,121 +220,224 @@ class HMICapabilitiesImpl : public HMICapabilities {
void set_navigation_capability(
const smart_objects::SmartObject& navigation_capability) OVERRIDE;
- /*
- * @brief Retrieves information regarding the navigation system capability
- *
- * @return NAVIGATION system capability
- */
- const smart_objects::SmartObject* navigation_capability() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr navigation_capability() const OVERRIDE;
- /*
- * @brief Interface used to store information regarding
- * the phone "System Capability"
- *
- * @param phone_capability contains information related
- * to the phone system capability.
- */
void set_phone_capability(
const smart_objects::SmartObject& phone_capability) OVERRIDE;
- /*
- * @brief Retrieves information regarding the phone call system capability
- *
- * @return PHONE_CALL system capability
- */
-
- const smart_objects::SmartObject* phone_capability() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr phone_capability() const OVERRIDE;
- /*
- * @brief Sets HMI's video streaming related capability information
- *
- * @param video_streaming_capability the video streaming related capabilities
- */
void set_video_streaming_capability(
const smart_objects::SmartObject& video_streaming_capability) OVERRIDE;
- /*
- * @brief Retrieves HMI's video streaming related capabilities
- *
- * @return HMI's video streaming related capability information
- */
- const smart_objects::SmartObject* video_streaming_capability() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr video_streaming_capability()
+ const OVERRIDE;
void set_rc_capability(
const smart_objects::SmartObject& rc_capability) OVERRIDE;
- const smart_objects::SmartObject* rc_capability() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr rc_capability() const OVERRIDE;
+
+ void set_driver_distraction_capability(
+ const smart_objects::SmartObject& driver_distraction_capability) OVERRIDE;
+
+ const smart_objects::SmartObjectSPtr driver_distraction_capability()
+ const OVERRIDE;
void set_seat_location_capability(
const smart_objects::SmartObject& seat_location_capability) OVERRIDE;
- const smart_objects::SmartObject* seat_location_capability() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr seat_location_capability()
+ const OVERRIDE;
void Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
DEPRECATED
void Init(resumption::LastState* last_state) OVERRIDE;
- /*
- * @brief return component which follows for correctness of
- * languages
- * @return HMI language handler
- */
HMILanguageHandler& get_hmi_language_handler() OVERRIDE;
- /**
- * @brief Trigger waiting for response
- * @param request Request object
- */
void set_handle_response_for(
const smart_objects::SmartObject& request) OVERRIDE;
+ bool SaveCachedCapabilitiesToFile(
+ const std::string& interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema) OVERRIDE;
+
+ bool DeleteCachedCapabilitiesFile() const OVERRIDE;
+
+ bool IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType function_id) const OVERRIDE;
+
+ void UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType requested_interface) OVERRIDE;
+
+ void OnSoftwareVersionReceived(const std::string& ccpu_version) OVERRIDE;
+
+ void UpdateCachedCapabilities() OVERRIDE;
+
protected:
- /*
+ /**
* @brief Loads capabilities from local file in case SDL was launched
* without HMI
*
* @return TRUE if capabilities loaded successfully, otherwise FALSE.
*/
- bool load_capabilities_from_file();
-
- /*
- * @brief function checks if json member exists
- *
- * @param json_member from file hmi_capabilities.json
- * @param name_of_member name which we should check
- * hmi_capabilities.json
- *
- * @returns TRUE if member exists and returns FALSE if
- * member does not exist.
- */
- bool check_existing_json_member(const Json::Value& json_member,
- const char* name_of_member) const OVERRIDE;
+ bool LoadCapabilitiesFromFile();
- /*
+ /**
* @brief function converts json object "languages" to smart object
- *
* @param json_languages from file hmi_capabilities.json
* @param languages - the converted object
*
*/
void convert_json_languages_to_obj(
const Json::Value& json_languages,
- smart_objects::SmartObject& languages) const OVERRIDE;
+ smart_objects::SmartObject& languages) const;
- /*
+ /**
* @brief function that converts a single entry of audio pass thru capability
* to smart object
- *
* @param capability json object that represents a single entry of audio pass
* thru capability
* @param output_so the converted object
*/
void convert_audio_capability_to_obj(
const Json::Value& capability,
- smart_objects::SmartObject& output_so) const OVERRIDE;
+ smart_objects::SmartObject& output_so) const;
private:
+ /**
+ * @brief Checks are all updating fields are currently saved in the JSON
+ * structure
+ * @param root_node reference to root node of JSON structure
+ * @param interface_name name of interface to check
+ * @param sections_to_check reference to list of fields to check
+ * @return true if all fields from the list are saved in the JSON structure,
+ * otherwise returns false
+ */
+ bool AllFieldsSaved(const Json::Value& root_node,
+ const std::string& interface_name,
+ const std::vector<std::string>& sections_to_check) const;
+
+ /**
+ * @brief Remove received interface from default initialized capabilities
+ * @param requested_interface interface which should be removed
+ */
+ void RemoveFromRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType requested_interface);
+
+ /**
+ * @brief Gets the currently active language depending on interface
+ * @param interface_name name of interface of currently active language
+ * @return active language for specified interface
+ *
+ */
+ hmi_apis::Common_Language::eType GetActiveLanguageForInterface(
+ const std::string& interface_name) const;
+
+ /**
+ * @brief Prepares specified JSON structure according to sections which
+ * should be updated
+ * @param interface_name name of interface to prepare
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_root_node reference to JSON structure to update
+ */
+ void PrepareJsonValueForSaving(
+ const char* interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_root_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for UI interface according to
+ * sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareUiJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for VR interface according to
+ * sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareVrJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for TTS interface according to
+ * sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareTtsJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for Buttons interface according to
+ * sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareButtonsJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for VehicleInfo interface
+ * according to sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareVehicleInfoJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Prepares specified JSON structure for RC interface according to
+ * sections which should be updated
+ * @param sections_to_update reference to list of fields to update
+ * @param schema reference to schema which should be unapplied before field
+ * updating
+ * @param out_node reference to JSON structure to update
+ */
+ void PrepareRCJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const;
+
+ /**
+ * @brief Adds appropriate request IDs to the requested required collection
+ * according to an interface name
+ * @param interface_name An interface name which requests required to send to
+ * the HMI
+ */
+ void AddRequiredRequestsForCapabilities(const std::string& interface_name);
+
bool is_vr_cooperating_;
bool is_tts_cooperating_;
bool is_ui_cooperating_;
@@ -587,9 +450,9 @@ class HMICapabilitiesImpl : public HMICapabilities {
hmi_apis::Common_Language::eType vr_language_;
hmi_apis::Common_Language::eType tts_language_;
smart_objects::SmartObjectSPtr vehicle_type_;
- smart_objects::SmartObject* ui_supported_languages_;
- smart_objects::SmartObject* tts_supported_languages_;
- smart_objects::SmartObject* vr_supported_languages_;
+ smart_objects::SmartObjectSPtr ui_supported_languages_;
+ smart_objects::SmartObjectSPtr tts_supported_languages_;
+ smart_objects::SmartObjectSPtr vr_supported_languages_;
/*
* display_capabilities_ is deprecated and replaced by
* system_display_capabilities_. For backward compatibility
@@ -610,16 +473,20 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool is_phone_call_supported_;
bool is_video_streaming_supported_;
bool is_rc_supported_;
+ bool is_driver_distraction_supported_;
std::string ccpu_version_;
- smart_objects::SmartObject* navigation_capability_;
- smart_objects::SmartObject* phone_capability_;
- smart_objects::SmartObject* video_streaming_capability_;
- smart_objects::SmartObject* rc_capability_;
- smart_objects::SmartObject* seat_location_capability_;
+ smart_objects::SmartObjectSPtr navigation_capability_;
+ smart_objects::SmartObjectSPtr phone_capability_;
+ smart_objects::SmartObjectSPtr video_streaming_capability_;
+ smart_objects::SmartObjectSPtr rc_capability_;
+ smart_objects::SmartObjectSPtr driver_distraction_capability_;
+ smart_objects::SmartObjectSPtr seat_location_capability_;
ApplicationManager& app_mngr_;
HMILanguageHandler hmi_language_handler_;
+ std::set<hmi_apis::FunctionID::eType> requests_required_for_capabilities_;
+
DISALLOW_COPY_AND_ASSIGN(HMICapabilitiesImpl);
};
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 8559e77061..2f50fd4a6b 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
@@ -385,6 +385,10 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
+
+ std::string GetCCPUVersionFromPT() const OVERRIDE;
+
/**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
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 19dd6fbe3b..c96c9ebe69 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
@@ -119,6 +119,7 @@ extern const char* num_ticks;
extern const char* slider_footer;
extern const char* menu_id;
extern const char* menu_name;
+extern const char* parent_id;
extern const char* menu_layout;
extern const char* menu_layouts_available;
extern const char* interaction_choice_set_id;
@@ -197,6 +198,8 @@ extern const char* navigation_capability;
extern const char* phone_capability;
extern const char* video_streaming_capability;
extern const char* rc_capability;
+extern const char* driver_distraction_capability;
+extern const char* driver_distraction;
extern const char* seat_location_capability;
extern const char* app_services_capabilities;
extern const char* day_color_scheme;
@@ -296,6 +299,7 @@ extern const char* cloud_app_vehicle_id;
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* odometer;
@@ -309,6 +313,7 @@ extern const char* head_lamp_status;
extern const char* engine_torque;
extern const char* acc_pedal_pos;
extern const char* steering_wheel_angle;
+extern const char* stability_controls_status;
extern const char* e_call_info;
extern const char* airbag_status;
extern const char* emergency_event;
@@ -334,6 +339,8 @@ extern const char* system_software_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;
// app services
extern const char* app_service_manifest;
@@ -479,6 +486,19 @@ extern const char* const x;
extern const char* const y;
} // namespace strings
+namespace hmi_interface {
+extern const char* basic_communication;
+extern const char* buttons;
+extern const char* navigation;
+extern const char* sdl;
+extern const char* tts;
+extern const char* ui;
+extern const char* vr;
+extern const char* rc;
+extern const char* vehicle_info;
+extern const char* app_service;
+} // namespace hmi_interface
+
namespace json {
extern const char* appId;
extern const char* name;
@@ -590,6 +610,7 @@ extern const char* capabilities;
extern const char* speech_capabilities;
extern const char* prerecorded_speech_capabilities;
extern const char* preset_bank_capabilities;
+extern const char* on_screen_presets_available;
extern const char* allowed;
extern const char* vehicle_type;
extern const char* did_result;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h
index 36fd8bbbf9..743cf69a28 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h
@@ -37,7 +37,13 @@
namespace rc_rpc_plugin {
-enum capabilitiesStatus { success, missedLightName, missedParam, readOnly };
+enum capabilitiesStatus {
+ kInvalidStatus,
+ kSuccess,
+ kMissedLightName,
+ kMissedParam,
+ kReadOnly
+};
typedef std::pair<std::string, capabilitiesStatus> ModuleTypeCapability;
class RCCapabilitiesManager {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
index 5ee2e0725c..6625641f54 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
@@ -65,8 +65,6 @@ const char kGrid[] = "grid";
const char kAllowMultipleAccess[] = "allowMultipleAccess";
-const char kSupportedLights[] = "supportedLights";
-
// ClimateControlCapabilities
const char kFanSpeedAvailable[] = "fanSpeedAvailable";
const char kCurrentTemperatureAvailable[] = "currentTemperatureAvailable";
@@ -88,6 +86,7 @@ const char kName[] = "name";
const char kStatusAvailable[] = "statusAvailable";
const char kDensityAvailable[] = "densityAvailable";
const char kRGBColorSpaceAvailable[] = "rgbColorSpaceAvailable";
+const char kSupportedLights[] = "supportedLights";
// RadioControlCapabilities
const char kRadioBandAvailable[] = "radioBandAvailable";
@@ -100,6 +99,7 @@ const char kSignalChangeThresholdAvailable[] = "signalChangeThresholdAvailable";
const char kRadioEnableAvailable[] = "radioEnableAvailable";
const char kStateAvailable[] = "stateAvailable";
const char kSisDataAvailable[] = "sisDataAvailable";
+const char kHdChannelAvailable[] = "hdChannelAvailable";
const char kSiriusxmRadioAvailable[] = "siriusxmRadioAvailable";
@@ -128,6 +128,7 @@ const char kSourceAvailable[] = "sourceAvailable";
const char kKeepContextAvailable[] = "keepContextAvailable";
const char kVolumeAvailable[] = "volumeAvailable";
const char kEqualizerAvailable[] = "equalizerAvailable";
+const char kEqualizerMaxChannelId[] = "equalizerMaxChannelId";
// HmiSettingsCapabilities
const char kDistanceUnitAvailable[] = "distanceUnitAvailable";
@@ -358,6 +359,7 @@ const char kNotFound[] = "NOT_FOUND";
const char kFront[] = "FRONT";
const char kRear[] = "REAR";
const char kAll[] = "ALL";
+const char kNone[] = "NONE";
// DefrostZone enum
// TemperatureUnit enum
@@ -387,8 +389,9 @@ const char kRepeat[] = "REPEAT";
// ButtonName enum
// ButtonPressMode enum
-const char kLong[] = "LONG";
-const char kShort[] = "SHORT";
+const char kShortPressAvailable[] = "shortPressAvailable";
+const char kLongPressAvailable[] = "longPressAvailable";
+const char kUpDownAvailable[] = "upDownAvailable";
// ButtonPressMode enum
// Access mode enum
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 10f6303ac9..e89b260dca 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
@@ -54,13 +54,12 @@ GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest(
bool GetInteriorVehicleDataRequest::ProcessCapabilities() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject* rc_capabilities =
- hmi_capabilities_.rc_capability();
+ const auto rc_capability = hmi_capabilities_.rc_capability();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
const ModuleUid module(module_type, module_id);
- if (rc_capabilities &&
+ if (rc_capability &&
!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
LOG4CXX_WARN(
logger_,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
index e30d7869bd..375db9cd9d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
@@ -91,13 +91,12 @@ ReleaseInteriorVehicleDataModuleRequest::
bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject* rc_capabilities =
- hmi_capabilities_.rc_capability();
+ const auto rc_capability = hmi_capabilities_.rc_capability();
const std::string module_type = ModuleType();
const std::string module_id = ModuleId();
const ModuleUid module(module_type, module_id);
- if (rc_capabilities &&
+ if (rc_capability &&
!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
LOG4CXX_WARN(
logger_,
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 c3e5e807d7..dfcc6205b1 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
@@ -84,22 +84,24 @@ mobile_apis::Result::eType PrepareResultCodeAndInfo(
mobile_apis::Result::UNSUPPORTED_RESOURCE;
if (message_params::kLightState == module_data_capabilities.first) {
switch (module_data_capabilities.second) {
- case capabilitiesStatus::missedLightName:
+ case capabilitiesStatus::kMissedLightName:
info = "The requested LightName is not supported by the vehicle.";
break;
- case capabilitiesStatus::missedParam:
+ case capabilitiesStatus::kMissedParam:
info =
"The requested parameter of the given LightName is not supported "
"by the vehicle.";
break;
- case capabilitiesStatus::readOnly:
+ case capabilitiesStatus::kReadOnly:
info = "The requested parameter is read-only.";
result_code = mobile_apis::Result::READ_ONLY;
break;
default:
break;
}
-
+ } else if (module_data_capabilities.second ==
+ capabilitiesStatus::kInvalidStatus) {
+ info = "The RC Capability is not available";
} else {
info = "Accessing not supported module data.";
}
@@ -133,7 +135,7 @@ void SetInteriorVehicleDataRequest::Execute() {
rc_capabilities_manager_.GetModuleDataCapabilities(module_data,
module_id);
- if (capabilitiesStatus::success != module_data_capabilities.second) {
+ if (capabilitiesStatus::kSuccess != module_data_capabilities.second) {
SetResourceState(ModuleType(), ResourceState::FREE);
std::string info;
mobile_apis::Result::eType result =
@@ -152,14 +154,14 @@ void SetInteriorVehicleDataRequest::Execute() {
return;
}
- module_data_capabilities = std::make_pair("", capabilitiesStatus::success);
+ module_data_capabilities = std::make_pair("", capabilitiesStatus::kSuccess);
if (rc_capabilities_manager_.AreReadOnlyParamsPresent(
module_data, module_type, module_data_capabilities)) {
LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters");
if (enums_value::kLight == module_data_capabilities.first &&
- capabilitiesStatus::success != module_data_capabilities.second) {
+ capabilitiesStatus::kSuccess != module_data_capabilities.second) {
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(
false,
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 885c5ac0dd..fc342a6d86 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
@@ -157,8 +157,8 @@ void RCCommandRequest::Run() {
"Remote control is disabled by user");
return;
}
- auto rc_capabilities = hmi_capabilities_.rc_capability();
- if (!rc_capabilities || rc_capabilities->empty()) {
+ auto rc_capability = hmi_capabilities_.rc_capability();
+ if (!rc_capability || rc_capability->empty()) {
LOG4CXX_WARN(logger_, "Accessing not supported module: " << ModuleType());
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
index dbedd0167f..0f68769b38 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
@@ -92,7 +92,13 @@ RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesArray(
const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities(
const std::string& module_type) const {
LOG4CXX_AUTO_TRACE(logger_);
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return std::string();
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
if (!rc_capabilities.keyExists(mapping(module_type))) {
LOG4CXX_WARN(
@@ -165,7 +171,14 @@ const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities(
bool RCCapabilitiesManagerImpl::CheckIfModuleExistsInCapabilities(
const ModuleUid& module) const {
LOG4CXX_AUTO_TRACE(logger_);
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return false;
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
const auto& resource_list = GetResources();
bool is_module_type_valid = false;
@@ -252,7 +265,13 @@ void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesArray(
const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<ModuleUid> resources;
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return resources;
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& control_caps_list = GetCapabilitiesList();
for (const auto& capability_key : control_caps_list) {
if (rc_capabilities.keyExists(capability_key)) {
@@ -272,7 +291,14 @@ const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const {
const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation(
const mobile_apis::SupportedSeat::eType id) const {
LOG4CXX_AUTO_TRACE(logger_);
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized.");
+ return std::string();
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto seat_capabilities =
rc_capabilities[strings::kseatControlCapabilities];
if (seat_capabilities.length() > 0) {
@@ -294,7 +320,13 @@ const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation(
bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps(
const mobile_apis::ButtonName::eType button) const {
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return false;
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
if (rc_capabilities.keyExists(strings::kbuttonCapabilities)) {
const smart_objects::SmartObject& button_caps =
rc_capabilities[strings::kbuttonCapabilities];
@@ -453,14 +485,20 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities(
const smart_objects::SmartObject& module_data,
const std::string& module_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return {std::string(), capabilitiesStatus::kInvalidStatus};
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& all_module_types = RCHelpers::GetModuleTypesList();
const auto& get_module_data_key = RCHelpers::GetModuleTypeToDataMapping();
const auto& get_capabilities_key =
RCHelpers::GetModuleTypeToCapabilitiesMapping();
ModuleTypeCapability module_data_capabilities =
- std::make_pair("", capabilitiesStatus::missedParam);
+ std::make_pair("", capabilitiesStatus::kMissedParam);
for (const auto& module_type : all_module_types) {
const auto module_data_key = get_module_data_key(module_type);
@@ -501,13 +539,13 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities(
}
if (message_params::kLightState == request_parameter) {
ModuleTypeCapability light_capability =
- std::make_pair("", capabilitiesStatus::success);
+ std::make_pair("", capabilitiesStatus::kSuccess);
for (auto& light_data : *(control_data[request_parameter].asArray())) {
light_capability = GetLightNameCapabilities(
capabilities[strings::kSupportedLights], light_data);
- if (capabilitiesStatus::success != light_capability.second) {
+ if (capabilitiesStatus::kSuccess != light_capability.second) {
return light_capability;
}
}
@@ -517,7 +555,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities(
if (message_params::kBand == request_parameter) {
ModuleTypeCapability radio_capability = GetRadioBandByCapabilities(
capabilities, control_data[request_parameter]);
- if (capabilitiesStatus::success != radio_capability.second) {
+ if (capabilitiesStatus::kSuccess != radio_capability.second) {
return radio_capability;
}
}
@@ -528,12 +566,12 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities(
request_parameter,
mobile_apis::Result::UNSUPPORTED_RESOURCE);
- if (capabilitiesStatus::success != status_item_capability) {
+ if (capabilitiesStatus::kSuccess != status_item_capability) {
return std::make_pair("", status_item_capability);
}
}
- return std::make_pair("", capabilitiesStatus::success);
+ return std::make_pair("", capabilitiesStatus::kSuccess);
}
capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
@@ -547,7 +585,7 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
LOG4CXX_DEBUG(
logger_,
"Parameter " << request_parameter << " doesn't exist in capabilities.");
- return capabilitiesStatus::missedParam;
+ return capabilitiesStatus::kMissedParam;
}
const std::string& caps_key = it->second;
@@ -561,7 +599,7 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
LOG4CXX_DEBUG(logger_,
"Capability " << caps_key
<< " is missed in RemoteControl capabilities");
- return capabilitiesStatus::missedParam;
+ return capabilitiesStatus::kMissedParam;
}
if (!capabilities[caps_key].asBool()) {
@@ -569,14 +607,14 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
"Capability "
<< caps_key
<< " is switched off in RemoteControl capabilities");
- capabilitiesStatus status = capabilitiesStatus::missedParam;
+ capabilitiesStatus status = capabilitiesStatus::kMissedParam;
if (mobile_apis::Result::READ_ONLY == switched_off_result) {
- status = capabilitiesStatus::readOnly;
+ status = capabilitiesStatus::kReadOnly;
}
return status;
}
- return capabilitiesStatus::success;
+ return capabilitiesStatus::kSuccess;
}
ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities(
@@ -598,13 +636,13 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities(
request_parameter,
mobile_apis::Result::READ_ONLY);
- if (capabilitiesStatus::success != status_item_capability) {
+ if (capabilitiesStatus::kSuccess != status_item_capability) {
return std::make_pair(message_params::kLightState,
status_item_capability);
}
}
- return std::make_pair("", capabilitiesStatus::success);
+ return std::make_pair("", capabilitiesStatus::kSuccess);
}
ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightNameCapabilities(
@@ -619,7 +657,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightNameCapabilities(
}
LOG4CXX_DEBUG(logger_, "There is no such light name in capabilities");
return std::make_pair(message_params::kLightState,
- capabilitiesStatus::missedLightName);
+ capabilitiesStatus::kMissedLightName);
}
ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities(
@@ -634,7 +672,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities(
<< strings::kSiriusxmRadioAvailable
<< " is missed in RemoteControl capabilities");
return std::make_pair(strings::kSiriusxmRadioAvailable,
- capabilitiesStatus::missedParam);
+ capabilitiesStatus::kMissedParam);
}
if (!capabilities_status[strings::kSiriusxmRadioAvailable].asBool()) {
LOG4CXX_DEBUG(logger_,
@@ -642,10 +680,10 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities(
<< strings::kSiriusxmRadioAvailable
<< " is switched off in RemoteControl capabilities");
return std::make_pair(strings::kSiriusxmRadioAvailable,
- capabilitiesStatus::missedParam);
+ capabilitiesStatus::kMissedParam);
}
}
- return std::make_pair("", capabilitiesStatus::success);
+ return std::make_pair("", capabilitiesStatus::kSuccess);
}
const smart_objects::SmartObject& RCCapabilitiesManagerImpl::ControlDataForType(
@@ -729,7 +767,7 @@ bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent(
if (result) {
module_data_capabilities =
- std::make_pair(module_type, capabilitiesStatus::readOnly);
+ std::make_pair(module_type, capabilitiesStatus::kReadOnly);
}
return result;
}
@@ -869,7 +907,13 @@ Grid RCCapabilitiesManagerImpl::GetModuleServiceAreaFromControlCapability(
Grid RCCapabilitiesManagerImpl::GetModuleServiceArea(
const ModuleUid& module) const {
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_WARN(logger_, "RC capability is not initialized");
+ return Grid();
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
const auto& module_type = module.first;
const auto& capabilities_key = mapping(module_type);
@@ -903,7 +947,13 @@ bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowedInControlCaps(
bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed(
const ModuleUid& module) const {
- auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ auto rc_capabilities_ptr = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities_ptr) {
+ LOG4CXX_ERROR(logger_, "RC capability is not initialized");
+ return false;
+ }
+
+ auto rc_capabilities = *rc_capabilities_ptr;
const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
const auto& module_type = module.first;
const auto& capabilities_key = mapping(module_type);
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 fb8de0bb9c..625b2d6312 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
@@ -79,14 +79,15 @@ class ButtonPressRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ButtonPressRequestTest()
- : rc_capabilities_(smart_objects::SmartType_Map)
+ : rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map))
, mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extention_(
std::make_shared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {}
void SetUp() OVERRIDE {
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
- rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
+ (*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
.WillByDefault(Return(rc_app_extention_));
@@ -95,7 +96,7 @@ class ButtonPressRequestTest
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(mock_hmi_capabilities_));
ON_CALL(mock_hmi_capabilities_, rc_capability())
- .WillByDefault(Return(&rc_capabilities_));
+ .WillByDefault(Return(rc_capabilities_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
ON_CALL(mock_policy_handler_,
CheckHMIType(kPolicyAppId,
@@ -140,7 +141,7 @@ class ButtonPressRequestTest
}
protected:
- smart_objects::SmartObject rc_capabilities_;
+ smart_objects::SmartObjectSPtr rc_capabilities_;
std::shared_ptr<MockApplication> mock_app_;
std::shared_ptr<rc_rpc_plugin::RCAppExtension> rc_app_extention_;
test::components::policy_test::MockPolicyHandlerInterface
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 532a62df3b..82b71f1be4 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
@@ -96,7 +96,8 @@ class GetInteriorVehicleDataRequestTest
, rc_app_extention2_(std::make_shared<RCAppExtension>(kModuleId))
, apps_lock_(std::make_shared<sync_primitives::Lock>())
, apps_da_(apps_, apps_lock_)
- , rc_capabilities_(smart_objects::SmartType::SmartType_Array) {
+ , rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType::SmartType_Array)) {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(*mock_app2_, app_id()).WillByDefault(Return(kAppId2));
ON_CALL(*mock_app_, is_remote_control_supported())
@@ -131,7 +132,7 @@ class GetInteriorVehicleDataRequestTest
frequency.first = max_request_in_time_frame;
frequency.second = time_frame_of_allowed_requests;
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
- rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
+ (*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, get_settings())
.WillByDefault(ReturnRef(app_mngr_settings_));
ON_CALL(app_mngr_settings_, get_interior_vehicle_data_frequency())
@@ -151,7 +152,7 @@ class GetInteriorVehicleDataRequestTest
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(mock_hmi_capabilities_));
ON_CALL(mock_hmi_capabilities_, rc_capability())
- .WillByDefault(Return(&rc_capabilities_));
+ .WillByDefault(Return(rc_capabilities_));
ON_CALL(mock_policy_handler_,
CheckHMIType(
_, mobile_apis::AppHMIType::eType::REMOTE_CONTROL, nullptr))
@@ -195,7 +196,7 @@ class GetInteriorVehicleDataRequestTest
DataAccessor<application_manager::ApplicationSet> apps_da_;
testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
mock_rc_capabilities_manager_;
- smart_objects::SmartObject rc_capabilities_;
+ smart_objects::SmartObjectSPtr rc_capabilities_;
testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
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 55be43f37b..e5f96215eb 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
@@ -106,7 +106,8 @@ class RCGetInteriorVehicleDataConsentTest
RCGetInteriorVehicleDataConsentTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, command_holder(app_mngr_)
- , rc_capabilities_(smart_objects::SmartType::SmartType_Array)
+ , 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>())
@@ -124,7 +125,7 @@ class RCGetInteriorVehicleDataConsentTest
, rpc_plugin(mock_rpc_plugin)
, optional_mock_rpc_plugin(mock_rpc_plugin) {
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
- rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
+ (*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
@@ -143,7 +144,7 @@ class RCGetInteriorVehicleDataConsentTest
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(mock_hmi_capabilities_));
ON_CALL(mock_hmi_capabilities_, rc_capability())
- .WillByDefault(Return(&rc_capabilities_));
+ .WillByDefault(Return(rc_capabilities_));
ON_CALL(mock_policy_handler_,
CheckHMIType(
_, mobile_apis::AppHMIType::eType::REMOTE_CONTROL, nullptr))
@@ -209,7 +210,7 @@ class RCGetInteriorVehicleDataConsentTest
mock_interior_data_cache_;
testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
mock_interior_data_manager_;
- smart_objects::SmartObject rc_capabilities_;
+ smart_objects::SmartObjectSPtr rc_capabilities_;
MockRPCPlugin mock_rpc_plugin;
MockCommandFactory mock_command_factory;
am::request_controller::RequestController request_controller;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc
index 200e458c17..81e0fa87af 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc
@@ -84,16 +84,10 @@ using namespace rc_rpc_plugin;
class ReleaseInteriorVehicleDataModuleRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ReleaseInteriorVehicleDataModuleRequestTest() : mock_app_(CreateMockApp()) {}
-
- void SetUp() OVERRIDE {
- TestPreCondition();
- ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppID));
- ON_CALL(mock_rc_capabilities_manager_,
- GetDefaultModuleIdFromCapabilities(kModuleType))
- .WillByDefault(Return(kDefaultModuleID));
- }
+ ReleaseInteriorVehicleDataModuleRequestTest()
+ : mock_app_(CreateMockApp())
+ , rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType::SmartType_Array)) {}
MessageSharedPtr CreateBasicMessage() {
MessageSharedPtr message = CreateMessage();
@@ -111,13 +105,6 @@ class ReleaseInteriorVehicleDataModuleRequestTest
return message;
}
- void TestPreCondition() {
- message_ = CreateBasicMessage();
- command_ =
- CreateRCCommand<commands::ReleaseInteriorVehicleDataModuleRequest>(
- message_);
- }
-
template <class Command>
std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
@@ -134,6 +121,26 @@ class ReleaseInteriorVehicleDataModuleRequestTest
}
protected:
+ void SetUp() OVERRIDE {
+ TestPreCondition();
+ ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppID));
+ ON_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillByDefault(Return(rc_capabilities_));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_,
+ GetDefaultModuleIdFromCapabilities(kModuleType))
+ .WillByDefault(Return(kDefaultModuleID));
+ }
+
+ void TestPreCondition() {
+ message_ = CreateBasicMessage();
+ command_ =
+ CreateRCCommand<commands::ReleaseInteriorVehicleDataModuleRequest>(
+ message_);
+ }
+
MessageSharedPtr message_;
ReleaseCommandPtr command_;
@@ -143,6 +150,7 @@ class ReleaseInteriorVehicleDataModuleRequestTest
MockInteriorDataManager mock_interior_data_manager_;
NiceMock<MockRCCapabilitiesManager> mock_rc_capabilities_manager_;
MockRCConsentManager mock_rc_consent_manger_;
+ smart_objects::SmartObjectSPtr rc_capabilities_;
};
TEST_F(ReleaseInteriorVehicleDataModuleRequestTest,
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 5a822a2fe4..1e4da625b2 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,11 +74,12 @@ class SetInteriorVehicleDataRequestTest
SetInteriorVehicleDataRequestTest()
: mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
- , rc_capabilities_(smart_objects::SmartType::SmartType_Array) {}
+ , rc_capabilities_(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType::SmartType_Array)) {}
void SetUp() OVERRIDE {
smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
- rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
+ (*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(
@@ -102,13 +103,14 @@ class SetInteriorVehicleDataRequestTest
nullptr))
.WillByDefault(Return(true));
ON_CALL(mock_hmi_capabilities_, rc_capability())
- .WillByDefault(Return(&rc_capabilities_));
+ .WillByDefault(Return(rc_capabilities_));
ON_CALL(mock_allocation_manager_, is_rc_enabled())
.WillByDefault(Return(true));
ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
.WillByDefault(Return(true));
ON_CALL(mock_rc_capabilities_manager_, GetModuleDataCapabilities(_, _))
- .WillByDefault(Return(std::make_pair("", capabilitiesStatus::success)));
+ .WillByDefault(
+ Return(std::make_pair("", capabilitiesStatus::kSuccess)));
}
MessageSharedPtr CreateBasicMessage() {
@@ -149,7 +151,7 @@ class SetInteriorVehicleDataRequestTest
std::shared_ptr<RCAppExtension> rc_app_extention_;
testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
mock_rc_capabilities_manager_;
- smart_objects::SmartObject rc_capabilities_;
+ smart_objects::SmartObjectSPtr rc_capabilities_;
testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
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 9bb3d9a6fb..62be7e8836 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
@@ -62,10 +62,9 @@ class ButtonGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~ButtonGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 8d3be68539..0b82feb1c5 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
@@ -64,7 +64,12 @@ class GetSystemInfoRequest : public app_mngr::commands::RequestToHMI {
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
+
+ /**
+ * @brief onTimeOut from request controller
+ */
+ 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 d4f35a4e2a..2d3c40c3f3 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
@@ -74,8 +74,7 @@ class GetSystemInfoResponse : public app_mngr::commands::ResponseFromHMI {
virtual void Run();
private:
- const SystemInfo GetSystemInfo(
- const hmi_apis::Common_Result::eType code) const;
+ const SystemInfo GetSystemInfo() const;
DISALLOW_COPY_AND_ASSIGN(GetSystemInfoResponse);
};
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 57a90955f4..6dd06f283d 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
@@ -61,10 +61,9 @@ class RCGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~RCGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 305a866659..15b2e13867 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
@@ -34,7 +34,6 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_IS_READY_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
-#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -78,11 +77,6 @@ class RCIsReadyRequest : public app_mngr::commands::RequestToHMI,
*/
void onTimeOut() OVERRIDE;
- /**
- * @brief Send request to HMI for fetching of cappabilities
- */
- void SendMessageToHMI();
-
private:
DISALLOW_COPY_AND_ASSIGN(RCIsReadyRequest);
};
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 d636485915..4ddd6f25fc 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
@@ -61,10 +61,9 @@ class TTSGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~TTSGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 73ef8c5234..b00fc9cffa 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
@@ -61,10 +61,9 @@ class TTSGetLanguageRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~TTSGetLanguageRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 a24a6446b3..802a196c46 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
@@ -63,10 +63,9 @@ class TTSGetSupportedLanguagesRequest
**/
virtual ~TTSGetSupportedLanguagesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 dd360eeb4a..039df31972 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
@@ -35,6 +35,8 @@
#include "application_manager/commands/request_to_hmi.h"
+#include <set>
+
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -77,11 +79,6 @@ class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI,
*/
void onTimeOut() OVERRIDE;
- /**
- * @brief Send request to HMI for fetching of cappabilities
- */
- void SendMessageToHMI();
-
private:
DISALLOW_COPY_AND_ASSIGN(TTSIsReadyRequest);
};
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 58d8d0f732..32e878e733 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
@@ -61,10 +61,9 @@ class UIGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~UIGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 842a97a717..d642beb341 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
@@ -61,10 +61,9 @@ class UIGetLanguageRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~UIGetLanguageRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 42ea555358..9c2492b9fe 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
@@ -62,10 +62,9 @@ class UIGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~UIGetSupportedLanguagesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 18536032b7..9bcde383e0 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
@@ -35,6 +35,8 @@
#include "application_manager/commands/request_to_hmi.h"
+#include <set>
+
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -77,11 +79,6 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI,
*/
virtual void onTimeOut() OVERRIDE;
- /**
- * @brief Send request to HMI for fetching of cappabilities
- */
- void SendMessageToHMI();
-
private:
DISALLOW_COPY_AND_ASSIGN(UIIsReadyRequest);
};
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 254d00452f..7f8485ffa0 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
@@ -61,10 +61,9 @@ class VRGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~VRGetCapabilitiesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 441795cfb5..abcaa35726 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
@@ -61,10 +61,9 @@ class VRGetLanguageRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~VRGetLanguageRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 ad87415a87..fb6d05b0aa 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
@@ -62,10 +62,9 @@ class VRGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~VRGetSupportedLanguagesRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 2dba80065a..cbd77087b2 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
@@ -34,7 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_IS_READY_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
-#include "application_manager/message_helper.h"
+
+#include <set>
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -78,11 +79,6 @@ class VRIsReadyRequest : public app_mngr::commands::RequestToHMI,
*/
void onTimeOut() OVERRIDE;
- /**
- * @brief Send request to HMI for fetching of cappabilities
- */
- void SendMessageToHMI();
-
private:
DISALLOW_COPY_AND_ASSIGN(VRIsReadyRequest);
};
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 2f85065ee7..af2ba4a1ea 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
@@ -83,22 +83,33 @@ class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
private:
/*
- * @brief Deletes VR commands from SDL for corresponding submenu ID
+ * @brief Deletes submenus that have a parentID that 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 app_mngr::SubMenuMap& subMenus);
+
+ /*
+ * @brief Deletes VR commands from SDL for corresponding submenu ID
*
- * @return TRUE on success, otherwise FALSE
+ * @param app_id Application ID
+ * @param parentID Parent ID of a nested submenu
*/
- void DeleteSubMenuVRCommands(app_mngr::ApplicationConstSharedPtr app);
+ void DeleteSubMenuVRCommands(app_mngr::ApplicationConstSharedPtr app,
+ uint32_t parentID);
/*
* @brief Deletes UI commands from SDL for corresponding submenu ID
*
* @param app_id Application ID
- *
- * @return TRUE on success, otherwise FALSE
+ * @param parentID Parent ID of a nested submenu
*/
- void DeleteSubMenuUICommands(app_mngr::ApplicationSharedPtr const app);
+ void DeleteSubMenuUICommands(app_mngr::ApplicationSharedPtr const app,
+ uint32_t parentID);
DISALLOW_COPY_AND_ASSIGN(DeleteSubMenuRequest);
};
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 6696689174..c0d22dcb89 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
@@ -58,6 +58,12 @@ void ButtonGetCapabilitiesRequest::Run() {
SendRequest();
}
+void ButtonGetCapabilitiesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities);
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
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 b6ab822c47..cc3a61a9df 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
@@ -58,22 +58,32 @@ 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) {
LOG4CXX_ERROR(logger_, "Error is returned. Capabilities won't be updated.");
return;
}
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
-
- hmi_capabilities.set_button_capabilities(
+ std::vector<std::string> sections_to_update{
+ hmi_response::button_capabilities};
+ hmi_capabilities_.set_button_capabilities(
(*message_)[strings::msg_params][hmi_response::capabilities]);
if ((*message_)[strings::msg_params].keyExists(
hmi_response::preset_bank_capabilities)) {
- hmi_capabilities.set_preset_bank_capabilities(
+ sections_to_update.push_back(hmi_response::preset_bank_capabilities);
+ hmi_capabilities_.set_preset_bank_capabilities(
(*message_)[strings::msg_params]
[hmi_response::preset_bank_capabilities]);
}
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::buttons, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save Buttons.GetCapabilities response to cache");
+ }
}
} // namespace commands
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 8546252119..7a505a46f3 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
@@ -59,6 +59,11 @@ void GetSystemInfoRequest::Run() {
SendRequest();
}
+void GetSystemInfoRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateCachedCapabilities();
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
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 baff925a4e..7a7d015e21 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
@@ -53,38 +53,38 @@ GetSystemInfoResponse::~GetSystemInfoResponse() {}
void GetSystemInfoResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const hmi_apis::Common_Result::eType code =
- static_cast<hmi_apis::Common_Result::eType>(
- (*message_)[strings::params][hmi_response::code].asInt());
+ const auto code = static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
- const SystemInfo& info = GetSystemInfo(code);
+ hmi_capabilities_.set_ccpu_version(policy_handler_.GetCCPUVersionFromPT());
+
+ if (hmi_apis::Common_Result::SUCCESS != code) {
+ LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
+ hmi_capabilities_.UpdateCachedCapabilities();
+ policy_handler_.SetPreloadedPtFlag(false);
+ return;
+ }
+
+ const SystemInfo& info = GetSystemInfo();
- // We have to set preloaded flag as false in policy table on any response
- // of GetSystemInfo (SDLAQ-CRS-2365)
policy_handler_.OnGetSystemInfo(
info.ccpu_version, info.wers_country_code, info.language);
+
+ hmi_capabilities_.OnSoftwareVersionReceived(info.ccpu_version);
}
-const SystemInfo GetSystemInfoResponse::GetSystemInfo(
- const hmi_apis::Common_Result::eType code) const {
+const SystemInfo GetSystemInfoResponse::GetSystemInfo() const {
SystemInfo info;
- if (hmi_apis::Common_Result::SUCCESS != code) {
- LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
- return info;
- }
info.ccpu_version =
(*message_)[strings::msg_params]["ccpu_version"].asString();
info.wers_country_code =
(*message_)[strings::msg_params]["wersCountryCode"].asString();
- const uint32_t lang_code =
- (*message_)[strings::msg_params]["language"].asUInt();
- info.language = application_manager::MessageHelper::CommonLanguageToString(
- static_cast<hmi_apis::Common_Language::eType>(lang_code));
-
- hmi_capabilities_.set_ccpu_version(info.ccpu_version);
+ const auto lang_code = static_cast<hmi_apis::Common_Language::eType>(
+ (*message_)[strings::msg_params]["language"].asUInt());
+ info.language = MessageHelper::CommonLanguageToString(lang_code);
return info;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
index da3612b043..c9270fd80b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
@@ -54,7 +54,7 @@ OnReadyNotification::~OnReadyNotification() {}
void OnReadyNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- application_manager_.OnHMIStartedCooperation();
+ application_manager_.OnHMIReady();
event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady);
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 f89baad737..293857f8d5 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
@@ -59,20 +59,31 @@ OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {}
void OnTTSLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
-
- hmi_capabilities.set_active_tts_language(
+ hmi_capabilities_.set_active_tts_language(
static_cast<hmi_apis::Common_Language::eType>(
(*message_)[strings::msg_params][strings::language].asInt()));
/* need to clarify, because unchanged VR
cause WRONG_LANGUAGE on Register */
- hmi_capabilities.set_active_vr_language(
+ hmi_capabilities_.set_active_vr_language(
static_cast<hmi_apis::Common_Language::eType>(
(*message_)[strings::msg_params][strings::language].asInt()));
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save TTS.OnLanguageChange response to cache");
+ }
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vr, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save VR.OnLanguageChange response to cache");
+ }
+
(*message_)[strings::msg_params][strings::hmi_display_language] =
- hmi_capabilities.active_ui_language();
+ hmi_capabilities_.active_ui_language();
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
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 697b2036c4..995d69cc45 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
@@ -59,17 +59,22 @@ OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {}
void OnUILanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
-
- hmi_capabilities.set_active_ui_language(
+ hmi_capabilities_.set_active_ui_language(
static_cast<hmi_apis::Common_Language::eType>(
(*message_)[strings::msg_params][strings::language].asInt()));
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::ui, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save UI.OnLanguageChange response to cache");
+ }
+
(*message_)[strings::msg_params][strings::hmi_display_language] =
(*message_)[strings::msg_params][strings::language];
(*message_)[strings::msg_params][strings::language] =
- hmi_capabilities.active_vr_language();
+ hmi_capabilities_.active_vr_language();
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
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 c308af9b92..1500f272ab 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
@@ -60,14 +60,19 @@ OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {}
void OnVRLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
-
- hmi_capabilities.set_active_vr_language(
+ hmi_capabilities_.set_active_vr_language(
static_cast<hmi_apis::Common_Language::eType>(
(*message_)[strings::msg_params][strings::language].asInt()));
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vr, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save VR.OnLanguageChange response to cache");
+ }
+
(*message_)[strings::msg_params][strings::hmi_display_language] =
- hmi_capabilities.active_ui_language();
+ hmi_capabilities_.active_ui_language();
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
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 d8ad6087a6..d882dcd6e7 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
@@ -57,6 +57,12 @@ void RCGetCapabilitiesRequest::Run() {
SendRequest();
}
+void RCGetCapabilitiesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities);
+}
+
} // namespace commands
} // namespace sdl_rpc_plugin
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 128b111c5e..910c12e979 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
@@ -53,13 +53,26 @@ RCGetCapabilitiesResponse::~RCGetCapabilitiesResponse() {}
void RCGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ 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) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ std::vector<std::string> sections_to_update;
bool rc_capability_exists =
(*message_)[strings::msg_params].keyExists(strings::rc_capability);
if (rc_capability_exists) {
- hmi_capabilities.set_rc_capability(
+ hmi_capabilities_.set_rc_capability(
(*message_)[strings::msg_params][strings::rc_capability]);
+ sections_to_update.push_back(strings::rc_capability);
}
bool seat_location_capability_exists =
@@ -67,11 +80,18 @@ void RCGetCapabilitiesResponse::Run() {
strings::seat_location_capability);
if (seat_location_capability_exists) {
- hmi_capabilities.set_seat_location_capability(
+ hmi_capabilities_.set_seat_location_capability(
(*message_)[strings::msg_params][strings::seat_location_capability]);
+ sections_to_update.push_back(strings::seat_location_capability);
}
- hmi_capabilities.set_rc_supported(rc_capability_exists);
+ hmi_capabilities_.set_rc_supported(rc_capability_exists);
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::rc, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save RC.GetCapabilities response to cache");
+ }
}
} // namespace commands
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 5e4af1503a..4ea0d43dc3 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
@@ -31,6 +31,9 @@
*/
#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h"
+
+#include <set>
+
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -77,11 +80,13 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_RC)) {
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities);
LOG4CXX_INFO(logger_,
"HmiInterfaces::HMI_INTERFACE_RC isn't available");
return;
}
- SendMessageToHMI();
+ RequestInterfaceCapabilities(hmi_interface::rc);
break;
}
default: {
@@ -93,14 +98,7 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
void RCIsReadyRequest::onTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
- SendMessageToHMI();
-}
-
-void RCIsReadyRequest::SendMessageToHMI() {
- std::shared_ptr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::RC_GetCapabilities, application_manager_));
- rpc_service_.ManageHMICommand(get_capabilities);
+ RequestInterfaceCapabilities(hmi_interface::rc);
}
} // namespace commands
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 9baaabf401..85f0b93b8c 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
@@ -57,6 +57,11 @@ void TTSGetCapabilitiesRequest::Run() {
SendRequest();
}
+void TTSGetCapabilitiesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 c0581a6380..e6edcdb365 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
@@ -52,19 +52,38 @@ TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {}
void TTSGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities);
+
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ std::vector<std::string> sections_to_update;
if ((*message_)[strings::msg_params].keyExists(
hmi_response::speech_capabilities)) {
- hmi_capabilities.set_speech_capabilities(
+ sections_to_update.push_back(hmi_response::speech_capabilities);
+ hmi_capabilities_.set_speech_capabilities(
(*message_)[strings::msg_params][hmi_response::speech_capabilities]);
}
if ((*message_)[strings::msg_params].keyExists(
hmi_response::prerecorded_speech_capabilities)) {
- hmi_capabilities.set_prerecorded_speech(
+ sections_to_update.push_back(hmi_response::prerecorded_speech_capabilities);
+ hmi_capabilities_.set_prerecorded_speech(
(*message_)[strings::msg_params]
[hmi_response::prerecorded_speech_capabilities]);
}
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save TTS.GetCapabilities response to cache");
+ }
}
} // namespace commands
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 7d2c15a9bf..d62c9627f5 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
@@ -57,6 +57,11 @@ void TTSGetLanguageRequest::Run() {
SendRequest();
}
+void TTSGetLanguageRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 627056dce1..1487fd7915 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
@@ -56,6 +56,18 @@ void TTSGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis;
+ 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) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
Common_Language::eType language = Common_Language::INVALID_ENUM;
if ((*message_).keyExists(strings::msg_params) &&
@@ -66,6 +78,12 @@ void TTSGetLanguageResponse::Run() {
hmi_capabilities_.set_active_tts_language(language);
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, message_->getSchema())) {
+ LOG4CXX_DEBUG(logger_, "Failed to save TTS.GetLanguage response to cache");
+ }
+
LOG4CXX_DEBUG(logger_,
"Raising event for function_id " << function_id()
<< " and correlation_id "
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 2cb47380d5..5d758c84b7 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
@@ -57,6 +57,11 @@ void TTSGetSupportedLanguagesRequest::Run() {
SendRequest();
}
+void TTSGetSupportedLanguagesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 a70d1c89a3..baa10394c5 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
@@ -59,11 +59,23 @@ void TTSGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages);
- hmi_capabilities.set_tts_supported_languages(
- (*message_)[strings::msg_params][hmi_response::languages]);
+ if (hmi_apis::Common_Result::SUCCESS != code) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ hmi_capabilities_.set_tts_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::tts, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save TTS.GetSupportedLanguages response to cache");
}
}
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 89b5961895..4ae737bec4 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
@@ -31,7 +31,6 @@
*/
#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -74,11 +73,13 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
hmi_capabilities.set_is_tts_cooperating(is_available);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_TTS)) {
+ UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::tts);
LOG4CXX_INFO(logger_,
"HmiInterfaces::HMI_INTERFACE_TTS isn't available");
return;
}
- SendMessageToHMI();
+
+ RequestInterfaceCapabilities(hmi_interface::tts);
break;
}
default: {
@@ -90,25 +91,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) {
void TTSIsReadyRequest::onTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
- SendMessageToHMI();
-}
-
-void TTSIsReadyRequest::SendMessageToHMI() {
- std::shared_ptr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage,
- application_manager_));
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
- hmi_capabilities.set_handle_response_for(*get_language);
- rpc_service_.ManageHMICommand(get_language);
- std::shared_ptr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetSupportedLanguages,
- application_manager_));
- rpc_service_.ManageHMICommand(get_all_languages);
- std::shared_ptr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_));
- rpc_service_.ManageHMICommand(get_capabilities);
+ RequestInterfaceCapabilities(hmi_interface::tts);
}
} // namespace commands
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 5f8704b3e5..32c19eabcd 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
@@ -57,6 +57,11 @@ void UIGetCapabilitiesRequest::Run() {
SendRequest();
}
+void UIGetCapabilitiesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 a3eb9244bd..9f45d174e7 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
@@ -53,80 +53,120 @@ UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {}
void UIGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ 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) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ std::vector<std::string> sections_to_update;
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
if (msg_params.keyExists(hmi_response::display_capabilities)) {
- hmi_capabilities.set_display_capabilities(
+ sections_to_update.push_back(hmi_response::display_capabilities);
+ hmi_capabilities_.set_display_capabilities(
msg_params[hmi_response::display_capabilities]);
}
if (msg_params.keyExists(hmi_response::hmi_zone_capabilities)) {
- hmi_capabilities.set_hmi_zone_capabilities(
+ sections_to_update.push_back(hmi_response::hmi_zone_capabilities);
+ hmi_capabilities_.set_hmi_zone_capabilities(
msg_params[hmi_response::hmi_zone_capabilities]);
}
if (msg_params.keyExists(hmi_response::soft_button_capabilities)) {
- hmi_capabilities.set_soft_button_capabilities(
+ sections_to_update.push_back(hmi_response::soft_button_capabilities);
+ hmi_capabilities_.set_soft_button_capabilities(
msg_params[hmi_response::soft_button_capabilities]);
}
// use newer parameter "audioPassThruCapabilitiesList" when available
if (msg_params.keyExists(strings::audio_pass_thru_capabilities_list)) {
- hmi_capabilities.set_audio_pass_thru_capabilities(
+ sections_to_update.push_back(strings::audio_pass_thru_capabilities);
+ hmi_capabilities_.set_audio_pass_thru_capabilities(
msg_params[strings::audio_pass_thru_capabilities_list]);
} else if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) {
smart_objects::SmartObject audio_pass_thru_capabilities_list(
smart_objects::SmartType_Array);
audio_pass_thru_capabilities_list[0] =
msg_params[strings::audio_pass_thru_capabilities];
- hmi_capabilities.set_audio_pass_thru_capabilities(
+ sections_to_update.push_back(strings::audio_pass_thru_capabilities);
+ hmi_capabilities_.set_audio_pass_thru_capabilities(
audio_pass_thru_capabilities_list);
}
if (msg_params.keyExists(strings::hmi_capabilities)) {
if (msg_params[strings::hmi_capabilities].keyExists(strings::navigation)) {
- hmi_capabilities.set_navigation_supported(
+ sections_to_update.push_back(strings::navigation);
+ hmi_capabilities_.set_navigation_supported(
msg_params[strings::hmi_capabilities][strings::navigation].asBool());
}
if (msg_params[strings::hmi_capabilities].keyExists(strings::phone_call)) {
- hmi_capabilities.set_phone_call_supported(
+ sections_to_update.push_back(strings::phone_call);
+ hmi_capabilities_.set_phone_call_supported(
msg_params[strings::hmi_capabilities][strings::phone_call].asBool());
}
if (msg_params[strings::hmi_capabilities].keyExists(
strings::video_streaming)) {
- hmi_capabilities.set_video_streaming_supported(
+ sections_to_update.push_back(strings::video_streaming);
+ hmi_capabilities_.set_video_streaming_supported(
msg_params[strings::hmi_capabilities][strings::video_streaming]
.asBool());
}
}
if (msg_params.keyExists(strings::system_capabilities)) {
- if (msg_params[strings::system_capabilities].keyExists(
- strings::navigation_capability)) {
- hmi_capabilities.set_navigation_capability(
- msg_params[strings::system_capabilities]
- [strings::navigation_capability]);
+ auto& system_capabilities_so = msg_params[strings::system_capabilities];
+
+ if (system_capabilities_so.keyExists(strings::navigation_capability)) {
+ sections_to_update.push_back(strings::navigation_capability);
+ hmi_capabilities_.set_navigation_capability(
+ system_capabilities_so[strings::navigation_capability]);
}
- if (msg_params[strings::system_capabilities].keyExists(
- strings::phone_capability)) {
- hmi_capabilities.set_phone_capability(
- msg_params[strings::system_capabilities][strings::phone_capability]);
+ if (system_capabilities_so.keyExists(strings::phone_capability)) {
+ sections_to_update.push_back(strings::phone_capability);
+ hmi_capabilities_.set_phone_capability(
+ system_capabilities_so[strings::phone_capability]);
}
- if (msg_params[strings::system_capabilities].keyExists(
- strings::video_streaming_capability)) {
- hmi_capabilities.set_video_streaming_capability(
- msg_params[strings::system_capabilities]
- [strings::video_streaming_capability]);
+ if (system_capabilities_so.keyExists(strings::video_streaming_capability)) {
+ sections_to_update.push_back(strings::video_streaming_capability);
+ hmi_capabilities_.set_video_streaming_capability(
+ system_capabilities_so[strings::video_streaming_capability]);
}
- if (msg_params[strings::system_capabilities].keyExists(
- strings::display_capabilities)) {
- hmi_capabilities.set_system_display_capabilities(
- msg_params[strings::system_capabilities]
- [strings::display_capabilities]);
+ if (system_capabilities_so.keyExists(
+ strings::driver_distraction_capability)) {
+ if (!system_capabilities_so[strings::driver_distraction_capability]
+ .empty()) {
+ hmi_capabilities_.set_driver_distraction_capability(
+ system_capabilities_so[strings::driver_distraction_capability]);
+ 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)) {
+ sections_to_update.push_back(strings::pcm_stream_capabilities);
+ hmi_capabilities_.set_pcm_stream_capabilities(
+ msg_params[strings::pcm_stream_capabilities]);
+ }
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::ui, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "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 d3b44d1168..948adbdece 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
@@ -57,6 +57,11 @@ void UIGetLanguageRequest::Run() {
SendRequest();
}
+void UIGetLanguageRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 2a5c0ab016..e32dbf3c47 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
@@ -56,6 +56,17 @@ UIGetLanguageResponse::~UIGetLanguageResponse() {}
void UIGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis;
+ 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) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
Common_Language::eType language = Common_Language::INVALID_ENUM;
@@ -67,6 +78,12 @@ void UIGetLanguageResponse::Run() {
hmi_capabilities_.set_active_ui_language(language);
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::ui, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_, "Failed to save UI.GetLanguage response to cache");
+ }
+
LOG4CXX_DEBUG(logger_,
"Raising event for function_id " << function_id()
<< " and correlation_id "
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 0665612525..0001af9203 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
@@ -57,6 +57,11 @@ void UIGetSupportedLanguagesRequest::Run() {
SendRequest();
}
+void UIGetSupportedLanguagesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 19ee62e51d..53704b3705 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
@@ -59,11 +59,23 @@ void UIGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS == code) {
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages);
- hmi_capabilities.set_ui_supported_languages(
- (*message_)[strings::msg_params][hmi_response::languages]);
+ if (hmi_apis::Common_Result::SUCCESS != code) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ hmi_capabilities_.set_ui_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::ui, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save UI.GetSupportedLanguages response to cache");
}
}
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 2546b704b2..4882095d42 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
@@ -31,7 +31,6 @@
*/
#include "sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -73,11 +72,13 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
hmi_capabilities.set_is_ui_cooperating(is_available);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_UI)) {
+ UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::ui);
LOG4CXX_INFO(logger_,
"HmiInterfaces::HMI_INTERFACE_UI isn't available");
return;
}
- SendMessageToHMI();
+
+ RequestInterfaceCapabilities(hmi_interface::ui);
break;
}
default: {
@@ -89,25 +90,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) {
void UIIsReadyRequest::onTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
- SendMessageToHMI();
-}
-
-void UIIsReadyRequest::SendMessageToHMI() {
- std::shared_ptr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage,
- application_manager_));
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
- hmi_capabilities.set_handle_response_for(*get_language);
- rpc_service_.ManageHMICommand(get_language);
- std::shared_ptr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetSupportedLanguages,
- application_manager_));
- rpc_service_.ManageHMICommand(get_all_languages);
- std::shared_ptr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetCapabilities, application_manager_));
- rpc_service_.ManageHMICommand(get_capabilities);
+ RequestInterfaceCapabilities(hmi_interface::ui);
}
} // namespace commands
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 b06bfa0e77..dd0d78cf2d 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
@@ -57,6 +57,11 @@ void VRGetCapabilitiesRequest::Run() {
SendRequest();
}
+void VRGetCapabilitiesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 80c308ea40..79d532bff8 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
@@ -52,11 +52,32 @@ VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {}
void VRGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities);
- hmi_capabilities.set_vr_capabilities(
- (*message_)[strings::msg_params][strings::vr_capabilities]);
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ std::vector<std::string> sections_to_update;
+ if (msg_params.keyExists(strings::vr_capabilities)) {
+ sections_to_update.push_back(strings::vr_capabilities);
+ hmi_capabilities_.set_vr_capabilities(msg_params[strings::vr_capabilities]);
+ }
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vr, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to save VR.GetCapabilities response to cache");
+ }
}
} // namespace commands
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 84179f6357..3aa36aee33 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
@@ -57,6 +57,11 @@ void VRGetLanguageRequest::Run() {
SendRequest();
}
+void VRGetLanguageRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 6b7fec736d..462ccc529c 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
@@ -56,6 +56,17 @@ VRGetLanguageResponse::~VRGetLanguageResponse() {}
void VRGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis;
+ 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) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
Common_Language::eType language = Common_Language::INVALID_ENUM;
@@ -67,6 +78,12 @@ void VRGetLanguageResponse::Run() {
hmi_capabilities_.set_active_vr_language(language);
+ std::vector<std::string> sections_to_update{hmi_response::language};
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vr, sections_to_update, message_->getSchema())) {
+ LOG4CXX_ERROR(logger_, "Failed to save VR.GetLanguage response to cache");
+ }
+
LOG4CXX_DEBUG(logger_,
"Raising event for function_id " << function_id()
<< " and correlation_id "
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 351940bf68..5755b91ab6 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
@@ -57,6 +57,11 @@ void VRGetSupportedLanguagesRequest::Run() {
SendRequest();
}
+void VRGetSupportedLanguagesRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages);
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 4c725267fa..59602cf10a 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
@@ -60,10 +60,20 @@ void VRGetSupportedLanguagesResponse::Run() {
static_cast<hmi_apis::Common_Result::eType>(
(*message_)[strings::params][hmi_response::code].asInt());
+ 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())) {
+ LOG4CXX_ERROR(
+ logger_, "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 12414eab10..f65f58f423 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
@@ -73,11 +73,13 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
hmi_capabilities.set_is_vr_cooperating(is_available);
if (!app_mngr::commands::CheckAvailabilityHMIInterfaces(
application_manager_, HmiInterfaces::HMI_INTERFACE_VR)) {
+ UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::vr);
LOG4CXX_INFO(logger_,
"HmiInterfaces::HMI_INTERFACE_VR isn't available");
return;
}
- SendMessageToHMI();
+
+ RequestInterfaceCapabilities(hmi_interface::vr);
break;
}
default: {
@@ -89,25 +91,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) {
void VRIsReadyRequest::onTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
- SendMessageToHMI();
-}
-
-void VRIsReadyRequest::SendMessageToHMI() {
- std::shared_ptr<smart_objects::SmartObject> get_language(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage,
- application_manager_));
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
- hmi_capabilities.set_handle_response_for(*get_language);
- rpc_service_.ManageHMICommand(get_language);
- std::shared_ptr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VR_GetSupportedLanguages,
- application_manager_));
- rpc_service_.ManageHMICommand(get_all_languages);
- std::shared_ptr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VR_GetCapabilities, application_manager_));
- rpc_service_.ManageHMICommand(get_capabilities);
+ RequestInterfaceCapabilities(hmi_interface::vr);
}
} // namespace commands
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 89ccfb8bd7..71bf867054 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
@@ -94,7 +94,12 @@ void AddSubMenuRequest::Run() {
const std::string& menu_name =
received_msg_params[strings::menu_name].asString();
- if (app->IsSubMenuNameAlreadyExist(menu_name)) {
+ const uint32_t parent_id =
+ received_msg_params.keyExists(strings::parent_id)
+ ? received_msg_params[strings::parent_id].asUInt()
+ : 0;
+
+ if (app->IsSubMenuNameAlreadyExist(menu_name, parent_id)) {
LOG4CXX_ERROR(logger_, "Menu name " << menu_name << " is duplicated.");
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
@@ -130,6 +135,10 @@ void AddSubMenuRequest::Run() {
}
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;
+ }
+
msg_params[strings::app_id] = app->app_id();
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
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 50217a9c8a..27cac83fad 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
@@ -177,7 +177,7 @@ void ChangeRegistrationRequest::Run() {
IsLanguageSupportedByVR(language) &&
IsLanguageSupportedByTTS(language))) {
LOG4CXX_ERROR(logger_, "Language is not supported");
- SendResponse(false, mobile_apis::Result::REJECTED);
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
@@ -460,8 +460,7 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
const int32_t& hmi_display_lang) {
const HMICapabilities& hmi_capabilities = hmi_capabilities_;
- const smart_objects::SmartObject* ui_languages =
- hmi_capabilities.ui_supported_languages();
+ const auto ui_languages = hmi_capabilities.ui_supported_languages();
if (!ui_languages) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -482,8 +481,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
const int32_t& hmi_display_lang) {
const HMICapabilities& hmi_capabilities = hmi_capabilities_;
- const smart_objects::SmartObject* vr_languages =
- hmi_capabilities.vr_supported_languages();
+ const auto vr_languages = hmi_capabilities.vr_supported_languages();
if (!vr_languages) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -504,8 +502,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
const int32_t& hmi_display_lang) {
const HMICapabilities& hmi_capabilities = hmi_capabilities_;
- const smart_objects::SmartObject* tts_languages =
- hmi_capabilities.tts_supported_languages();
+ const auto tts_languages = hmi_capabilities.tts_supported_languages();
if (!tts_languages) {
LOG4CXX_ERROR(logger_, "NULL pointer");
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 6aaa2406e8..383daa9b83 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
@@ -33,6 +33,7 @@
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h"
+#include "application_manager/application.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
@@ -88,8 +89,41 @@ void DeleteSubMenuRequest::Run() {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true);
}
+void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app,
+ uint32_t parentID,
+ const SubMenuMap& subMenus) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SubMenuMap::const_iterator it = subMenus.begin();
+ LOG4CXX_DEBUG(logger_, "Delete Submenus with Parent ID: " << parentID);
+ while (subMenus.end() != it) {
+ if (!(*it->second).keyExists(strings::parent_id)) {
+ LOG4CXX_ERROR(logger_, "parent ID does not exist");
+ ++it;
+ continue;
+ }
+
+ if (parentID == (*it->second)[strings::parent_id].asUInt()) {
+ 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;
+ LOG4CXX_DEBUG(logger_, "Removing submenuID: " << menuID);
+ app->RemoveSubMenu(menuID);
+ } else {
+ ++it;
+ }
+ }
+}
+
void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
- ApplicationConstSharedPtr app) {
+ ApplicationConstSharedPtr app, uint32_t parentID) {
LOG4CXX_AUTO_TRACE(logger_);
const DataAccessor<CommandsMap> accessor = app->commands_map();
@@ -101,7 +135,7 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
continue;
}
- if ((*message_)[strings::msg_params][strings::menu_id].asInt() ==
+ if (parentID ==
(*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -116,9 +150,9 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
}
void DeleteSubMenuRequest::DeleteSubMenuUICommands(
- ApplicationSharedPtr const app) {
+ ApplicationSharedPtr const app, uint32_t parentID) {
LOG4CXX_AUTO_TRACE(logger_);
-
+ LOG4CXX_DEBUG(logger_, "Delete UI Commands with Parent ID: " << parentID);
const DataAccessor<CommandsMap> accessor(app->commands_map());
const CommandsMap& commands = accessor.GetData();
CommandsMap::const_iterator it = commands.begin();
@@ -130,13 +164,14 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(
continue;
}
- if ((*message_)[strings::msg_params][strings::menu_id].asInt() ==
- (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) {
+ if (parentID ==
+ (*it->second)[strings::menu_params][hmi_request::parent_id].asUInt()) {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
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;
+ LOG4CXX_DEBUG(logger_, "Removing UI Command: " << cmd_id);
app->RemoveCommand(cmd_id);
app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
it = commands.begin(); // Can not relay on
@@ -174,8 +209,13 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
if (result) {
// delete sub menu items from SDL and HMI
- DeleteSubMenuVRCommands(application);
- DeleteSubMenuUICommands(application);
+ 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());
}
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 6121747ccc..8b557efc5d 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
@@ -163,6 +163,16 @@ void GetSystemCapabilityRequest::Run() {
all_services);
break;
}
+ case mobile_apis::SystemCapabilityType::DRIVER_DISTRACTION:
+ if (hmi_capabilities.driver_distraction_capability()) {
+ response_params[strings::system_capability]
+ [strings::driver_distraction_capability] =
+ *hmi_capabilities.driver_distraction_capability();
+ } else {
+ SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
+ return;
+ }
+ break;
case mobile_apis::SystemCapabilityType::DISPLAYS: {
auto capabilities = hmi_capabilities.system_display_capabilities();
if (app->display_capabilities()) {
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 bca3b20fe0..9c4be847a1 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
@@ -139,8 +139,10 @@ void OnButtonEventNotification::Run() {
<< "in FULL or LIMITED hmi level");
continue;
}
- // if "app_id" absent send notification only in HMI_FULL mode
- if (is_app_id_exists || subscribed_app->IsFullscreen()) {
+ // 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);
}
}
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 a205660e23..87d16e87e6 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
@@ -149,8 +149,10 @@ void OnButtonPressNotification::Run() {
if (app->app_id() == subscribed_app->app_id()) {
SendButtonPress(subscribed_app);
}
- } else if (subscribed_app->IsFullscreen()) {
- // if No "appID" - send it FULL apps only.
+ } 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);
}
}
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 5fb66c25ac..70bd47e232 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
@@ -677,6 +677,8 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
response_params[strings::hmi_capabilities][strings::displays] = true;
response_params[strings::hmi_capabilities][strings::seat_location] =
hmi_capabilities.seat_location_capability() ? true : false;
+ response_params[strings::hmi_capabilities][strings::driver_distraction] =
+ hmi_capabilities.driver_distraction_supported();
}
void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
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
new file mode 100644
index 0000000000..f3d8dd4f93
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc
@@ -0,0 +1,116 @@
+/*
+ * 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/button_get_capabilities_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace button_get_capabilities_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::ButtonGetCapabilitiesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+} // namespace
+
+class ButtonGetCapabilitiesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<ButtonGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(ButtonGetCapabilitiesRequestTest,
+ onTimeOut_ButtonsGetCapabilitiesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<ButtonGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace button_get_capabilities_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/button_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
index 7d9ed899a6..f90611f58d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
@@ -86,6 +86,7 @@ TEST_F(ButtonGetCapabilitiesResponseTest, Run_CodeSuccess_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_, set_button_capabilities(capabilities_));
EXPECT_CALL(mock_hmi_capabilities_,
set_preset_bank_capabilities(preset_bank_capabilities_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -102,6 +103,23 @@ TEST_F(ButtonGetCapabilitiesResponseTest, Run_CodeAborted_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_preset_bank_capabilities(preset_bank_capabilities_))
.Times(0);
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(ButtonGetCapabilitiesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr msg = CreateMsgParams();
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ ResponsePtr command(CreateCommand<ButtonGetCapabilitiesResponse>(msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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 11589683be..30d125ff46 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
@@ -126,11 +126,27 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) {
static_cast<hmi_apis::Common_Language::eType>(lang_code)))
.Times(0);
- EXPECT_CALL(mock_policy_handler_, OnGetSystemInfo("", "", ""));
+ 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;
+ (*command_msg)[strings::msg_params][hmi_response::capabilities] =
+ (capabilities_);
+
+ ResponseFromHMIPtr command(CreateCommand<GetSystemInfoResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_, OnSoftwareVersionReceived(ccpu_version));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
} // namespace get_system_info_response
} // namespace hmi_commands_test
} // namespace commands_test
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 26f7a63872..3819c720f8 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
@@ -545,7 +545,7 @@ TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) {
std::shared_ptr<Command> command =
CreateCommand<OnReadyNotification>(message);
- EXPECT_CALL(app_mngr_, OnHMIStartedCooperation());
+ EXPECT_CALL(app_mngr_, OnHMIReady());
EXPECT_CALL(app_mngr_, event_dispatcher());
EXPECT_CALL(mock_event_dispatcher_, raise_event(_))
.WillOnce(GetEventId(&event_id));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
index 926e51446f..00c95b5425 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
@@ -60,6 +60,7 @@ using sdl_rpc_plugin::commands::AudioStartStreamRequest;
namespace {
const uint32_t kHmiAppId = 13u;
+const uint32_t kCorrelationId = 2u;
const am::HmiInterfaces::InterfaceID kHmiInterface =
am::HmiInterfaces::HMI_INTERFACE_Navigation;
} // namespace
@@ -74,11 +75,24 @@ class AudioStartStreamRequestTest
command_ = CreateCommand<AudioStartStreamRequest>(msg_);
}
+ void UpdateMsgParams(MessageSharedPtr& message) {
+ (*message)[am::strings::params][am::strings::correlation_id] =
+ kCorrelationId;
+ (*message)[am::strings::params][am::strings::message_type] =
+ am::MessageType::kRequest;
+ (*message)[am::strings::params][am::strings::function_id] =
+ static_cast<int32_t>(hmi_apis::FunctionID::Navigation_StartAudioStream);
+ (*message)[am::strings::msg_params][am::strings::app_id] = kHmiAppId;
+ }
+
std::pair<uint32_t, int32_t> start_stream_retry_amount_;
MessageSharedPtr msg_;
std::shared_ptr<AudioStartStreamRequest> command_;
+ static const std::string big_url_;
};
+const std::string AudioStartStreamRequestTest::big_url_(20000u, 'a');
+
TEST_F(AudioStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(kHmiInterface))
.WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -114,6 +128,48 @@ TEST_F(AudioStartStreamRequestTest, Run_HmiInterfaceAvailable_SentRequest) {
command_->Run();
}
+TEST_F(AudioStartStreamRequestTest, Run_HmiHugeUrl_SentRequest_SUCCESS) {
+ UpdateMsgParams(msg_);
+
+ (*msg_)[am::strings::msg_params][am::strings::url] = big_url_;
+
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(kHmiInterface))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application_by_hmi_app(kHmiAppId))
+ .WillByDefault(Return(mock_app));
+
+ ON_CALL(app_mngr_, application(kHmiAppId)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmiAppId));
+
+ EXPECT_CALL(*mock_app, set_audio_streaming_allowed(true));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(msg_));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(AudioStartStreamRequestTest, ValidateSchema_HmiHugeUrl_SUCCESS) {
+ UpdateMsgParams(msg_);
+
+ (*msg_)[am::strings::params][am::strings::protocol_type] =
+ am::commands::CommandImpl::hmi_protocol_type_;
+ (*msg_)[am::strings::params][am::strings::protocol_version] =
+ am::commands::CommandImpl::protocol_version_;
+
+ (*msg_)[am::strings::msg_params][am::strings::url] = big_url_;
+
+ hmi_apis::HMI_API hmi_so_factory;
+ ns_smart_device_link::ns_smart_objects::CSmartSchema schema;
+ hmi_so_factory.GetSchema(hmi_apis::FunctionID::Navigation_StartAudioStream,
+ hmi_apis::messageType::eType::request,
+ schema);
+
+ rpc::ValidationReport report("RPC");
+ EXPECT_EQ(smart_objects::errors::eType::OK, schema.validate(*msg_, &report));
+ EXPECT_EQ("", rpc::PrettyFormat(report));
+}
+
} // namespace navi_audio_start_stream_request
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
index 232d5ab628..ba4eefeee1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
@@ -59,6 +59,7 @@ using sdl_rpc_plugin::commands::NaviStartStreamRequest;
namespace {
const uint32_t kHmiAppId = 13u;
+const uint32_t kCorrelationId = 2u;
const am::HmiInterfaces::InterfaceID kHmiInterface =
am::HmiInterfaces::HMI_INTERFACE_Navigation;
} // namespace
@@ -73,11 +74,24 @@ class NaviStartStreamRequestTest
command_ = CreateCommand<NaviStartStreamRequest>(msg_);
}
+ void UpdateMsgParams(MessageSharedPtr& message) {
+ (*message)[am::strings::params][am::strings::correlation_id] =
+ kCorrelationId;
+ (*message)[am::strings::params][am::strings::message_type] =
+ am::MessageType::kRequest;
+ (*message)[am::strings::params][am::strings::function_id] =
+ static_cast<int32_t>(hmi_apis::FunctionID::Navigation_StartStream);
+ (*message)[am::strings::msg_params][am::strings::app_id] = kHmiAppId;
+ }
+
std::pair<uint32_t, int32_t> start_stream_retry_amount_;
MessageSharedPtr msg_;
std::shared_ptr<NaviStartStreamRequest> command_;
+ static const std::string big_url_;
};
+const std::string NaviStartStreamRequestTest::big_url_(20000u, 'a');
+
TEST_F(NaviStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(kHmiInterface))
.WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -113,6 +127,48 @@ TEST_F(NaviStartStreamRequestTest, Run_HmiInterfaceAvailable_SentRequest) {
command_->Run();
}
+TEST_F(NaviStartStreamRequestTest, Run_HmiHugeUrl_SentRequest_SUCCESS) {
+ UpdateMsgParams(msg_);
+
+ (*msg_)[am::strings::msg_params][am::strings::url] = big_url_;
+
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(kHmiInterface))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application_by_hmi_app(kHmiAppId))
+ .WillByDefault(Return(mock_app));
+
+ ON_CALL(app_mngr_, application(kHmiAppId)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmiAppId));
+
+ EXPECT_CALL(*mock_app, set_video_streaming_allowed(true));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(msg_));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(NaviStartStreamRequestTest, ValidateSchema_HmiHugeUrl_SUCCESS) {
+ UpdateMsgParams(msg_);
+
+ (*msg_)[am::strings::params][am::strings::protocol_type] =
+ am::commands::CommandImpl::hmi_protocol_type_;
+ (*msg_)[am::strings::params][am::strings::protocol_version] =
+ am::commands::CommandImpl::protocol_version_;
+
+ (*msg_)[am::strings::msg_params][am::strings::url] = big_url_;
+
+ hmi_apis::HMI_API hmi_so_factory;
+ ns_smart_device_link::ns_smart_objects::CSmartSchema schema;
+ hmi_so_factory.GetSchema(hmi_apis::FunctionID::Navigation_StartStream,
+ hmi_apis::messageType::eType::request,
+ schema);
+
+ rpc::ValidationReport report("RPC");
+ EXPECT_EQ(smart_objects::errors::eType::OK, schema.validate(*msg_, &report));
+ EXPECT_EQ("", rpc::PrettyFormat(report));
+}
+
} // namespace navi_start_stream_request
} // 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
new file mode 100644
index 0000000000..f7da89df0b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc
@@ -0,0 +1,106 @@
+/*
+ * 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/rc_get_capabilities_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace rc_get_capabilities_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::RCGetCapabilitiesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class RCGetCapabilitiesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::number] = kStrNumber;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(RCGetCapabilitiesRequestTest,
+ onTimeOut_OnCapabilityInitialized_RemoveRCGetCapabilities) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+}
+
+} // namespace rc_get_capabilities_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/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
index 67c36dce9c..22ecb014b0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
@@ -166,6 +166,24 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
EXPECT_CALL(mock_hmi_capabilities_, set_rc_capability(rc_capability_so));
EXPECT_CALL(mock_hmi_capabilities_, set_rc_supported(true));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(RCGetCapabilitiesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ RCGetCapabilitiesResponsePtr command(
+ CreateCommand<RCGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities));
+ ASSERT_TRUE(command->Init());
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
index 539c0efeb3..b569ecb83f 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
@@ -113,8 +113,14 @@ class RCIsReadyRequestTest
event.set_smart_object(*msg);
}
+ void HMICapabilitiesExpectations() {
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities))
+ .WillOnce(Return(true));
+ }
+
RCIsReadyRequestPtr command_;
- am::MockHmiInterfaces mock_hmi_interfaces_;
};
TEST_F(RCIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
@@ -123,6 +129,7 @@ TEST_F(RCIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
const bool is_message_contain_param = false;
Event event(hmi_apis::FunctionID::RC_IsReady);
PrepareEvent(is_message_contain_param, event);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_rc_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -149,6 +156,7 @@ TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
const bool is_message_contain_param = true;
Event event(hmi_apis::FunctionID::RC_IsReady);
PrepareEvent(is_message_contain_param, event, is_rc_cooperating_available);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_rc_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -157,6 +165,7 @@ TEST_F(RCIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
}
TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
+ HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
command_->onTimeOut();
}
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
new file mode 100644
index 0000000000..bae6b6082e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc
@@ -0,0 +1,117 @@
+/*
+ * 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/tts_get_capabilities_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace tts_get_capabilities_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::TTSGetCapabilitiesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class TTSGetCapabilitiesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<TTSGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<TTSGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace tts_get_capabilities_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/tts_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
index c7b96f1acf..2479b0a28e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
@@ -52,16 +52,20 @@ using testing::_;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
namespace {
-const std::string kText = "TEXT";
-}
+const std::string kText{"TEXT"};
+const hmi_apis::Common_Result::eType kSuccess =
+ hmi_apis::Common_Result::SUCCESS;
+} // namespace
class TTSGetCapabilitiesResponseTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(TTSGetCapabilitiesResponseTest, Run_BothExist_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
(*msg)[strings::msg_params][hmi_response::speech_capabilities] = kText;
(*msg)[strings::msg_params][hmi_response::prerecorded_speech_capabilities] =
kText;
@@ -70,50 +74,82 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_BothExist_SUCCESS) {
set_speech_capabilities(SmartObject(kText)));
EXPECT_CALL(mock_hmi_capabilities_,
set_prerecorded_speech(SmartObject(kText)));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlySpeech_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
(*msg)[strings::msg_params][hmi_response::speech_capabilities] = kText;
EXPECT_CALL(mock_hmi_capabilities_,
set_speech_capabilities(SmartObject(kText)));
EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0);
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlyPrerecorded_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
(*msg)[strings::msg_params][hmi_response::prerecorded_speech_capabilities] =
kText;
EXPECT_CALL(mock_hmi_capabilities_, set_speech_capabilities(_)).Times(0);
EXPECT_CALL(mock_hmi_capabilities_,
set_prerecorded_speech(SmartObject(kText)));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(TTSGetCapabilitiesResponseTest, Run_Nothing_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
EXPECT_CALL(mock_hmi_capabilities_, set_speech_capabilities(_)).Times(0);
EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0);
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(TTSGetCapabilitiesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ std::shared_ptr<TTSGetCapabilitiesResponse> command(
+ CreateCommand<TTSGetCapabilitiesResponse>(msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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
new file mode 100644
index 0000000000..a0bf0887db
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc
@@ -0,0 +1,115 @@
+/*
+ * 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/tts_get_language_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace tts_get_language_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::TTSGetLanguageRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class TTSGetLanguageRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace tts_get_language_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/tts_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
index c0d23cb34b..4aeef5198b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
@@ -51,10 +51,13 @@ using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
+namespace hmi_interface = application_manager::hmi_interface;
using namespace hmi_apis;
namespace {
const Common_Language::eType kLanguage = Common_Language::EN_GB;
+const hmi_apis::Common_Result::eType kSuccess =
+ hmi_apis::Common_Result::SUCCESS;
} // namespace
class TTSGetLanguageResponseTest
@@ -63,22 +66,28 @@ class TTSGetLanguageResponseTest
TEST_F(TTSGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<TTSGetLanguageResponse> command(
CreateCommand<TTSGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(kLanguage));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
+
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(TTSGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<TTSGetLanguageResponse> command(
CreateCommand<TTSGetLanguageResponse>(msg));
@@ -86,10 +95,31 @@ TEST_F(TTSGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_active_tts_language(Common_Language::INVALID_ENUM));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
+
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(TTSGetLanguageResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ std::shared_ptr<TTSGetLanguageResponse> command(
+ CreateCommand<TTSGetLanguageResponse>(msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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
new file mode 100644
index 0000000000..1561e1def5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc
@@ -0,0 +1,118 @@
+/*
+ * 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/tts_get_supported_languages_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace tts_get_supported_languages_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class TTSGetSupportedLanguagesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(TTSGetSupportedLanguagesRequestTest,
+ onTimeOut_TTSGetSupportedLanguagesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace tts_get_supported_languages_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/tts_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
index c0f187a85f..e09d3198d7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
@@ -57,6 +57,7 @@ using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesResponse;
@@ -95,6 +96,9 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_tts_supported_languages((
*command_msg)[strings::msg_params][hmi_response::languages]));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::tts, _, _));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -115,6 +119,7 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_UNSUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_tts_supported_languages(supported_languages))
.Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
@@ -122,6 +127,23 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_UNSUCCESS) {
am::hmi_response::languages));
}
+TEST_F(TTSGetSupportedLanguageResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<TTSGetSupportedLanguagesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
} // namespace tts_get_supported_languages_response
} // namespace hmi_commands_test
} // namespace commands_test
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
new file mode 100644
index 0000000000..e758bfca1f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc
@@ -0,0 +1,252 @@
+/*
+ * 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/tts_is_ready_request.h"
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace tts_is_ready_request {
+
+using ::testing::_;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::commands::RequestToHMI;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::TTSIsReadyRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+typedef std::shared_ptr<TTSIsReadyRequest> TTSIsReadyRequestPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class TTSIsReadyRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ TTSIsReadyRequestTest() : command_(CreateCommand<TTSIsReadyRequest>()) {}
+
+ void SetUpExpectations(const bool is_tts_cooperating_available,
+ const bool should_message_be_sent,
+ const bool message_contains_param,
+ const am::HmiInterfaces::InterfaceState state) {
+ if (should_message_be_sent) {
+ ExpectSendMessagesToHMI();
+ }
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_is_tts_cooperating(is_tts_cooperating_available));
+
+ if (message_contains_param) {
+ ON_CALL(app_mngr_, hmi_interfaces())
+ .WillByDefault(ReturnRef(mock_hmi_interfaces_));
+ EXPECT_CALL(
+ mock_hmi_interfaces_,
+ SetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS, state));
+ } else {
+ EXPECT_CALL(app_mngr_, hmi_interfaces())
+ .WillOnce(ReturnRef(mock_hmi_interfaces_));
+ EXPECT_CALL(mock_hmi_interfaces_, SetInterfaceState(_, _)).Times(0);
+ }
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
+ .WillOnce(Return(state));
+ }
+
+ void ExpectSendMessagesToHMI() {
+ smart_objects::SmartObjectSPtr language =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ EXPECT_CALL(mock_message_helper_,
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, _))
+ .WillOnce(Return(language));
+ EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language, _));
+
+ smart_objects::SmartObjectSPtr support_language =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ EXPECT_CALL(
+ mock_message_helper_,
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetSupportedLanguages, _))
+ .WillOnce(Return(support_language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language, _));
+
+ smart_objects::SmartObjectSPtr capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ EXPECT_CALL(
+ mock_message_helper_,
+ CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetCapabilities, _))
+ .WillOnce(Return(capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
+ }
+
+ void PrepareEvent(const bool message_contains_param,
+ const bool is_tts_cooperating_available,
+ Event& out_event) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ if (message_contains_param) {
+ (*msg)[am::strings::msg_params][am::strings::available] =
+ is_tts_cooperating_available;
+ }
+ out_event.set_smart_object(*msg);
+ }
+
+ void HMICapabilitiesExpectations() {
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities))
+ .WillOnce(Return(true));
+ }
+
+ TTSIsReadyRequestPtr command_;
+};
+
+TEST_F(TTSIsReadyRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::number] = kStrNumber;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ RequestToHMIPtr command(CreateCommand<TTSIsReadyRequest>(command_msg));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(TTSIsReadyRequestTest,
+ Run_NoKeyAvailableInMessage_HmiInterfacesIgnored_CacheIsAbsent) {
+ const bool is_tts_cooperating_available = false;
+ const bool should_message_be_sent = true;
+ const bool message_contains_param = false;
+ const auto state = am::HmiInterfaces::STATE_NOT_RESPONSE;
+ Event event(hmi_apis::FunctionID::TTS_IsReady);
+ PrepareEvent(message_contains_param, is_tts_cooperating_available, event);
+ HMICapabilitiesExpectations();
+ SetUpExpectations(is_tts_cooperating_available,
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
+ command_->on_event(event);
+}
+
+TEST_F(TTSIsReadyRequestTest,
+ Run_KeyAvailableEqualToFalse_StateNotAvailable_CacheIsAbsent) {
+ const bool is_tts_cooperating_available = false;
+ const bool should_message_be_sent = false;
+ const bool message_contains_param = true;
+ const auto state = am::HmiInterfaces::STATE_NOT_AVAILABLE;
+ Event event(hmi_apis::FunctionID::TTS_IsReady);
+ PrepareEvent(message_contains_param, is_tts_cooperating_available, event);
+ SetUpExpectations(is_tts_cooperating_available,
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
+ command_->on_event(event);
+}
+
+TEST_F(TTSIsReadyRequestTest,
+ Run_KeyAvailableEqualToTrue_StateAvailable_CacheIsAbsnet) {
+ const bool is_tts_cooperating_available = true;
+ const bool should_message_be_sent = true;
+ const bool message_contains_param = true;
+ const auto state = am::HmiInterfaces::STATE_AVAILABLE;
+ Event event(hmi_apis::FunctionID::TTS_IsReady);
+ PrepareEvent(message_contains_param, is_tts_cooperating_available, event);
+ HMICapabilitiesExpectations();
+ SetUpExpectations(is_tts_cooperating_available,
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
+ command_->on_event(event);
+}
+
+TEST_F(TTSIsReadyRequestTest,
+ Run_HMIDoestRespond_SendMessageToHMIByTimeout_CacheIsAbsent) {
+ HMICapabilitiesExpectations();
+ ExpectSendMessagesToHMI();
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
+ command_->onTimeOut();
+}
+
+} // namespace tts_is_ready_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/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
new file mode 100644
index 0000000000..1057a89cc6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc
@@ -0,0 +1,115 @@
+/*
+ * 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/ui_get_capabilities_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace ui_get_capabilities_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::UIGetCapabilitiesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class UIGetCapabilitiesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace ui_get_capabilities_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/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 4683fc62c7..cf701caf51 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
@@ -51,6 +51,7 @@ using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::UIGetCapabilitiesResponse;
@@ -99,6 +100,7 @@ TEST_F(UIGetCapabilitiesResponseTest, RUN_SetDisplay_SUCCESSS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_display_capabilities(display_capabilities_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -119,6 +121,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetSoftButton_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_soft_button_capabilities(soft_button_capabilities_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -138,6 +141,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetHmiZone_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_hmi_zone_capabilities(hmi_zone_capabilities_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -162,6 +166,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) {
EXPECT_CALL(
mock_hmi_capabilities_,
set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -187,6 +192,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) {
EXPECT_CALL(
mock_hmi_capabilities_,
set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -206,6 +212,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetNavigation_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_navigation_supported(
hmi_capabilities_so[strings::navigation].asBool()));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -225,6 +232,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetPhoneCall_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_phone_call_supported(
hmi_capabilities_so[strings::phone_call].asBool()));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -244,6 +252,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreaming_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_video_streaming_supported(
hmi_capabilities_so[strings::video_streaming].asBool()));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -268,6 +277,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetNavigationCapability_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_navigation_capability(navigation_capability_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -289,6 +299,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetPhonenCapability_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_phone_capability(phone_capability_so));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -339,6 +350,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_video_streaming_capability(video_streaming_capability));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -362,6 +374,39 @@ TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) {
command->Run();
}
+TEST_F(UIGetCapabilitiesResponseTest,
+ SaveCachedCapabilitiesToFileCall_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));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::ui, _, _));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(UIGetCapabilitiesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
} // namespace ui_get_capabilities_response
} // namespace hmi_commands_test
} // namespace commands_test
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
new file mode 100644
index 0000000000..c944f1b49b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc
@@ -0,0 +1,115 @@
+/*
+ * 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/ui_get_language_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace ui_get_language_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::UIGetLanguageRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class UIGetLanguageRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace ui_get_language_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/ui_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
index 7e8040543d..d3edf074bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
@@ -52,6 +52,7 @@ using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
+namespace hmi_interface = application_manager::hmi_interface;
using namespace hmi_apis;
typedef NiceMock<
@@ -60,6 +61,8 @@ typedef NiceMock<
namespace {
const hmi_apis::Common_Language::eType kLanguage = Common_Language::EN_GB;
+const hmi_apis::Common_Result::eType kSuccess =
+ hmi_apis::Common_Result::SUCCESS;
} // namespace
class UIGetLanguageResponseTest
@@ -68,33 +71,58 @@ class UIGetLanguageResponseTest
TEST_F(UIGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<UIGetLanguageResponse> command(
CreateCommand<UIGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_ui_language(kLanguage));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::ui, _, _));
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(UIGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<UIGetLanguageResponse> command(
CreateCommand<UIGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_,
set_active_ui_language(Common_Language::INVALID_ENUM));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::ui, _, _));
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(UIGetLanguageResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ std::shared_ptr<UIGetLanguageResponse> command(
+ CreateCommand<UIGetLanguageResponse>(msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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
new file mode 100644
index 0000000000..251b6b7d58
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc
@@ -0,0 +1,118 @@
+/*
+ * 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/ui_get_supported_languages_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace ui_get_supported_languages_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::UIGetSupportedLanguagesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class UIGetSupportedLanguagesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<UIGetSupportedLanguagesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(UIGetSupportedLanguagesRequestTest,
+ onTimeOut_UIGetSupportedLanguagesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<UIGetSupportedLanguagesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace ui_get_supported_languages_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/ui_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
index 10cf244bcf..d73519734d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
@@ -54,6 +54,7 @@ using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
using sdl_rpc_plugin::commands::UIGetSupportedLanguagesResponse;
typedef std::shared_ptr<UIGetSupportedLanguagesResponse>
@@ -91,6 +92,9 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_ui_supported_languages((supported_languages)));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::ui, _, _));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -109,6 +113,7 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_ui_supported_languages(supported_languages))
.Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
@@ -116,6 +121,23 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
am::hmi_response::languages));
}
+TEST_F(UIGetSupportedLanguagesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ UIGetSupportedLanguagesResponsePtr command(
+ CreateCommand<UIGetSupportedLanguagesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
} // namespace ui_get_supported_languages_response
} // namespace hmi_commands_test
} // namespace commands_test
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 837b8438dc..a82ad39d83 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
@@ -141,17 +141,33 @@ class UIIsReadyRequestTest
event.set_smart_object(*msg);
}
+ void HMICapabilitiesExpectations() {
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(hmi_apis::FunctionID::UI_GetLanguage))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities))
+ .WillOnce(Return(true));
+ }
+
UIIsReadyRequestPtr command_;
policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
};
TEST_F(UIIsReadyRequestTest,
- OnEvent_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
+ OnEvent_NoKeyAvailableInMessage_HmiInterfacesIgnored_CacheIsAbsent) {
const bool is_ui_cooperating_available = false;
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = false;
Event event(hmi_apis::FunctionID::UI_IsReady);
PrepareEvent(is_message_contain_param, event);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_ui_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -161,7 +177,7 @@ TEST_F(UIIsReadyRequestTest,
}
TEST_F(UIIsReadyRequestTest,
- OnEvent_KeyAvailableEqualToFalse_StateNotAvailable) {
+ OnEvent_KeyAvailableEqualToFalse_StateNotAvailable_CacheIsAbsent) {
const bool is_ui_cooperating_available = false;
const bool is_send_message_to_hmi = false;
const bool is_message_contain_param = true;
@@ -174,12 +190,14 @@ TEST_F(UIIsReadyRequestTest,
command_->on_event(event);
}
-TEST_F(UIIsReadyRequestTest, OnEvent_KeyAvailableEqualToTrue_StateAvailable) {
+TEST_F(UIIsReadyRequestTest,
+ OnEvent_KeyAvailableEqualToTrue_StateAvailable_CacheIsAbsent) {
const bool is_ui_cooperating_available = true;
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = true;
Event event(hmi_apis::FunctionID::UI_IsReady);
PrepareEvent(is_message_contain_param, event, is_ui_cooperating_available);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_ui_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -187,7 +205,8 @@ TEST_F(UIIsReadyRequestTest, OnEvent_KeyAvailableEqualToTrue_StateAvailable) {
command_->on_event(event);
}
-TEST_F(UIIsReadyRequestTest, OnTimeout_SUCCESS) {
+TEST_F(UIIsReadyRequestTest, OnTimeout_SUCCESS_CacheIsAbsent) {
+ HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
command_->onTimeOut();
}
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 96f3b38fbf..92e3fa1187 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
@@ -58,7 +58,7 @@ typedef std::shared_ptr<UpdateSDLRequest> UpdateSDLRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
const uint32_t kCorrelationId = 1u;
-const std::string kStrNumber = "123";
+const std::string kStrNumber{"123"};
} // namespace
class UpdateSDLRequestTest : public CommandsTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
index 62ffc6be4d..f0d431ac86 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
@@ -55,7 +55,7 @@ typedef std::shared_ptr<UpdateSDLResponse> UpdateSDLResponsePtr;
namespace {
const uint32_t kConnectionKey = 2u;
-const std::string kStrNumber = "123";
+const std::string kStrNumber{"123"};
} // namespace
class UpdateSDLResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {
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
new file mode 100644
index 0000000000..cef87f06b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc
@@ -0,0 +1,115 @@
+/*
+ * 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/vr_get_capabilities_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vr_get_capabilities_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::VRGetCapabilitiesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class VRGetCapabilitiesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace vr_get_capabilities_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/vr_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
index 21acf2bb70..99024df485 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
@@ -51,6 +51,7 @@ using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
using am::commands::CommandImpl;
using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse;
@@ -95,6 +96,26 @@ TEST_F(VRGetCapabilitiesResponseTest, RUN_SUCCESSS) {
(*command_msg)[strings::msg_params][strings::vr_capabilities];
EXPECT_CALL(mock_hmi_capabilities_, set_vr_capabilities(vr_capabilities_so));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::vr, _, _));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(VRGetCapabilitiesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ VRGetCapabilitiesResponsePtr command(
+ CreateCommand<VRGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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
new file mode 100644
index 0000000000..6235b41691
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc
@@ -0,0 +1,115 @@
+/*
+ * 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/vr_get_language_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vr_get_language_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::VRGetLanguageRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class VRGetLanguageRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace vr_get_language_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/vr_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
index 8b00b4dded..d927195fd5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
@@ -52,6 +52,7 @@ using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
+namespace hmi_interface = application_manager::hmi_interface;
using namespace hmi_apis;
typedef NiceMock<
@@ -60,6 +61,8 @@ typedef NiceMock<
namespace {
const hmi_apis::Common_Language::eType kLanguage = Common_Language::EN_GB;
+const hmi_apis::Common_Result::eType kSuccess =
+ hmi_apis::Common_Result::SUCCESS;
} // namespace
class VRGetLanguageResponseTest
@@ -68,22 +71,28 @@ class VRGetLanguageResponseTest
TEST_F(VRGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<VRGetLanguageResponse> command(
CreateCommand<VRGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(kLanguage));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::vr, _, _));
+
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(VRGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] = kSuccess;
std::shared_ptr<VRGetLanguageResponse> command(
CreateCommand<VRGetLanguageResponse>(msg));
@@ -91,10 +100,31 @@ TEST_F(VRGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_active_vr_language(Common_Language::INVALID_ENUM));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::vr, _, _));
+
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+TEST_F(VRGetLanguageResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ std::shared_ptr<VRGetLanguageResponse> command(
+ CreateCommand<VRGetLanguageResponse>(msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage));
+ ASSERT_TRUE(command->Init());
command->Run();
}
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
new file mode 100644
index 0000000000..73657528e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc
@@ -0,0 +1,118 @@
+/*
+ * 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/vr_get_supported_languages_request.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vr_get_supported_languages_request {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using am::commands::RequestToHMI;
+using sdl_rpc_plugin::commands::VRGetSupportedLanguagesRequest;
+
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class VRGetSupportedLanguagesRequestTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::msg_params][strings::number] = kStrNumber;
+ (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+
+ RequestToHMIPtr command(
+ CreateCommand<VRGetSupportedLanguagesRequest>(command_msg));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(VRGetSupportedLanguagesRequestTest,
+ onTimeOut_VRGetSupportedLanguagesUpdated) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ RequestToHMIPtr command(
+ CreateCommand<VRGetSupportedLanguagesRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+} // namespace vr_get_supported_languages_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/vr_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
index b81823624c..2d51ee9d8a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
@@ -54,6 +54,7 @@ using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
using sdl_rpc_plugin::commands::VRGetSupportedLanguagesResponse;
typedef std::shared_ptr<VRGetSupportedLanguagesResponse>
@@ -91,6 +92,9 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_vr_supported_languages((supported_languages)));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::vr, _, _));
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -109,6 +113,7 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_vr_supported_languages(supported_languages))
.Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
@@ -116,6 +121,23 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
am::hmi_response::languages));
}
+TEST_F(VRGetSupportedLanguagesResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ VRGetSupportedLanguagesResponsePtr command(
+ CreateCommand<VRGetSupportedLanguagesResponse>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
} // namespace vr_get_supported_languages_response
} // namespace hmi_commands_test
} // namespace commands_test
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 9bb8e4c2d5..3d2a46707e 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
@@ -68,9 +68,8 @@ class VRIsReadyRequestTest
bool is_send_message_to_hmi,
bool is_message_contain_param,
am::HmiInterfaces::InterfaceState state) {
- const bool is_send_message_by_timeout = false;
if (is_send_message_to_hmi) {
- ExpectSendMessagesToHMI(is_send_message_by_timeout);
+ ExpectSendMessagesToHMI();
}
EXPECT_CALL(mock_hmi_capabilities_,
set_is_vr_cooperating(is_vr_cooperating_available));
@@ -91,7 +90,7 @@ class VRIsReadyRequestTest
.WillOnce(Return(state));
}
- void ExpectSendMessagesToHMI(bool is_send_message_by_timeout) {
+ void ExpectSendMessagesToHMI() {
smart_objects::SmartObjectSPtr language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
EXPECT_CALL(mock_message_helper_,
@@ -127,15 +126,32 @@ class VRIsReadyRequestTest
event.set_smart_object(*msg);
}
+ void HMICapabilitiesExpectations() {
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(hmi_apis::FunctionID::VR_GetLanguage))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities))
+ .WillOnce(Return(true));
+ }
+
VRIsReadyRequestPtr command_;
};
-TEST_F(VRIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
+TEST_F(VRIsReadyRequestTest,
+ Run_NoKeyAvailableInMessage_HmiInterfacesIgnored_CacheIsAbsent) {
const bool is_vr_cooperating_available = false;
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = false;
Event event(hmi_apis::FunctionID::VR_IsReady);
PrepareEvent(is_message_contain_param, event);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_vr_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -143,7 +159,8 @@ TEST_F(VRIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
command_->on_event(event);
}
-TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) {
+TEST_F(VRIsReadyRequestTest,
+ Run_KeyAvailableEqualToFalse_StateNotAvailable_CacheIsAbsent) {
const bool is_vr_cooperating_available = false;
const bool is_send_message_to_hmi = false;
const bool is_message_contain_param = true;
@@ -156,12 +173,14 @@ TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) {
command_->on_event(event);
}
-TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
+TEST_F(VRIsReadyRequestTest,
+ Run_KeyAvailableEqualToTrue_StateAvailable_CacheIsAbsnet) {
const bool is_vr_cooperating_available = true;
const bool is_send_message_to_hmi = true;
const bool is_message_contain_param = true;
Event event(hmi_apis::FunctionID::VR_IsReady);
PrepareEvent(is_message_contain_param, event, is_vr_cooperating_available);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_vr_cooperating_available,
is_send_message_to_hmi,
is_message_contain_param,
@@ -169,9 +188,10 @@ TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
command_->on_event(event);
}
-TEST_F(VRIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
- const bool is_send_message_by_timeout = true;
- ExpectSendMessagesToHMI(is_send_message_by_timeout);
+TEST_F(VRIsReadyRequestTest,
+ Run_HMIDoestRespond_SendMessageToHMIByTimeout_CacheIsAbsent) {
+ HMICapabilitiesExpectations();
+ ExpectSendMessagesToHMI();
command_->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
index 4394c6fe5e..9736bb380b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
@@ -103,11 +103,11 @@ class ChangeRegistrationRequestTest
(*supported_languages_)[0] =
static_cast<int32_t>(mobile_apis::Language::EN_US);
EXPECT_CALL(mock_hmi_capabilities_, ui_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(mock_hmi_capabilities_, vr_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(mock_hmi_capabilities_, tts_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(app_mngr_, hmi_interfaces())
.WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
@@ -242,11 +242,11 @@ class ChangeRegistrationRequestTest
void ExpectationsHmiCapabilities(
smart_objects::SmartObjectSPtr supported_languages) {
EXPECT_CALL(mock_hmi_capabilities_, ui_supported_languages())
- .WillOnce(Return(supported_languages.get()));
+ .WillOnce(Return(supported_languages));
EXPECT_CALL(mock_hmi_capabilities_, vr_supported_languages())
- .WillOnce(Return(supported_languages.get()));
+ .WillOnce(Return(supported_languages));
EXPECT_CALL(mock_hmi_capabilities_, tts_supported_languages())
- .WillOnce(Return(supported_languages.get()));
+ .WillOnce(Return(supported_languages));
}
void ResultCommandExpectations(MessageSharedPtr msg,
@@ -381,11 +381,11 @@ TEST_F(ChangeRegistrationRequestTest,
(*supported_languages_)[0] =
static_cast<int32_t>(mobile_apis::Language::EN_US);
EXPECT_CALL(mock_hmi_capabilities_, ui_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(mock_hmi_capabilities_, vr_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(mock_hmi_capabilities_, tts_supported_languages())
- .WillOnce(Return(supported_languages_.get()));
+ .WillOnce(Return(supported_languages_));
EXPECT_CALL(app_mngr_, hmi_interfaces())
.WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
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 04f12568b4..cd832d3122 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
@@ -98,7 +98,9 @@ class DeleteSubMenuRequestTest
public:
DeleteSubMenuRequestTest()
: commands_lock_(std::make_shared<sync_primitives::Lock>())
+ , sub_menu_lock_(std::make_shared<sync_primitives::RecursiveLock>())
, accessor_(commands_map_, commands_lock_)
+ , sub_menu_accessor_(sub_menu_map_, sub_menu_lock_)
, message_(CreateMessage())
, command_(CreateCommand<DeleteSubMenuRequest>(message_))
, mock_help_prompt_manager_(
@@ -106,8 +108,11 @@ class DeleteSubMenuRequestTest
, app_(CreateMockApp()) {}
am::CommandsMap commands_map_;
+ am::SubMenuMap sub_menu_map_;
mutable std::shared_ptr<sync_primitives::Lock> commands_lock_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock> sub_menu_lock_;
DataAccessor<am::CommandsMap> accessor_;
+ DataAccessor<am::SubMenuMap> sub_menu_accessor_;
MessageSharedPtr message_;
DeleteSubMenuRequestPtr command_;
@@ -266,6 +271,17 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
+ 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";
+
+ 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_));
InSequence seq;
@@ -330,6 +346,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
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);
@@ -357,6 +374,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
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);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
index ffa7203f1f..93ccf6c435 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
@@ -77,10 +77,25 @@ class OnSystemRequestNotificationTest
ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
}
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[strings::params][strings::connection_key] = kConnectionKey;
+ (*message)[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID);
+ const mobile_apis::RequestType::eType request_type =
+ RequestType::NAVIGATION;
+ (*message)[strings::msg_params][strings::request_type] = request_type;
+ return message;
+ }
+
+ static const std::string big_url_;
+
protected:
MockAppPtr mock_app_;
};
+const std::string OnSystemRequestNotificationTest::big_url_(20000u, 'a');
+
TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
const mobile_apis::RequestType::eType request_type =
mobile_apis::RequestType::PROPRIETARY;
@@ -160,6 +175,56 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
(*msg)[strings::params][strings::protocol_version].asInt());
}
+TEST_F(OnSystemRequestNotificationTest, Run_NavigationHugeUrl_SUCCESS) {
+ MessageSharedPtr msg = CreateBasicMessage();
+
+ (*msg)[strings::msg_params][strings::url] = big_url_;
+
+ auto command = CreateCommand<OnSystemRequestNotification>(msg);
+
+ PreConditions();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, RequestType::NAVIGATION))
+ .WillByDefault(Return(true));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(msg, false));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnSystemRequestNotificationTest,
+ ValidateSchema_NavigationHugeUrl_SUCCESS) {
+ MessageSharedPtr msg = CreateBasicMessage();
+
+ (*msg)[strings::params][strings::protocol_type] =
+ CommandImpl::hmi_protocol_type_;
+ (*msg)[strings::params][strings::protocol_version] =
+ CommandImpl::protocol_version_;
+ (*msg)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+
+ (*msg)[strings::msg_params][strings::url] = big_url_;
+
+ mobile_apis::MOBILE_API mobile_so_factoy;
+ ns_smart_device_link::ns_smart_objects::CSmartSchema schema;
+ mobile_so_factoy.GetSchema(mobile_apis::FunctionID::eType::OnSystemRequestID,
+ mobile_apis::messageType::eType::notification,
+ schema);
+
+ rpc::ValidationReport report("RPC");
+ EXPECT_EQ(smart_objects::errors::eType::OK, schema.validate(*msg, &report));
+ EXPECT_EQ("", rpc::PrettyFormat(report));
+}
+
TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
const mobile_apis::RequestType::eType request_type =
mobile_apis::RequestType::HTTP;
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 6376570106..a42aa61400 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
@@ -201,6 +201,8 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(smart_objects::SmartObjectSPtr()));
ON_CALL(mock_hmi_capabilities_, pcm_stream_capabilities())
.WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, seat_location_capability())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
ON_CALL(app_mngr_settings_, supported_diag_modes())
.WillByDefault(ReturnRef(kDummyDiagModes));
ON_CALL(mock_policy_handler_, GetAppRequestTypes(_, _))
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 7f2e8389ad..74f12c07d4 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
@@ -59,10 +59,9 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI {
**/
virtual ~VIGetVehicleTypeRequest();
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ void Run() 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 fa9bfebad4..96f8c8ecb8 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
@@ -75,11 +75,6 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI,
*/
void onTimeOut() OVERRIDE;
- /**
- * @brief Send request to HMI for fetching of cappabilities
- */
- void SendMessageToHMI();
-
private:
DISALLOW_COPY_AND_ASSIGN(VIIsReadyRequest);
};
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 250584bd12..e8df12ca5c 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
@@ -54,6 +54,12 @@ void VIGetVehicleTypeRequest::Run() {
SendRequest();
}
+void VIGetVehicleTypeRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
+}
+
} // namespace commands
} // namespace vehicle_info_plugin
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 fb6eadf747..dcc73d26f3 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
@@ -50,10 +50,29 @@ VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {}
void VIGetVehicleTypeResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- HMICapabilities& hmi_capabilities = hmi_capabilities_;
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
- hmi_capabilities.set_vehicle_type(
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
+
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_DEBUG(logger_,
+ "Request was not successful. Don't change HMI capabilities");
+ return;
+ }
+
+ std::vector<std::string> sections_to_update{hmi_response::vehicle_type};
+ hmi_capabilities_.set_vehicle_type(
(*message_)[strings::msg_params][hmi_response::vehicle_type]);
+
+ if (!hmi_capabilities_.SaveCachedCapabilitiesToFile(
+ hmi_interface::vehicle_info,
+ sections_to_update,
+ message_->getSchema())) {
+ LOG4CXX_ERROR(
+ logger_, "Failed to save VehicleInfo.GetVehicleType response to cache");
+ }
}
} // namespace commands
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 93781a7420..3525be059d 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
@@ -31,7 +31,9 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_is_ready_request.h"
-#include "application_manager/message_helper.h"
+
+#include <set>
+
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/rpc_service.h"
@@ -79,10 +81,12 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
LOG4CXX_INFO(
logger_,
"HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available");
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
return;
}
- SendMessageToHMI();
+ RequestInterfaceCapabilities(hmi_interface ::vehicle_info);
break;
}
default: {
@@ -94,15 +98,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) {
void VIIsReadyRequest::onTimeOut() {
// Note(dtrunov): According to new requirment APPLINK-27956
- SendMessageToHMI();
-}
-
-void VIIsReadyRequest::SendMessageToHMI() {
- std::shared_ptr<smart_objects::SmartObject> get_type(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
- application_manager_));
- rpc_service_.ManageHMICommand(get_type);
+ RequestInterfaceCapabilities(hmi_interface ::vehicle_info);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
index ea8dab0366..48df3d03bd 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
@@ -70,7 +70,7 @@ typedef std::shared_ptr<VIGetVehicleDataResponse> VIGetVehicleDataResponsePtr;
namespace {
const uint32_t kConnectionKey = 2u;
const uint32_t kCorrelationId = 1u;
-const std::string kStrNumber = "123";
+const std::string kStrNumber{"123"};
} // namespace
class VIGetVehicleDataResponseTest
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
new file mode 100644
index 0000000000..20bf34f2ca
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc
@@ -0,0 +1,109 @@
+/*
+ * 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/vi_get_vehicle_type_request.h"
+
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vi_get_vehicle_type_request {
+
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
+using ::testing::_;
+using vehicle_info_plugin::commands::VIGetVehicleTypeRequest;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kStrNumber{"123"};
+} // namespace
+
+class VIGetVehicleTypeRequestTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateCommandMsg() {
+ auto command_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*command_msg)[am::strings::msg_params][am::strings::number] = kStrNumber;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ return command_msg;
+ }
+};
+
+TEST_F(VIGetVehicleTypeRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ auto command = CreateCommandVI<VIGetVehicleTypeRequest>(command_msg);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(
+ VIGetVehicleTypeRequestTest,
+ onTimeOut_VIGetVehicleTypeRequestTimeoutExpired_UpdateRequestsRequiredForVIGetVehicleType) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ auto command(CreateCommandVI<VIGetVehicleTypeRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ command->onTimeOut();
+}
+
+} // namespace vi_get_vehicle_type_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_response_test.cc
new file mode 100644
index 0000000000..8239905df7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_response_test.cc
@@ -0,0 +1,142 @@
+/*
+ * 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/vi_get_vehicle_type_response.h"
+
+#include <memory>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vi_get_vehicle_type_response {
+
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+namespace hmi_response = am::hmi_response;
+namespace hmi_interface = ::application_manager::hmi_interface;
+using vehicle_info_plugin::commands::VIGetVehicleTypeResponse;
+
+typedef std::shared_ptr<VIGetVehicleTypeResponse> VIGetVehicleTypeResponsePtr;
+typedef NiceMock<
+ ::test::components::application_manager_test::MockHMICapabilities>
+ MockHMICapabilities;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kVehicleType{"vehicle_type"};
+} // namespace
+
+class VIGetVehicleTypeResponseTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(VIGetVehicleTypeResponseTest,
+ RUN_ResultCodeSuccess_ChangeHMICapabilities) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::vehicle_type] = kVehicleType;
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ VIGetVehicleTypeResponsePtr command =
+ CreateCommandVI<VIGetVehicleTypeResponse>(command_msg);
+
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ set_vehicle_type(
+ (*command_msg)[strings::msg_params][hmi_response::vehicle_type]));
+ EXPECT_CALL(mock_hmi_capabilities_,
+ SaveCachedCapabilitiesToFile(hmi_interface::vehicle_info, _, _));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+ EXPECT_TRUE((*command_msg)[am::strings::msg_params].keyExists(
+ hmi_response::vehicle_type));
+}
+
+TEST_F(VIGetVehicleTypeResponseTest,
+ RUN_ResultCodeNotSuccess_DontChangeHMICapabilities) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+ (*command_msg)[strings::params][hmi_response::vehicle_type] = kVehicleType;
+
+ VIGetVehicleTypeResponsePtr command =
+ CreateCommandVI<VIGetVehicleTypeResponse>(command_msg);
+
+ EXPECT_CALL(mock_hmi_capabilities_, set_vehicle_type(_)).Times(0);
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_FALSE((*command_msg)[am::strings::msg_params].keyExists(
+ hmi_response::vehicle_type));
+}
+
+TEST_F(VIGetVehicleTypeResponseTest,
+ onTimeOut_Run_ResponseForInterface_ReceivedError) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::ABORTED;
+
+ VIGetVehicleTypeResponsePtr command =
+ CreateCommandVI<VIGetVehicleTypeResponse>(command_msg);
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+}
+
+} // namespace vi_get_vehicle_type_response
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
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 c083bf4d60..f207faad77 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
@@ -32,6 +32,9 @@
#include "hmi/vi_is_ready_request.h"
+#include <memory>
+#include <set>
+
#include "gtest/gtest.h"
#include "application_manager/event_engine/event.h"
@@ -55,25 +58,32 @@ using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
+using am::commands::RequestToHMI;
using am::event_engine::Event;
using vehicle_info_plugin::commands::VIIsReadyRequest;
typedef std::shared_ptr<VIIsReadyRequest> VIIsReadyRequestPtr;
+namespace {
+const uint32_t kConnectionKey = 2u;
+} // namespace
+
class VIIsReadyRequestTest
: public VICommandRequestTest<CommandsTestMocks::kIsNice> {
public:
VIIsReadyRequestTest() : command_(CreateCommandVI<VIIsReadyRequest>()) {}
void SetUpExpectations(bool is_vi_cooperating_available,
- bool is_send_message_to_hmi,
- bool is_message_contain_param,
+ bool should_message_be_sent,
+ bool message_contains_param,
am::HmiInterfaces::InterfaceState state) {
EXPECT_CALL(mock_hmi_capabilities_,
set_is_ivi_cooperating(is_vi_cooperating_available));
- if (is_message_contain_param) {
+ if (message_contains_param) {
EXPECT_CALL(app_mngr_, hmi_interfaces())
.WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
EXPECT_CALL(mock_hmi_interfaces_,
@@ -90,7 +100,7 @@ class VIIsReadyRequestTest
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VehicleInfo))
.WillOnce(Return(state));
- if (is_send_message_to_hmi) {
+ if (should_message_be_sent) {
ExpectSendMessagesToHMI();
}
}
@@ -104,61 +114,102 @@ class VIIsReadyRequestTest
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type, _));
}
- void PrepareEvent(bool is_message_contain_param,
- Event& event,
- bool is_vi_cooperating_available = false) {
+ void PrepareEvent(bool message_contains_param,
+ bool is_vi_cooperating_available,
+ Event& out_event) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- if (is_message_contain_param) {
+ if (message_contains_param) {
(*msg)[am::strings::msg_params][am::strings::available] =
is_vi_cooperating_available;
}
- event.set_smart_object(*msg);
+ out_event.set_smart_object(*msg);
+ }
+
+ void HMICapabilitiesExpectations() {
+ EXPECT_CALL(mock_hmi_capabilities_,
+ IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType))
+ .WillOnce(Return(true));
}
VIIsReadyRequestPtr command_;
};
+TEST_F(VIIsReadyRequestTest, RUN_SendRequest_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ VIIsReadyRequestPtr command = CreateCommandVI<VIIsReadyRequest>(command_msg);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ASSERT_TRUE(command->Init());
+
+ command->Run();
+
+ EXPECT_EQ(CommandImpl::hmi_protocol_type_,
+ (*command_msg)[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(CommandImpl::protocol_version_,
+ (*command_msg)[strings::params][strings::protocol_version].asInt());
+}
+
TEST_F(VIIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) {
const bool is_vi_cooperating_available = false;
- const bool is_send_message_to_hmi = true;
- const bool is_message_contain_param = false;
+ const bool should_message_be_sent = true;
+ const bool message_contains_param = false;
+ const auto state = am::HmiInterfaces::STATE_NOT_RESPONSE;
Event event(hmi_apis::FunctionID::VehicleInfo_IsReady);
- PrepareEvent(is_message_contain_param, event);
+ PrepareEvent(message_contains_param, is_vi_cooperating_available, event);
+ HMICapabilitiesExpectations();
SetUpExpectations(is_vi_cooperating_available,
- is_send_message_to_hmi,
- is_message_contain_param,
- am::HmiInterfaces::STATE_NOT_RESPONSE);
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
command_->on_event(event);
}
TEST_F(VIIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) {
const bool is_vi_cooperating_available = false;
- const bool is_send_message_to_hmi = false;
- const bool is_message_contain_param = true;
+ const bool should_message_be_sent = false;
+ const bool message_contains_param = true;
+ const auto state = am::HmiInterfaces::STATE_NOT_AVAILABLE;
Event event(hmi_apis::FunctionID::VehicleInfo_IsReady);
- PrepareEvent(is_message_contain_param, event);
+ PrepareEvent(message_contains_param, is_vi_cooperating_available, event);
SetUpExpectations(is_vi_cooperating_available,
- is_send_message_to_hmi,
- is_message_contain_param,
- am::HmiInterfaces::STATE_NOT_AVAILABLE);
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
command_->on_event(event);
}
TEST_F(VIIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) {
const bool is_vi_cooperating_available = true;
- const bool is_send_message_to_hmi = true;
- const bool is_message_contain_param = true;
+ const bool should_message_be_sent = true;
+ const bool message_contains_param = true;
+ const auto state = am::HmiInterfaces::STATE_AVAILABLE;
Event event(hmi_apis::FunctionID::VehicleInfo_IsReady);
- PrepareEvent(is_message_contain_param, event, is_vi_cooperating_available);
+ HMICapabilitiesExpectations();
+ PrepareEvent(message_contains_param, is_vi_cooperating_available, event);
SetUpExpectations(is_vi_cooperating_available,
- is_send_message_to_hmi,
- is_message_contain_param,
- am::HmiInterfaces::STATE_AVAILABLE);
+ should_message_be_sent,
+ message_contains_param,
+ state);
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
command_->on_event(event);
}
TEST_F(VIIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) {
+ HMICapabilitiesExpectations();
ExpectSendMessagesToHMI();
+ ASSERT_TRUE(command_->Init());
+
+ command_->Run();
command_->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc
new file mode 100644
index 0000000000..c559268bfd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/subscribe_vehicle_request_test.cc
@@ -0,0 +1,344 @@
+/*
+ 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 <string>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "mobile/subscribe_vehicle_data_request.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
+
+#include "application_manager/mock_rpc_handler.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace subscribe_vehicle_data_request {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+
+using am::commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::SubscribeVehicleDataRequest;
+
+typedef std::shared_ptr<SubscribeVehicleDataRequest> CommandPtr;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const std::string kMsgParamKey = "test_key";
+const mobile_apis::VehicleDataType::eType kVehicleType =
+ mobile_apis::VehicleDataType::VEHICLEDATA_WINDOWSTATUS;
+const std::string kVehicleTypeStr = am::strings::window_status;
+} // namespace
+
+class SubscribeVehicleRequestTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ SubscribeVehicleRequestTest()
+ : mock_app_(CreateMockApp())
+ , vi_app_extension_ptr_(
+ std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
+ vi_plugin_, *mock_app_))
+ , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , mock_last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption_test::MockLastState>())) {}
+
+ protected:
+ void SubscribeSuccessfully();
+ void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, GetRPCHandler())
+ .WillByDefault(ReturnRef(mock_rpc_handler_));
+
+ vi_plugin_.Init(app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_last_state_);
+ ON_CALL(*mock_app_, AddExtension(vi_app_extension_ptr_));
+ vi_plugin_.OnApplicationEvent(application_manager::plugin_manager::
+ ApplicationEvent::kApplicationRegistered,
+ mock_app_);
+ ON_CALL(*mock_app_,
+ QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension::
+ VehicleInfoAppExtensionUID))
+ .WillByDefault(Return(vi_app_extension_ptr_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ }
+
+ MockAppPtr mock_app_;
+ application_manager::AppExtensionPtr vi_app_extension_ptr_;
+ std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_;
+ vehicle_info_plugin::VehicleInfoPlugin vi_plugin_;
+ application_manager_test::MockRPCHandler mock_rpc_handler_;
+ resumption::LastStateWrapperPtr mock_last_state_;
+};
+
+TEST_F(SubscribeVehicleRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SubscribeVehicleRequestTest, Run_DataToSubscribeIsNotExisted_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] =
+ kVehicleTypeStr;
+
+ am::VehicleData empty_data;
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(empty_data));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ const std::set<std::string> hmi_message_params;
+ ON_CALL(mock_custom_vehicle_data_manager_,
+ CreateHMIMessageParams(hmi_message_params))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SubscribeVehicleRequestTest,
+ Run_EmptyVehicleData_INVALID_DATA_SentToMobile) {
+ am::VehicleData vehicle_data;
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(vehicle_data));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ const std::set<std::string> hmi_message_params;
+ ON_CALL(mock_custom_vehicle_data_manager_,
+ CreateHMIMessageParams(hmi_message_params))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = false;
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SubscribeVehicleRequestTest,
+ Run_SubscribeDataNotIncludedToRequest_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ const std::set<std::string> hmi_message_params;
+ ON_CALL(mock_custom_vehicle_data_manager_,
+ CreateHMIMessageParams(hmi_message_params))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(vehicle_data));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SubscribeVehicleRequestTest, Run_Subscribe_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params]
+ [application_manager::strings::window_status] = true;
+
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(app_mngr_, hmi_interfaces())
+ .WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VehicleInfo))
+ .WillRepeatedly(Return(
+ application_manager::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillRepeatedly(Return(
+ application_manager::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_SDL))
+ .WillRepeatedly(Return(
+ application_manager::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
+ am::VehicleData vehicle_data;
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(vehicle_data));
+
+ application_manager::ApplicationSet app_set = {mock_app_};
+ DataAccessor<application_manager::ApplicationSet> accessor(app_set,
+ app_set_lock_ptr_);
+ EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData),
+ _));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SubscribeVehicleRequestTest, OnEvent_WrongEvent_FAIL) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*command_msg)[am::strings::msg_params]
+ [application_manager::strings::window_status] = true;
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app_));
+
+ am::event_engine::Event test_event(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData);
+ test_event.set_smart_object(*command_msg);
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ ASSERT_TRUE(command->Init());
+ command->on_event(test_event);
+}
+
+TEST_F(SubscribeVehicleRequestTest, OnEvent_AppNotRegistered_FAIL) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*command_msg)[am::strings::msg_params]
+ [application_manager::strings::window_status] = true;
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(nullptr));
+
+ am::event_engine::Event test_event(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
+ test_event.set_smart_object(*command_msg);
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ ASSERT_TRUE(command->Init());
+ command->on_event(test_event);
+}
+
+TEST_F(SubscribeVehicleRequestTest, OnEvent_DataSubscribed_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params]
+ [application_manager::strings::window_status] = true;
+ CommandPtr command(CreateCommandVI<SubscribeVehicleDataRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app_));
+ am::event_engine::Event test_event(
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
+ SmartObject message(smart_objects::SmartType_Map);
+ const hmi_apis::Common_Result::eType hmi_result =
+ hmi_apis::Common_Result::SUCCESS;
+ message[am::strings::params][am::hmi_response::code] = hmi_result;
+ message[am::strings::msg_params][kVehicleTypeStr] = true;
+ test_event.set_smart_object(message);
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ kVehicleTypeStr, mobile_apis::VehicleDataType::VEHICLEDATA_WINDOWSTATUS));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(vehicle_data));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ ASSERT_TRUE(command->Init());
+ command->on_event(test_event);
+}
+
+} // namespace subscribe_vehicle_data_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index a5b5827f2f..0bf992d68b 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -205,7 +205,7 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
, commands_()
, commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, sub_menu_()
- , sub_menu_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , sub_menu_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, choice_set_map_()
, choice_set_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, performinteraction_choice_set_map_()
@@ -855,12 +855,13 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu(
}
bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
- const std::string& name) {
+ const std::string& name, const uint32_t parent_id) {
sync_primitives::AutoLock lock(sub_menu_lock_ptr_);
for (SubMenuMap::iterator it = sub_menu_.begin(); sub_menu_.end() != it;
++it) {
smart_objects::SmartObject* menu = it->second;
- if ((*menu)[strings::menu_name] == name) {
+ if ((*menu)[strings::menu_name].asString() == name &&
+ (*menu)[strings::parent_id].asInt() == parent_id) {
return true;
}
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 009052bc72..5e1ae3bc3a 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -845,9 +845,8 @@ void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
connection_handler().ConnectToDevice(handle);
}
-void ApplicationManagerImpl::OnHMIStartedCooperation() {
+void ApplicationManagerImpl::OnHMIReady() {
LOG4CXX_AUTO_TRACE(logger_);
- hmi_cooperating_ = true;
#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
connection_handler_->CreateWebEngineDevice();
@@ -855,6 +854,29 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
MessageHelper::SendGetSystemInfoRequest(*this);
+ std::shared_ptr<smart_objects::SmartObject> is_navi_ready(
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::Navigation_IsReady, *this));
+ rpc_service_->ManageHMICommand(is_navi_ready);
+
+ std::shared_ptr<smart_objects::SmartObject> mixing_audio_supported_request(
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
+ *this));
+ rpc_service_->ManageHMICommand(mixing_audio_supported_request);
+ resume_controller().ResetLaunchTime();
+
+ RefreshCloudAppInformation();
+ policy_handler_->TriggerPTUOnStartupIfRequired();
+}
+
+void ApplicationManagerImpl::RequestForInterfacesAvailability() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::shared_ptr<smart_objects::SmartObject> is_ivi_ready(
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_IsReady, *this));
+ rpc_service_->ManageHMICommand(is_ivi_ready);
+
std::shared_ptr<smart_objects::SmartObject> is_vr_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_IsReady,
*this));
@@ -870,36 +892,18 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
*this));
rpc_service_->ManageHMICommand(is_ui_ready);
- std::shared_ptr<smart_objects::SmartObject> is_navi_ready(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::Navigation_IsReady, *this));
- rpc_service_->ManageHMICommand(is_navi_ready);
-
- std::shared_ptr<smart_objects::SmartObject> is_ivi_ready(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_IsReady, *this));
- rpc_service_->ManageHMICommand(is_ivi_ready);
-
std::shared_ptr<smart_objects::SmartObject> is_rc_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::RC_IsReady,
*this));
rpc_service_->ManageHMICommand(is_rc_ready);
- std::shared_ptr<smart_objects::SmartObject> button_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::Buttons_GetCapabilities, *this));
- rpc_service_->ManageHMICommand(button_capabilities);
-
- std::shared_ptr<smart_objects::SmartObject> mixing_audio_supported_request(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
- *this));
- rpc_service_->ManageHMICommand(mixing_audio_supported_request);
- resume_controller().ResetLaunchTime();
-
- RefreshCloudAppInformation();
-
- policy_handler_->TriggerPTUOnStartupIfRequired();
+ if (hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities)) {
+ std::shared_ptr<smart_objects::SmartObject> button_capabilities(
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::Buttons_GetCapabilities, *this));
+ rpc_service_->ManageHMICommand(button_capabilities);
+ }
}
std::string ApplicationManagerImpl::PolicyIDByIconUrl(const std::string url) {
@@ -1472,7 +1476,12 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
LOG4CXX_INFO(logger_, "START MICROPHONE RECORDER");
DCHECK_OR_RETURN_VOID(media_manager_);
media_manager_->StartMicrophoneRecording(
- session_key, get_settings().recording_file_name(), max_duration);
+ session_key,
+ get_settings().recording_file_name(),
+ max_duration,
+ static_cast<mobile_apis::SamplingRate::eType>(sampling_rate),
+ static_cast<mobile_apis::BitsPerSample::eType>(bits_per_sample),
+ static_cast<mobile_apis::AudioType::eType>(audio_type));
}
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
@@ -3015,7 +3024,9 @@ void ApplicationManagerImpl::HeadUnitReset(
GetPolicyHandler().UnloadPolicyLibrary();
resume_controller().StopSavePersistentDataTimer();
-
+ if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) {
+ LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file");
+ }
const std::string storage_folder = get_settings().app_storage_folder();
file_system::RemoveDirectory(storage_folder, true);
ClearAppsPersistentData();
@@ -3026,7 +3037,9 @@ void ApplicationManagerImpl::HeadUnitReset(
GetPolicyHandler().ClearUserConsent();
resume_controller().StopSavePersistentDataTimer();
-
+ if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) {
+ LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file");
+ }
ClearAppsPersistentData();
break;
}
@@ -3125,7 +3138,7 @@ void ApplicationManagerImpl::SendOnSDLClose() {
void ApplicationManagerImpl::UnregisterAllApplications() {
LOG4CXX_DEBUG(logger_, "Unregister reason " << unregister_reason_);
- hmi_cooperating_ = false;
+ SetHMICooperating(false);
bool is_ignition_off = false;
using namespace mobile_api::AppInterfaceUnregisteredReason;
using namespace helpers;
@@ -4086,6 +4099,10 @@ bool ApplicationManagerImpl::IsHMICooperating() const {
return hmi_cooperating_;
}
+void ApplicationManagerImpl::SetHMICooperating(const bool hmi_cooperating) {
+ hmi_cooperating_ = hmi_cooperating;
+}
+
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
LOG4CXX_DEBUG(logger_, "Application list update timer finished");
const bool is_new_app_registered = registered_during_timer_execution_;
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 3f279679a3..d20039bf70 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -927,21 +927,25 @@ std::string GetComponentNameFromInterface(
const HmiInterfaces::InterfaceID& interface) {
switch (interface) {
case HmiInterfaces::HMI_INTERFACE_Buttons:
- return "Buttons";
+ return hmi_interface::buttons;
case HmiInterfaces::HMI_INTERFACE_BasicCommunication:
- return "BasicCommunication";
+ return hmi_interface::basic_communication;
case HmiInterfaces::HMI_INTERFACE_VR:
- return "VR";
+ return hmi_interface::vr;
case HmiInterfaces::HMI_INTERFACE_TTS:
- return "TTS";
+ return hmi_interface::tts;
case HmiInterfaces::HMI_INTERFACE_UI:
- return "UI";
+ return hmi_interface::ui;
case HmiInterfaces::HMI_INTERFACE_Navigation:
- return "Navigation";
+ return hmi_interface::navigation;
case HmiInterfaces::HMI_INTERFACE_VehicleInfo:
- return "VehicleInfo";
+ return hmi_interface::vehicle_info;
case HmiInterfaces::HMI_INTERFACE_SDL:
- return "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";
}
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 1acbc9ace7..ac34d091af 100644
--- a/src/components/application_manager/src/commands/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/request_to_hmi.cc
@@ -31,10 +31,43 @@
*/
#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
namespace application_manager {
+namespace {
+static const std::set<hmi_apis::FunctionID::eType> tts_request_ids{
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages};
+
+static const std::set<hmi_apis::FunctionID::eType> vr_request_ids{
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages};
+
+static const std::set<hmi_apis::FunctionID::eType> ui_request_ids{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages};
+
+static const std::set<hmi_apis::FunctionID::eType> rc_request_ids{
+ hmi_apis::FunctionID::RC_GetCapabilities};
+
+static const std::set<hmi_apis::FunctionID::eType> vehicle_info_request_ids{
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+static std::map<std::string, std::set<hmi_apis::FunctionID::eType> >
+ interface_requests{
+ {std::string(hmi_interface::ui), ui_request_ids},
+ {std::string(hmi_interface::vr), vr_request_ids},
+ {std::string(hmi_interface::tts), tts_request_ids},
+ {std::string(hmi_interface::rc), rc_request_ids},
+ {std::string(hmi_interface::vehicle_info), vehicle_info_request_ids}};
+
+} // namespace
+
namespace commands {
bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
@@ -92,6 +125,57 @@ void RequestToHMI::SendRequest() {
rpc_service_.SendMessageToHMI(message_);
}
+void RequestToHMI::RequestInterfaceCapabilities(const char* interface_name) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Request capabilities for the " << interface_name << " interface");
+
+ const auto& request_ids = interface_requests[std::string(interface_name)];
+ RequestCapabilities(request_ids);
+}
+
+void RequestToHMI::UpdateRequestsRequiredForCapabilities(
+ const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi) {
+ for (auto request_id : requests_to_send_to_hmi) {
+ hmi_capabilities_.UpdateRequestsRequiredForCapabilities(request_id);
+ }
+}
+
+void RequestToHMI::UpdateRequiredInterfaceCapabilitiesRequests(
+ const std::string& interface_name) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Update requests required for the " << interface_name << " interface");
+
+ const auto& request_ids = interface_requests[std::string(interface_name)];
+ UpdateRequestsRequiredForCapabilities(request_ids);
+}
+
+void RequestToHMI::RequestCapabilities(
+ const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi) {
+ LOG4CXX_DEBUG(logger_,
+ "There are " << requests_to_send_to_hmi.size()
+ << " requests to send to the HMI");
+
+ for (const auto& function_id : requests_to_send_to_hmi) {
+ if (hmi_capabilities_.IsRequestsRequiredForCapabilities(function_id)) {
+ std::shared_ptr<smart_objects::SmartObject> request_so(
+ MessageHelper::CreateModuleInfoSO(function_id, application_manager_));
+
+ switch (function_id) {
+ case hmi_apis::FunctionID::UI_GetLanguage:
+ case hmi_apis::FunctionID::VR_GetLanguage:
+ case hmi_apis::FunctionID::TTS_GetLanguage:
+ hmi_capabilities_.set_handle_response_for(*request_so);
+ break;
+ default:
+ break;
+ }
+ rpc_service_.ManageHMICommand(request_so);
+ }
+ }
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index e02acd55da..b9ab340614 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -30,17 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/hmi_capabilities_impl.h"
+
#include <map>
#include "application_manager/application_manager.h"
-#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/message_helper.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 "config_profile/profile.h"
#include "formatters/CFormatterJsonBase.h"
#include "interfaces/HMI_API.h"
+#include "smart_objects/enum_schema_item.h"
#include "smart_objects/smart_object.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
namespace application_manager {
@@ -53,6 +58,8 @@ std::map<std::string, hmi_apis::Common_VrCapabilities::eType>
vr_enum_capabilities;
std::map<std::string, hmi_apis::Common_SpeechCapabilities::eType>
tts_enum_capabilities;
+std::map<std::string, hmi_apis::Common_PrerecordedSpeech::eType>
+ tts_enum_prerecorded_speech;
std::map<std::string, hmi_apis::Common_ButtonName::eType> button_enum_name;
std::map<std::string, hmi_apis::Common_TextFieldName::eType>
text_fields_enum_name;
@@ -98,6 +105,22 @@ void InitCapabilities() {
tts_enum_capabilities.insert(std::make_pair(
std::string("FILE"), hmi_apis::Common_SpeechCapabilities::FILE));
+ tts_enum_prerecorded_speech.insert(
+ std::make_pair(std::string("HELP_JINGLE"),
+ hmi_apis::Common_PrerecordedSpeech::HELP_JINGLE));
+ tts_enum_prerecorded_speech.insert(
+ std::make_pair(std::string("INITIAL_JINGLE"),
+ hmi_apis::Common_PrerecordedSpeech::INITIAL_JINGLE));
+ tts_enum_prerecorded_speech.insert(
+ std::make_pair(std::string("LISTEN_JINGLE"),
+ hmi_apis::Common_PrerecordedSpeech::LISTEN_JINGLE));
+ tts_enum_prerecorded_speech.insert(
+ std::make_pair(std::string("POSITIVE_JINGLE"),
+ hmi_apis::Common_PrerecordedSpeech::POSITIVE_JINGLE));
+ tts_enum_prerecorded_speech.insert(
+ std::make_pair(std::string("NEGATIVE_JINGLE"),
+ hmi_apis::Common_PrerecordedSpeech::NEGATIVE_JINGLE));
+
button_enum_name.insert(
std::make_pair(std::string("OK"), hmi_apis::Common_ButtonName::OK));
button_enum_name.insert(std::make_pair(
@@ -422,6 +445,33 @@ void InitCapabilities() {
} // namespace
+namespace {
+/**
+ * @brief Saves smart object content into the JSON node
+ * @param field_name name of the field to save
+ * @param schema reference to schema to unapply
+ * @param object_to_save pointer to object to save
+ * @param out_json_node JSON node for the output result
+ */
+void save_hmi_capability_field_to_json(
+ const std::string& field_name,
+ smart_objects::CSmartSchema schema,
+ smart_objects::SmartObjectSPtr object_to_save,
+ Json::Value& out_json_node) {
+ if (!object_to_save) {
+ return;
+ }
+ namespace Formatters = ns_smart_device_link::ns_json_handler::formatters;
+ smart_objects::SmartObject formatted_object(smart_objects::SmartType_Map);
+ formatted_object[strings::msg_params][field_name] = *object_to_save;
+ schema.unapplySchema(formatted_object); // converts enums back to strings
+ Json::Value temp_value;
+ Formatters::CFormatterJsonBase::objToJsonValue(formatted_object, temp_value);
+ out_json_node[field_name] = temp_value[strings::msg_params][field_name];
+}
+
+} // namespace
+
HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
: is_vr_cooperating_(false)
, is_tts_cooperating_(false)
@@ -451,10 +501,12 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
, is_phone_call_supported_(false)
, is_video_streaming_supported_(false)
, is_rc_supported_(false)
+ , is_driver_distraction_supported_(false)
, navigation_capability_(NULL)
, phone_capability_(NULL)
, video_streaming_capability_(NULL)
, rc_capability_(NULL)
+ , driver_distraction_capability_(NULL)
, seat_location_capability_(NULL)
, app_mngr_(app_mngr)
, hmi_language_handler_(app_mngr) {
@@ -469,15 +521,7 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
}
}
-HMICapabilitiesImpl::~HMICapabilitiesImpl() {
- delete ui_supported_languages_;
- delete tts_supported_languages_;
- delete vr_supported_languages_;
- delete navigation_capability_;
- delete phone_capability_;
- delete video_streaming_capability_;
- delete rc_capability_;
-}
+HMICapabilitiesImpl::~HMICapabilitiesImpl() {}
bool HMICapabilitiesImpl::VerifyImageType(const int32_t image_type) const {
auto capabilities = display_capabilities();
@@ -573,27 +617,23 @@ HMICapabilitiesImpl::active_tts_language() const {
void HMICapabilitiesImpl::set_ui_supported_languages(
const smart_objects::SmartObject& supported_languages) {
- if (ui_supported_languages_) {
- delete ui_supported_languages_;
- }
- ui_supported_languages_ = new smart_objects::SmartObject(supported_languages);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(supported_languages);
+ ui_supported_languages_.swap(new_value);
}
void HMICapabilitiesImpl::set_tts_supported_languages(
const smart_objects::SmartObject& supported_languages) {
- if (tts_supported_languages_) {
- delete tts_supported_languages_;
- }
- tts_supported_languages_ =
- new smart_objects::SmartObject(supported_languages);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(supported_languages);
+ tts_supported_languages_.swap(new_value);
}
void HMICapabilitiesImpl::set_vr_supported_languages(
const smart_objects::SmartObject& supported_languages) {
- if (vr_supported_languages_) {
- delete vr_supported_languages_;
- }
- vr_supported_languages_ = new smart_objects::SmartObject(supported_languages);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(supported_languages);
+ vr_supported_languages_.swap(new_value);
}
void HMICapabilitiesImpl::set_display_capabilities(
@@ -601,7 +641,7 @@ void HMICapabilitiesImpl::set_display_capabilities(
if (app_mngr_.IsSOStructValid(
hmi_apis::StructIdentifiers::Common_DisplayCapabilities,
display_capabilities)) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(display_capabilities);
display_capabilities_.swap(new_value);
}
@@ -615,71 +655,69 @@ void HMICapabilitiesImpl::set_system_display_capabilities(
void HMICapabilitiesImpl::set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(hmi_zone_capabilities);
hmi_zone_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_soft_button_capabilities(
const smart_objects::SmartObject& soft_button_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(soft_button_capabilities);
soft_buttons_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_button_capabilities(
const smart_objects::SmartObject& button_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(button_capabilities);
button_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_vr_capabilities(
const smart_objects::SmartObject& vr_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(vr_capabilities);
vr_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_speech_capabilities(
const smart_objects::SmartObject& speech_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(speech_capabilities);
speech_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_audio_pass_thru_capabilities(
const smart_objects::SmartObject& audio_pass_thru_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
- std::make_shared<smart_objects::SmartObject>(
- audio_pass_thru_capabilities);
+ auto new_value = std::make_shared<smart_objects::SmartObject>(
+ audio_pass_thru_capabilities);
audio_pass_thru_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_pcm_stream_capabilities(
const smart_objects::SmartObject& pcm_stream_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(pcm_stream_capabilities);
pcm_stream_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_preset_bank_capabilities(
const smart_objects::SmartObject& preset_bank_capabilities) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(preset_bank_capabilities);
preset_bank_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_vehicle_type(
const smart_objects::SmartObject& vehicle_type) {
- smart_objects::SmartObjectSPtr new_value =
- std::make_shared<smart_objects::SmartObject>(vehicle_type);
+ auto new_value = std::make_shared<smart_objects::SmartObject>(vehicle_type);
vehicle_type_.swap(new_value);
}
void HMICapabilitiesImpl::set_prerecorded_speech(
const smart_objects::SmartObject& prerecorded_speech) {
- smart_objects::SmartObjectSPtr new_value =
+ auto new_value =
std::make_shared<smart_objects::SmartObject>(prerecorded_speech);
prerecorded_speech_.swap(new_value);
}
@@ -699,53 +737,56 @@ void HMICapabilitiesImpl::set_rc_supported(const bool supported) {
is_rc_supported_ = supported;
}
+void HMICapabilitiesImpl::set_driver_distraction_supported(
+ const bool supported) {
+ is_driver_distraction_supported_ = supported;
+}
+
void HMICapabilitiesImpl::set_navigation_capability(
const smart_objects::SmartObject& navigation_capability) {
- if (navigation_capability_) {
- delete navigation_capability_;
- }
- navigation_capability_ =
- new smart_objects::SmartObject(navigation_capability);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(navigation_capability);
+ navigation_capability_.swap(new_value);
}
void HMICapabilitiesImpl::set_phone_capability(
const smart_objects::SmartObject& phone_capability) {
- if (phone_capability_) {
- delete phone_capability_;
- }
- phone_capability_ = new smart_objects::SmartObject(phone_capability);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(phone_capability);
+ phone_capability_.swap(new_value);
}
void HMICapabilitiesImpl::set_video_streaming_capability(
const smart_objects::SmartObject& video_streaming_capability) {
- if (video_streaming_capability_) {
- delete video_streaming_capability_;
- }
- video_streaming_capability_ =
- new smart_objects::SmartObject(video_streaming_capability);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(video_streaming_capability);
+ video_streaming_capability_.swap(new_value);
}
void HMICapabilitiesImpl::set_rc_capability(
const smart_objects::SmartObject& rc_capability) {
- if (rc_capability_) {
- delete rc_capability_;
- }
- rc_capability_ = new smart_objects::SmartObject(rc_capability);
+ auto new_value = std::make_shared<smart_objects::SmartObject>(rc_capability);
+ rc_capability_.swap(new_value);
+}
+
+void HMICapabilitiesImpl::set_driver_distraction_capability(
+ const smart_objects::SmartObject& driver_distraction_capability) {
+ auto new_value = std::make_shared<smart_objects::SmartObject>(
+ driver_distraction_capability);
+ driver_distraction_capability_.swap(new_value);
}
void HMICapabilitiesImpl::set_seat_location_capability(
const smart_objects::SmartObject& seat_location_capability) {
- if (seat_location_capability_) {
- delete seat_location_capability_;
- }
- seat_location_capability_ =
- new smart_objects::SmartObject(seat_location_capability);
+ auto new_value =
+ std::make_shared<smart_objects::SmartObject>(seat_location_capability);
+ seat_location_capability_.swap(new_value);
}
void HMICapabilitiesImpl::Init(
resumption::LastStateWrapperPtr last_state_wrapper) {
hmi_language_handler_.Init(last_state_wrapper);
- if (false == load_capabilities_from_file()) {
+ if (!LoadCapabilitiesFromFile()) {
LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
} else {
LOG4CXX_INFO(logger_, "file hmi_capabilities.json was loaded");
@@ -780,18 +821,18 @@ bool HMICapabilitiesImpl::is_rc_cooperating() const {
return is_rc_cooperating_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::ui_supported_languages()
- const {
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::ui_supported_languages() const {
return ui_supported_languages_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::vr_supported_languages()
- const {
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::vr_supported_languages() const {
return vr_supported_languages_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::tts_supported_languages()
- const {
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::tts_supported_languages() const {
return tts_supported_languages_;
}
@@ -874,33 +915,183 @@ bool HMICapabilitiesImpl::rc_supported() const {
return is_rc_supported_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::navigation_capability()
- const {
+bool HMICapabilitiesImpl::driver_distraction_supported() const {
+ return is_driver_distraction_supported_;
+}
+
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::navigation_capability() const {
return navigation_capability_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::phone_capability()
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::phone_capability()
const {
return phone_capability_;
}
-const smart_objects::SmartObject*
+const smart_objects::SmartObjectSPtr
HMICapabilitiesImpl::video_streaming_capability() const {
return video_streaming_capability_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::rc_capability() const {
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::rc_capability()
+ const {
return rc_capability_;
}
-const smart_objects::SmartObject*
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::driver_distraction_capability() const {
+ return driver_distraction_capability_;
+}
+
+const smart_objects::SmartObjectSPtr
HMICapabilitiesImpl::seat_location_capability() const {
return seat_location_capability_;
}
-bool HMICapabilitiesImpl::load_capabilities_from_file() {
+/**
+ * @brief Checks if JSON member exists
+ * @param json_member reference to JSON structure to check
+ * @param name_of_member name which we should be checked
+ * @returns true if member exists, otherwise returns false
+ */
+bool JsonIsMemberSafe(const Json::Value& json_member,
+ const char* name_of_member) {
+ return !json_member.isNull() && json_member.isMember(name_of_member);
+}
+
+/**
+ * @brief Converts specified string to appropriate enum value
+ * according to schema
+ * @return converted enum value
+ */
+template <typename EnumType>
+EnumType ConvertStringToEnum(const std::string& str) {
+ using ns_smart_device_link::ns_smart_objects::EnumConversionHelper;
+ EnumType value;
+ if (EnumConversionHelper<EnumType>::StringToEnum(str, &value)) {
+ return value;
+ }
+
+ return EnumType::INVALID_ENUM;
+}
+
+/**
+ * @brief Converts the JSON array of string type into the SmartArray of enums
+ * @param json_array JSON value containing array
+ * @param out_so_array output SmartArray
+ */
+template <typename EnumType>
+void ConvertJsonArrayToSoArray(const Json::Value& json_array,
+ smart_objects::SmartObject& out_so_array) {
+ out_so_array =
+ smart_objects::SmartObject(smart_objects::SmartType::SmartType_Array);
+ for (uint32_t i = 0; i < json_array.size(); ++i) {
+ out_so_array[i] = ConvertStringToEnum<EnumType>(json_array[i].asString());
+ }
+}
+
+/**
+ * @brief Helper class for obtaining proper capabilities JSON value considering
+ * case if it were overriden by cache
+ */
+struct JsonCapabilitiesGetter {
+ public:
+ /**
+ * @brief JsonCapabilitiesGetter constructor
+ * @param json_default_node reference to the main JSON capabilities node
+ * @param json_cache_node reference to cached JSON capabilities node
+ */
+ JsonCapabilitiesGetter(Json::Value& json_default_node,
+ Json::Value& json_cache_node)
+ : json_default_node_(json_default_node)
+ , json_cache_node_(json_cache_node) {}
+
+ JsonCapabilitiesGetter(JsonCapabilitiesGetter&& other) {
+ std::swap(json_default_node_, other.json_default_node_);
+ std::swap(json_cache_node_, other.json_cache_node_);
+ }
+
+ bool IsInterfaceJsonMemberExists(const char* interface_name) {
+ return JsonIsMemberSafe(json_cache_node_, interface_name) ||
+ JsonIsMemberSafe(json_default_node_, interface_name);
+ }
+
+ /**
+ * @brief GetJsonMember gets JSON value for a specified JSON member from
+ * cached JSON node if member exists, otherwise main JSON node will be
+ * taken
+ * @param member_name name of the JSON member to get
+ * @return JSON value for specified member or Value::null if not found
+ */
+ Json::Value GetJsonMember(
+ const char* member_name,
+ hmi_apis::FunctionID::eType request_id,
+ std::set<hmi_apis::FunctionID::eType>& default_initialized_capabilities) {
+ if (JsonIsMemberSafe(json_cache_node_, member_name)) {
+ return GetCachedJsonMember(member_name);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Add request ID: " << request_id
+ << " for the interface: " << member_name);
+ default_initialized_capabilities.insert(request_id);
+
+ if (JsonIsMemberSafe(json_default_node_, member_name)) {
+ return GetMainJsonMember(member_name);
+ }
+
+ return Json::Value::null;
+ }
+
+ /**
+ * @brief GetMainJsonMember gets JSON value for a specified JSON member from
+ * the main JSON node
+ * @param member_name name of the JSON member to get
+ * @return JSON value for specified member or Value::null if not found
+ */
+ Json::Value GetMainJsonMember(const char* member_name) {
+ return json_default_node_.get(member_name, Json::Value::null);
+ }
+
+ /**
+ * @brief GetCachedJsonMember gets JSON value for a specified JSON member
+ * from the cached JSON node
+ * @param member_name name of the JSON member to get
+ * @return JSON value for specified member or Value::null if not found
+ */
+ Json::Value GetCachedJsonMember(const char* member_name) {
+ return json_cache_node_.get(member_name, Json::Value::null);
+ }
+
+ private:
+ Json::Value json_default_node_;
+ Json::Value json_cache_node_;
+};
+
+/**
+ * @brief Gets the JSON node related to the specified interface name.
+ * @param interface_name Interface name which JSON node should be retreive from
+ * the main JSON node
+ * @return JsonCapabilitiesGetter instance initialized by default JSON node and
+ * cache JSON node for the specified interface
+ */
+
+JsonCapabilitiesGetter GetInterfaceGetter(
+ const char* interface_name, JsonCapabilitiesGetter& json_root_getter) {
+ auto interface_default_node =
+ json_root_getter.GetMainJsonMember(interface_name);
+ auto interface_cache_node =
+ json_root_getter.GetCachedJsonMember(interface_name);
+
+ JsonCapabilitiesGetter getter(interface_default_node, interface_cache_node);
+ return getter;
+}
+
+bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() {
std::string json_string;
- std::string file_name = app_mngr_.get_settings().hmi_capabilities_file_name();
+ const std::string file_name =
+ app_mngr_.get_settings().hmi_capabilities_file_name();
if (!file_system::FileExists(file_name)) {
return false;
@@ -910,45 +1101,82 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
return false;
}
+ const std::string cache_file_name =
+ app_mngr_.get_settings().hmi_capabilities_cache_file_name();
+ Json::Value root_json_override;
+
+ if (file_system::FileExists(cache_file_name)) {
+ LOG4CXX_DEBUG(logger_,
+ "HMI capabilities cache was found: " << cache_file_name);
+
+ std::string cache_json_string;
+ if (!file_system::ReadFile(cache_file_name, cache_json_string)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Failed to read data from cache file. Cache will be ignored");
+ }
+
+ try {
+ utils::JsonReader reader;
+ std::string json(cache_json_string.begin(), cache_json_string.end());
+ if (!reader.parse(json, &root_json_override)) {
+ LOG4CXX_ERROR(logger_,
+ "Cached JSON file is invalid. Deleting the file");
+ file_system::DeleteFile(cache_file_name);
+ root_json_override =
+ Json::Value::null; // Just to clear intermediate state of value
+ }
+ } catch (...) {
+ return false;
+ }
+ }
+
try {
- Json::CharReaderBuilder reader_builder;
- const std::unique_ptr<Json::CharReader> reader_(
- reader_builder.newCharReader());
- JSONCPP_STRING err;
Json::Value root_json;
- const size_t json_len = json_string.length();
-
- const bool result = reader_->parse(
- json_string.c_str(), json_string.c_str() + json_len, &root_json, &err);
- if (!result) {
- LOG4CXX_DEBUG(logger_, "Json parsing fails: " << err);
+ utils::JsonReader reader;
+ std::string json(json_string.begin(), json_string.end());
+ if (!reader.parse(json, &root_json)) {
+ LOG4CXX_DEBUG(logger_, "Default JSON parsing fails");
return false;
}
+
+ JsonCapabilitiesGetter json_root_getter(root_json, root_json_override);
// UI
- if (check_existing_json_member(root_json, "UI")) {
- Json::Value ui = root_json.get("UI", Json::Value::null);
- if (check_existing_json_member(ui, "language")) {
- const std::string lang = ui.get("language", "EN-US").asString();
+ if (json_root_getter.IsInterfaceJsonMemberExists(hmi_interface::ui)) {
+ auto json_ui_getter =
+ GetInterfaceGetter(hmi_interface::ui, json_root_getter);
+
+ auto ui_language_node =
+ json_ui_getter.GetJsonMember(hmi_response::language,
+ hmi_apis::FunctionID::UI_GetLanguage,
+ requests_required_for_capabilities_);
+
+ if (!ui_language_node.isNull()) {
+ const std::string lang = ui_language_node.asString();
set_active_ui_language(MessageHelper::CommonLanguageFromString(lang));
- } else {
- set_active_ui_language(
- MessageHelper::CommonLanguageFromString("EN-US"));
}
- if (check_existing_json_member(ui, "languages")) {
+ auto ui_languages_node = json_ui_getter.GetJsonMember(
+ hmi_response::languages,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ requests_required_for_capabilities_);
+ if (!ui_languages_node.isNull()) {
smart_objects::SmartObject ui_languages_so(
smart_objects::SmartType_Array);
- Json::Value languages_ui = ui.get("languages", "");
- convert_json_languages_to_obj(languages_ui, ui_languages_so);
+ ConvertJsonArrayToSoArray<hmi_apis::Common_Language::eType>(
+ ui_languages_node, ui_languages_so);
set_ui_supported_languages(ui_languages_so);
}
- if (check_existing_json_member(ui, "displayCapabilities")) {
+ auto ui_display_capabilities_node =
+ json_ui_getter.GetJsonMember(hmi_response::display_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_display_capabilities_node.isNull()) {
smart_objects::SmartObject display_capabilities_so;
- Json::Value display_capabilities = ui.get("displayCapabilities", "");
- formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities,
- display_capabilities_so);
+ formatters::CFormatterJsonBase::jsonValueToObj(
+ ui_display_capabilities_node, display_capabilities_so);
if (display_capabilities_so.keyExists(hmi_response::display_type)) {
std::map<std::string,
@@ -1082,55 +1310,73 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
set_display_capabilities(display_capabilities_so);
}
- if (check_existing_json_member(ui, "audioPassThruCapabilities")) {
- Json::Value audio_capabilities =
- ui.get("audioPassThruCapabilities", "");
+ auto ui_audio_pass_thru_capabilities_node =
+ json_ui_getter.GetJsonMember(strings::audio_pass_thru_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_audio_pass_thru_capabilities_node.isNull()) {
smart_objects::SmartObject audio_capabilities_so(
smart_objects::SmartType_Array);
- if (audio_capabilities.type() == Json::arrayValue) {
- for (uint32_t i = 0; i < audio_capabilities.size(); i++) {
- convert_audio_capability_to_obj(audio_capabilities[i],
- audio_capabilities_so[i]);
+ if (ui_audio_pass_thru_capabilities_node.type() == Json::arrayValue) {
+ for (uint32_t i = 0; i < ui_audio_pass_thru_capabilities_node.size();
+ i++) {
+ convert_audio_capability_to_obj(
+ ui_audio_pass_thru_capabilities_node[i],
+ audio_capabilities_so[i]);
}
- } else if (audio_capabilities.type() == Json::objectValue) {
- convert_audio_capability_to_obj(audio_capabilities,
+ } else if (ui_audio_pass_thru_capabilities_node.type() ==
+ Json::objectValue) {
+ convert_audio_capability_to_obj(ui_audio_pass_thru_capabilities_node,
audio_capabilities_so[0]);
}
set_audio_pass_thru_capabilities(audio_capabilities_so);
}
- if (check_existing_json_member(ui, "pcmStreamCapabilities")) {
- Json::Value pcm_capabilities = ui.get("pcmStreamCapabilities", "");
+ auto ui_pcm_stream_capabilities_node =
+ json_ui_getter.GetJsonMember(strings::pcm_stream_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_pcm_stream_capabilities_node.isNull()) {
smart_objects::SmartObject pcm_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- convert_audio_capability_to_obj(pcm_capabilities, pcm_capabilities_so);
+ convert_audio_capability_to_obj(ui_pcm_stream_capabilities_node,
+ pcm_capabilities_so);
set_pcm_stream_capabilities(pcm_capabilities_so);
}
- if (check_existing_json_member(ui, "hmiZoneCapabilities")) {
+ auto ui_hmi_zone_capabilities_node =
+ json_ui_getter.GetJsonMember(hmi_response::hmi_zone_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_hmi_zone_capabilities_node.isNull()) {
smart_objects::SmartObject hmi_zone_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
hmi_zone_capabilities_so =
- hmi_zone_enum.find(ui.get("hmiZoneCapabilities", "").asString())
+ hmi_zone_enum.find(ui_hmi_zone_capabilities_node.asString())
->second;
set_hmi_zone_capabilities(hmi_zone_capabilities_so);
}
- if (check_existing_json_member(ui, "softButtonCapabilities")) {
- Json::Value soft_button_capabilities =
- ui.get("softButtonCapabilities", "");
+ auto ui_soft_button_capabilities_node =
+ json_ui_getter.GetJsonMember(hmi_response::soft_button_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_soft_button_capabilities_node.isNull()) {
smart_objects::SmartObject soft_button_capabilities_so;
formatters::CFormatterJsonBase::jsonValueToObj(
- soft_button_capabilities, soft_button_capabilities_so);
+ ui_soft_button_capabilities_node, soft_button_capabilities_so);
set_soft_button_capabilities(soft_button_capabilities_so);
}
- if (check_existing_json_member(ui, "systemCapabilities")) {
- Json::Value system_capabilities = ui.get("systemCapabilities", "");
- if (check_existing_json_member(system_capabilities,
- "navigationCapability")) {
- Json::Value navigation_capability =
- system_capabilities.get("navigationCapability", "");
+ auto ui_system_capabilities_node =
+ json_ui_getter.GetJsonMember(strings::system_capabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!ui_system_capabilities_node.isNull()) {
+ if (JsonIsMemberSafe(ui_system_capabilities_node,
+ strings::navigation_capability)) {
+ Json::Value navigation_capability = ui_system_capabilities_node.get(
+ strings::navigation_capability, "");
smart_objects::SmartObject navigation_capability_so;
formatters::CFormatterJsonBase::jsonValueToObj(
navigation_capability, navigation_capability_so);
@@ -1139,10 +1385,10 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
set_navigation_supported(true);
}
}
- if (check_existing_json_member(system_capabilities,
- "phoneCapability")) {
+ if (JsonIsMemberSafe(ui_system_capabilities_node,
+ strings::phone_capability)) {
Json::Value phone_capability =
- system_capabilities.get("phoneCapability", "");
+ ui_system_capabilities_node.get(strings::phone_capability, "");
smart_objects::SmartObject phone_capability_so;
formatters::CFormatterJsonBase::jsonValueToObj(phone_capability,
phone_capability_so);
@@ -1151,23 +1397,23 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
set_phone_call_supported(true);
}
}
- if (check_existing_json_member(system_capabilities,
- "videoStreamingCapability")) {
- Json::Value vs_capability =
- system_capabilities.get("videoStreamingCapability", "");
+ if (JsonIsMemberSafe(ui_system_capabilities_node,
+ strings::video_streaming_capability)) {
+ Json::Value vs_capability = ui_system_capabilities_node.get(
+ strings::video_streaming_capability, "");
smart_objects::SmartObject vs_capability_so;
formatters::CFormatterJsonBase::jsonValueToObj(vs_capability,
vs_capability_so);
- if (vs_capability_so.keyExists("supportedFormats")) {
+ if (vs_capability_so.keyExists(strings::supported_formats)) {
smart_objects::SmartObject& supported_format_array =
- vs_capability_so["supportedFormats"];
+ vs_capability_so[strings::supported_formats];
smart_objects::SmartObject converted_array(
smart_objects::SmartType_Array);
for (uint32_t i = 0, j = 0; i < supported_format_array.length();
i++) {
- if (!supported_format_array[i].keyExists("protocol") ||
- !supported_format_array[i].keyExists("codec")) {
+ if (!supported_format_array[i].keyExists(strings::protocol) ||
+ !supported_format_array[i].keyExists(strings::codec)) {
continue;
}
@@ -1175,12 +1421,13 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
hmi_apis::Common_VideoStreamingProtocol::eType>::
const_iterator it_protocol =
video_streaming_protocol_enum.find(
- supported_format_array[i]["protocol"].asString());
+ supported_format_array[i][strings::protocol]
+ .asString());
std::map<std::string,
hmi_apis::Common_VideoStreamingCodec::eType>::
const_iterator it_codec = video_streaming_codec_enum.find(
- supported_format_array[i]["codec"].asString());
+ supported_format_array[i][strings::codec].asString());
// format is valid only if both protocol and codec are converted
// to enum values successfully
@@ -1188,128 +1435,200 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
it_codec != video_streaming_codec_enum.end()) {
smart_objects::SmartObject format_so =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- format_so["protocol"] = it_protocol->second;
- format_so["codec"] = it_codec->second;
+ format_so[strings::protocol] = it_protocol->second;
+ format_so[strings::codec] = it_codec->second;
converted_array[j++] = format_so;
}
}
- vs_capability_so.erase("supportedFormats");
- vs_capability_so["supportedFormats"] = converted_array;
+ vs_capability_so.erase(strings::supported_formats);
+ vs_capability_so[strings::supported_formats] = converted_array;
}
set_video_streaming_capability(vs_capability_so);
if (!vs_capability_so.empty()) {
set_video_streaming_supported(true);
}
}
- if (check_existing_json_member(system_capabilities,
- "remoteControlCapability")) {
- Json::Value rc_capability =
- system_capabilities.get("remoteControlCapability", "");
- smart_objects::SmartObject rc_capability_so;
- formatters::CFormatterJsonBase::jsonValueToObj(rc_capability,
- rc_capability_so);
- if (rc_capability_so.keyExists("lightControlCapabilities")) {
- if (rc_capability_so["lightControlCapabilities"].keyExists(
- "supportedLights")) {
- auto& lights = rc_capability_so["lightControlCapabilities"]
- ["supportedLights"];
- auto it = lights.asArray()->begin();
- for (; it != lights.asArray()->end(); ++it) {
- smart_objects::SmartObject& light_name_so = (*it)["name"];
- auto light_name = MessageHelper::CommonLightNameFromString(
- light_name_so.asString());
- light_name_so = light_name;
- }
+ if (JsonIsMemberSafe(ui_system_capabilities_node,
+ strings::driver_distraction_capability)) {
+ Json::Value dd_capability = ui_system_capabilities_node.get(
+ strings::driver_distraction_capability, "");
+ smart_objects::SmartObject dd_capability_so;
+ formatters::CFormatterJsonBase::jsonValueToObj(dd_capability,
+ dd_capability_so);
+ set_driver_distraction_capability(dd_capability_so);
+ if (!dd_capability_so.empty()) {
+ set_driver_distraction_supported(true);
+ }
+ }
+ }
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::ui);
+ } // UI end
+
+ // RC
+ if (json_root_getter.IsInterfaceJsonMemberExists(hmi_interface::rc)) {
+ auto rc_json_getter =
+ GetInterfaceGetter(hmi_interface::rc, json_root_getter);
+
+ auto rc_capabilitity_node =
+ rc_json_getter.GetJsonMember(strings::rc_capability,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!rc_capabilitity_node.isNull()) {
+ smart_objects::SmartObject rc_capability_so;
+ formatters::CFormatterJsonBase::jsonValueToObj(rc_capabilitity_node,
+ rc_capability_so);
+ if (rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::klightControlCapabilities)) {
+ if (rc_capability_so
+ [rc_rpc_plugin::strings::klightControlCapabilities]
+ .keyExists(rc_rpc_plugin::strings::kSupportedLights)) {
+ auto& lights = rc_capability_so
+ [rc_rpc_plugin::strings::klightControlCapabilities]
+ [rc_rpc_plugin::strings::kSupportedLights];
+ auto it = lights.asArray()->begin();
+ for (; it != lights.asArray()->end(); ++it) {
+ smart_objects::SmartObject& light_name_so = (*it)[strings::name];
+ auto light_name = MessageHelper::CommonLightNameFromString(
+ light_name_so.asString());
+ light_name_so = light_name;
}
}
+ }
+ if (!rc_capability_so.empty()) {
+ set_rc_supported(true);
set_rc_capability(rc_capability_so);
- if (!rc_capability_so.empty()) {
- set_rc_supported(true);
- }
}
- if (check_existing_json_member(system_capabilities,
- "seatLocationCapability")) {
- Json::Value seat_location_capability =
- system_capabilities.get("seatLocationCapability", "");
- smart_objects::SmartObject seat_location_capability_so;
- formatters::CFormatterJsonBase::jsonValueToObj(
- seat_location_capability, seat_location_capability_so);
+ }
+
+ auto seat_location_capabilitiy_node =
+ rc_json_getter.GetJsonMember(strings::seat_location_capability,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ requests_required_for_capabilities_);
+
+ if (!seat_location_capabilitiy_node.isNull()) {
+ smart_objects::SmartObject seat_location_capability_so;
+ formatters::CFormatterJsonBase::jsonValueToObj(
+ seat_location_capabilitiy_node, seat_location_capability_so);
+
+ if (!seat_location_capability_so.empty()) {
+ set_rc_supported(true);
set_seat_location_capability(seat_location_capability_so);
}
}
- } // UI end
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::rc);
+ }
+ // RC end
// VR
- if (check_existing_json_member(root_json, "VR")) {
- Json::Value vr = root_json.get("VR", "");
- if (check_existing_json_member(vr, "language")) {
- const std::string lang = vr.get("language", "EN-US").asString();
+ if (json_root_getter.IsInterfaceJsonMemberExists(hmi_interface::vr)) {
+ auto json_vr_getter =
+ GetInterfaceGetter(hmi_interface::vr, json_root_getter);
+
+ auto vr_language_node =
+ json_vr_getter.GetJsonMember(hmi_response::language,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ requests_required_for_capabilities_);
+ if (!vr_language_node.isNull()) {
+ const std::string lang = vr_language_node.asString();
set_active_vr_language(MessageHelper::CommonLanguageFromString(lang));
- } else {
- set_active_vr_language(
- MessageHelper::CommonLanguageFromString("EN-US"));
}
- if (check_existing_json_member(vr, "languages")) {
- Json::Value languages_vr = vr.get("languages", "");
+ auto vr_languages_node = json_vr_getter.GetJsonMember(
+ hmi_response::languages,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ requests_required_for_capabilities_);
+ if (!vr_languages_node.isNull()) {
smart_objects::SmartObject vr_languages_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- convert_json_languages_to_obj(languages_vr, vr_languages_so);
+ ConvertJsonArrayToSoArray<hmi_apis::Common_Language::eType>(
+ vr_languages_node, vr_languages_so);
set_vr_supported_languages(vr_languages_so);
}
- if (check_existing_json_member(vr, "capabilities")) {
- Json::Value capabilities = vr.get("capabilities", "");
+ auto vr_capabilities_node =
+ json_vr_getter.GetJsonMember(strings::vr_capabilities,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!vr_capabilities_node.isNull()) {
smart_objects::SmartObject vr_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- for (uint32_t i = 0; i < capabilities.size(); ++i) {
- vr_capabilities_so[i] =
- vr_enum_capabilities.find(capabilities[i].asString())->second;
- }
+ ConvertJsonArrayToSoArray<hmi_apis::Common_VrCapabilities::eType>(
+ vr_capabilities_node, vr_capabilities_so);
set_vr_capabilities(vr_capabilities_so);
}
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::vr);
} // VR end
// TTS
- if (check_existing_json_member(root_json, "TTS")) {
- Json::Value tts = root_json.get("TTS", "");
-
- if (check_existing_json_member(tts, "language")) {
- const std::string lang = tts.get("language", "EN-US").asString();
+ if (json_root_getter.IsInterfaceJsonMemberExists(hmi_interface::tts)) {
+ auto json_tts_getter =
+ GetInterfaceGetter(hmi_interface::tts, json_root_getter);
+
+ auto tts_language_node =
+ json_tts_getter.GetJsonMember(hmi_response::language,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ requests_required_for_capabilities_);
+ if (!tts_language_node.isNull()) {
+ const std::string lang = tts_language_node.asString();
set_active_tts_language(MessageHelper::CommonLanguageFromString(lang));
- } else {
- set_active_tts_language(
- MessageHelper::CommonLanguageFromString("EN-US"));
}
- if (check_existing_json_member(tts, "languages")) {
- Json::Value languages_tts = tts.get("languages", "");
+ auto tts_languages_node = json_tts_getter.GetJsonMember(
+ hmi_response::languages,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ requests_required_for_capabilities_);
+ if (!tts_languages_node.isNull()) {
smart_objects::SmartObject tts_languages_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- convert_json_languages_to_obj(languages_tts, tts_languages_so);
+ ConvertJsonArrayToSoArray<hmi_apis::Common_Language::eType>(
+ tts_languages_node, tts_languages_so);
set_tts_supported_languages(tts_languages_so);
}
- if (check_existing_json_member(tts, "capabilities")) {
- Json::Value capabilities = tts.get("capabilities", "");
+ auto tts_speech_capabilities_node = json_tts_getter.GetJsonMember(
+ hmi_response::speech_capabilities,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!tts_speech_capabilities_node.isNull()) {
smart_objects::SmartObject tts_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- for (uint32_t i = 0; i < capabilities.size(); ++i) {
- tts_capabilities_so[i] =
- tts_enum_capabilities.find(capabilities[i].asString())->second;
- }
+ ConvertJsonArrayToSoArray<hmi_apis::Common_SpeechCapabilities::eType>(
+ tts_speech_capabilities_node, tts_capabilities_so);
set_speech_capabilities(tts_capabilities_so);
}
+
+ auto tts_prerecorded_speech_capabilities_node =
+ json_tts_getter.GetJsonMember(
+ hmi_response::prerecorded_speech_capabilities,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!tts_prerecorded_speech_capabilities_node.isNull()) {
+ smart_objects::SmartObject tts_capabilities_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ ConvertJsonArrayToSoArray<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_prerecorded_speech_capabilities_node, tts_capabilities_so);
+ set_prerecorded_speech(tts_capabilities_so);
+ }
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::tts);
} // TTS end
// Buttons
- if (check_existing_json_member(root_json, "Buttons")) {
- Json::Value buttons = root_json.get("Buttons", "");
- if (check_existing_json_member(buttons, "capabilities")) {
- Json::Value bt_capabilities = buttons.get("capabilities", "");
+ if (json_root_getter.IsInterfaceJsonMemberExists(hmi_interface::buttons)) {
+ auto json_buttons_getter =
+ GetInterfaceGetter(hmi_interface::buttons, json_root_getter);
+
+ auto buttons_capabilities_node = json_buttons_getter.GetJsonMember(
+ hmi_response::capabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ requests_required_for_capabilities_);
+ if (!buttons_capabilities_node.isNull()) {
smart_objects::SmartObject buttons_capabilities_so;
- formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities,
- buttons_capabilities_so);
+ formatters::CFormatterJsonBase::jsonValueToObj(
+ buttons_capabilities_node, buttons_capabilities_so);
for (uint32_t i = 0; i < buttons_capabilities_so.length(); ++i) {
if ((buttons_capabilities_so[i]).keyExists(strings::name)) {
@@ -1325,22 +1644,39 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
}
set_button_capabilities(buttons_capabilities_so);
}
- if (check_existing_json_member(buttons, "presetBankCapabilities")) {
- Json::Value presetBank = buttons.get("presetBankCapabilities", "");
+
+ auto buttons_preset_bank_capabilities_node =
+ json_buttons_getter.GetMainJsonMember(
+ hmi_response::preset_bank_capabilities);
+ if (!buttons_preset_bank_capabilities_node.isNull()) {
smart_objects::SmartObject preset_bank_so;
- formatters::CFormatterJsonBase::jsonValueToObj(presetBank,
- preset_bank_so);
+ formatters::CFormatterJsonBase::jsonValueToObj(
+ buttons_preset_bank_capabilities_node, preset_bank_so);
set_preset_bank_capabilities(preset_bank_so);
}
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::buttons);
} // Buttons end
// VehicleType
- if (check_existing_json_member(root_json, "VehicleInfo")) {
- Json::Value vehicle_info = root_json.get("VehicleInfo", "");
- smart_objects::SmartObject vehicle_type_so;
- formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info,
- vehicle_type_so);
- set_vehicle_type(vehicle_type_so);
+
+ if (json_root_getter.IsInterfaceJsonMemberExists(
+ hmi_interface::vehicle_info)) {
+ auto json_vehicle_info_getter =
+ GetInterfaceGetter(hmi_interface::vehicle_info, json_root_getter);
+
+ auto vehicle_type_node = json_vehicle_info_getter.GetJsonMember(
+ hmi_response::vehicle_type,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
+ requests_required_for_capabilities_);
+ if (!vehicle_type_node.isNull()) {
+ smart_objects::SmartObject vehicle_type_so;
+ formatters::CFormatterJsonBase::jsonValueToObj(vehicle_type_node,
+ vehicle_type_so);
+ set_vehicle_type(vehicle_type_so);
+ }
+ } else {
+ AddRequiredRequestsForCapabilities(hmi_interface::vehicle_info);
} // VehicleType end
} catch (...) {
return false;
@@ -1348,6 +1684,534 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
return true;
}
+hmi_apis::Common_Language::eType
+HMICapabilitiesImpl::GetActiveLanguageForInterface(
+ const std::string& interface_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (hmi_interface::ui == interface_name) {
+ return active_ui_language();
+ }
+ if (hmi_interface::vr == interface_name) {
+ return active_vr_language();
+ }
+ if (hmi_interface::tts == interface_name) {
+ return active_tts_language();
+ }
+ return hmi_apis::Common_Language::INVALID_ENUM;
+}
+
+void HMICapabilitiesImpl::UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType requested_interface) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (app_mngr_.IsHMICooperating()) {
+ LOG4CXX_DEBUG(logger_,
+ "Remove from default initialized capabilities skipped, "
+ "because hmi_cooperating equal true already");
+ return;
+ }
+
+ RemoveFromRequestsRequiredForCapabilities(requested_interface);
+ if (requests_required_for_capabilities_.empty()) {
+ app_mngr_.SetHMICooperating(true);
+ }
+}
+
+void HMICapabilitiesImpl::OnSoftwareVersionReceived(
+ const std::string& ccpu_version) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (ccpu_version == ccpu_version_) {
+ LOG4CXX_DEBUG(logger_, "Software version not changed");
+ if (requests_required_for_capabilities_.empty()) {
+ app_mngr_.SetHMICooperating(true);
+ }
+ app_mngr_.RequestForInterfacesAvailability();
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Software version changed");
+ set_ccpu_version(ccpu_version);
+ UpdateCachedCapabilities();
+}
+
+void HMICapabilitiesImpl::UpdateCachedCapabilities() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DeleteCachedCapabilitiesFile();
+
+ if (!LoadCapabilitiesFromFile()) {
+ LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
+ }
+
+ app_mngr_.RequestForInterfacesAvailability();
+}
+
+bool HMICapabilitiesImpl::AllFieldsSaved(
+ const Json::Value& root_node,
+ const std::string& interface_name,
+ const std::vector<std::string>& sections_to_check) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!JsonIsMemberSafe(root_node, interface_name.c_str())) {
+ LOG4CXX_DEBUG(logger_,
+ interface_name
+ << " interface is not found. All fields should be saved");
+ return false;
+ }
+
+ const auto& interface_node = root_node.get(interface_name, Json::Value::null);
+ for (auto it = sections_to_check.begin(); it != sections_to_check.end();
+ ++it) {
+ const std::string section = (*it).c_str();
+ if (!JsonIsMemberSafe(interface_node, section.c_str())) {
+ LOG4CXX_DEBUG(logger_,
+ "Field " << *it << " should be saved into the file");
+ return false;
+ }
+
+ if (hmi_response::language == section) {
+ const auto active_language =
+ GetActiveLanguageForInterface(interface_name);
+ const auto json_language = interface_node[hmi_response::language];
+
+ if (active_language !=
+ MessageHelper::CommonLanguageFromString(json_language.asString())) {
+ LOG4CXX_DEBUG(logger_,
+ "Active " << interface_name
+ << " language is not the same as the persisted "
+ "one. Field should be overwritten");
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+void HMICapabilitiesImpl::RemoveFromRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType requested_interface) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto it = find(requests_required_for_capabilities_.begin(),
+ requests_required_for_capabilities_.end(),
+ requested_interface);
+ if (it != requests_required_for_capabilities_.end()) {
+ requests_required_for_capabilities_.erase(it);
+ LOG4CXX_DEBUG(logger_,
+ "Wait for " << requests_required_for_capabilities_.size()
+ << " responses");
+ }
+}
+
+void HMICapabilitiesImpl::PrepareUiJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject capability(smart_objects::SmartType_Map);
+ auto system_capabilities = std::make_shared<smart_objects::SmartObject>(
+ capability[strings::system_capabilities]);
+
+ for (const auto& section_to_update : sections_to_update) {
+ if (section_to_update == hmi_response::hmi_zone_capabilities) {
+ save_hmi_capability_field_to_json(hmi_response::hmi_zone_capabilities,
+ schema,
+ hmi_zone_capabilities(),
+ out_node);
+ }
+
+ else if (section_to_update == hmi_response::soft_button_capabilities) {
+ save_hmi_capability_field_to_json(hmi_response::soft_button_capabilities,
+ schema,
+ soft_button_capabilities(),
+ out_node);
+ }
+
+ else if (section_to_update == strings::audio_pass_thru_capabilities) {
+ smart_objects::SmartObjectSPtr audio_pass_thru_capabilities_so =
+ audio_pass_thru_capabilities();
+
+ for (size_t i = 0; i < audio_pass_thru_capabilities_so->length(); ++i) {
+ const smart_objects::SmartObject& element =
+ (*audio_pass_thru_capabilities_so)[i];
+ const auto audio_pass_thru_capabilities =
+ std::make_shared<smart_objects::SmartObject>(element);
+ Json::Value out_audio_pass_thru;
+ save_hmi_capability_field_to_json(strings::audio_pass_thru_capabilities,
+ schema,
+ audio_pass_thru_capabilities,
+ out_audio_pass_thru);
+ out_node[strings::audio_pass_thru_capabilities][Json::ArrayIndex(i)] =
+ out_audio_pass_thru[strings::audio_pass_thru_capabilities];
+ }
+ }
+
+ else if (section_to_update == strings::navigation) {
+ out_node[strings::hmi_capabilities][strings::navigation] =
+ navigation_supported();
+ }
+
+ else if (section_to_update == strings::phone_call) {
+ out_node[strings::hmi_capabilities][strings::phone_call] =
+ phone_call_supported();
+ }
+
+ else if (section_to_update == strings::video_streaming) {
+ out_node[strings::hmi_capabilities][strings::video_streaming] =
+ video_streaming_supported();
+ }
+
+ else if (section_to_update == strings::navigation_capability) {
+ const auto navigation_capability_so = navigation_capability();
+ if (navigation_capability_so) {
+ (*system_capabilities)[strings::navigation_capability] =
+ *navigation_capability_so;
+ }
+ }
+
+ else if (section_to_update == strings::phone_capability) {
+ const auto phone_capability_so = phone_capability();
+ if (phone_capability_so) {
+ (*system_capabilities)[strings::phone_capability] =
+ *phone_capability_so;
+ }
+ }
+
+ else if (section_to_update == strings::video_streaming_capability) {
+ const auto video_streaming_capability_so = video_streaming_capability();
+
+ if (video_streaming_capability_so) {
+ (*system_capabilities)[strings::video_streaming_capability] =
+ *video_streaming_capability_so;
+ }
+ }
+
+ else if (section_to_update == strings::display_capabilities) {
+ const auto display_capabilities_so = display_capabilities();
+
+ if (display_capabilities_so) {
+ save_hmi_capability_field_to_json(strings::display_capabilities,
+ schema,
+ display_capabilities_so,
+ out_node);
+ }
+ }
+
+ else if (section_to_update == strings::pcm_stream_capabilities) {
+ save_hmi_capability_field_to_json(strings::pcm_stream_capabilities,
+ schema,
+ pcm_stream_capabilities(),
+ out_node);
+ }
+
+ else if (section_to_update == hmi_response::language) {
+ out_node[hmi_response::language] =
+ MessageHelper::CommonLanguageToString(active_ui_language());
+ }
+
+ else if (section_to_update == hmi_response::languages) {
+ save_hmi_capability_field_to_json(
+ hmi_response::languages, schema, ui_supported_languages(), out_node);
+ }
+ }
+
+ if (!system_capabilities->empty()) {
+ save_hmi_capability_field_to_json(
+ strings::system_capabilities, schema, system_capabilities, out_node);
+ }
+}
+
+void HMICapabilitiesImpl::PrepareVrJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (const auto& section_to_update : sections_to_update) {
+ if (section_to_update == hmi_response::language) {
+ out_node[hmi_response::language] =
+ MessageHelper::CommonLanguageToString(active_vr_language());
+ }
+
+ if (section_to_update == hmi_response::languages) {
+ save_hmi_capability_field_to_json(
+ hmi_response::languages, schema, vr_supported_languages(), out_node);
+ }
+
+ if (section_to_update == strings::vr_capabilities) {
+ save_hmi_capability_field_to_json(
+ strings::vr_capabilities, schema, vr_capabilities(), out_node);
+ }
+ }
+}
+
+void HMICapabilitiesImpl::PrepareTtsJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (const auto& section_to_update : sections_to_update) {
+ if (section_to_update == hmi_response::language) {
+ out_node[hmi_response::language] =
+ MessageHelper::CommonLanguageToString(active_tts_language());
+ }
+
+ if (section_to_update == hmi_response::languages) {
+ save_hmi_capability_field_to_json(
+ hmi_response::languages, schema, tts_supported_languages(), out_node);
+ }
+
+ if (section_to_update == hmi_response::speech_capabilities) {
+ save_hmi_capability_field_to_json(hmi_response::speech_capabilities,
+ schema,
+ speech_capabilities(),
+ out_node);
+ }
+
+ if (section_to_update == hmi_response::prerecorded_speech_capabilities) {
+ save_hmi_capability_field_to_json(
+ hmi_response::prerecorded_speech_capabilities,
+ schema,
+ prerecorded_speech(),
+ out_node);
+ }
+ }
+}
+
+void HMICapabilitiesImpl::PrepareButtonsJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (const auto& section_to_update : sections_to_update) {
+ if (section_to_update == hmi_response::button_capabilities) {
+ save_hmi_capability_field_to_json(
+ hmi_response::capabilities, schema, button_capabilities(), out_node);
+ }
+
+ if (section_to_update == hmi_response::preset_bank_capabilities) {
+ save_hmi_capability_field_to_json(hmi_response::preset_bank_capabilities,
+ schema,
+ preset_bank_capabilities(),
+ out_node);
+ }
+ }
+}
+
+void HMICapabilitiesImpl::PrepareVehicleInfoJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (helpers::in_range(sections_to_update, hmi_response::vehicle_type)) {
+ save_hmi_capability_field_to_json(
+ hmi_response::vehicle_type, schema, vehicle_type(), out_node);
+ }
+}
+
+void HMICapabilitiesImpl::PrepareRCJsonValueForSaving(
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_node) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (const auto& section_to_update : sections_to_update) {
+ if (section_to_update == strings::rc_capability) {
+ save_hmi_capability_field_to_json(
+ strings::rc_capability, schema, rc_capability(), out_node);
+ }
+
+ if (section_to_update == strings::seat_location_capability) {
+ save_hmi_capability_field_to_json(strings::seat_location_capability,
+ schema,
+ seat_location_capability(),
+ out_node);
+ }
+ }
+}
+
+void HMICapabilitiesImpl::AddRequiredRequestsForCapabilities(
+ const std::string& interface_name) {
+ LOG4CXX_DEBUG(logger_, "Add request IDs for interface: " << interface_name);
+
+ if (interface_name == hmi_interface::ui) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::UI_GetLanguage);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::UI_GetCapabilities);
+ }
+
+ else if (interface_name == hmi_interface::rc) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::RC_GetCapabilities);
+ }
+
+ else if (interface_name == hmi_interface::vr) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::VR_GetLanguage);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::VR_GetCapabilities);
+ }
+
+ else if (interface_name == hmi_interface::tts) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::TTS_GetLanguage);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages);
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::TTS_GetCapabilities);
+ }
+
+ else if (interface_name == hmi_interface::buttons) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::Buttons_GetCapabilities);
+ }
+
+ else if (interface_name == hmi_interface::vehicle_info) {
+ requests_required_for_capabilities_.insert(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType);
+ }
+}
+
+void HMICapabilitiesImpl::PrepareJsonValueForSaving(
+ const char* interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema,
+ Json::Value& out_root_node) const {
+ LOG4CXX_DEBUG(logger_,
+ "Prepare " << interface_name << " sections for saving");
+
+ if (out_root_node.isNull()) {
+ out_root_node = Json::Value(Json::objectValue);
+ }
+
+ if (!out_root_node.isMember(interface_name)) {
+ out_root_node[interface_name] = Json::Value(Json::objectValue);
+ }
+
+ Json::Value& interface_node = out_root_node[interface_name];
+ if (strcmp(interface_name, hmi_interface::ui) == 0) {
+ PrepareUiJsonValueForSaving(sections_to_update, schema, interface_node);
+ }
+
+ else if (strcmp(interface_name, hmi_interface::vr) == 0) {
+ PrepareVrJsonValueForSaving(sections_to_update, schema, interface_node);
+ }
+
+ else if (strcmp(interface_name, hmi_interface::tts) == 0) {
+ PrepareTtsJsonValueForSaving(sections_to_update, schema, interface_node);
+ }
+
+ else if (strcmp(interface_name, hmi_interface::buttons) == 0) {
+ PrepareButtonsJsonValueForSaving(
+ sections_to_update, schema, interface_node);
+ }
+
+ else if (strcmp(interface_name, hmi_interface::vehicle_info) == 0) {
+ PrepareVehicleInfoJsonValueForSaving(
+ sections_to_update, schema, interface_node);
+ }
+
+ else if (strcmp(interface_name, hmi_interface::rc) == 0) {
+ PrepareRCJsonValueForSaving(sections_to_update, schema, interface_node);
+ }
+}
+
+bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile(
+ const std::string& interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (sections_to_update.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "There is no one section to update in the cache file");
+ return true;
+ }
+
+ const std::string cache_file_name =
+ app_mngr_.get_settings().hmi_capabilities_cache_file_name();
+ if (cache_file_name.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "Cache file name is not specified. No need to save cache");
+ return true;
+ }
+
+ Json::Value root_node;
+ if (file_system::FileExists(cache_file_name)) {
+ LOG4CXX_DEBUG(logger_, "Cache file exists. Check for it's content");
+
+ std::string file_content;
+ if (!file_system::ReadFile(cache_file_name, file_content)) {
+ LOG4CXX_ERROR(logger_, "Failed to read file content");
+ return false;
+ }
+
+ Json::CharReaderBuilder builder;
+ const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
+ if (!reader->parse(file_content.c_str(),
+ file_content.c_str() + file_content.length(),
+ &root_node,
+ NULL)) {
+ LOG4CXX_ERROR(logger_, "Can't parse the file. Skipping");
+ return false;
+ }
+
+ if (AllFieldsSaved(root_node, interface_name, sections_to_update)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "All " << interface_name
+ << " fields are present in the file. No need to update");
+ return true;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Some fields in the cache file should be updated");
+ }
+
+ PrepareJsonValueForSaving(
+ interface_name.c_str(), sections_to_update, schema, root_node);
+
+ LOG4CXX_DEBUG(logger_, "Saving cache to file: " << cache_file_name);
+ const std::string content_to_save = root_node.toStyledString();
+ const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(),
+ content_to_save.end());
+
+ return file_system::Write(cache_file_name, binary_data_to_save);
+}
+
+bool HMICapabilitiesImpl::DeleteCachedCapabilitiesFile() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const std::string cache_file_name =
+ app_mngr_.get_settings().hmi_capabilities_cache_file_name();
+ if (cache_file_name.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "Cache file name is not specified. Nothing to delete");
+ return false;
+ }
+
+ if (!file_system::FileExists(cache_file_name)) {
+ LOG4CXX_DEBUG(logger_, "Cache file does not exist");
+ return false;
+ }
+
+ if (!file_system::DeleteFile(cache_file_name)) {
+ LOG4CXX_ERROR(logger_, "Failed to delete cache file");
+ return false;
+ }
+ return true;
+}
+
+bool HMICapabilitiesImpl::IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType function_id) const {
+ return helpers::in_range(requests_required_for_capabilities_, function_id);
+}
+
void HMICapabilitiesImpl::set_ccpu_version(const std::string& ccpu_version) {
ccpu_version_ = ccpu_version;
}
@@ -1356,11 +2220,6 @@ const std::string& HMICapabilitiesImpl::ccpu_version() const {
return ccpu_version_;
}
-bool HMICapabilitiesImpl::check_existing_json_member(
- const Json::Value& json_member, const char* name_of_member) const {
- return json_member.isMember(name_of_member);
-}
-
void HMICapabilitiesImpl::convert_json_languages_to_obj(
const Json::Value& json_languages,
smart_objects::SmartObject& languages) const {
@@ -1373,18 +2232,18 @@ void HMICapabilitiesImpl::convert_json_languages_to_obj(
void HMICapabilitiesImpl::convert_audio_capability_to_obj(
const Json::Value& capability,
smart_objects::SmartObject& output_so) const {
- if (check_existing_json_member(capability, "samplingRate")) {
+ if (JsonIsMemberSafe(capability, "samplingRate")) {
output_so[strings::sampling_rate] =
sampling_rate_enum.find(capability.get("samplingRate", "").asString())
->second;
}
- if (check_existing_json_member(capability, "bitsPerSample")) {
+ if (JsonIsMemberSafe(capability, "bitsPerSample")) {
output_so[strings::bits_per_sample] =
bit_per_sample_enum
.find(capability.get("bitsPerSample", "").asString())
->second;
}
- if (check_existing_json_member(capability, "audioType")) {
+ if (JsonIsMemberSafe(capability, "audioType")) {
output_so[strings::audio_type] =
audio_type_enum.find(capability.get("audioType", "").asString())
->second;
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 d6fbed115b..d351ea91b8 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -189,6 +189,8 @@ std::pair<std::string, mobile_apis::VehicleDataType::eType>
mobile_apis::VehicleDataType::VEHICLEDATA_TURNSIGNAL),
std::make_pair(strings::vin,
mobile_apis::VehicleDataType::VEHICLEDATA_VIN),
+ std::make_pair(strings::gearStatus,
+ mobile_apis::VehicleDataType::VEHICLEDATA_GEARSTATUS),
std::make_pair(strings::prndl,
mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL),
std::make_pair(strings::tire_pressure,
@@ -211,6 +213,9 @@ std::pair<std::string, mobile_apis::VehicleDataType::eType>
std::make_pair(
strings::head_lamp_status,
mobile_apis::VehicleDataType::VEHICLEDATA_HEADLAMPSTATUS),
+ std::make_pair(
+ strings::stability_controls_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_STABILITYCONTROLSSTATUS),
std::make_pair(strings::e_call_info,
mobile_apis::VehicleDataType::VEHICLEDATA_ECALLINFO),
std::make_pair(strings::airbag_status,
@@ -237,9 +242,13 @@ std::pair<std::string, mobile_apis::VehicleDataType::eType>
mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL),
std::make_pair(strings::steering_wheel_angle,
mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL),
+ std::make_pair(strings::engine_oil_life,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE),
+ std::make_pair(strings::window_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_WINDOWSTATUS),
std::make_pair(
- strings::engine_oil_life,
- mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE)};
+ strings::hands_off_steering,
+ mobile_apis::VehicleDataType::VEHICLEDATA_HANDSOFFSTEERING)};
const VehicleData MessageHelper::vehicle_data_(
kVehicleDataInitializer,
@@ -1108,8 +1117,7 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
return;
}
- DataAccessor<ButtonSubscriptions> button_accessor = app->SubscribedButtons();
- ButtonSubscriptions subscriptions = button_accessor.GetData();
+ const ButtonSubscriptions subscriptions = app->SubscribedButtons().GetData();
ButtonSubscriptions::iterator it = subscriptions.begin();
for (; subscriptions.end() != it; ++it) {
SendOnButtonSubscriptionNotification(
@@ -1877,6 +1885,10 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
(*i->second)[strings::position];
msg_params[strings::menu_params][strings::menu_name] =
(*i->second)[strings::menu_name];
+ if ((*i->second).keyExists(strings::parent_id)) {
+ msg_params[strings::menu_params][strings::parent_id] =
+ (*i->second)[strings::parent_id];
+ }
msg_params[strings::app_id] = app->app_id();
(*ui_sub_menu)[strings::msg_params] = msg_params;
if (((*i->second).keyExists(strings::menu_icon)) &&
@@ -2366,25 +2378,20 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id,
(*start_stream)[strings::params][strings::function_id] =
hmi_apis::FunctionID::Navigation_StartStream;
- char url[100] = {'\0'};
+ std::string url;
if ("socket" == app_mngr.get_settings().video_server_type()) {
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "http://%s:%d",
- app_mngr.get_settings().server_address().c_str(),
- app_mngr.get_settings().video_streaming_port());
+ auto const port = app_mngr.get_settings().video_streaming_port();
+ url = "http://";
+ url += app_mngr.get_settings().server_address();
+ url += ":";
+ url += std::to_string(port);
} else if ("pipe" == app_mngr.get_settings().video_server_type()) {
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "%s",
- app_mngr.get_settings().named_video_pipe_path().c_str());
+ url.reserve(PATH_MAX);
+ url.insert(
+ 0, app_mngr.get_settings().named_video_pipe_path(), 0, PATH_MAX - 1);
} else {
- int snprintf_result =
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "%s",
- app_mngr.get_settings().video_stream_file().c_str());
- DCHECK(snprintf_result);
+ url.reserve(PATH_MAX);
+ url.insert(0, app_mngr.get_settings().video_stream_file(), 0, PATH_MAX - 1);
}
(*start_stream)[strings::msg_params][strings::app_id] = app_id;
@@ -2423,25 +2430,20 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id,
(*start_stream)[strings::params][strings::function_id] =
hmi_apis::FunctionID::Navigation_StartAudioStream;
- char url[100] = {'\0'};
+ std::string url;
if ("socket" == app_mngr.get_settings().audio_server_type()) {
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "http://%s:%d",
- app_mngr.get_settings().server_address().c_str(),
- app_mngr.get_settings().audio_streaming_port());
+ auto const port = app_mngr.get_settings().audio_streaming_port();
+ url = "http://";
+ url += app_mngr.get_settings().server_address();
+ url += ":";
+ url += std::to_string(port);
} else if ("pipe" == app_mngr.get_settings().audio_server_type()) {
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "%s",
- app_mngr.get_settings().named_audio_pipe_path().c_str());
+ url.reserve(PATH_MAX);
+ url.insert(
+ 0, app_mngr.get_settings().named_audio_pipe_path(), 0, PATH_MAX - 1);
} else {
- int snprintf_result =
- snprintf(url,
- sizeof(url) / sizeof(url[0]),
- "%s",
- app_mngr.get_settings().audio_stream_file().c_str());
- DCHECK(snprintf_result);
+ url.reserve(PATH_MAX);
+ url.insert(0, app_mngr.get_settings().audio_stream_file(), 0, PATH_MAX - 1);
}
(*start_stream)[strings::msg_params][strings::app_id] = app_id;
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 646d523cf4..4992bd96ca 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1018,6 +1018,11 @@ void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
policy_manager_->SetSystemLanguage(language);
}
+void PolicyHandler::SetPreloadedPtFlag(const bool is_preloaded) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ policy_manager_->SetPreloadedPtFlag(is_preloaded);
+}
+
void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
@@ -1026,6 +1031,11 @@ void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
}
+std::string PolicyHandler::GetCCPUVersionFromPT() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return policy_manager_->GetCCPUVersionFromPT();
+}
+
void PolicyHandler::OnVIIsReady() {
LOG4CXX_AUTO_TRACE(logger_);
const uint32_t correlation_id =
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 9046fe35ad..0312975fec 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -148,20 +148,23 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
}
LOG4CXX_DEBUG(logger_, "app_id:" << application->app_id());
- DataAccessor<ButtonSubscriptions> button_accessor =
- application->SubscribedButtons();
+ {
+ DataAccessor<ButtonSubscriptions> button_accessor =
+ application->SubscribedButtons();
- const ButtonSubscriptions& button_subscriptions = button_accessor.GetData();
+ const ButtonSubscriptions& button_subscriptions = button_accessor.GetData();
- LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size());
- Append(button_subscriptions.begin(),
- button_subscriptions.end(),
- strings::application_buttons,
- subscriptions);
+ LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size());
+ Append(button_subscriptions.begin(),
+ button_subscriptions.end(),
+ strings::application_buttons,
+ subscriptions);
+ }
for (auto extension : application->Extensions()) {
extension->SaveResumptionData(subscriptions);
}
+
return subscriptions;
}
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index fe0f878e6c..f95476b7a6 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -85,6 +85,7 @@ const char* user_location = "userLocation";
const char* num_ticks = "numTicks";
const char* slider_footer = "sliderFooter";
const char* menu_id = "menuID";
+const char* parent_id = "parentID";
const char* menu_name = "menuName";
const char* menu_layout = "menuLayout";
const char* menu_layouts_available = "menuLayoutsAvailable";
@@ -163,6 +164,8 @@ const char* system_capabilities = "systemCapabilities";
const char* navigation_capability = "navigationCapability";
const char* phone_capability = "phoneCapability";
const char* video_streaming_capability = "videoStreamingCapability";
+const char* driver_distraction_capability = "driverDistractionCapability";
+const char* driver_distraction = "driverDistraction";
const char* rc_capability = "remoteControlCapability";
const char* seat_location_capability = "seatLocationCapability";
const char* app_services_capabilities = "appServicesCapabilities";
@@ -263,6 +266,7 @@ const char* cloud_app_vehicle_id = "cloudAppVehicleID";
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* odometer = "odometer";
@@ -276,6 +280,7 @@ const char* head_lamp_status = "headLampStatus";
const char* engine_torque = "engineTorque";
const char* acc_pedal_pos = "accPedalPosition";
const char* steering_wheel_angle = "steeringWheelAngle";
+const char* stability_controls_status = "stabilityControlsStatus";
const char* e_call_info = "eCallInfo";
const char* airbag_status = "airbagStatus";
const char* emergency_event = "emergencyEvent";
@@ -301,6 +306,8 @@ const char* system_software_version = "systemSoftwareVersion";
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";
// app services
const char* app_service_manifest = "appServiceManifest";
@@ -438,6 +445,19 @@ const char* const x = "x";
const char* const y = "y";
} // namespace strings
+namespace hmi_interface {
+const char* basic_communication = "BasicCommunication";
+const char* buttons = "Buttons";
+const char* navigation = "Navigation";
+const char* sdl = "SDL";
+const char* tts = "TTS";
+const char* ui = "UI";
+const char* vr = "VR";
+const char* rc = "RC";
+const char* vehicle_info = "VehicleInfo";
+const char* app_service = "AppService";
+} // namespace hmi_interface
+
namespace json {
const char* appId = "appId";
const char* name = "name";
@@ -547,6 +567,7 @@ const char* capabilities = "capabilities";
const char* speech_capabilities = "speechCapabilities";
const char* prerecorded_speech_capabilities = "prerecordedSpeechCapabilities";
const char* preset_bank_capabilities = "presetBankCapabilities";
+const char* on_screen_presets_available = "onScreenPresetsAvailable";
const char* allowed = "allowed";
const char* vehicle_type = "vehicleType";
const char* did_result = "didResult";
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index afc39b9fdd..c9c9a80391 100755
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -47,6 +47,7 @@ include_directories(
${COMPONENTS_DIR}/application_manager/test/include/
${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include/
${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include/
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/include/
${BSON_INCLUDE_DIRECTORY}
)
@@ -158,7 +159,7 @@ set(ResumptionData_SOURCES
${AM_TEST_DIR}/mock_message_helper.cc
)
-file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY ${CMAKE_SOURCE_DIR}/src/appMain/hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc1.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc2.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_old_apt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
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 2c16048e97..d19cbbad22 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -269,6 +269,17 @@ class ApplicationManagerImplTest
ASSERT_TRUE(mock_app_ptr_.get());
}
+ void SetExpectationForCreateModuleInfoSO(
+ const hmi_apis::FunctionID::eType function_id) {
+ smart_objects::SmartObject sm_object(smart_objects::SmartType_Map);
+ sm_object[strings::params][strings::function_id] =
+ static_cast<int>(function_id);
+ auto sptr = std::make_shared<smart_objects::SmartObject>(sm_object);
+
+ ON_CALL(*mock_message_helper_, CreateModuleInfoSO(function_id, _))
+ .WillByDefault(Return(sptr));
+ }
+
application_manager::commands::MessageSharedPtr CreateCloseAppMessage() {
using namespace application_manager;
@@ -351,6 +362,13 @@ class ApplicationManagerImplTest
mock_statistics_manager_;
};
+MATCHER_P(HMIFunctionIDIs, result_code, "") {
+ return result_code == static_cast<hmi_apis::FunctionID::eType>(
+ (*arg)[application_manager::strings::params]
+ [application_manager::strings::function_id]
+ .asInt());
+}
+
INSTANTIATE_TEST_CASE_P(
ProcessServiceStatusUpdate_REQUEST_ACCEPTED,
ApplicationManagerImplTest,
@@ -1198,14 +1216,19 @@ TEST_F(ApplicationManagerImplTest, StartStopAudioPassThru) {
const uint32_t app_id = 65537;
const int32_t max_duration = 1000;
- // below are not used
const int32_t correlation_id = 0;
const int32_t sampling_rate = 0;
const int32_t bits_per_sample = 0;
const int32_t audio_type = 0;
- EXPECT_CALL(mock_media_manager,
- StartMicrophoneRecording(app_id, _, max_duration))
+ EXPECT_CALL(
+ mock_media_manager,
+ StartMicrophoneRecording(app_id,
+ _,
+ max_duration,
+ mobile_apis::SamplingRate::SamplingRate_8KHZ,
+ mobile_apis::BitsPerSample::BitsPerSample_8_BIT,
+ mobile_apis::AudioType::PCM))
.WillOnce(Return());
EXPECT_CALL(mock_media_manager, StopMicrophoneRecording(app_id))
.WillOnce(Return());
@@ -1282,14 +1305,19 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
app_manager_impl_->AddMockApplication(mock_app_2);
const int32_t max_duration = 1000;
- // below are not used
const int32_t correlation_id = 0;
const int32_t sampling_rate = 0;
const int32_t bits_per_sample = 0;
const int32_t audio_type = 0;
- EXPECT_CALL(mock_media_manager,
- StartMicrophoneRecording(app_id_2, _, max_duration))
+ EXPECT_CALL(
+ mock_media_manager,
+ StartMicrophoneRecording(app_id_2,
+ _,
+ max_duration,
+ mobile_apis::SamplingRate::SamplingRate_8KHZ,
+ mobile_apis::BitsPerSample::BitsPerSample_8_BIT,
+ mobile_apis::AudioType::PCM))
.WillOnce(Return());
EXPECT_CALL(mock_media_manager, StopMicrophoneRecording(app_id_2))
.WillOnce(Return());
@@ -2028,6 +2056,26 @@ TEST_F(ApplicationManagerImplTest, AddAndRemoveQueryAppDevice_SUCCESS) {
EXPECT_FALSE(app_manager_impl_->IsAppsQueriedFrom(device_handle));
}
+TEST_F(
+ ApplicationManagerImplTest,
+ RequestForInterfacesAvailability_AllRequestsWillBeSuccessfullyRequested) {
+ std::vector<hmi_apis::FunctionID::eType> expected_requests{
+ 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};
+
+ for (auto request : expected_requests) {
+ SetExpectationForCreateModuleInfoSO(request);
+ EXPECT_CALL(*mock_rpc_service_,
+ ManageHMICommand(HMIFunctionIDIs(request),
+ commands::Command::SOURCE_HMI));
+ }
+
+ app_manager_impl_->RequestForInterfacesAvailability();
+}
+
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json
deleted file mode 100644
index afa5fa6056..0000000000
--- a/src/components/application_manager/test/hmi_capabilities.json
+++ /dev/null
@@ -1,731 +0,0 @@
-{
- "UI": {
- "language":"EN_US",
- "languages":[
- "EN_US",
- "ES_MX",
- "FR_CA",
- "DE_DE",
- "ES_ES",
- "EN_GB",
- "RU_RU",
- "TR_TR",
- "PL_PL",
- "FR_FR",
- "IT_IT",
- "SV_SE",
- "PT_PT",
- "NL_NL",
- "ZH_TW",
- "JA_JP",
- "AR_SA",
- "KO_KR",
- "PT_BR",
- "CS_CZ",
- "DA_DK",
- "NO_NO",
- "NL_BE",
- "EL_GR",
- "HU_HU",
- "FI_FI",
- "SK_SK",
- "EN_IN",
- "TH_TH",
- "EN_SA",
- "HE_IL",
- "RO_RO",
- "UK_UA",
- "ID_ID",
- "VI_VN",
- "MS_MY",
- "HI_IN"
- ],
- "displayCapabilities": {
- "displayType": "GEN2_8_DMA",
- "displayName": "GENERIC_DISPLAY",
- "textFields": [
- {
- "name": "mainField1",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "mainField2",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "mainField3",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "mainField4",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "statusBar",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "mediaClock",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "mediaTrack",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "alertText1",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "alertText2",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "alertText3",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "scrollableMessageBody",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "initialInteractionText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "navigationText1",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "navigationText2",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "ETA",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "totalDistance",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "navigationText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "audioPassThruDisplayText1",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "audioPassThruDisplayText2",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "sliderHeader",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "sliderFooter",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "notificationText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "menuName",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "secondaryText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "tertiaryText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "timeToDestination",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "turnText",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- },
- {
- "name": "menuTitle",
- "characterSet": "TYPE2SET",
- "width": 500,
- "rows": 1
- }
- ],
- "imageFields": [
- {
- "name": "softButtonImage",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "choiceImage",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "choiceSecondaryImage",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "menuIcon",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "cmdIcon",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "appIcon",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "graphic",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "secondaryGraphic",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- },
- {
- "name": "locationImage",
- "imageTypeSupported": [
- "GRAPHIC_PNG"
- ],
- "imageResolution": {
- "resolutionWidth": 35,
- "resolutionHeight": 35
- }
- }
-
- ],
- "mediaClockFormats": [
- "CLOCK1",
- "CLOCK2",
- "CLOCK3",
- "CLOCKTEXT1",
- "CLOCKTEXT2",
- "CLOCKTEXT3",
- "CLOCKTEXT4"
- ],
- "graphicSupported": true,
- "templatesAvailable": [
-
- "DEFAULT",
- "MEDIA",
- "NON-MEDIA",
- "ONSCREEN_PRESETS",
- "NAV_FULLSCREEN_MAP",
- "NAV_KEYBOARD",
- "GRAPHIC_WITH_TEXT",
- "TEXT_WITH_GRAPHIC",
- "TILES_ONLY",
- "TEXTBUTTONS_ONLY",
- "GRAPHIC_WITH_TILES",
- "TILES_WITH_GRAPHIC",
- "GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS",
- "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC",
- "GRAPHIC_WITH_TEXTBUTTONS",
- "TEXTBUTTONS_WITH_GRAPHIC",
- "LARGE_GRAPHIC_WITH_SOFTBUTTONS",
- "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS",
- "LARGE_GRAPHIC_ONLY"
- ],
- "screenParams": {
- "resolution": {
- "resolutionWidth": 800,
- "resolutionHeight": 350
- },
- "touchEventAvailable": {
- "pressAvailable": true,
- "multiTouchAvailable": false,
- "doublePressAvailable": false
- }
- },
- "numCustomPresetsAvailable": 8,
- "imageCapabilities": [
- "DYNAMIC",
- "STATIC"
- ]
- },
- "audioPassThruCapabilities": [{
- "samplingRate": "44KHZ",
- "bitsPerSample": "RATE_8_BIT",
- "audioType": "PCM"
- }],
- "pcmStreamCapabilities": {
- "samplingRate": "16KHZ",
- "bitsPerSample": "RATE_16_BIT",
- "audioType": "PCM"
- },
- "hmiZoneCapabilities": "FRONT",
- "softButtonCapabilities": [
- {
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true,
- "imageSupported": true
- }
- ],
- "systemCapabilities": {
- "navigationCapability": {
- "sendLocationEnabled": true,
- "getWayPointsEnabled": true
- },
- "phoneCapability": {
- "dialNumberEnabled": true
- },
-
- "remoteControlCapability":{
- "climateControlCapabilities": [
- {
- "moduleName": "primary_climate",
- "fanSpeedAvailable": true,
- "desiredTemperatureAvailable": true,
- "acEnableAvailable": true,
- "acMaxEnableAvailable": true,
- "circulateAirEnableAvailable": true,
- "autoModeEnableAvailable": true,
- "dualModeEnableAvailable": true,
- "defrostZoneAvailable": true,
- "ventilationModeAvailable": true,
- "defrostZone": [
- "FRONT",
- "REAR",
- "ALL",
- "NONE"
- ],
- "ventilationMode": [
- "UPPER",
- "LOWER",
- "BOTH",
- "NONE"
- ]
- }
- ],
- "radioControlCapabilities": [
- {
- "moduleName": "radio",
- "radioEnableAvailable": true,
- "radioBandAvailable": true,
- "radioFrequencyAvailable": true,
- "hdChannelAvailable": true,
- "rdsDataAvailable": true,
- "availableHDsAvailable": true,
- "stateAvailable": true,
- "signalStrengthAvailable": true,
- "signalChangeThresholdAvailable": true
- }
- ],
- "buttonCapabilities": [
- {
- "name": "AC_MAX",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "AC",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "RECIRCULATE",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "FAN_UP",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "FAN_DOWN",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "TEMP_UP",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "TEMP_DOWN",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "DEFROST_MAX",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "DEFROST",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "DEFROST_REAR",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "UPPER_VENT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "LOWER_VENT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "VOLUME_UP",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "VOLUME_DOWN",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "EJECT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "SOURCE",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "SHUFFLE",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- },
- {
- "name": "REPEAT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": false
- }
- ]
- },
- "videoStreamingCapability": {
- "preferredResolution": {
- "resolutionWidth": 800,
- "resolutionHeight": 350
- },
- "maxBitrate": 10000,
- "supportedFormats": [
- {
- "protocol": "RAW",
- "codec": "H264"
- },
- {
- "protocol": "RTP",
- "codec": "Theora"
- }
- ],
- "hapticSpatialDataSupported": true
- }
- }
- },
- "VR": {
- "capabilities": [
- "TEXT"
- ],
- "language": "ES_MX",
- "languages": [
- "AR_SA",
- "EN_US",
- "ES_MX",
- "FR_CA",
- "DE_DE",
- "ES_ES",
- "EN_GB",
- "RU_RU",
- "TR_TR",
- "PL_PL",
- "FR_FR",
- "IT_IT",
- "SV_SE",
- "PT_PT",
- "NL_NL",
- "ZH_TW",
- "JA_JP",
- "KO_KR",
- "PT_BR",
- "CS_CZ",
- "DA_DK",
- "NO_NO"
- ]
- },
- "TTS": {
- "capabilities": [
- "TEXT"
- ],
- "language": "DE_DE",
- "languages": [
- "DA_DK",
- "CS_CZ",
- "KO_KR",
- "EN_US",
- "ES_MX",
- "FR_CA",
- "DE_DE",
- "ES_ES",
- "EN_GB",
- "RU_RU",
- "TR_TR",
- "PL_PL",
- "FR_FR",
- "IT_IT",
- "SV_SE",
- "PT_PT",
- "NL_NL",
- "ZH_TW",
- "JA_JP",
- "AR_SA",
- "PT_BR",
- "NO_NO"
- ]
- },
- "Buttons": {
- "capabilities": [
- {
- "name": "PRESET_0",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_1",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_2",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_3",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_4",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_5",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_6",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_7",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_8",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PRESET_9",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "OK",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "PLAY_PAUSE",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "SEEKLEFT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "SEEKRIGHT",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "TUNEUP",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- },
- {
- "name": "TUNEDOWN",
- "shortPressAvailable": true,
- "longPressAvailable": true,
- "upDownAvailable": true
- }
- ],
- "presetBankCapabilities": {
- "onScreenPresetsAvailable": true
- }
- },
- "VehicleInfo": {
- "make": "Ford",
- "model": "Fiesta",
- "modelYear": "2013",
- "trim": "SE"
- },
- "SyncMessageVersion": {
- "majorVersion": 3,
- "minorVersion": 0
- }
-}
diff --git a/src/components/application_manager/test/hmi_capabilities_sc2.json b/src/components/application_manager/test/hmi_capabilities_sc2.json
index a8578f04f5..318fcf7a3e 100644
--- a/src/components/application_manager/test/hmi_capabilities_sc2.json
+++ b/src/components/application_manager/test/hmi_capabilities_sc2.json
@@ -1,5 +1,11 @@
{
"UI": {
+ "language": "EN_US",
+ "languages": [
+ "EN_US",
+ "ES_MX",
+ "FR_CA"
+ ],
"systemCapabilities": {
"navigationCapability": {
"sendLocationEnabled": true,
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index 6234830f50..73e86fc7a7 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -33,7 +33,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/hmi_capabilities_impl.h"
+
+#include <algorithm>
+#include <memory>
#include <string>
+#include <vector>
#include "application_manager/hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
@@ -42,81 +47,57 @@
#include "smart_objects/enum_schema_item.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/hmi_capabilities_for_testing.h"
#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_rpc_service.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/state_controller.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
#include "resumption/last_state_impl.h"
#include "resumption/last_state_wrapper_impl.h"
#include "utils/file_system.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace test {
namespace components {
namespace application_manager_test {
+namespace {
+const std::string kAppInfoDataFile = "./app_info_data";
+const std::string kAppStorageFolder = "app_storage_folder";
+const std::string kAppInfoStorage = "app_info_storage";
+const std::string kHmiCapabilitiesDefaultFile = "hmi_capabilities.json";
+const std::string kHmiCapabilitiesCacheFile = "hmi_capabilities_cache.json";
+const uint32_t kEqualizerMaxChanelId = 10;
+} // namespace
+
using ::testing::_;
-using ::testing::AtLeast;
-using ::testing::InSequence;
using ::testing::Invoke;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
using namespace application_manager;
-class HMICapabilitiesTest : public ::testing::Test {
- protected:
- HMICapabilitiesTest()
- : last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
- std::make_shared<resumption::LastStateImpl>("app_storage_folder",
- "app_info_storage")))
- , file_name_("hmi_capabilities.json") {}
- virtual void SetUp() OVERRIDE {
- EXPECT_CALL(app_mngr_, event_dispatcher())
- .WillOnce(ReturnRef(mock_event_dispatcher));
- EXPECT_CALL(app_mngr_, get_settings())
- .WillRepeatedly(ReturnRef(mock_application_manager_settings_));
- EXPECT_CALL(mock_application_manager_settings_,
- hmi_capabilities_file_name())
- .WillOnce(ReturnRef(file_name_));
- EXPECT_CALL(mock_event_dispatcher, add_observer(_, _, _)).Times(1);
- EXPECT_CALL(mock_event_dispatcher, remove_observer(_)).Times(1);
- EXPECT_CALL(mock_application_manager_settings_, launch_hmi())
- .WillOnce(Return(false));
- hmi_capabilities_test =
- std::make_shared<HMICapabilitiesForTesting>(app_mngr_);
- hmi_capabilities_test->Init(last_state_wrapper_);
- }
+typedef std::map<std::string, hmi_apis::Common_Language::eType>
+ LanguageCStringToEnumMap;
- void TearDown() OVERRIDE {
- hmi_capabilities_test.reset();
- }
- static void TearDownTestCase() {
- if (file_system::FileExists("./app_info_data")) {
- EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
- }
- }
+typedef std::map<std::string, hmi_apis::Common_LightName::eType>
+ LightNameCStringToEnumMap;
- void SetCooperating();
- MockApplicationManager app_mngr_;
- event_engine_test::MockEventDispatcher mock_event_dispatcher;
- resumption::LastStateWrapperPtr last_state_wrapper_;
- MockApplicationManagerSettings mock_application_manager_settings_;
- std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities_test;
- const std::string file_name_;
- application_manager_test::MockRPCService mock_rpc_service_;
-};
+static LanguageCStringToEnumMap languages_map;
+static LightNameCStringToEnumMap light_names_map;
-const char* const cstring_values_[] = {
- "EN_US", "ES_MX", "FR_CA", "DE_DE", "ES_ES", "EN_GB", "RU_RU", "TR_TR",
- "PL_PL", "FR_FR", "IT_IT", "SV_SE", "PT_PT", "NL_NL", "EN_AU", "ZH_CN",
- "ZH_TW", "JA_JP", "AR_SA", "KO_KR", "PT_BR", "CS_CZ", "DA_DK", "NO_NO",
- "NL_BE", "EL_GR", "HU_HU", "FI_FI", "SK_SK", "EN_IN", "TH_TH", "EN_SA",
- "HE_IL", "RO_RO", "UK_UA", "ID_ID", "VI_VN", "MS_MY", "HI_IN"};
+const std::vector<std::string> language_string_values{
+ {"EN-US"}, {"ES-MX"}, {"FR-CA"}, {"DE-DE"}, {"ES-ES"}, {"EN-GB"}, {"RU-RU"},
+ {"TR-TR"}, {"PL-PL"}, {"FR-FR"}, {"IT-IT"}, {"SV-SE"}, {"PT-PT"}, {"NL-NL"},
+ {"EN-AU"}, {"ZH-CN"}, {"ZH-TW"}, {"JA-JP"}, {"AR-SA"}, {"KO-KR"}, {"PT-BR"},
+ {"CS-CZ"}, {"DA-DK"}, {"NO-NO"}, {"NL-BE"}, {"EL-GR"}, {"HU-HU"}, {"FI-FI"},
+ {"SK-SK"}, {"EN-IN"}, {"TH-TH"}, {"EN-SA"}, {"HE-IL"}, {"RO-RO"}, {"UK-UA"},
+ {"ID-ID"}, {"VI-VN"}, {"MS-MY"}, {"HI-IN"}};
-const hmi_apis::Common_Language::eType enum_values_[] = {
+const std::vector<hmi_apis::Common_Language::eType> language_enum_values{
hmi_apis::Common_Language::EN_US, hmi_apis::Common_Language::ES_MX,
hmi_apis::Common_Language::FR_CA, hmi_apis::Common_Language::DE_DE,
hmi_apis::Common_Language::ES_ES, hmi_apis::Common_Language::EN_GB,
@@ -138,142 +119,338 @@ const hmi_apis::Common_Language::eType enum_values_[] = {
hmi_apis::Common_Language::VI_VN, hmi_apis::Common_Language::MS_MY,
hmi_apis::Common_Language::HI_IN};
-struct CStringComparator {
- bool operator()(const char* a, const char* b) {
- return strcmp(a, b) < 0;
+const std::vector<hmi_apis::Common_LightName::eType> light_name_enum_values{
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_HIGH_BEAM,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_HIGH_BEAM,
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_LOW_BEAM,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_LOW_BEAM,
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_PARKING_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_PARKING_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_FOG_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_FOG_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_DAYTIME_RUNNING_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_DAYTIME_RUNNING_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_LEFT_TURN_LIGHT,
+ hmi_apis::Common_LightName::eType::FRONT_RIGHT_TURN_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_LEFT_FOG_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_RIGHT_FOG_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_LEFT_TAIL_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_RIGHT_TAIL_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_LEFT_BRAKE_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_RIGHT_BRAKE_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_LEFT_TURN_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_RIGHT_TURN_LIGHT,
+ hmi_apis::Common_LightName::eType::REAR_REGISTRATION_PLATE_LIGHT,
+ hmi_apis::Common_LightName::eType::HIGH_BEAMS,
+ hmi_apis::Common_LightName::eType::LOW_BEAMS,
+ hmi_apis::Common_LightName::eType::FOG_LIGHTS,
+ hmi_apis::Common_LightName::eType::RUNNING_LIGHTS,
+ hmi_apis::Common_LightName::eType::PARKING_LIGHTS,
+ hmi_apis::Common_LightName::eType::BRAKE_LIGHTS,
+ hmi_apis::Common_LightName::eType::REAR_REVERSING_LIGHTS,
+ hmi_apis::Common_LightName::eType::SIDE_MARKER_LIGHTS,
+ hmi_apis::Common_LightName::eType::LEFT_TURN_LIGHTS,
+ hmi_apis::Common_LightName::eType::RIGHT_TURN_LIGHTS,
+ hmi_apis::Common_LightName::eType::HAZARD_LIGHTS,
+ hmi_apis::Common_LightName::eType::REAR_CARGO_LIGHTS,
+ hmi_apis::Common_LightName::eType::REAR_TRUCK_BED_LIGHTS,
+ hmi_apis::Common_LightName::eType::REAR_TRAILER_LIGHTS,
+ hmi_apis::Common_LightName::eType::LEFT_SPOT_LIGHTS,
+ hmi_apis::Common_LightName::eType::RIGHT_SPOT_LIGHTS,
+ hmi_apis::Common_LightName::eType::LEFT_PUDDLE_LIGHTS,
+ hmi_apis::Common_LightName::eType::RIGHT_PUDDLE_LIGHTS,
+ hmi_apis::Common_LightName::eType::AMBIENT_LIGHTS,
+ hmi_apis::Common_LightName::eType::OVERHEAD_LIGHTS,
+ hmi_apis::Common_LightName::eType::READING_LIGHTS,
+ hmi_apis::Common_LightName::eType::TRUNK_LIGHTS,
+ hmi_apis::Common_LightName::eType::EXTERIOR_FRONT_LIGHTS,
+ hmi_apis::Common_LightName::eType::EXTERIOR_REAR_LIGHTS,
+ hmi_apis::Common_LightName::eType::EXTERIOR_LEFT_LIGHTS,
+ hmi_apis::Common_LightName::eType::EXTERIOR_RIGHT_LIGHTS,
+ hmi_apis::Common_LightName::eType::EXTERIOR_ALL_LIGHTS};
+
+const std::vector<std::string> light_name_string_values{
+ {"FRONT_LEFT_HIGH_BEAM"},
+ {"FRONT_RIGHT_HIGH_BEAM"},
+ {"FRONT_LEFT_LOW_BEAM"},
+ {"FRONT_RIGHT_LOW_BEAM"},
+ {"FRONT_LEFT_PARKING_LIGHT"},
+ {"FRONT_RIGHT_PARKING_LIGHT"},
+ {"FRONT_LEFT_FOG_LIGHT"},
+ {"FRONT_RIGHT_FOG_LIGHT"},
+ {"FRONT_LEFT_DAYTIME_RUNNING_LIGHT"},
+ {"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT"},
+ {"FRONT_LEFT_TURN_LIGHT"},
+ {"FRONT_RIGHT_TURN_LIGHT"},
+ {"REAR_LEFT_FOG_LIGHT"},
+ {"REAR_RIGHT_FOG_LIGHT"},
+ {"REAR_LEFT_TAIL_LIGHT"},
+ {"REAR_RIGHT_TAIL_LIGHT"},
+ {"REAR_LEFT_BRAKE_LIGHT"},
+ {"REAR_RIGHT_BRAKE_LIGHT"},
+ {"REAR_LEFT_TURN_LIGHT"},
+ {"REAR_RIGHT_TURN_LIGHT"},
+ {"REAR_REGISTRATION_PLATE_LIGHT"},
+ {"HIGH_BEAMS"},
+ {"LOW_BEAMS"},
+ {"FOG_LIGHTS"},
+ {"RUNNING_LIGHTS"},
+ {"PARKING_LIGHTS"},
+ {"BRAKE_LIGHTS"},
+ {"REAR_REVERSING_LIGHTS"},
+ {"SIDE_MARKER_LIGHTS"},
+ {"LEFT_TURN_LIGHTS"},
+ {"RIGHT_TURN_LIGHTS"},
+ {"HAZARD_LIGHTS"},
+ {"REAR_CARGO_LIGHTS"},
+ {"REAR_TRUCK_BED_LIGHTS"},
+ {"REAR_TRAILER_LIGHTS"},
+ {"LEFT_SPOT_LIGHTS"},
+ {"RIGHT_SPOT_LIGHTS"},
+ {"LEFT_PUDDLE_LIGHTS"},
+ {"RIGHT_PUDDLE_LIGHTS"},
+ {"AMBIENT_LIGHTS"},
+ {"OVERHEAD_LIGHTS"},
+ {"READING_LIGHTS"},
+ {"TRUNK_LIGHTS"},
+ {"EXTERIOR_FRONT_LIGHTS"},
+ {"EXTERIOR_REAR_LIGHTS"},
+ {"EXTERIOR_LEFT_LIGHTS"},
+ {"EXTERIOR_RIGHT_LIGHTS"},
+ {"EXTERIOR_ALL_LIGHTS"}};
+
+void InitLightNameStringToEnumMap(
+ LightNameCStringToEnumMap& out_light_names_map) {
+ for (size_t i = 0; i < light_name_string_values.size(); ++i) {
+ out_light_names_map[light_name_string_values[i]] =
+ light_name_enum_values[i];
}
-};
-
-typedef std::
- map<const char*, hmi_apis::Common_Language::eType, CStringComparator>
- CStringToEnumMap;
+}
-CStringToEnumMap InitCStringToEnumMap() {
- size_t value = sizeof(cstring_values_) / sizeof(cstring_values_[0]);
- CStringToEnumMap result;
- for (size_t i = 0; i < value; ++i) {
- result[cstring_values_[i]] = enum_values_[i];
+bool LightNameStringToEnum(const std::string& light_name_str,
+ hmi_apis::Common_LightName::eType& out_value) {
+ auto it = light_names_map.find(light_name_str);
+ if (it == light_names_map.end()) {
+ return false;
}
- return result;
+ out_value = it->second;
+ return true;
}
-bool StringToEnum(const char* str, hmi_apis::Common_Language::eType& value) {
- size_t count_value = sizeof(cstring_values_) / sizeof(cstring_values_[0]);
- CStringToEnumMap result;
- for (size_t i = 0; i < count_value; ++i) {
- result[cstring_values_[i]] = enum_values_[i];
+void InitLanguageStringToEnumMap(LanguageCStringToEnumMap& out_languages_map) {
+ for (size_t i = 0; i < language_string_values.size(); ++i) {
+ out_languages_map[language_string_values[i]] = language_enum_values[i];
}
+}
- CStringToEnumMap::const_iterator it = result.find(str);
- if (it == result.end()) {
+bool LanguageStringToEnum(const std::string& language_str,
+ hmi_apis::Common_Language::eType& out_value) {
+ LanguageCStringToEnumMap::const_iterator it =
+ languages_map.find(language_str);
+ if (it == languages_map.end()) {
return false;
}
- value = it->second;
+ out_value = it->second;
return true;
}
hmi_apis::Common_Language::eType TestCommonLanguageFromString(
const std::string& language) {
hmi_apis::Common_Language::eType value;
- if (StringToEnum(language.c_str(), value)) {
+ if (LanguageStringToEnum(language, value)) {
return value;
}
return hmi_apis::Common_Language::INVALID_ENUM;
}
-TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
- const std::string hmi_capabilities_file = "hmi_capabilities.json";
- EXPECT_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
- .WillOnce(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
- CommonLanguageFromString(_))
- .WillRepeatedly(Invoke(TestCommonLanguageFromString));
+hmi_apis::Common_LightName::eType TestCommonLightNameFromString(
+ const std::string& light_name_str) {
+ hmi_apis::Common_LightName::eType value;
+ if (LightNameStringToEnum(light_name_str, value)) {
+ return value;
+ }
+ return hmi_apis::Common_LightName::INVALID_ENUM;
+}
+
+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);
+ return !(it == light_name_enum_values.end());
+}
+
+class HMICapabilitiesTest : public ::testing::Test {
+ protected:
+ HMICapabilitiesTest()
+ : last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage))) {
+ if (languages_map.empty()) {
+ InitLanguageStringToEnumMap(languages_map);
+ }
+ if (light_names_map.empty()) {
+ InitLightNameStringToEnumMap(light_names_map);
+ }
+ }
+
+ void SetUp() OVERRIDE {
+ ON_CALL(mock_app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(mock_event_dispatcher_));
+ ON_CALL(mock_app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(mock_application_manager_settings_));
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(kHmiCapabilitiesDefaultFile));
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(kHmiCapabilitiesCacheFile));
+
+ hmi_capabilities_ = std::make_shared<HMICapabilitiesImpl>(mock_app_mngr_);
+ }
- if (file_system::FileExists("./app_info_data")) {
- EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ void TearDown() OVERRIDE {
+ DeleteFileIfExists(kHmiCapabilitiesCacheFile);
+ DeleteFileIfExists(kAppInfoDataFile);
+ hmi_capabilities_.reset();
+ }
+
+ void CreateFile(const std::string& file_name) {
+ file_system::CreateFile(file_name);
+ ASSERT_TRUE(file_system::FileExists(file_name));
+ }
+
+ void DeleteFileIfExists(const std::string& file_path) {
+ if (file_system::FileExists(file_path)) {
+ EXPECT_TRUE(::file_system::DeleteFile(file_path));
+ }
}
- EXPECT_CALL(app_mngr_, IsSOStructValid(_, _)).WillOnce(Return(true));
- EXPECT_TRUE(hmi_capabilities_test->LoadCapabilitiesFromFile());
+ void SetUpLanguageAndLightCapabilitiesExpectation() {
+ ON_CALL(mock_app_mngr_, IsSOStructValid(_, _)).WillByDefault(Return(true));
+
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(_))
+ .WillRepeatedly(Invoke(TestCommonLanguageFromString));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLightNameFromString(_))
+ .WillRepeatedly(Invoke(TestCommonLightNameFromString));
+ }
+
+ std::shared_ptr<HMICapabilitiesImpl> hmi_capabilities_;
+ NiceMock<MockApplicationManager> mock_app_mngr_;
+ NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
+ NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ smart_objects::CSmartSchema schema_;
+};
+
+TEST_F(HMICapabilitiesTest,
+ Init_CheckActiveLanguages_SuccesSetupDefaultLanguages) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
- // Check active languages
EXPECT_EQ(hmi_apis::Common_Language::EN_US,
- hmi_capabilities_test->active_ui_language());
- EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
- hmi_capabilities_test->active_vr_language());
- EXPECT_EQ(hmi_apis::Common_Language::DE_DE,
- hmi_capabilities_test->active_tts_language());
+ hmi_capabilities_->active_ui_language());
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ hmi_capabilities_->active_vr_language());
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
+ hmi_capabilities_->active_tts_language());
+}
- // Check UI languages
- const smart_objects::SmartObject ui_supported_languages =
- *(hmi_capabilities_test->ui_supported_languages());
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckUILanguages_SuccessLoadAndConvert) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto ui_supported_languages_so =
+ *(hmi_capabilities_->ui_supported_languages());
EXPECT_EQ(hmi_apis::Common_Language::EN_US,
static_cast<hmi_apis::Common_Language::eType>(
- ui_supported_languages[0].asInt()));
+ ui_supported_languages_so[0].asInt()));
EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
static_cast<hmi_apis::Common_Language::eType>(
- ui_supported_languages[1].asInt()));
+ ui_supported_languages_so[1].asInt()));
EXPECT_EQ(hmi_apis::Common_Language::FR_CA,
static_cast<hmi_apis::Common_Language::eType>(
- ui_supported_languages[2].asInt()));
+ ui_supported_languages_so[2].asInt()));
+}
- // Check VR languages
- const smart_objects::SmartObject vr_supported_languages =
- *(hmi_capabilities_test->vr_supported_languages());
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckVRLanguages_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto vr_supported_languages_so =
+ *(hmi_capabilities_->vr_supported_languages());
- EXPECT_EQ(hmi_apis::Common_Language::AR_SA,
- static_cast<hmi_apis::Common_Language::eType>(
- vr_supported_languages[0].asInt()));
EXPECT_EQ(hmi_apis::Common_Language::EN_US,
static_cast<hmi_apis::Common_Language::eType>(
- vr_supported_languages[1].asInt()));
+ vr_supported_languages_so[0].asInt()));
EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
static_cast<hmi_apis::Common_Language::eType>(
- vr_supported_languages[2].asInt()));
+ vr_supported_languages_so[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::FR_CA,
+ static_cast<hmi_apis::Common_Language::eType>(
+ vr_supported_languages_so[2].asInt()));
+}
- // Check TTS languages
- const smart_objects::SmartObject tts_supported_languages =
- *(hmi_capabilities_test->tts_supported_languages());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckTTSSupportedLanguages_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto tts_supported_languages_so =
+ *(hmi_capabilities_->tts_supported_languages());
- EXPECT_EQ(hmi_apis::Common_Language::DA_DK,
+ EXPECT_EQ(hmi_apis::Common_Language::EN_US,
static_cast<hmi_apis::Common_Language::eType>(
- tts_supported_languages[0].asInt()));
- EXPECT_EQ(hmi_apis::Common_Language::CS_CZ,
+ tts_supported_languages_so[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::ES_MX,
static_cast<hmi_apis::Common_Language::eType>(
- tts_supported_languages[1].asInt()));
- EXPECT_EQ(hmi_apis::Common_Language::KO_KR,
+ tts_supported_languages_so[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_Language::FR_CA,
static_cast<hmi_apis::Common_Language::eType>(
- tts_supported_languages[2].asInt()));
+ tts_supported_languages_so[2].asInt()));
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckSpeechCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto tts_capabilities_so = *(hmi_capabilities_->speech_capabilities());
- // Check TTS capabilities
- const smart_objects::SmartObject tts_capabilities =
- *(hmi_capabilities_test->speech_capabilities());
EXPECT_EQ(hmi_apis::Common_SpeechCapabilities::SC_TEXT,
static_cast<hmi_apis::Common_SpeechCapabilities::eType>(
- tts_capabilities[0].asInt()));
+ tts_capabilities_so[0].asInt()));
+}
- // Check button capabilities
- const smart_objects::SmartObject buttons_capabilities_so =
- *(hmi_capabilities_test->button_capabilities());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckUIButtonCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto buttons_capabilities_so =
+ *(hmi_capabilities_->button_capabilities());
// Count of buttons in json file
- const uint32_t btn_length = buttons_capabilities_so.length();
- EXPECT_EQ(16u, btn_length);
- for (uint32_t i = 0; i < btn_length; ++i) {
- EXPECT_TRUE((buttons_capabilities_so[i]).keyExists(strings::name));
- EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("shortPressAvailable"));
- EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("longPressAvailable"));
- EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("upDownAvailable"));
- EXPECT_TRUE(buttons_capabilities_so[i]["shortPressAvailable"].asBool());
- EXPECT_TRUE(buttons_capabilities_so[i]["longPressAvailable"].asBool());
- EXPECT_TRUE(buttons_capabilities_so[i]["upDownAvailable"].asBool());
+ 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]
+ .asBool());
+ EXPECT_TRUE(
+ buttons_capabilities_so[index]
+ [rc_rpc_plugin::enums_value::kLongPressAvailable]
+ .asBool());
+ EXPECT_TRUE(
+ buttons_capabilities_so[index]
+ [rc_rpc_plugin::enums_value::kUpDownAvailable]
+ .asBool());
}
- const smart_objects::SmartObject display_capabilities_so =
- *(hmi_capabilities_test->display_capabilities());
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckDisplayType_SuccessLoadAndConvert) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto display_capabilities_so =
+ *(hmi_capabilities_->display_capabilities());
- // Check display type
- EXPECT_EQ(hmi_apis::Common_DisplayType::GEN2_8_DMA,
+ EXPECT_EQ(hmi_apis::Common_DisplayType::SDL_GENERIC,
static_cast<hmi_apis::Common_DisplayType::eType>(
display_capabilities_so[hmi_response::display_type].asInt()));
@@ -281,51 +458,79 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
display_capabilities_so[hmi_response::display_name].asString());
EXPECT_TRUE(display_capabilities_so["graphicSupported"].asBool());
+}
- // Check text fields
- const uint32_t text_len =
- display_capabilities_so[hmi_response::text_fields].length();
- EXPECT_NE(0u, text_len);
- for (uint32_t i = 0; i < text_len; ++i) {
- EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][i])
- .keyExists(strings::name));
- EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][i])
- .keyExists(strings::character_set));
- }
-
- // Check image fields
- EXPECT_TRUE((display_capabilities_so).keyExists(hmi_response::image_fields));
- const uint32_t img_len =
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckImageFields_SuccessLoadAndConvert) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto display_capabilities_so =
+ *(hmi_capabilities_->display_capabilities());
+
+ ASSERT_TRUE((display_capabilities_so).keyExists(hmi_response::image_fields));
+ const size_t img_len =
display_capabilities_so[hmi_response::image_fields].length();
- EXPECT_NE(0u, img_len);
- for (uint32_t i = 0; i < img_len; ++i) {
- EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][i])
+ EXPECT_NE(0ull, img_len);
+ for (size_t index = 0; index < img_len; ++index) {
+ EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][index])
.keyExists(strings::name));
- EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][i])
- .keyExists(strings::image_type_supported));
- if (display_capabilities_so[hmi_response::image_fields][i][strings::name] ==
- hmi_apis::Common_ImageFieldName::locationImage) {
+
+ const hmi_apis::Common_ImageFieldName::eType field_name =
+ static_cast<hmi_apis::Common_ImageFieldName::eType>(
+ display_capabilities_so[hmi_response::image_fields][index]
+ [strings::name]
+ .asInt());
+
+ if ((field_name == hmi_apis::Common_ImageFieldName::locationImage) ||
+ (field_name == hmi_apis::Common_ImageFieldName::alertIcon)) {
+ EXPECT_TRUE((display_capabilities_so[hmi_response::image_fields][index])
+ .keyExists(strings::image_type_supported));
EXPECT_EQ(hmi_apis::Common_FileType::GRAPHIC_PNG,
static_cast<hmi_apis::Common_FileType::eType>(
- display_capabilities_so[hmi_response::image_fields][i]
+ display_capabilities_so[hmi_response::image_fields][index]
[strings::image_type_supported][0]
.asInt()));
}
}
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckTextFields_SuccessLoadAndConvert) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto display_capabilities_so =
+ *(hmi_capabilities_->display_capabilities());
+
+ const size_t text_len =
+ display_capabilities_so[hmi_response::text_fields].length();
+ EXPECT_NE(0ull, text_len);
+ for (size_t index = 0; index < text_len; ++index) {
+ EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][index])
+ .keyExists(strings::name));
+ EXPECT_TRUE((display_capabilities_so[hmi_response::text_fields][index])
+ .keyExists(strings::character_set));
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckMediaClockFormats_SuccessLoadAndConvert) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto display_capabilities_so =
+ *(hmi_capabilities_->display_capabilities());
- // Check media clock formats
EXPECT_TRUE(
(display_capabilities_so).keyExists(hmi_response::media_clock_formats));
- const uint32_t media_length =
+ const size_t media_length =
display_capabilities_so[hmi_response::media_clock_formats].length();
- EXPECT_NE(0u, media_length);
- for (uint32_t i = 0; i < media_length; ++i) {
+ EXPECT_NE(0ull, media_length);
+ for (size_t i = 0; i < media_length; ++i) {
EXPECT_EQ(
i,
display_capabilities_so[hmi_response::media_clock_formats][i].asUInt());
}
- EXPECT_TRUE(
+ ASSERT_TRUE(
(display_capabilities_so).keyExists(hmi_response::image_capabilities));
EXPECT_EQ(hmi_apis::Common_ImageType::DYNAMIC,
static_cast<hmi_apis::Common_ImageType::eType>(
@@ -336,9 +541,17 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
display_capabilities_so[hmi_response::image_capabilities][1]
.asInt()));
- // Check audio pass thru
- const smart_objects::SmartObject audio_pass_thru_capabilities_so =
- *(hmi_capabilities_test->audio_pass_thru_capabilities());
+ // TemplatesAvailable parameter could be as empty array
+ ASSERT_TRUE(
+ display_capabilities_so.keyExists(hmi_response::templates_available));
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckAudioPassThru_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto audio_pass_thru_capabilities_so =
+ *(hmi_capabilities_->audio_pass_thru_capabilities());
+
EXPECT_EQ(smart_objects::SmartType_Array,
audio_pass_thru_capabilities_so.getType());
EXPECT_EQ(1u, audio_pass_thru_capabilities_so.length());
@@ -351,57 +564,118 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
static_cast<hmi_apis::Common_AudioType::eType>(
audio_pass_thru_capabilities_so[0]["audioType"].asInt()));
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckHmiZoneCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto hmi_zone_capabilities_so =
+ *(hmi_capabilities_->hmi_zone_capabilities());
- // Check hmi zone capabilities
- const smart_objects::SmartObject hmi_zone_capabilities_so =
- *(hmi_capabilities_test->hmi_zone_capabilities());
EXPECT_EQ(hmi_apis::Common_HmiZoneCapabilities::FRONT,
static_cast<hmi_apis::Common_HmiZoneCapabilities::eType>(
hmi_zone_capabilities_so.asInt()));
+}
- const smart_objects::SmartObject soft_button_capabilities_so =
- *(hmi_capabilities_test->soft_button_capabilities());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckSoftButtonCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto& soft_button_capabilities_so =
+ *(hmi_capabilities_->soft_button_capabilities());
+
+ const size_t soft_butons_length = soft_button_capabilities_so.length();
+
+ ASSERT_TRUE(soft_butons_length > 0);
+
+ for (size_t index = 0; index < soft_butons_length; ++index) {
+ EXPECT_TRUE(soft_button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kShortPressAvailable));
+ EXPECT_EQ(smart_objects::SmartType::SmartType_Boolean,
+ soft_button_capabilities_so
+ [index][rc_rpc_plugin::enums_value::kShortPressAvailable]
+ .getType());
+
+ EXPECT_TRUE(soft_button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kLongPressAvailable));
+ EXPECT_EQ(smart_objects::SmartType::SmartType_Boolean,
+ soft_button_capabilities_so
+ [index][rc_rpc_plugin::enums_value::kLongPressAvailable]
+ .getType());
+
+ EXPECT_TRUE(soft_button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kUpDownAvailable));
+ EXPECT_EQ(smart_objects::SmartType::SmartType_Boolean,
+ soft_button_capabilities_so
+ [index][rc_rpc_plugin::enums_value::kUpDownAvailable]
+ .getType());
+
+ EXPECT_TRUE(soft_button_capabilities_so[index].keyExists(
+ hmi_response::image_supported));
+ EXPECT_EQ(smart_objects::SmartType::SmartType_Boolean,
+ soft_button_capabilities_so[index][hmi_response::image_supported]
+ .getType());
+ }
+}
- EXPECT_TRUE(soft_button_capabilities_so[0]["shortPressAvailable"].asBool());
- EXPECT_TRUE(soft_button_capabilities_so[0]["longPressAvailable"].asBool());
- EXPECT_TRUE(soft_button_capabilities_so[0]["upDownAvailable"].asBool());
- EXPECT_TRUE(soft_button_capabilities_so[0]["imageSupported"].asBool());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckPresetBankCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto preset_bank_so = *(hmi_capabilities_->preset_bank_capabilities());
- const smart_objects::SmartObject preset_bank_so =
- *(hmi_capabilities_test->preset_bank_capabilities());
- EXPECT_TRUE(preset_bank_so["onScreenPresetsAvailable"].asBool());
+ EXPECT_TRUE(
+ preset_bank_so.keyExists(hmi_response::on_screen_presets_available));
+ EXPECT_EQ(
+ smart_objects::SmartType::SmartType_Boolean,
+ preset_bank_so[hmi_response::on_screen_presets_available].getType());
+}
- // Check vehicle type
- const smart_objects::SmartObject vehicle_type_so =
- *(hmi_capabilities_test->vehicle_type());
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckVehicleType_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto vehicle_type_so = *(hmi_capabilities_->vehicle_type());
- EXPECT_EQ("Ford", vehicle_type_so["make"].asString());
- EXPECT_EQ("Fiesta", vehicle_type_so["model"].asString());
- EXPECT_EQ("2013", vehicle_type_so["modelYear"].asString());
+ EXPECT_EQ("SDL", vehicle_type_so["make"].asString());
+ EXPECT_EQ("Generic", vehicle_type_so["model"].asString());
+ EXPECT_EQ("2019", vehicle_type_so["modelYear"].asString());
EXPECT_EQ("SE", vehicle_type_so["trim"].asString());
+}
- // Check system capabilities
- smart_objects::SmartObject navigation_capability_so =
- *(hmi_capabilities_test->navigation_capability());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckNavigationCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto navigation_capability_so =
+ *(hmi_capabilities_->navigation_capability());
EXPECT_TRUE(navigation_capability_so.keyExists("sendLocationEnabled"));
EXPECT_TRUE(navigation_capability_so.keyExists("getWayPointsEnabled"));
EXPECT_TRUE(navigation_capability_so["sendLocationEnabled"].asBool());
EXPECT_TRUE(navigation_capability_so["getWayPointsEnabled"].asBool());
- // since we have navigation capabilities, the feature should be supported
- EXPECT_TRUE(hmi_capabilities_test->navigation_supported());
+ // Since we have navigation capabilities, the feature should be supported
+ EXPECT_TRUE(hmi_capabilities_->navigation_supported());
+}
- const smart_objects::SmartObject phone_capability_so =
- *(hmi_capabilities_test->phone_capability());
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckPhoneCapability_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto phone_capability_so = *(hmi_capabilities_->phone_capability());
EXPECT_TRUE(phone_capability_so.keyExists("dialNumberEnabled"));
EXPECT_TRUE(phone_capability_so["dialNumberEnabled"].asBool());
- EXPECT_TRUE(hmi_capabilities_test->phone_call_supported());
+ EXPECT_TRUE(hmi_capabilities_->phone_call_supported());
+}
- const smart_objects::SmartObject vs_capability_so =
- *(hmi_capabilities_test->video_streaming_capability());
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckVideoStreamingCapability_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto vs_capability_so =
+ *(hmi_capabilities_->video_streaming_capability());
EXPECT_TRUE(vs_capability_so.keyExists(strings::preferred_resolution));
EXPECT_TRUE(vs_capability_so[strings::preferred_resolution].keyExists(
@@ -419,156 +693,312 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
EXPECT_TRUE(vs_capability_so.keyExists(strings::max_bitrate));
EXPECT_EQ(10000, vs_capability_so[strings::max_bitrate].asInt());
EXPECT_TRUE(vs_capability_so.keyExists(strings::supported_formats));
- const uint32_t supported_formats_len =
+ const size_t supported_formats_len =
vs_capability_so[strings::supported_formats].length();
- EXPECT_EQ(2u, supported_formats_len);
+ EXPECT_EQ(1ull, supported_formats_len);
+
EXPECT_TRUE(vs_capability_so[strings::supported_formats][0].keyExists(
strings::protocol));
EXPECT_TRUE(vs_capability_so[strings::supported_formats][0].keyExists(
strings::codec));
- EXPECT_EQ(0,
+ EXPECT_EQ(hmi_apis::Common_VideoStreamingProtocol::RAW,
vs_capability_so[strings::supported_formats][0][strings::protocol]
.asInt());
EXPECT_EQ(
- 0,
+ hmi_apis::Common_VideoStreamingCodec::H264,
vs_capability_so[strings::supported_formats][0][strings::codec].asInt());
- EXPECT_TRUE(vs_capability_so[strings::supported_formats][1].keyExists(
- strings::protocol));
- EXPECT_TRUE(vs_capability_so[strings::supported_formats][1].keyExists(
- strings::codec));
- EXPECT_EQ(1,
- vs_capability_so[strings::supported_formats][1][strings::protocol]
- .asInt());
- EXPECT_EQ(
- 2,
- vs_capability_so[strings::supported_formats][1][strings::codec].asInt());
EXPECT_TRUE(
vs_capability_so.keyExists(strings::haptic_spatial_data_supported));
- EXPECT_TRUE(
+ EXPECT_FALSE(
vs_capability_so[strings::haptic_spatial_data_supported].asBool());
- EXPECT_TRUE(hmi_capabilities_test->video_streaming_supported());
-
- // Check remote control capabilites
- const smart_objects::SmartObject rc_capability_so =
- *(hmi_capabilities_test->rc_capability());
+ EXPECT_TRUE(hmi_capabilities_->video_streaming_supported());
+}
- EXPECT_TRUE(rc_capability_so.keyExists("climateControlCapabilities"));
- EXPECT_TRUE(rc_capability_so.keyExists("radioControlCapabilities"));
- EXPECT_TRUE(rc_capability_so.keyExists("buttonCapabilities"));
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckRemoteControlCapabilites_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ ASSERT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::kclimateControlCapabilities));
+ const auto& climate_control_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::kclimateControlCapabilities][0];
+
+ EXPECT_TRUE(climate_control_capabilities_so
+ [rc_rpc_plugin::strings::kFanSpeedAvailable]
+ .asBool());
+ EXPECT_TRUE(climate_control_capabilities_so
+ [rc_rpc_plugin::strings::kDesiredTemperatureAvailable]
+ .asBool());
+ EXPECT_TRUE(climate_control_capabilities_so
+ [rc_rpc_plugin::strings::kAcEnableAvailable]
+ .asBool());
+ EXPECT_TRUE(climate_control_capabilities_so
+ [rc_rpc_plugin::strings::kAcMaxEnableAvailable]
+ .asBool());
+}
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckRadioControlCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ ASSERT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::kradioControlCapabilities));
+ const auto& radio_control_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::kradioControlCapabilities][0];
+
+ EXPECT_EQ("radio", radio_control_capabilities_so["moduleName"].asString());
+
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::message_params::kAvailableHdChannelsAvailable]
+ .asBool());
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::strings::kSignalChangeThresholdAvailable]
+ .asBool());
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::strings::kSignalStrengthAvailable]
+ .asBool());
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::strings::kHdRadioEnableAvailable]
+ .asBool());
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::strings::kSiriusxmRadioAvailable]
+ .asBool());
EXPECT_TRUE(
- rc_capability_so["climateControlCapabilities"][0]["fanSpeedAvailable"]
+ radio_control_capabilities_so[rc_rpc_plugin::strings::kSisDataAvailable]
.asBool());
- EXPECT_TRUE(rc_capability_so["climateControlCapabilities"][0]
- ["desiredTemperatureAvailable"]
- .asBool());
EXPECT_TRUE(
- rc_capability_so["climateControlCapabilities"][0]["acEnableAvailable"]
+ radio_control_capabilities_so[rc_rpc_plugin::strings::kStateAvailable]
.asBool());
EXPECT_TRUE(
- rc_capability_so["climateControlCapabilities"][0]["acMaxEnableAvailable"]
+ radio_control_capabilities_so[rc_rpc_plugin::strings::kRadioBandAvailable]
.asBool());
-
+ EXPECT_TRUE(radio_control_capabilities_so
+ [rc_rpc_plugin::strings::kRadioFrequencyAvailable]
+ .asBool());
EXPECT_TRUE(
- rc_capability_so["radioControlCapabilities"][0]["radioBandAvailable"]
+ radio_control_capabilities_so[rc_rpc_plugin::strings::kHdChannelAvailable]
.asBool());
EXPECT_TRUE(
- rc_capability_so["radioControlCapabilities"][0]["radioFrequencyAvailable"]
+ radio_control_capabilities_so[rc_rpc_plugin::strings::kRdsDataAvailable]
.asBool());
+
+ ASSERT_TRUE(radio_control_capabilities_so.keyExists(
+ rc_rpc_plugin::message_params::kModuleInfo));
+ ASSERT_TRUE(
+ radio_control_capabilities_so[rc_rpc_plugin::message_params::kModuleInfo]
+ .keyExists(rc_rpc_plugin::message_params::kModuleId));
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckRCButtonCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ ASSERT_TRUE(
+ rc_capability_so.keyExists(rc_rpc_plugin::strings::kbuttonCapabilities));
+ const auto& button_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::kbuttonCapabilities];
+
+ const size_t button_capabilities_length = button_capabilities_so.length();
+
+ for (size_t index = 0; index < button_capabilities_length; ++index) {
+ ASSERT_TRUE(button_capabilities_so[index].keyExists("name"));
+
+ ASSERT_TRUE(button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kLongPressAvailable));
+ EXPECT_EQ(
+ smart_objects::SmartType::SmartType_Boolean,
+ button_capabilities_so[index]
+ [rc_rpc_plugin::enums_value::kLongPressAvailable]
+ .getType());
+ ASSERT_TRUE(button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kShortPressAvailable));
+ EXPECT_EQ(
+ smart_objects::SmartType::SmartType_Boolean,
+ button_capabilities_so[index]
+ [rc_rpc_plugin::enums_value::kShortPressAvailable]
+ .getType());
+
+ ASSERT_TRUE(button_capabilities_so[index].keyExists(
+ rc_rpc_plugin::enums_value::kUpDownAvailable));
+ EXPECT_EQ(
+ smart_objects::SmartType::SmartType_Boolean,
+ button_capabilities_so[index]
+ [rc_rpc_plugin::enums_value::kUpDownAvailable]
+ .getType());
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckAudioCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ EXPECT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::kaudioControlCapabilities));
+
+ const auto& audio_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::kaudioControlCapabilities][0];
+
+ EXPECT_TRUE(audio_capabilities_so.keyExists(
+ rc_rpc_plugin::message_params::kModuleInfo));
+
+ const auto& audio_cap_module_info =
+ audio_capabilities_so[rc_rpc_plugin::message_params::kModuleInfo];
+ EXPECT_TRUE(audio_cap_module_info.keyExists(
+ rc_rpc_plugin::message_params::kModuleId));
+ EXPECT_TRUE(audio_cap_module_info.keyExists(
+ rc_rpc_plugin::strings::kAllowMultipleAccess));
EXPECT_TRUE(
- rc_capability_so["radioControlCapabilities"][0]["hdChannelAvailable"]
+ audio_cap_module_info[rc_rpc_plugin::strings::kAllowMultipleAccess]
.asBool());
+
+ EXPECT_TRUE(
+ audio_capabilities_so[rc_rpc_plugin::strings::kSourceAvailable].asBool());
+ EXPECT_TRUE(
+ audio_capabilities_so[rc_rpc_plugin::strings::kVolumeAvailable].asBool());
+ EXPECT_TRUE(audio_capabilities_so[rc_rpc_plugin::strings::kEqualizerAvailable]
+ .asBool());
EXPECT_TRUE(
- rc_capability_so["radioControlCapabilities"][0]["rdsDataAvailable"]
+ audio_capabilities_so[rc_rpc_plugin::strings::kKeepContextAvailable]
.asBool());
+ EXPECT_EQ(
+ kEqualizerMaxChanelId,
+ audio_capabilities_so[rc_rpc_plugin::strings::kEqualizerMaxChannelId]
+ .asInt());
+}
- EXPECT_TRUE(rc_capability_so["buttonCapabilities"][0]["shortPressAvailable"]
- .asBool());
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFile_CheckSeatCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ EXPECT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::kseatControlCapabilities));
+ const auto& seat_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::kseatControlCapabilities][0];
+
+ EXPECT_TRUE(seat_capabilities_so.keyExists(
+ rc_rpc_plugin::message_params::kModuleInfo));
+ const auto& seat_cap_module_info =
+ seat_capabilities_so[rc_rpc_plugin::message_params::kModuleInfo];
EXPECT_TRUE(
- rc_capability_so["buttonCapabilities"][0]["longPressAvailable"].asBool());
+ seat_cap_module_info.keyExists(rc_rpc_plugin::message_params::kModuleId));
+ EXPECT_TRUE(seat_cap_module_info.keyExists(
+ rc_rpc_plugin::strings::kAllowMultipleAccess));
EXPECT_FALSE(
- rc_capability_so["buttonCapabilities"][0]["upDownAvailable"].asBool());
+ seat_cap_module_info[rc_rpc_plugin::strings::kAllowMultipleAccess]
+ .asBool());
}
TEST_F(HMICapabilitiesTest,
- LoadCapabilitiesFromFileAndVerifyUnsupportedSystemCapabilities) {
- MockApplicationManager mock_app_mngr;
- event_engine_test::MockEventDispatcher mock_dispatcher;
- MockApplicationManagerSettings mock_application_manager_settings;
+ LoadCapabilitiesFromFile_CheckLightCapabilities_SuccessLoadAndConvert) {
+ hmi_capabilities_->Init(last_state_wrapper_);
+ const auto rc_capability_so = *(hmi_capabilities_->rc_capability());
+
+ EXPECT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::klightControlCapabilities));
+ const auto& light_capabilities_so =
+ rc_capability_so[rc_rpc_plugin::strings::klightControlCapabilities];
+
+ EXPECT_TRUE(light_capabilities_so.keyExists(
+ rc_rpc_plugin::message_params::kModuleInfo));
+ const auto& light_cap_module_info =
+ light_capabilities_so[rc_rpc_plugin::message_params::kModuleInfo];
+ EXPECT_TRUE(light_cap_module_info.keyExists(
+ rc_rpc_plugin::message_params::kModuleId));
+ EXPECT_FALSE(
+ light_cap_module_info[rc_rpc_plugin::strings::kAllowMultipleAccess]
+ .asBool());
- const std::string hmi_capabilities_file = "hmi_capabilities_sc1.json";
+ EXPECT_TRUE(light_capabilities_so.keyExists(
+ rc_rpc_plugin::strings::kSupportedLights));
+
+ const auto& supported_lights =
+ light_capabilities_so[rc_rpc_plugin::strings::kSupportedLights];
+
+ const size_t supported_lights_length = supported_lights.length();
+ for (size_t index = 0; index < supported_lights_length; ++index) {
+ EXPECT_TRUE(
+ IsLightNameExists(static_cast<hmi_apis::Common_LightName::eType>(
+ supported_lights[index]["name"].asInt())));
+ EXPECT_TRUE(supported_lights[index].keyExists(
+ rc_rpc_plugin::strings::kStatusAvailable));
+ EXPECT_TRUE(supported_lights[index].keyExists(
+ rc_rpc_plugin::strings::kDensityAvailable));
+ EXPECT_TRUE(supported_lights[index].keyExists(
+ rc_rpc_plugin::strings::kRGBColorSpaceAvailable));
+ }
+
+ EXPECT_TRUE(rc_capability_so.keyExists(
+ rc_rpc_plugin::strings::klightControlCapabilities));
+ const auto& light_ctrl_cap_so =
+ rc_capability_so[rc_rpc_plugin::strings::klightControlCapabilities];
+
+ EXPECT_TRUE(light_ctrl_cap_so.keyExists("moduleName"));
+ EXPECT_TRUE(
+ light_ctrl_cap_so.keyExists(rc_rpc_plugin::strings::kSupportedLights));
+ EXPECT_EQ(
+ smart_objects::SmartType::SmartType_Array,
+ light_ctrl_cap_so[rc_rpc_plugin::strings::kSupportedLights].getType());
+
+ const auto& supported_light_so =
+ light_ctrl_cap_so[rc_rpc_plugin::strings::kSupportedLights];
- EXPECT_CALL(mock_app_mngr, event_dispatcher())
- .WillOnce(ReturnRef(mock_dispatcher));
- EXPECT_CALL(mock_app_mngr, get_settings())
- .WillRepeatedly(ReturnRef(mock_application_manager_settings));
- EXPECT_CALL(mock_application_manager_settings, hmi_capabilities_file_name())
- .WillOnce(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(mock_dispatcher, add_observer(_, _, _)).Times(1);
- EXPECT_CALL(mock_dispatcher, remove_observer(_)).Times(1);
- EXPECT_CALL(mock_application_manager_settings, launch_hmi())
- .WillOnce(Return(false));
-
- if (file_system::FileExists("./app_info_data")) {
- EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ const size_t sup_lights_length = supported_light_so.length();
+
+ for (size_t index = 0; index < sup_lights_length; ++index) {
+ EXPECT_TRUE(
+ supported_light_so[index].keyExists(rc_rpc_plugin::strings::kName));
}
+}
+
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFileAndVerifyUnsupportedSystemCapabilities) {
+ const std::string hmi_capabilities_file = "hmi_capabilities_sc1.json";
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_file));
- std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
- std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
- hmi_capabilities->Init(last_state_wrapper_);
+ hmi_capabilities_->Init(last_state_wrapper_);
// Check system capabilities; only phone capability is available
- EXPECT_FALSE(hmi_capabilities->navigation_supported());
- EXPECT_TRUE(hmi_capabilities->phone_call_supported());
- EXPECT_FALSE(hmi_capabilities->video_streaming_supported());
- EXPECT_FALSE(hmi_capabilities->rc_supported());
+ EXPECT_FALSE(hmi_capabilities_->navigation_supported());
+ EXPECT_TRUE(hmi_capabilities_->phone_call_supported());
+ EXPECT_FALSE(hmi_capabilities_->video_streaming_supported());
+ EXPECT_FALSE(hmi_capabilities_->rc_supported());
// verify phone capability
const smart_objects::SmartObject phone_capability_so =
- *(hmi_capabilities->phone_capability());
+ *(hmi_capabilities_->phone_capability());
EXPECT_TRUE(phone_capability_so.keyExists("dialNumberEnabled"));
EXPECT_TRUE(phone_capability_so["dialNumberEnabled"].asBool());
}
TEST_F(HMICapabilitiesTest,
LoadCapabilitiesFromFileAndVerifyEmptySystemCapabilities) {
- MockApplicationManager mock_app_mngr;
- event_engine_test::MockEventDispatcher mock_dispatcher;
- MockApplicationManagerSettings mock_application_manager_settings;
-
const std::string hmi_capabilities_file = "hmi_capabilities_sc2.json";
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(mock_app_mngr, event_dispatcher())
- .WillOnce(ReturnRef(mock_dispatcher));
- EXPECT_CALL(mock_app_mngr, get_settings())
- .WillRepeatedly(ReturnRef(mock_application_manager_settings));
- EXPECT_CALL(mock_application_manager_settings, hmi_capabilities_file_name())
- .WillOnce(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(mock_dispatcher, add_observer(_, _, _)).Times(1);
- EXPECT_CALL(mock_dispatcher, remove_observer(_)).Times(1);
- EXPECT_CALL(mock_application_manager_settings, launch_hmi())
- .WillOnce(Return(false));
-
- if (file_system::FileExists("./app_info_data")) {
- EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
- }
-
- std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
- std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
- hmi_capabilities->Init(last_state_wrapper_);
+ hmi_capabilities_->Init(last_state_wrapper_);
// Check system capabilities; only navigation capability is valid, the other
// two are empty
- EXPECT_TRUE(hmi_capabilities->navigation_supported());
- EXPECT_FALSE(hmi_capabilities->phone_call_supported());
- EXPECT_FALSE(hmi_capabilities->video_streaming_supported());
- EXPECT_FALSE(hmi_capabilities->rc_supported());
+ EXPECT_TRUE(hmi_capabilities_->navigation_supported());
+ EXPECT_FALSE(hmi_capabilities_->phone_call_supported());
+ EXPECT_FALSE(hmi_capabilities_->video_streaming_supported());
+ EXPECT_FALSE(hmi_capabilities_->rc_supported());
// verify navigation capabilities
smart_objects::SmartObject navigation_capability_so =
- *(hmi_capabilities->navigation_capability());
+ *(hmi_capabilities_->navigation_capability());
EXPECT_TRUE(navigation_capability_so.keyExists("sendLocationEnabled"));
EXPECT_TRUE(navigation_capability_so.keyExists("getWayPointsEnabled"));
EXPECT_TRUE(navigation_capability_so["sendLocationEnabled"].asBool());
@@ -577,41 +1007,23 @@ TEST_F(HMICapabilitiesTest,
TEST_F(HMICapabilitiesTest,
LoadCapabilitiesFromFileAndVerifyOldAudioPassThruCapabilities) {
- MockApplicationManager mock_app_mngr;
- event_engine_test::MockEventDispatcher mock_dispatcher;
- MockApplicationManagerSettings mock_application_manager_settings;
-
const std::string hmi_capabilities_file = "hmi_capabilities_old_apt.json";
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(mock_app_mngr, event_dispatcher())
- .WillOnce(ReturnRef(mock_dispatcher));
- EXPECT_CALL(mock_app_mngr, get_settings())
- .WillRepeatedly(ReturnRef(mock_application_manager_settings));
- EXPECT_CALL(mock_application_manager_settings, hmi_capabilities_file_name())
- .WillOnce(ReturnRef(hmi_capabilities_file));
- EXPECT_CALL(mock_dispatcher, add_observer(_, _, _)).Times(1);
- EXPECT_CALL(mock_dispatcher, remove_observer(_)).Times(1);
- EXPECT_CALL(mock_application_manager_settings, launch_hmi())
- .WillOnce(Return(false));
EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
CommonLanguageFromString(_))
.WillRepeatedly(Invoke(TestCommonLanguageFromString));
- if (file_system::FileExists("./app_info_data")) {
- EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
- }
-
- std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
- std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
- hmi_capabilities->Init(last_state_wrapper_);
+ hmi_capabilities_->Init(last_state_wrapper_);
// with old audio pass thru format, the object is an array containing a single
// object
smart_objects::SmartObjectSPtr audio_pass_thru_capabilities_so =
- hmi_capabilities->audio_pass_thru_capabilities();
+ hmi_capabilities_->audio_pass_thru_capabilities();
EXPECT_EQ(smart_objects::SmartType_Array,
audio_pass_thru_capabilities_so->getType());
- EXPECT_EQ(1u, audio_pass_thru_capabilities_so->length());
+ EXPECT_EQ(1ull, audio_pass_thru_capabilities_so->length());
smart_objects::SmartObject& first_element =
(*audio_pass_thru_capabilities_so)[0];
EXPECT_TRUE(first_element.keyExists("samplingRate"));
@@ -629,45 +1041,608 @@ TEST_F(HMICapabilitiesTest,
}
TEST_F(HMICapabilitiesTest, VerifyImageType) {
+ ON_CALL(mock_app_mngr_, IsSOStructValid(_, _)).WillByDefault(Return(true));
+
const int32_t image_type = 1;
smart_objects::SmartObject sm_obj;
- EXPECT_CALL(app_mngr_, IsSOStructValid(_, _)).WillOnce(Return(true));
sm_obj[hmi_response::image_capabilities][0] = image_type;
- hmi_capabilities_test->set_display_capabilities(sm_obj);
+ hmi_capabilities_->set_display_capabilities(sm_obj);
- EXPECT_TRUE(hmi_capabilities_test->VerifyImageType(image_type));
+ EXPECT_TRUE(hmi_capabilities_->VerifyImageType(image_type));
const int32_t new_image_type = 2;
- EXPECT_FALSE(hmi_capabilities_test->VerifyImageType(new_image_type));
-}
-
-void HMICapabilitiesTest::SetCooperating() {
- smart_objects::SmartObjectSPtr test_so;
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
- CreateModuleInfoSO(_, _))
- .WillRepeatedly(Return(test_so));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
- .WillRepeatedly(Return(true));
+ EXPECT_FALSE(hmi_capabilities_->VerifyImageType(new_image_type));
}
TEST_F(HMICapabilitiesTest, SetVRCooperating) {
- hmi_capabilities_test->set_is_vr_cooperating(true);
- EXPECT_EQ(true, hmi_capabilities_test->is_vr_cooperating());
+ hmi_capabilities_->set_is_vr_cooperating(true);
+ EXPECT_TRUE(hmi_capabilities_->is_vr_cooperating());
}
TEST_F(HMICapabilitiesTest, SetTTSCooperating) {
- hmi_capabilities_test->set_is_tts_cooperating(true);
- EXPECT_EQ(true, hmi_capabilities_test->is_tts_cooperating());
+ hmi_capabilities_->set_is_tts_cooperating(true);
+ EXPECT_TRUE(hmi_capabilities_->is_tts_cooperating());
}
TEST_F(HMICapabilitiesTest, SetUICooperating) {
- hmi_capabilities_test->set_is_ui_cooperating(true);
- EXPECT_EQ(true, hmi_capabilities_test->is_ui_cooperating());
+ hmi_capabilities_->set_is_ui_cooperating(true);
+ EXPECT_TRUE(hmi_capabilities_->is_ui_cooperating());
}
TEST_F(HMICapabilitiesTest, SetIviCooperating) {
- hmi_capabilities_test->set_is_ivi_cooperating(true);
- EXPECT_EQ(true, hmi_capabilities_test->is_ivi_cooperating());
+ hmi_capabilities_->set_is_ivi_cooperating(true);
+ EXPECT_TRUE(hmi_capabilities_->is_ivi_cooperating());
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ UpdateCapabilitiesDependingOn_ccpuVersion_FromCacheForOld_RequestForNew) {
+ const std::string ccpu_version = "4.1.3.B_EB355B";
+ const std::string ccpu_version_new = "5.1.3.B_EB355B";
+ const std::string hmi_capabilities_invalid_file =
+ "hmi_capabilities_invalid_file.json";
+
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_invalid_file));
+
+ EXPECT_CALL(mock_app_mngr_, SetHMICooperating(true));
+ EXPECT_CALL(mock_app_mngr_, RequestForInterfacesAvailability()).Times(2);
+
+ hmi_capabilities_->set_ccpu_version(ccpu_version);
+ hmi_capabilities_->OnSoftwareVersionReceived(ccpu_version);
+
+ EXPECT_EQ(ccpu_version, hmi_capabilities_->ccpu_version());
+
+ hmi_capabilities_->OnSoftwareVersionReceived(ccpu_version_new);
+ EXPECT_EQ(ccpu_version_new, hmi_capabilities_->ccpu_version());
+}
+
+TEST_F(HMICapabilitiesTest,
+ UpdateCapabilitiesForNew_ccpuVersion_DeleteCacheFile) {
+ MockApplicationManagerSettings mock_application_manager_settings;
+ const std::string ccpu_version = "4.1.3.B_EB355B";
+ const std::string ccpu_version_new = "5.1.3.B_EB355B";
+ const std::string hmi_capabilities_invalid_file =
+ "hmi_capabilities_invalid_file.json";
+
+ CreateFile(kHmiCapabilitiesCacheFile);
+
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_invalid_file));
+
+ hmi_capabilities_->set_ccpu_version(ccpu_version);
+ hmi_capabilities_->OnSoftwareVersionReceived(ccpu_version_new);
+ EXPECT_EQ(ccpu_version_new, hmi_capabilities_->ccpu_version());
+
+ EXPECT_FALSE(file_system::FileExists(kHmiCapabilitiesCacheFile));
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ OnSoftwareVersionReceived_CcpuMatchNoPendingRequestsForCapability_SetHMICooperatingToTrue) {
+ // If local ccpu_version matches with the received ccpu_version from the HMI,
+ // and cache exists, SDL Core should check if hmi_cooperating is set to true
+ // if yes - SDL should respond to all pending RAI requests, if they exist.
+ // hmi_cooperting is set to true when no pending capability requests exist
+ const std::string ccpu_version = "4.1.3.B_EB355B";
+
+ hmi_capabilities_->set_ccpu_version(ccpu_version);
+
+ EXPECT_CALL(mock_app_mngr_, SetHMICooperating(true));
+
+ hmi_capabilities_->OnSoftwareVersionReceived(ccpu_version);
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ OnSoftwareVersionReceived_CcpuMatchHavePendingRequestsForCapability_NoSetHMICooperatingToTrue) {
+ // If local ccpu_version matches with the received ccpu_version from the HMI,
+ // and there is no cache, SDL Core should check if hmi_cooperating is set to
+ // true if no - SDL should suspend all RAI responses (if any) and wait for HMI
+ // responses with all required capabilities. The RAI responses (if any) could
+ // be handled only after hmi_cooperating is set to true, it is set when all
+ // capabilities responses are received from the HMI
+ const std::string ccpu_version = "4.1.3.B_EB355B";
+
+ // Init() is required to set pending capabilities requests to the HMI
+ hmi_capabilities_->Init(last_state_wrapper_);
+ hmi_capabilities_->set_ccpu_version(ccpu_version);
+
+ EXPECT_CALL(mock_app_mngr_, SetHMICooperating(true)).Times(0);
+
+ hmi_capabilities_->OnSoftwareVersionReceived(ccpu_version);
+}
+
+TEST_F(HMICapabilitiesTest,
+ CacheFileNameNotSpecified_NoNeedToSave_ReturnSuccess) {
+ const std::string hmi_capabilities_empty_file_name = "";
+ const std::vector<std::string> sections_to_update{hmi_response::language};
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_empty_file_name));
+
+ EXPECT_TRUE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, schema_));
+}
+
+TEST_F(HMICapabilitiesTest, SaveCachedCapabilitiesToFile_ParseFile_Failed) {
+ const std::vector<std::string> sections_to_update{hmi_response::language};
+
+ file_system::CreateFile(kHmiCapabilitiesCacheFile);
+ EXPECT_TRUE(file_system::FileExists(kHmiCapabilitiesCacheFile));
+
+ EXPECT_FALSE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, schema_));
+}
+
+TEST_F(HMICapabilitiesTest,
+ SaveCachedCapabilitiesToFile_ParsedFieldsSave_Success) {
+ const std::vector<std::string> sections_to_update{
+ hmi_response::display_capabilities};
+ const std::string content_to_save = "{\"field\" : \"value\" }";
+
+ CreateFile(kHmiCapabilitiesCacheFile);
+
+ const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(),
+ content_to_save.end());
+ file_system::Write(kHmiCapabilitiesCacheFile, binary_data_to_save);
+
+ EXPECT_TRUE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, schema_));
+
+ std::string content_after_update;
+ EXPECT_TRUE(
+ file_system::ReadFile(kHmiCapabilitiesCacheFile, content_after_update));
+ EXPECT_NE(content_to_save, content_after_update);
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ SaveCachedCapabilitiesToFile_LanguageIsNotTheSameAsPersisted_SaveNewLanguageToCache) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+ const std::string new_language = "RU_RU";
+ ON_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageToString(_))
+ .WillByDefault(Return(new_language));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+ hmi_capabilities_->set_active_tts_language(hmi_apis::Common_Language::RU_RU);
+ const std::vector<std::string> sections_to_update{hmi_response::language};
+ const std::string content_to_save = "{\"TTS\": {\"language\":\"EN_US\"}}";
+
+ CreateFile(kHmiCapabilitiesCacheFile);
+ const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(),
+ content_to_save.end());
+ file_system::Write(kHmiCapabilitiesCacheFile, binary_data_to_save);
+
+ EXPECT_TRUE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ hmi_interface::tts, sections_to_update, schema_));
+
+ std::string content_after_update;
+ ASSERT_TRUE(
+ file_system::ReadFile(kHmiCapabilitiesCacheFile, content_after_update));
+ EXPECT_TRUE(content_after_update.find(new_language) != std::string::npos);
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ SaveCachedCapabilitiesToFile_SectionToUpdateIsEmpty_SkipSaving_ReturnTrue) {
+ const std::vector<std::string> sections_to_update;
+ EXPECT_TRUE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ "", sections_to_update, schema_));
+}
+
+TEST_F(HMICapabilitiesTest, PrepareJsonValueForSaving_Success) {
+ const std::vector<std::string> sections_to_update{
+ hmi_response::display_capabilities,
+ hmi_response::hmi_zone_capabilities,
+ hmi_response::soft_button_capabilities,
+ strings::audio_pass_thru_capabilities,
+ strings::hmi_capabilities,
+ strings::system_capabilities,
+ hmi_response::languages};
+
+ const std::vector<std::string> interfaces_name{
+ hmi_interface::tts,
+ hmi_interface::vr,
+ hmi_interface::ui,
+ hmi_interface::buttons,
+ hmi_interface::vehicle_info,
+ hmi_interface::rc,
+ hmi_response::speech_capabilities,
+ hmi_response::prerecorded_speech_capabilities,
+ hmi_response::button_capabilities,
+ hmi_response::preset_bank_capabilities};
+
+ smart_objects::SmartObject audio_capabilities_so(
+ smart_objects::SmartType_Array);
+ audio_capabilities_so[0][strings::sampling_rate] =
+ hmi_apis::Common_SamplingRate::RATE_44KHZ;
+ audio_capabilities_so[0][strings::bits_per_sample] =
+ hmi_apis::Common_BitsPerSample::RATE_8_BIT;
+ audio_capabilities_so[0][strings::audio_type] =
+ hmi_apis::Common_AudioType::PCM;
+
+ const std::string content_to_save = "{\"field\" : \"value\" }";
+ const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(),
+ content_to_save.end());
+
+ hmi_capabilities_->set_audio_pass_thru_capabilities(audio_capabilities_so);
+
+ CreateFile(kHmiCapabilitiesCacheFile);
+ file_system::Write(kHmiCapabilitiesCacheFile, binary_data_to_save);
+
+ for (size_t i = 0; i < interfaces_name.size(); ++i) {
+ EXPECT_TRUE(hmi_capabilities_->SaveCachedCapabilitiesToFile(
+ interfaces_name[i], sections_to_update, schema_));
+ }
+
+ std::string content_after_update;
+ EXPECT_TRUE(
+ file_system::ReadFile(kHmiCapabilitiesCacheFile, content_after_update));
+
+ Json::Value root_node;
+ utils::JsonReader reader;
+ ASSERT_TRUE(reader.parse(content_after_update, &root_node));
+
+ for (size_t i = 0; i < interfaces_name.size(); ++i) {
+ EXPECT_TRUE(static_cast<bool>(root_node[interfaces_name[i]]));
+ }
+ EXPECT_TRUE(
+ root_node[hmi_interface::ui][strings::audio_pass_thru_capabilities]
+ .isArray());
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnCapabilityInitialized_RespondToAllPendingRAIRequestsIfTheyHold) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages};
+
+ // Contains only UI capabilities
+ const std::string hmi_capabilities_file = "hmi_capabilities_sc2.json";
+ ON_CALL(mock_application_manager_settings_, hmi_capabilities_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_file));
+
+ // Initializes the UI capabilities with the default values
+ // Other interfaces are absent and appropriate requests should be sent
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ ON_CALL(mock_app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+
+ // Sets isHMICooperating flag to true after all required capabilities are
+ // received from HMI
+ EXPECT_CALL(mock_app_mngr_, SetHMICooperating(true));
+
+ for (const auto& request_id : requests_required) {
+ hmi_capabilities_->UpdateRequestsRequiredForCapabilities(request_id);
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyUICapabilitiesInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_ui_capabilities =
+ "{\"UI\" : {\"language\" : "
+ "\"EN-US\",\"languages\":[],\"displayCapabilities\" : "
+ "{},\"audioPassThruCapabilities\":[],\"pcmStreamCapabilities\" : "
+ "{},\"hmiZoneCapabilities\": \"\",\"softButtonCapabilities\" : "
+ "[],\"systemCapabilities\" : {}}}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_ui_capabilities.begin(), predefined_ui_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetLanguage));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::UI_GetCapabilities));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+
+ DeleteFileIfExists(hmi_capabilities_cache_file);
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyRCCapabilitiesInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_rc_capabilities =
+ "{\"RC\" : {\"remoteControlCapability\" : {\"buttonCapabilities\": "
+ "[],\"climateControlCapabilities\": [],\"radioControlCapabilities\": "
+ "[],\"audioControlCapabilities\": [],\"seatControlCapabilities\": "
+ "[],\"lightControlCapabilities\": {},\"hmiSettingsControlCapabilities\": "
+ "{}},\"seatLocationCapability\": {}}}}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_rc_capabilities.begin(), predefined_rc_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::RC_GetCapabilities));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyVRCapabilitiesInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_vr_capabilities =
+ "{\"VR\": {\"vrCapabilities\": [],\"language\": \"\",\"languages\": []}}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_vr_capabilities.begin(), predefined_vr_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetLanguage));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VR_GetCapabilities));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyTTSCapabilitiesInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_tts_capabilities =
+ "{\"TTS\": {\"speechCapabilities\": [],\"prerecordedSpeechCapabilities\" "
+ ": [],\"language\": \"\",\"languages\": "
+ "[]}}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_tts_capabilities.begin(), predefined_tts_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetLanguage));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages));
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::TTS_GetCapabilities));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyButtonsSCapabilitiesInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_buttons_capabilities =
+ "{\"Buttons\": {\"capabilities\": [],\"presetBankCapabilities\": {}}}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_buttons_capabilities.begin(),
+ predefined_buttons_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::Buttons_GetCapabilities));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+}
+
+TEST_F(HMICapabilitiesTest,
+ OnlyVehicleInfoInCacheFile_RequestRequiredForOtherInterfaces) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ std::vector<hmi_apis::FunctionID::eType> requests_required{
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::UI_GetSupportedLanguages,
+ hmi_apis::FunctionID::UI_GetCapabilities,
+ hmi_apis::FunctionID::RC_GetCapabilities,
+ hmi_apis::FunctionID::TTS_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages,
+ hmi_apis::FunctionID::TTS_GetCapabilities,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::VR_GetSupportedLanguages,
+ hmi_apis::FunctionID::VR_GetCapabilities,
+ hmi_apis::FunctionID::Buttons_GetCapabilities};
+
+ const std::string hmi_capabilities_cache_file =
+ "hmi_capabilities_cache_test.json";
+ CreateFile(hmi_capabilities_cache_file);
+ const std::string predefined_vi_capabilities =
+ "{\"VehicleInfo\": { \"vehicleType\" : {} }}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ predefined_vi_capabilities.begin(), predefined_vi_capabilities.end());
+
+ file_system::Write(hmi_capabilities_cache_file, binary_data_to_save);
+
+ ON_CALL(mock_application_manager_settings_,
+ hmi_capabilities_cache_file_name())
+ .WillByDefault(ReturnRef(hmi_capabilities_cache_file));
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ EXPECT_FALSE(hmi_capabilities_->IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType));
+
+ for (const auto& item : requests_required) {
+ EXPECT_TRUE(hmi_capabilities_->IsRequestsRequiredForCapabilities(item));
+ }
+}
+
+TEST_F(
+ HMICapabilitiesTest,
+ ConvertJsonArrayToSoArray_ConvertPrerecordedSpeech_SuccessConvertFromStringToEnum) {
+ SetUpLanguageAndLightCapabilitiesExpectation();
+
+ CreateFile(kHmiCapabilitiesCacheFile);
+ const std::string prerecordedSpeechCapabilities =
+ "{ \"TTS\" :{"
+ "\"prerecordedSpeechCapabilities\" :["
+ "\"HELP_JINGLE\","
+ "\"INITIAL_JINGLE\","
+ "\"LISTEN_JINGLE\","
+ "\"POSITIVE_JINGLE\","
+ "\"NEGATIVE_JINGLE\"]}"
+ "}";
+
+ const std::vector<uint8_t> binary_data_to_save(
+ prerecordedSpeechCapabilities.begin(),
+ prerecordedSpeechCapabilities.end());
+ file_system::Write(kHmiCapabilitiesCacheFile, binary_data_to_save);
+
+ hmi_capabilities_->Init(last_state_wrapper_);
+
+ const auto tts_capabilities_so = *(hmi_capabilities_->prerecorded_speech());
+
+ EXPECT_EQ(hmi_apis::Common_PrerecordedSpeech::HELP_JINGLE,
+ static_cast<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_capabilities_so[0].asInt()));
+ EXPECT_EQ(hmi_apis::Common_PrerecordedSpeech::INITIAL_JINGLE,
+ static_cast<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_capabilities_so[1].asInt()));
+ EXPECT_EQ(hmi_apis::Common_PrerecordedSpeech::LISTEN_JINGLE,
+ static_cast<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_capabilities_so[2].asInt()));
+ EXPECT_EQ(hmi_apis::Common_PrerecordedSpeech::POSITIVE_JINGLE,
+ static_cast<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_capabilities_so[3].asInt()));
+ EXPECT_EQ(hmi_apis::Common_PrerecordedSpeech::NEGATIVE_JINGLE,
+ static_cast<hmi_apis::Common_PrerecordedSpeech::eType>(
+ tts_capabilities_so[4].asInt()));
}
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h b/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h
deleted file mode 100644
index 9764a9997f..0000000000
--- a/src/components/application_manager/test/include/application_manager/hmi_capabilities_for_testing.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2016, 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_TEST_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
-
-#include "application_manager/hmi_capabilities_impl.h"
-
-namespace test {
-namespace components {
-namespace application_manager_test {
-
-class HMICapabilitiesForTesting
- : public ::application_manager::HMICapabilitiesImpl {
- public:
- HMICapabilitiesForTesting(::application_manager::ApplicationManager& app_mngr)
- : HMICapabilitiesImpl(app_mngr) {}
- bool LoadCapabilitiesFromFile() {
- return load_capabilities_from_file();
- }
-};
-
-} // namespace application_manager_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_FOR_TESTING_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 362dda4efb..175c39513e 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
@@ -321,7 +321,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id));
MOCK_CONST_METHOD1(FindSubMenu,
smart_objects::SmartObject*(uint32_t menu_id));
- MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name));
+ MOCK_METHOD2(IsSubMenuNameAlreadyExist,
+ bool(const std::string& name, const uint32_t parent_id));
MOCK_METHOD2(AddChoiceSet,
void(uint32_t choice_set_id,
const smart_objects::SmartObject& choice_set));
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 7c163d78ad..2f9f40ad2a 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
@@ -75,7 +75,7 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
void(const hmi_apis::Common_Language::eType language));
MOCK_CONST_METHOD0(ui_supported_languages,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_ui_supported_languages,
void(const smart_objects::SmartObject& supported_languages));
@@ -85,7 +85,7 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
void(const hmi_apis::Common_Language::eType language));
MOCK_CONST_METHOD0(vr_supported_languages,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_vr_supported_languages,
void(const smart_objects::SmartObject& supported_languages));
@@ -95,7 +95,7 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
void(const hmi_apis::Common_Language::eType language));
MOCK_CONST_METHOD0(tts_supported_languages,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_tts_supported_languages,
void(const smart_objects::SmartObject& supported_languages));
@@ -172,26 +172,35 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD0(rc_supported, bool());
MOCK_METHOD1(set_rc_supported, void(const bool supported));
+ MOCK_CONST_METHOD0(driver_distraction_supported, bool());
+ MOCK_METHOD1(set_driver_distraction_supported, void(const bool supported));
+
MOCK_CONST_METHOD0(navigation_capability,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_navigation_capability,
void(const smart_objects::SmartObject& navigation_capability));
- MOCK_CONST_METHOD0(phone_capability, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(phone_capability, const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_phone_capability,
void(const smart_objects::SmartObject& phone_capability));
MOCK_CONST_METHOD0(video_streaming_capability,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(
set_video_streaming_capability,
void(const smart_objects::SmartObject& video_streaming_capability));
- MOCK_CONST_METHOD0(rc_capability, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(rc_capability, const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_rc_capability,
void(const smart_objects::SmartObject& rc_capability));
+ MOCK_CONST_METHOD0(driver_distraction_capability,
+ const smart_objects::SmartObjectSPtr());
+ MOCK_METHOD1(
+ set_driver_distraction_capability,
+ void(const smart_objects::SmartObject& driver_distraction_capability));
+
MOCK_CONST_METHOD0(seat_location_capability,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(
set_seat_location_capability,
void(const smart_objects::SmartObject& seat_location_capability));
@@ -203,22 +212,22 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD0(ccpu_version, const std::string&());
MOCK_METHOD1(set_ccpu_version, void(const std::string& ccpu_version));
+ MOCK_METHOD1(OnSoftwareVersionReceived,
+ void(const std::string& ccpu_version));
+ MOCK_METHOD0(UpdateCachedCapabilities, void());
MOCK_METHOD0(get_hmi_language_handler,
application_manager::HMILanguageHandler&());
MOCK_METHOD1(set_handle_response_for,
void(const smart_objects::SmartObject& request));
-
- protected:
- MOCK_CONST_METHOD2(check_existing_json_member,
- bool(const Json::Value& json_member,
- const char* name_of_member));
-
- MOCK_CONST_METHOD2(convert_json_languages_to_obj,
- void(const Json::Value& json_languages,
- smart_objects::SmartObject& languages));
- MOCK_CONST_METHOD2(convert_audio_capability_to_obj,
- void(const Json::Value& capability,
- smart_objects::SmartObject& output_so));
+ MOCK_METHOD3(SaveCachedCapabilitiesToFile,
+ bool(const std::string& interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema));
+ MOCK_CONST_METHOD0(DeleteCachedCapabilitiesFile, bool());
+ MOCK_CONST_METHOD1(IsRequestsRequiredForCapabilities,
+ bool(hmi_apis::FunctionID::eType));
+ MOCK_METHOD1(UpdateRequestsRequiredForCapabilities,
+ void(hmi_apis::FunctionID::eType requested_interface));
};
} // namespace application_manager_test
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 f85c569bdb..1a033fe87a 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
@@ -30,6 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
#include <string>
#include <vector>
@@ -40,12 +41,14 @@
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_rpc_service.h"
#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resume_ctrl.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"
@@ -77,6 +80,11 @@ using testing::ReturnRef;
using testing::ReturnRefOfCopy;
using testing::SaveArg;
+namespace {
+const uint32_t kAppId = 123u;
+const uint32_t kCorrelationId_ = 1939u;
+} // namespace
+
TEST(MessageHelperTestCreate,
CreateBlockedByPoliciesResponse_SmartObject_Equal) {
mobile_apis::FunctionID::eType function_id =
@@ -602,9 +610,21 @@ class MessageHelperTest : public ::testing::Test {
, hmi_level_strings{"FULL", "LIMITED", "BACKGROUND", "NONE"}
, delta_from_functions_id(32768) {}
+ void StartStreamPreConditions() {
+ ON_CALL(mock_application_manager_, GetNextHMICorrelationID())
+ .WillByDefault(Return(kCorrelationId_));
+ ON_CALL(mock_application_manager_, get_settings())
+ .WillByDefault(ReturnRef(mock_app_mngr_settings_));
+ ON_CALL(mock_application_manager_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ }
+
protected:
- application_manager_test::MockApplicationManager mock_application_manager;
- application_manager_test::MockRPCService mock_rpc_service_;
+ testing::NiceMock<application_manager_test::MockApplicationManager>
+ mock_application_manager_;
+ testing::NiceMock<application_manager_test::MockApplicationManagerSettings>
+ mock_app_mngr_settings_;
+ testing::NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
const StringArray language_strings;
const StringArray hmi_result_strings;
const StringArray mobile_result_strings;
@@ -748,10 +768,10 @@ TEST_F(MessageHelperTest,
smart_objects::SmartObject object;
policy_handler_test::MockPolicySettings policy_settings_;
const policy::PolicyHandler policy_handler(policy_settings_,
- mock_application_manager);
+ mock_application_manager_);
// Method call
mobile_apis::Result::eType result = MessageHelper::ProcessSoftButtons(
- object, appSharedMock, policy_handler, mock_application_manager);
+ object, appSharedMock, policy_handler, mock_application_manager_);
// Expect
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
}
@@ -767,10 +787,10 @@ TEST_F(MessageHelperTest,
buttons[0][strings::image][strings::value] = "invalid\\nvalue";
policy_handler_test::MockPolicySettings policy_settings_;
const policy::PolicyHandler policy_handler(policy_settings_,
- mock_application_manager);
+ mock_application_manager_);
// Method call
mobile_apis::Result::eType result = MessageHelper::ProcessSoftButtons(
- object, appSharedMock, policy_handler, mock_application_manager);
+ object, appSharedMock, policy_handler, mock_application_manager_);
// Expect
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
@@ -784,7 +804,7 @@ TEST_F(MessageHelperTest, VerifyImage_ImageTypeIsStatic_Success) {
image[strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImage(
- image, appSharedMock, mock_application_manager);
+ image, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
}
@@ -799,7 +819,7 @@ TEST_F(MessageHelperTest, VerifyImage_ImageValueNotValid_InvalidData) {
image[strings::value] = " ";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImage(
- image, appSharedMock, mock_application_manager);
+ image, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
@@ -813,7 +833,7 @@ TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageTypeIsStatic_Success) {
image[strings::value] = "icon.png";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImage(
- image, appSharedMock, mock_application_manager);
+ image, appSharedMock, mock_application_manager_);
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
// EXPECT
EXPECT_EQ("icon.png", image[strings::value].asString());
@@ -829,7 +849,7 @@ TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageValueNotValid_InvalidData) {
image[strings::value] = " ";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImage(
- image, appSharedMock, mock_application_manager);
+ image, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
@@ -845,7 +865,7 @@ TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithValidData_Success) {
images[1][strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageFiles(
- images, appSharedMock, mock_application_manager);
+ images, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
}
@@ -863,7 +883,7 @@ TEST_F(MessageHelperTest,
images[1][strings::value] = "image\\n";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageFiles(
- images, appSharedMock, mock_application_manager);
+ images, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
@@ -883,7 +903,7 @@ TEST_F(MessageHelperTest,
message[1][strings::image][strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageVrHelpItems(
- message, appSharedMock, mock_application_manager);
+ message, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
}
@@ -903,7 +923,7 @@ TEST_F(MessageHelperTest,
message[1][strings::image][strings::value] = "image\\n";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageVrHelpItems(
- message, appSharedMock, mock_application_manager);
+ message, appSharedMock, mock_application_manager_);
// EXPECT
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
@@ -973,7 +993,7 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
smart_objects::SmartObjectSPtr result;
- ON_CALL(mock_application_manager, GetRPCService())
+ ON_CALL(mock_application_manager_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
@@ -982,7 +1002,7 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
MessageHelper::SendGetListOfPermissionsResponse(permissions,
external_consent_status,
correlation_id,
- mock_application_manager);
+ mock_application_manager_);
ASSERT_TRUE(result.get());
@@ -1013,7 +1033,7 @@ TEST_F(MessageHelperTest,
smart_objects::SmartObjectSPtr result;
- ON_CALL(mock_application_manager, GetRPCService())
+ ON_CALL(mock_application_manager_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
@@ -1022,7 +1042,7 @@ TEST_F(MessageHelperTest,
MessageHelper::SendGetListOfPermissionsResponse(permissions,
external_consent_status,
correlation_id,
- mock_application_manager);
+ mock_application_manager_);
ASSERT_TRUE(result.get());
@@ -1059,7 +1079,7 @@ TEST_F(MessageHelperTest,
TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
smart_objects::SmartObjectSPtr result;
- ON_CALL(mock_application_manager, GetRPCService())
+ ON_CALL(mock_application_manager_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
@@ -1073,7 +1093,7 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
video_params[strings::height] = 480;
MessageHelper::SendNaviSetVideoConfig(
- app_id, mock_application_manager, video_params);
+ app_id, mock_application_manager_, video_params);
EXPECT_EQ(hmi_apis::FunctionID::Navigation_SetVideoConfig,
(*result)[strings::params][strings::function_id].asInt());
@@ -1091,6 +1111,120 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
EXPECT_EQ(480, msg_params[strings::config][strings::height].asInt());
}
+TEST_F(MessageHelperTest,
+ SendAudioStartStream_SendAudioStreamUrl_MaxPath_Equal) {
+ // baskslash-2 and place for a null character-1
+ auto const special_characters = 3;
+ std::string audio_stream_file = "/";
+ audio_stream_file +=
+ std::string(PATH_MAX - NAME_MAX - special_characters, 'u') + "/";
+ audio_stream_file += std::string(NAME_MAX, 'u');
+ std::string audio_server_type;
+ smart_objects::SmartObjectSPtr start_stream;
+
+ StartStreamPreConditions();
+
+ ON_CALL(mock_app_mngr_settings_, audio_server_type())
+ .WillByDefault(ReturnRef(audio_server_type));
+ ON_CALL(mock_app_mngr_settings_, audio_stream_file())
+ .WillByDefault(ReturnRef(audio_stream_file));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(DoAll(SaveArg<0>(&start_stream), Return(true)));
+
+ MessageHelper::SendAudioStartStream(kAppId, mock_application_manager_);
+
+ smart_objects::SmartObject& msg_params = (*start_stream)[strings::msg_params];
+
+ EXPECT_TRUE(msg_params.keyExists(strings::url));
+ EXPECT_EQ(msg_params[strings::url], audio_stream_file);
+}
+
+TEST_F(MessageHelperTest,
+ SendAudioStartStream_SendAudioStreamUrl_ViolationOfLimits_NotEqual) {
+ // baskslash-2 and place for a null character-1
+ auto const special_characters = 3;
+ std::string audio_stream_file = "/";
+ audio_stream_file +=
+ std::string(PATH_MAX - NAME_MAX - special_characters, 'u') + "/";
+ audio_stream_file += std::string(NAME_MAX + 1, 'u');
+ std::string audio_server_type;
+ smart_objects::SmartObjectSPtr start_stream;
+
+ StartStreamPreConditions();
+
+ ON_CALL(mock_app_mngr_settings_, audio_server_type())
+ .WillByDefault(ReturnRef(audio_server_type));
+ ON_CALL(mock_app_mngr_settings_, audio_stream_file())
+ .WillByDefault(ReturnRef(audio_stream_file));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(DoAll(SaveArg<0>(&start_stream), Return(true)));
+
+ MessageHelper::SendAudioStartStream(kAppId, mock_application_manager_);
+
+ smart_objects::SmartObject& msg_params = (*start_stream)[strings::msg_params];
+
+ EXPECT_TRUE(msg_params.keyExists(strings::url));
+ EXPECT_STRNE(msg_params[strings::url].asCharArray(),
+ audio_stream_file.c_str());
+}
+
+TEST_F(MessageHelperTest,
+ SendNaviStartStream_SendVideoStreamUrl_MaxPath_Equal) {
+ // baskslash-2 and place for a null character-1
+ auto const special_characters = 3;
+ std::string video_stream_file = "/";
+ video_stream_file +=
+ std::string(PATH_MAX - NAME_MAX - special_characters, 'u') + "/";
+ video_stream_file += std::string(NAME_MAX, 'u');
+ std::string video_server_type;
+ smart_objects::SmartObjectSPtr start_stream;
+
+ StartStreamPreConditions();
+
+ ON_CALL(mock_app_mngr_settings_, video_server_type())
+ .WillByDefault(ReturnRef(video_server_type));
+ ON_CALL(mock_app_mngr_settings_, video_stream_file())
+ .WillByDefault(ReturnRef(video_stream_file));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(DoAll(SaveArg<0>(&start_stream), Return(true)));
+
+ MessageHelper::SendNaviStartStream(kAppId, mock_application_manager_);
+
+ smart_objects::SmartObject& msg_params = (*start_stream)[strings::msg_params];
+
+ EXPECT_TRUE(msg_params.keyExists(strings::url));
+ EXPECT_EQ(msg_params[strings::url], video_stream_file);
+}
+
+TEST_F(MessageHelperTest,
+ SendNaviStartStream_SendVideoStreamUrl_ViolationOfLimits_NotEqual) {
+ // baskslash-2 and place for a null character-1
+ auto const special_characters = 3;
+ std::string video_stream_file = "/";
+ video_stream_file +=
+ std::string(PATH_MAX - NAME_MAX - special_characters, 'u') + "/";
+ video_stream_file += std::string(NAME_MAX + 1, 'u');
+ std::string video_server_type;
+ smart_objects::SmartObjectSPtr start_stream;
+
+ StartStreamPreConditions();
+
+ ON_CALL(mock_app_mngr_settings_, video_server_type())
+ .WillByDefault(ReturnRef(video_server_type));
+ ON_CALL(mock_app_mngr_settings_, video_stream_file())
+ .WillByDefault(ReturnRef(video_stream_file));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(DoAll(SaveArg<0>(&start_stream), Return(true)));
+
+ MessageHelper::SendNaviStartStream(kAppId, mock_application_manager_);
+
+ smart_objects::SmartObject& msg_params = (*start_stream)[strings::msg_params];
+
+ EXPECT_TRUE(msg_params.keyExists(strings::url));
+ EXPECT_STRNE(msg_params[strings::url].asCharArray(),
+ video_stream_file.c_str());
+}
+
TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_SUCCESS) {
const WindowID window_id = 145;
smart_objects::SmartObject message(smart_objects::SmartType_Map);
@@ -1112,6 +1246,38 @@ TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromWrongType) {
MessageHelper::ExtractWindowIdFromSmartObject(message));
}
+TEST_F(MessageHelperTest,
+ VehicleDataMapping_ContainsGeneratedVehicleTypes_SUCCESS) {
+ using VehicleDataTypeEnum = mobile_apis::VehicleDataType::eType;
+ using VehicleDataTypes =
+ smart_objects::EnumConversionHelper<VehicleDataTypeEnum>;
+
+ const auto& vehicle_data_mapping = MessageHelper::vehicle_data();
+ const auto& enum_map = VehicleDataTypes::enum_to_cstring_map();
+
+ // Values which vehicle_data_mapping doesn't contain
+ const std::vector<VehicleDataTypeEnum> excluded_values = {
+ VehicleDataTypeEnum::INVALID_ENUM,
+ VehicleDataTypeEnum::VEHICLEDATA_OEM_CUSTOM_DATA,
+ VehicleDataTypeEnum::VEHICLEDATA_BATTVOLTAGE};
+
+ for (const auto& enum_item : enum_map) {
+ const auto& excluded_value = std::find(
+ excluded_values.begin(), excluded_values.end(), enum_item.first);
+ if (excluded_value != excluded_values.end()) {
+ continue;
+ }
+
+ const auto& found_value = std::find_if(
+ vehicle_data_mapping.begin(),
+ vehicle_data_mapping.end(),
+ [&enum_item](const std::pair<std::string, VehicleDataTypeEnum>& item)
+ -> bool { return enum_item.first == item.second; });
+
+ EXPECT_NE(found_value, vehicle_data_mapping.end());
+ }
+}
+
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
index ad264c8518..e4818353d1 100644
--- a/src/components/application_manager/test/sdl_preloaded_pt.json
+++ b/src/components/application_manager/test/sdl_preloaded_pt.json
@@ -367,7 +367,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"]
+ "wiperStatus",
+ "stabilityControlsStatus"]
},
"OnVehicleData": {
"hmi_levels": ["BACKGROUND",
@@ -388,7 +389,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"]
+ "wiperStatus",
+ "stabilityControlsStatus"]
},
"SubscribeVehicleData": {
"hmi_levels": ["BACKGROUND",
@@ -408,7 +410,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"]
+ "wiperStatus",
+ "stabilityControlsStatus"]
},
"UnsubscribeVehicleData": {
"hmi_levels": ["BACKGROUND",
@@ -428,7 +431,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"]
+ "wiperStatus",
+ "stabilityControlsStatus"]
}
}
},
diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json
index aea3f7700b..205a962cc8 100644
--- a/src/components/application_manager/test/sdl_pt_update.json
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -1610,7 +1610,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"OnVehicleData" : {
@@ -1629,7 +1630,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"SubscribeVehicleData" : {
@@ -1647,7 +1649,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"UnsubscribeVehicleData" : {
@@ -1665,7 +1668,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
}
},
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 76c66c7c7b..bbd0a5d243 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -212,6 +212,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::string& hmi_capabilities_file_name() const;
/**
+ * @brief Returns hmi capabilities cache file name
+ * @return hmi capabilities cache file name
+ */
+ const std::string& hmi_capabilities_cache_file_name() const;
+
+ /**
* @brief Returns help promt vector
*/
const std::vector<std::string>& help_prompt() const;
@@ -985,6 +991,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
uint32_t stop_streaming_timeout_;
uint16_t time_testing_port_;
std::string hmi_capabilities_file_name_;
+ std::string hmi_capabilities_cache_file_name_;
std::vector<std::string> help_prompt_;
std::vector<std::string> time_out_promt_;
std::vector<std::string> vr_commands_;
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 3037b66fdd..26e5bb0c54 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -101,6 +101,7 @@ const char* kRCModuleConsentSection = "RCModuleConsent";
const char* kSDLVersionKey = "SDLVersion";
const char* kHmiCapabilitiesKey = "HMICapabilities";
+const char* kHmiCapabilitiesCacheFileKey = "HMICapabilitiesCacheFile";
const char* kPathToSnapshotKey = "PathToSnapshot";
const char* kPreloadedPTKey = "PreloadedPT";
const char* kAttemptsToOpenPolicyDBKey = "AttemptsToOpenPolicyDB";
@@ -472,6 +473,7 @@ Profile::Profile()
, stop_streaming_timeout_(kDefaultStopStreamingTimeout)
, time_testing_port_(kDefaultTimeTestingPort)
, hmi_capabilities_file_name_(kDefaultHmiCapabilitiesFileName)
+ , hmi_capabilities_cache_file_name_()
, help_prompt_()
, time_out_promt_()
, min_tread_stack_size_(threads::Thread::kMinStackSize)
@@ -650,6 +652,10 @@ const std::string& Profile::hmi_capabilities_file_name() const {
return hmi_capabilities_file_name_;
}
+const std::string& Profile::hmi_capabilities_cache_file_name() const {
+ return hmi_capabilities_cache_file_name_;
+}
+
const std::string& Profile::server_address() const {
return server_address_;
}
@@ -1335,6 +1341,21 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(app_storage_folder_, kAppStorageFolderKey, kMainSection);
+ // HMI capabilities cache file
+ ReadStringValue(&hmi_capabilities_cache_file_name_,
+ "",
+ kMainSection,
+ kHmiCapabilitiesCacheFileKey);
+
+ if (!hmi_capabilities_cache_file_name_.empty()) {
+ hmi_capabilities_cache_file_name_ =
+ app_storage_folder_ + "/" + hmi_capabilities_cache_file_name_;
+ }
+
+ LOG_UPDATED_VALUE(hmi_capabilities_cache_file_name_,
+ kHmiCapabilitiesCacheFileKey,
+ kMainSection);
+
// Application resourse folder
ReadStringValue(&app_resource_folder_,
file_system::CurrentWorkingDirectory().c_str(),
@@ -1531,7 +1552,8 @@ void Profile::UpdateValues() {
kMediaManagerSection,
kNamedVideoPipePathKey);
- named_video_pipe_path_ = app_storage_folder_ + "/" + named_video_pipe_path_;
+ named_video_pipe_path_ = app_storage_folder_ + "/" +
+ std::string(named_video_pipe_path_, 0, NAME_MAX);
LOG_UPDATED_VALUE(
named_video_pipe_path_, kNamedVideoPipePathKey, kMediaManagerSection);
@@ -1542,7 +1564,8 @@ void Profile::UpdateValues() {
kMediaManagerSection,
kNamedAudioPipePathKey);
- named_audio_pipe_path_ = app_storage_folder_ + "/" + named_audio_pipe_path_;
+ named_audio_pipe_path_ = app_storage_folder_ + "/" +
+ std::string(named_audio_pipe_path_, 0, NAME_MAX);
LOG_UPDATED_VALUE(
named_audio_pipe_path_, kNamedAudioPipePathKey, kMediaManagerSection);
@@ -1551,7 +1574,8 @@ void Profile::UpdateValues() {
ReadStringValue(
&video_stream_file_, "", kMediaManagerSection, kVideoStreamFileKey);
- video_stream_file_ = app_storage_folder_ + "/" + video_stream_file_;
+ video_stream_file_ =
+ app_storage_folder_ + "/" + std::string(video_stream_file_, 0, NAME_MAX);
LOG_UPDATED_VALUE(
video_stream_file_, kVideoStreamFileKey, kMediaManagerSection);
@@ -1560,7 +1584,8 @@ void Profile::UpdateValues() {
ReadStringValue(
&audio_stream_file_, "", kMediaManagerSection, kAudioStreamFileKey);
- audio_stream_file_ = app_storage_folder_ + "/" + audio_stream_file_;
+ audio_stream_file_ =
+ app_storage_folder_ + "/" + std::string(audio_stream_file_, 0, NAME_MAX);
LOG_UPDATED_VALUE(
audio_stream_file_, kAudioStreamFileKey, kMediaManagerSection);
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
index 544a3ca275..b4c03fd760 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
@@ -149,6 +149,8 @@ class CMessageBrokerController
int getNextControllerId();
private:
+ void CloseConnection();
+
boost::asio::io_context ioc_;
const std::string& address_;
uint16_t port_;
@@ -182,4 +184,4 @@ class CMessageBrokerController
} // namespace hmi_message_handler
-#endif /* MB_CONTROLLER_H */ \ No newline at end of file
+#endif /* MB_CONTROLLER_H */
diff --git a/src/components/hmi_message_handler/src/mb_controller.cc b/src/components/hmi_message_handler/src/mb_controller.cc
index ffc6ef23a3..cfc05647da 100644
--- a/src/components/hmi_message_handler/src/mb_controller.cc
+++ b/src/components/hmi_message_handler/src/mb_controller.cc
@@ -50,15 +50,8 @@ CMessageBrokerController::CMessageBrokerController(const std::string& address,
}
CMessageBrokerController::~CMessageBrokerController() {
- boost::system::error_code ec;
- socket_.close();
- acceptor_.close(ec);
- if (ec) {
- std::string str_err = "ErrorMessage Close: " + ec.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
- }
- shutdown_ = true;
- ioc_.stop();
+ shutdown_.exchange(true);
+ CloseConnection();
}
bool CMessageBrokerController::StartListener() {
@@ -114,9 +107,8 @@ void CMessageBrokerController::WaitForConnection() {
void CMessageBrokerController::StartSession(boost::system::error_code ec) {
if (ec) {
- std::string str_err = "ErrorMessage: " + ec.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
- ioc_.stop();
+ LOG4CXX_ERROR(mb_logger_, "ErrorMessage: " << ec.message());
+ CloseConnection();
return;
}
if (shutdown_) {
@@ -147,7 +139,7 @@ void CMessageBrokerController::sendNotification(Json::Value& message) {
int subscribersCount = getSubscribersFd(methodName, result);
if (0 < subscribersCount) {
std::vector<WebsocketSession*>::iterator it;
- for (it = result.begin(); it != result.end(); it++) {
+ for (it = result.begin(); it != result.end(); ++it) {
(*it)->sendJsonMessage(message);
}
} else {
@@ -216,7 +208,8 @@ bool CMessageBrokerController::Connect() {
}
void CMessageBrokerController::exitReceivingThread() {
- shutdown_ = true;
+ shutdown_.exchange(true);
+
mConnectionListLock.Acquire();
std::vector<std::shared_ptr<hmi_message_handler::WebsocketSession> >::iterator
it;
@@ -225,19 +218,7 @@ void CMessageBrokerController::exitReceivingThread() {
it = mConnectionList.erase(it);
}
mConnectionListLock.Release();
-
- boost::system::error_code ec;
- socket_.close();
- acceptor_.cancel(ec);
- if (ec) {
- std::string str_err = "ErrorMessage Cancel: " + ec.message();
- LOG4CXX_ERROR(mb_logger_, str_err);
- }
- acceptor_.close(ec);
- if (ec) {
- std::string str_err = "ErrorMessage Close: " + ec.message();
- }
- ioc_.stop();
+ CloseConnection();
}
std::string CMessageBrokerController::getMethodName(std::string& method) {
@@ -287,7 +268,7 @@ void CMessageBrokerController::deleteController(WebsocketSession* ws_session) {
if (it->second == ws_session) {
mControllersList.erase(it++);
} else {
- it++;
+ ++it;
}
}
}
@@ -341,7 +322,7 @@ bool CMessageBrokerController::addSubscriber(WebsocketSession* ws_session,
p = mSubscribersList.equal_range(name);
if (p.first != p.second) {
std::multimap<std::string, WebsocketSession*>::iterator itr;
- for (itr = p.first; itr != p.second; itr++) {
+ for (itr = p.first; itr != p.second; ++itr) {
if (ws_session == itr->second) {
result = false;
LOG4CXX_ERROR(mb_logger_, ("Subscriber already exists!\n"));
@@ -384,7 +365,7 @@ int CMessageBrokerController::getSubscribersFd(
p = mSubscribersList.equal_range(name);
if (p.first != p.second) {
std::multimap<std::string, WebsocketSession*>::iterator itr;
- for (itr = p.first; itr != p.second; itr++) {
+ for (itr = p.first; itr != p.second; ++itr) {
result.push_back(itr->second);
}
}
@@ -501,4 +482,27 @@ void CMessageBrokerController::processInternalRequest(
int CMessageBrokerController::getNextControllerId() {
return 1000 * mControllersIdCounter++;
}
+
+void CMessageBrokerController::CloseConnection() {
+ if (!ioc_.stopped()) {
+ boost::system::error_code ec;
+
+ acceptor_.cancel(ec);
+ if (ec) {
+ LOG4CXX_ERROR(mb_logger_, "Acceptor cancel error: " << ec.message());
+ }
+
+ acceptor_.close(ec);
+ if (ec) {
+ LOG4CXX_ERROR(mb_logger_, "Acceptor close error: " << ec.message());
+ }
+
+ socket_.close(ec);
+ if (ec) {
+ LOG4CXX_ERROR(mb_logger_, "Socket close error : " << ec.message());
+ }
+
+ ioc_.stop();
+ }
+}
} // namespace hmi_message_handler
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 9de5b3a143..7245553a18 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -512,7 +512,13 @@ class ApplicationManager {
virtual void ConnectToDevice(const std::string& device_mac) = 0;
- virtual void OnHMIStartedCooperation() = 0;
+ virtual void OnHMIReady() = 0;
+
+ /**
+ * @brief Send GetCapabilities requests for
+ * each interface (VR, TTS, UI etc) to HMI
+ */
+ virtual void RequestForInterfacesAvailability() = 0;
virtual void DisconnectCloudApp(ApplicationSharedPtr app) = 0;
@@ -531,6 +537,13 @@ class ApplicationManager {
GetCloudAppConnectionStatus(ApplicationConstSharedPtr app) const = 0;
virtual bool IsHMICooperating() const = 0;
+
+ /*
+ * @brief Hold or respond to all pending RAI requests
+ * @param hmi_cooperating new state to be set
+ */
+ virtual void SetHMICooperating(const bool hmi_cooperating) = 0;
+
/**
* @brief Notifies all components interested in Vehicle Data update
* i.e. new value of odometer etc and returns list of applications
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 5b3dfc26df..02cd79aa8e 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -76,6 +76,7 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::vector<std::string>& time_out_promt() const = 0;
virtual const std::vector<std::string>& help_prompt() const = 0;
virtual const std::string& hmi_capabilities_file_name() const = 0;
+ virtual const std::string& hmi_capabilities_cache_file_name() const = 0;
virtual const std::string& video_server_type() const = 0;
virtual const std::string& audio_server_type() const = 0;
virtual const std::string& server_address() const = 0;
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index e10295b56f..56ac807d63 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -46,9 +46,8 @@ class ApplicationManager;
class HMICapabilities {
public:
- /*
+ /**
* @brief Class destructor
- *
*/
virtual ~HMICapabilities() {}
@@ -59,7 +58,7 @@ class HMICapabilities {
*/
virtual HMILanguageHandler& get_hmi_language_handler() = 0;
- /*
+ /**
* @brief Checks if image type(Static/Dynamic) requested by
* Mobile Device is supported on current HMI.
* @param image_type received type of image from Enum.
@@ -69,7 +68,6 @@ class HMICapabilities {
/**
* @brief Checks if all HMI capabilities received
- *
* @return TRUE if all information received, otherwise FALSE
*/
virtual bool is_vr_cooperating() const = 0;
@@ -90,417 +88,385 @@ class HMICapabilities {
virtual bool is_rc_cooperating() const = 0;
virtual void set_is_rc_cooperating(const bool value) = 0;
- /*
+ /**
* @brief Interface used to store information about software version of the
- *target
- *
+ * target
* @param ccpu_version Received system/hmi software version
*/
virtual void set_ccpu_version(const std::string& ccpu_version) = 0;
- /*
+ /**
* @brief Returns software version of the target
- *
* @return TRUE if it supported, otherwise FALSE
*/
virtual const std::string& ccpu_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
*/
virtual bool attenuated_supported() const = 0;
- /*
+ /**
* @brief Sets state for mixing audio
- *
* @param state New state to be set
*/
virtual void set_attenuated_supported(const bool state) = 0;
- /*
+ /**
* @brief Retrieves currently active UI language
- *
* @return Currently active UI language
*/
virtual const hmi_apis::Common_Language::eType active_ui_language() const = 0;
- /*
+ /**
* @brief Sets currently active UI language
- *
* @param language Currently active UI language
*/
virtual void set_active_ui_language(
const hmi_apis::Common_Language::eType language) = 0;
- /*
+ /**
* @brief Retrieves UI supported languages
- *
* @return Currently supported UI languages
*/
- virtual const smart_objects::SmartObject* ui_supported_languages() const = 0;
+ virtual const smart_objects::SmartObjectSPtr ui_supported_languages()
+ const = 0;
- /*
+ /**
* @brief Sets supported UI languages
- *
* @param supported_languages Supported UI languages
*/
virtual void set_ui_supported_languages(
const smart_objects::SmartObject& supported_languages) = 0;
- /*
+ /**
* @brief Retrieves currently active VR language
- *
* @return Currently active VR language
*/
virtual const hmi_apis::Common_Language::eType active_vr_language() const = 0;
- /*
+ /**
* @brief Sets currently active VR language
- *
* @param language Currently active VR language
*/
virtual void set_active_vr_language(
const hmi_apis::Common_Language::eType language) = 0;
- /*
+ /**
* @brief Retrieves VR supported languages
- *
* @return Currently supported VR languages
*/
- virtual const smart_objects::SmartObject* vr_supported_languages() const = 0;
+ virtual const smart_objects::SmartObjectSPtr vr_supported_languages()
+ const = 0;
- /*
+ /**
* @brief Sets supported VR languages
- *
* @param supported_languages Supported VR languages
*/
virtual void set_vr_supported_languages(
const smart_objects::SmartObject& supported_languages) = 0;
- /*
+ /**
* @brief Retrieves currently active TTS language
- *
* @return Currently active TTS language
*/
virtual const hmi_apis::Common_Language::eType active_tts_language()
const = 0;
- /*
+ /**
* @brief Sets currently active TTS language
- *
* @param language Currently active TTS language
*/
virtual void set_active_tts_language(
const hmi_apis::Common_Language::eType language) = 0;
- /*
+ /**
* @brief Retrieves TTS supported languages
- *
* @return Currently supported TTS languages
*/
- virtual const smart_objects::SmartObject* tts_supported_languages() const = 0;
+ virtual const smart_objects::SmartObjectSPtr tts_supported_languages()
+ const = 0;
- /*
+ /**
* @brief Sets supported TTS languages
- *
* @param supported_languages Supported TTS languages
*/
virtual void set_tts_supported_languages(
const smart_objects::SmartObject& supported_languages) = 0;
- /*
+ /**
* @brief Retrieves information about the display capabilities
- *
* @return Currently supported display capabilities
*/
virtual const smart_objects::SmartObjectSPtr display_capabilities() const = 0;
- /*
+ /**
* @brief Sets supported display capabilities
- *
* @param display_capabilities supported display capabilities
*/
virtual void set_display_capabilities(
const smart_objects::SmartObject& display_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the display capability
* @return Currently supported display capability
*/
virtual const smart_objects::SmartObjectSPtr system_display_capabilities()
const = 0;
- /*
+ /**
* @brief Sets supported display capability
* @param display_capabilities supported display capability
*/
virtual void set_system_display_capabilities(
const smart_objects::SmartObject& display_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the HMI zone capabilities
- *
* @return Currently supported HMI zone capabilities
*/
virtual const smart_objects::SmartObjectSPtr hmi_zone_capabilities()
const = 0;
- /*
+ /**
* @brief Sets supported HMI zone capabilities
- *
* @param hmi_zone_capabilities supported HMI zone capabilities
*/
virtual void set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the SoftButton's capabilities
- *
* @return Currently supported SoftButton's capabilities
*/
virtual const smart_objects::SmartObjectSPtr soft_button_capabilities()
const = 0;
- /*
+ /**
* @brief Sets supported SoftButton's capabilities
- *
* @param soft_button_capabilities supported SoftButton's capabilities
*/
virtual void set_soft_button_capabilities(
const smart_objects::SmartObject& soft_button_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the Button's capabilities
- *
* @return Currently supported Button's capabilities
*/
virtual const smart_objects::SmartObjectSPtr button_capabilities() const = 0;
- /*
+ /**
* @brief Sets supported Button's capabilities
- *
* @param soft_button_capabilities supported Button's capabilities
*/
virtual void set_button_capabilities(
const smart_objects::SmartObject& button_capabilities) = 0;
- /*
+ /**
* @brief Sets supported speech capabilities
- *
* @param speech_capabilities supported speech capabilities
*/
virtual void set_speech_capabilities(
const smart_objects::SmartObject& speech_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the speech capabilities
- *
* @return Currently supported speech capabilities
*/
virtual const smart_objects::SmartObjectSPtr speech_capabilities() const = 0;
- /*
+ /**
* @brief Sets supported VR capabilities
- *
* @param vr_capabilities supported VR capabilities
*/
virtual void set_vr_capabilities(
const smart_objects::SmartObject& vr_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the VR capabilities
- *
* @return Currently supported VR capabilities
*/
virtual const smart_objects::SmartObjectSPtr vr_capabilities() const = 0;
- /*
+ /**
* @brief Sets supported audio_pass_thru capabilities
- *
* @param vr_capabilities supported audio_pass_thru capabilities
*/
virtual void set_audio_pass_thru_capabilities(
const smart_objects::SmartObject& audio_pass_thru_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the audio_pass_thru capabilities
- *
* @return Currently supported audio_pass_thru capabilities
*/
virtual const smart_objects::SmartObjectSPtr audio_pass_thru_capabilities()
const = 0;
- /*
+ /**
* @brief Sets supported pcm_stream capabilities
- *
* @param supported pcm_stream capabilities
*/
virtual void set_pcm_stream_capabilities(
const smart_objects::SmartObject& pcm_stream_capabilities) = 0;
- /*
+ /**
* @brief Retrieves information about the pcm_stream capabilities
- *
* @return Currently supported pcm_streaming capabilities
*/
virtual const smart_objects::SmartObjectSPtr pcm_stream_capabilities()
const = 0;
- /*
+ /**
* @brief Retrieves information about the preset bank capabilities
- *
* @return Currently supported preset bank capabilities
*/
virtual const smart_objects::SmartObjectSPtr preset_bank_capabilities()
const = 0;
- /*
+ /**
* @brief Sets supported preset bank capabilities
- *
* @param soft_button_capabilities supported preset bank capabilities
*/
virtual void set_preset_bank_capabilities(
const smart_objects::SmartObject& preset_bank_capabilities) = 0;
- /*
+ /**
* @brief Sets vehicle information(make, model, modelYear)
- *
- * @param vehicle_type Cuurent vehicle information
+ * @param vehicle_type vehicle information
*/
virtual void set_vehicle_type(
const smart_objects::SmartObject& vehicle_type) = 0;
- /*
+ /**
* @brief Retrieves vehicle information(make, model, modelYear)
- *
- * @param vehicle_type Cuurent vehicle information
+ * @param vehicle_type Current vehicle information
*/
virtual const smart_objects::SmartObjectSPtr vehicle_type() const = 0;
- /*
+ /**
* @brief Retrieves information about the prerecorded speech
- *
* @return Currently supported prerecorded speech
*/
virtual const smart_objects::SmartObjectSPtr prerecorded_speech() const = 0;
- /*
+ /**
* @brief Sets supported prerecorded speech
- *
* @param prerecorded_speech supported prerecorded speech
*/
virtual void set_prerecorded_speech(
const smart_objects::SmartObject& prerecorded_speech) = 0;
- /*
+ /**
* @brief Interface used to store information if navigation
* supported by the system
- *
* @param supported Indicates if navigation supported by the system
*/
virtual void set_navigation_supported(const bool supported) = 0;
- /*
+ /**
* @brief Retrieves information if navi supported by the system
- *
* @return TRUE if it supported, otherwise FALSE
*/
virtual bool navigation_supported() const = 0;
- /*
+ /**
* @brief Interface used to store information if phone call
* supported by the system
- *
* @param supported Indicates if navigation supported by the sustem
*/
virtual void set_phone_call_supported(const bool supported) = 0;
- /*
+ /**
* @brief Retrieves information if phone call supported by the system
- *
* @return TRUE if it supported, otherwise FALSE
*/
virtual bool phone_call_supported() const = 0;
- /*
+ /**
* @brief Interface to store whether HMI supports video streaming
- *
* @param supported Indicates whether video streaming is supported by HMI
*/
virtual void set_video_streaming_supported(const bool supported) = 0;
- /*
+ /**
* @brief Retrieves whether HMI supports video streaming
- *
* @return TRUE if it supported, otherwise FALSE
*/
virtual bool video_streaming_supported() const = 0;
- /*
+ /**
* @brief Interface to store whether HMI supports remote control
- *
- * @param supported Indicates whether remote control is supported by HMI
+ * @param supported Indicates whether video streaming is supported by HMI
*/
virtual void set_rc_supported(const bool supported) = 0;
- /*
+ /**
* @brief Retrieves whether HMI supports remote control
- *
* @return TRUE if it supported, otherwise FALSE
*/
virtual bool rc_supported() const = 0;
/*
+ * @brief Interface to store whether HMI supports driver distraction menu
+ * limits
+ *
+ * @param supported Indicates whether driver distraction menu limits is
+ * supported by HMI
+ */
+ virtual void set_driver_distraction_supported(const bool supported) = 0;
+
+ /*
+ * @brief Retrieves whether HMI supports driver distraction menu limits
+ *
+ * @return TRUE if it supported, otherwise FALSE
+ */
+ virtual bool driver_distraction_supported() const = 0;
+
+ /*
* @brief Interface used to store information regarding
* the navigation "System Capability"
- *
* @param navigation_capability contains information related
* to the navigation system capability.
*/
virtual void set_navigation_capability(
const smart_objects::SmartObject& navigation_capability) = 0;
- /*
+ /**
* @brief Retrieves information regarding the navigation system capability
- *
* @return NAVIGATION system capability
*/
- virtual const smart_objects::SmartObject* navigation_capability() const = 0;
+ virtual const smart_objects::SmartObjectSPtr navigation_capability()
+ const = 0;
- /*
+ /**
* @brief Interface used to store information regarding
* the phone "System Capability"
- *
* @param phone_capability contains information related
* to the phone system capability.
*/
virtual void set_phone_capability(
const smart_objects::SmartObject& phone_capability) = 0;
- /*
+ /**
* @brief Retrieves information regarding the phone call system capability
- *
* @return PHONE_CALL system capability
*/
- virtual const smart_objects::SmartObject* phone_capability() const = 0;
+ virtual const smart_objects::SmartObjectSPtr phone_capability() const = 0;
- /*
+ /**
* @brief Sets HMI's video streaming related capability information
- *
* @param video_streaming_capability the video streaming related capabilities
*/
virtual void set_video_streaming_capability(
const smart_objects::SmartObject& video_streaming_capability) = 0;
- /*
+ /**
* @brief Retrieves HMI's video streaming related capabilities
- *
* @return HMI's video streaming related capability information
*/
- virtual const smart_objects::SmartObject* video_streaming_capability()
+ virtual const smart_objects::SmartObjectSPtr video_streaming_capability()
const = 0;
/**
@@ -510,7 +476,17 @@ class HMICapabilities {
virtual void set_rc_capability(
const smart_objects::SmartObject& rc_capability) = 0;
- virtual const smart_objects::SmartObject* rc_capability() const = 0;
+ /**
+ * @brief Retrieves information regarding the remote control capabilities
+ * @return RC capabilities
+ */
+ virtual const smart_objects::SmartObjectSPtr rc_capability() const = 0;
+
+ virtual void set_driver_distraction_capability(
+ const smart_objects::SmartObject& driver_distraction_capability) = 0;
+
+ virtual const smart_objects::SmartObjectSPtr driver_distraction_capability()
+ const = 0;
/**
* @brief Sets available SeatLocation capabilities for further usage by
@@ -525,7 +501,7 @@ class HMICapabilities {
* seat location capability
* @return smart object of seat location capability
*/
- virtual const smart_objects::SmartObject* seat_location_capability()
+ virtual const smart_objects::SmartObjectSPtr seat_location_capability()
const = 0;
DEPRECATED
@@ -540,35 +516,53 @@ class HMICapabilities {
virtual void set_handle_response_for(
const smart_objects::SmartObject& request) = 0;
- protected:
- /*
- * @brief function checks if json member exists
- *
- * @param json_member from file hmi_capabilities.json
- * @param name_of_member name which we should check
- * hmi_capabilities.json
- *
- * @returns TRUE if member exists and returns FALSE if
- * member does not exist.
+ /**
+ * @brief Writes cached HMI capabilities from internal cache into the file if
+ * any of updated sections are not present in the file
+ * @param interface_name name of interface to be updated
+ * @param sections_to_update vector of names of sections which were updated in
+ * cache
+ * @param schema reference to schema which should be unapplied before saving
+ * stringified JSON data into the file
+ * @return true if cache was saved successfully, otherwise returns false
+ */
+ virtual bool SaveCachedCapabilitiesToFile(
+ const std::string& interface_name,
+ const std::vector<std::string>& sections_to_update,
+ const smart_objects::CSmartSchema& schema) = 0;
+
+ /**
+ * @brief Deletes cached HMI capabilities file from a file system
*/
- virtual bool check_existing_json_member(const Json::Value& json_member,
- const char* name_of_member) const = 0;
+ virtual bool DeleteCachedCapabilitiesFile() const = 0;
- virtual void convert_json_languages_to_obj(
- const Json::Value& json_languages,
- smart_objects::SmartObject& languages) const = 0;
+ /**
+ * @brief Checks if request required for appropriate function id
+ * @param function_id function ID that required request to get appropriate hmi
+ * capabilities
+ * @return true if request required for capabilities, otherwise false
+ */
+ virtual bool IsRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType function_id) const = 0;
- /*
- * @brief function that converts a single entry of audio pass thru capability
- * to smart object
- *
- * @param capability json object that represents a single entry of audio pass
- * thru capability
- * @param output_so the converted object
+ /**
+ * @brief Update collection of requests that should be send to
+ * the HMI to get required HMI capabilities
+ * @param requested_interface function id
+ */
+ virtual void UpdateRequestsRequiredForCapabilities(
+ hmi_apis::FunctionID::eType requested_interface) = 0;
+
+ /**
+ * @brief Interface that update capabilities depending on ccpu_version
+ * @param ccpu_version Received system/hmi software version
+ */
+ virtual void OnSoftwareVersionReceived(const std::string& ccpu_version) = 0;
+
+ /**
+ * @brief Interface that update cached hmi capabilities
*/
- virtual void convert_audio_capability_to_obj(
- const Json::Value& capability,
- smart_objects::SmartObject& output_so) const = 0;
+ virtual void UpdateCachedCapabilities() = 0;
};
} // namespace application_manager
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 1c039d6a88..24d6db0d65 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -316,6 +316,12 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
virtual void OnSystemInfoChanged(const std::string& language) = 0;
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
+
+ /**
* @brief Save data from GetSystemInfo request to policy table
* @param ccpu_version CCPU version
* @param wers_country_code WERS country code
@@ -326,6 +332,12 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
const std::string& language) = 0;
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ virtual std::string GetCCPUVersionFromPT() const = 0;
+
+ /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() = 0;
diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h
index 123e11f2f0..2d2201a949 100644
--- a/src/components/include/media_manager/media_manager.h
+++ b/src/components/include/media_manager/media_manager.h
@@ -34,8 +34,10 @@
#define SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_H_
#include <string>
+#include "interfaces/MOBILE_API.h" // see discussion in sdl_core PR #2184
#include "media_manager/media_manager_settings.h"
#include "protocol/service_type.h"
+#include "utils/macro.h" // for "DEPRECATED"
namespace media_manager {
class MediaManager {
@@ -43,9 +45,17 @@ class MediaManager {
virtual void PlayA2DPSource(int32_t application_key) = 0;
virtual void StopA2DPSource(int32_t application_key) = 0;
- virtual void StartMicrophoneRecording(int32_t application_key,
- const std::string& outputFileName,
- int32_t duration) = 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,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType sampling_rate,
+ mobile_apis::BitsPerSample::eType bits_per_sample,
+ mobile_apis::AudioType::eType audio_type) = 0;
virtual void StopMicrophoneRecording(int32_t application_key) = 0;
virtual void StartStreaming(int32_t application_key,
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 02810038c3..184b3049f5 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -417,6 +417,12 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual void SetSystemLanguage(const std::string& language) = 0;
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
+
+ /**
* @brief Set data from GetSystemInfo response to policy table
* @param ccpu_version CCPU version
* @param wers_country_code WERS country code
@@ -427,6 +433,12 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ virtual std::string GetCCPUVersionFromPT() 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/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 99f38673ef..cc7fc1e1ce 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -408,6 +408,12 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual void SetSystemLanguage(const std::string& language) = 0;
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
+
+ /**
* @brief Set data from GetSystemInfo response to policy table
* @param ccpu_version CCPU version
* @param wers_country_code WERS country code
@@ -418,6 +424,12 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ virtual std::string GetCCPUVersionFromPT() 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/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index cd15caf7a5..ca72c18229 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -205,7 +205,8 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(BeginAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
- MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_METHOD0(OnHMIReady, void());
+ MOCK_METHOD0(RequestForInterfacesAvailability, void());
MOCK_METHOD1(DisconnectCloudApp,
void(application_manager::ApplicationSharedPtr app));
MOCK_METHOD0(RefreshCloudAppInformation, void());
@@ -215,6 +216,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(PolicyIDByIconUrl, std::string(const std::string url));
MOCK_METHOD1(SetIconFileFromSystemRequest, void(const std::string policy_id));
MOCK_CONST_METHOD0(IsHMICooperating, bool());
+ MOCK_METHOD1(SetHMICooperating, void(const bool hmi_cooperating));
MOCK_METHOD2(IviInfoUpdated,
void(const std::string& vehicle_info, int value));
MOCK_METHOD1(RegisterApplication,
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 1a68d663fe..9a70a374a7 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
@@ -82,6 +82,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(help_prompt, const std::vector<std::string>&());
MOCK_CONST_METHOD0(time_out_promt, const std::vector<std::string>&());
MOCK_CONST_METHOD0(hmi_capabilities_file_name, const std::string&());
+ MOCK_CONST_METHOD0(hmi_capabilities_cache_file_name, const std::string&());
MOCK_CONST_METHOD0(video_server_type, const std::string&());
MOCK_CONST_METHOD0(audio_server_type, const std::string&());
MOCK_CONST_METHOD0(server_address, const std::string&());
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 38c1cca69e..d52daa8fca 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
@@ -180,10 +180,12 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
std::string(const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id));
MOCK_METHOD1(OnSystemInfoChanged, void(const std::string& language));
+ MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD3(OnGetSystemInfo,
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
MOCK_METHOD0(OnVIIsReady, void());
MOCK_METHOD1(OnVehicleDataUpdated,
void(const smart_objects::SmartObject& message));
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 aa0baa5682..364c495236 100644
--- a/src/components/include/test/media_manager/mock_media_manager.h
+++ b/src/components/include/test/media_manager/mock_media_manager.h
@@ -47,6 +47,13 @@ class MockMediaManager : public media_manager::MediaManager {
void(int32_t application_key,
const std::string& outputFileName,
int32_t duration));
+ MOCK_METHOD6(StartMicrophoneRecording,
+ void(int32_t application_key,
+ const std::string& outputFileName,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType,
+ mobile_apis::BitsPerSample::eType,
+ mobile_apis::AudioType::eType));
MOCK_METHOD1(StopMicrophoneRecording, void(int32_t application_key));
MOCK_METHOD2(StartStreaming,
void(int32_t application_key,
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 c7a6e3d50a..61022035bc 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
@@ -202,10 +202,12 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(SetUserPermissionsForApp,
bool(const PermissionConsent& permissions,
bool* out_app_permissions_changed));
+ MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD3(SetMetaInfo,
bool(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_CONST_METHOD0(GetCCPUVersionFromPT, 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 bf092d38e8..28a895fa64 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(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
const std::string& application_id));
@@ -305,6 +306,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(OnSystemRequestReceived, void());
MOCK_METHOD0(RetrySequenceFailed, void());
MOCK_METHOD0(ResetTimeout, void());
+ MOCK_CONST_METHOD0(GetCCPUVersionFromPT, 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 d8e13b4b2e..97915884d7 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
@@ -176,10 +176,12 @@ class MockCacheManagerInterface : public CacheManagerInterface {
bool(const std::string& app_id, bool is_device_allowed));
MOCK_METHOD1(SetUserPermissionsForApp,
bool(const PermissionConsent& permissions));
+ MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD3(SetMetaInfo,
bool(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_CONST_METHOD0(GetCCPUVersionFromPT, 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 ac0fab4328..97f4504f71 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(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
const std::string& application_id));
@@ -308,6 +309,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
RequestSubType::State(const std::string& policy_app_id));
MOCK_METHOD0(ResetTimeout, void());
+ MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
};
} // namespace policy_manager_test
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index e209f7f90c..7c293ed858 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -79,6 +79,12 @@
</element>
</enum>
+<enum name="CapacityUnit">
+ <element name="LITERS" />
+ <element name="KILOWATTHOURS" />
+ <element name="KILOGRAMS" />
+</enum>
+
<enum name="PredefinedWindows">
<element name="DEFAULT_WINDOW" value="0">
<description>The default window is a main window pre-created on behalf of the app.</description>
@@ -856,14 +862,6 @@
</element>
</enum>
-<struct name="FuelRange">
- <param name="type" type="Common.FuelType" mandatory="false"/>
- <param name="range" type="Float" minvalue="0" maxvalue="10000" mandatory="false">
- <description>
- The estimate range in KM the vehicle can travel based on fuel level and consumption.
- </description>
- </param>
-</struct>
<enum name="ComponentVolumeStatus">
<description>The volume status of a vehicle component.</description>
@@ -887,6 +885,27 @@
</element>
</enum>
+<struct name="FuelRange">
+ <param name="type" type="Common.FuelType" mandatory="false"/>
+ <param name="range" type="Float" minvalue="0" maxvalue="10000" mandatory="false">
+ <description>
+ The estimate range in KM the vehicle can travel based on fuel level and consumption.
+ </description>
+ </param>
+ <param name="level" type="Float" minvalue="-6" maxvalue="1000000" mandatory="false">
+ <description>The relative remaining capacity of this fuel type (percentage).</description>
+ </param>
+ <param name="levelState" type="Common.ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="capacity" type="Float" minvalue="0" maxvalue="1000000" mandatory="false">
+ <description>The absolute capacity of this fuel type.</description>
+ </param>
+ <param name="capacityUnit" type="Common.CapacityUnit" mandatory="false">
+ <description>The unit of the capacity of this fuel type such as liters for gasoline or kWh for batteries.</description>
+ </param>
+</struct>
+
<enum name="TPMS">
<element name="UNKNOWN">
<description>If set the status of the tire is not known.</description>
@@ -926,6 +945,7 @@
<description>No gear</description>
</element>
<element name="DRIVE">
+ <description>Regular Drive mode</description>
</element>
<element name="SPORT">
<description>Drive Sport mode</description>
@@ -949,12 +969,44 @@
</element>
<element name="EIGHTH">
</element>
+ <element name="NINTH">
+ </element>
+ <element name="TENTH">
+ </element>
<element name="UNKNOWN">
</element>
<element name="FAULT">
</element>
</enum>
+<enum name="TransmissionType">
+ <description>Type of transmission used in the vehicle.</description>
+ <element name="MANUAL">
+ <description>Manual transmission.</description>
+ </element>
+ <element name="AUTOMATIC">
+ <description>Automatic transmission.</description>
+ </element>
+ <element name="SEMI_AUTOMATIC">
+ <description>Semi automatic transmission.</description>
+ </element>
+ <element name="DUAL_CLUTCH">
+ <description>Dual clutch transmission.</description>
+ </element>
+ <element name="CONTINUOUSLY_VARIABLE">
+ <description>Continuously variable transmission(CVT).</description>
+ </element>
+ <element name="INFINITELY_VARIABLE">
+ <description>Infinitely variable transmission.</description>
+ </element>
+ <element name="ELECTRIC_VARIABLE">
+ <description>Electric variable transmission.</description>
+ </element>
+ <element name="DIRECT_DRIVE">
+ <description>Direct drive between engine and wheels.</description>
+ </element>
+</enum>
+
<enum name="VehicleDataEventStatus">
<description>Reflects the status of a vehicle data event; e.g. a seat belt event status.</description>
<element name="NO_EVENT" internal_name="VDES_NO_EVENT">
@@ -1138,6 +1190,7 @@
<element name="VEHICLEDATA_FUELCONSUMPTION" />
<element name="VEHICLEDATA_EXTERNTEMP" />
<element name="VEHICLEDATA_VIN" />
+ <element name="VEHICLEDATA_GEARSTATUS" />
<element name="VEHICLEDATA_PRNDL" />
<element name="VEHICLEDATA_TIREPRESSURE" />
<element name="VEHICLEDATA_ODOMETER" />
@@ -1162,6 +1215,9 @@
<element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" />
<element name="VEHICLEDATA_CLOUDAPPVEHICLEID" />
<element name="VEHICLEDATA_OEM_CUSTOM_DATA" />
+ <element name="VEHICLEDATA_STABILITYCONTROLSSTATUS" />
+ <element name="VEHICLEDATA_WINDOWSTATUS"/>
+ <element name="VEHICLEDATA_HANDSOFFSTEERING"/>
</enum>
<enum name="WiperStatus">
@@ -1682,6 +1738,21 @@
</param>
</struct>
+<struct name="WindowState">
+ <param name="approximatePosition" type="Integer" minvalue="0" maxvalue="100" mandatory="true">
+ <description>The approximate percentage that the window is open - 0 being fully closed, 100 being fully open</description>
+ </param>
+ <param name="deviation" type="Integer" minvalue="0" maxvalue="100" mandatory="true">
+ <description>The percentage deviation of the approximatePosition. e.g. If the approximatePosition is 50 and the deviation is 10, then the window's location is somewhere between 40 and 60.</description>
+ </param>
+</struct>
+
+<struct name="WindowStatus">
+ <description>Describes the status of a window of a door/liftgate etc.</description>
+ <param name="location" type="Common.Grid" mandatory="true"/>
+ <param name="state" type="Common.WindowState" mandatory="true"/>
+</struct>
+
<struct name="ModuleInfo">
<description>Information about a RC module</description>
<param name="moduleId" type="String" maxlength="100" mandatory="true">
@@ -2830,7 +2901,7 @@
<struct name="MenuParams">
<param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
<description>unique ID of the sub menu, the command must be added to.</description>
- <description>If not provided, the command must be added to the top level of the in application menu.</description>
+ <description>If not provided or 0, the command must be added to the top level of the in application menu.</description>
</param>
<param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
<description>Position within the items that are at the top level of the in application menu.</description>
@@ -3234,6 +3305,15 @@
</param>
</struct>
+<struct name="StabilityControlsStatus">
+ <param name="escSystem" type="Common.VehicleDataStatus" mandatory="false">
+ <description>true if vehicle stability control is ON, else false</description>
+ </param>
+ <param name="trailerSwayControl" type="Common.VehicleDataStatus" mandatory="false">
+ <description>true if vehicle trailer sway control is ON, else false</description>
+ </param>
+</struct>
+
<struct name="BodyInformation">
<param name="parkBrakeActive" type="Boolean" mandatory="true">
<description>Must be true if the park brake is active</description>
@@ -3570,6 +3650,15 @@
</param>
</struct>
+ <struct name="DriverDistractionCapability">
+ <param name="menuLength" type="Integer" mandatory="false">
+ <description>The number of items allowed in a Choice Set or Command menu while the driver is distracted</description>
+ </param>
+ <param name="subMenuDepth" type="Integer" minvalue="1" mandatory="false">
+ <description>The depth of submenus allowed when the driver is distracted. e.g. 3 == top level menu -> submenu -> submenu; 1 == top level menu only</description>
+ </param>
+ </struct>
+
<struct name="SystemCapabilities">
<param name="navigationCapability" type="NavigationCapability" mandatory="false">
</param>
@@ -3577,6 +3666,9 @@
</param>
<param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
</param>
+ <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false">
+ <description>Describes capabilities when the driver is distracted</description>
+ </param>
</struct>
<struct name="RemoteControlCapabilities">
@@ -4102,6 +4194,7 @@
<element name="APP_SERVICES" />
<element name="SEAT_LOCATION"/>
<element name="DISPLAYS"/>
+ <element name="DRIVER_DISTRACTION" />
</enum>
<struct name="SystemCapability">
@@ -4135,6 +4228,9 @@
<param name="seatLocationCapability" type="SeatLocationCapability" mandatory="false">
<description>Contains information about the locations of each seat</description>
</param>
+ <param name="driverDistractionCapability" type="DriverDistractionCapability" mandatory="false" since="6.0">
+ <description>Describes capabilities when the driver is distracted</description>
+ </param>
</struct>
<enum name="HybridAppPreference">
@@ -4172,6 +4268,18 @@
</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>
+ </param>
+ <param name="actualGear" type="Common.PRNDL" mandatory="false">
+ <description>Actual Gear in use by the transmission</description>
+ </param>
+ <param name="transmissionType" type="Common.TransmissionType" mandatory="false">
+ <description>Tells the transmission type</description>
+ </param>
+ </struct>
+
</interface>
<interface name="Buttons" version="1.3.0" date="2017-07-18">
@@ -4217,10 +4325,9 @@
</param>
<param name="appID" type="Integer" mandatory="false">
<description>
- In case the ButtonName is CUSTOM_BUTTON or OK, HMI must include appID parameters to OnButtonPress notification sent to SDL.
If appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
If appID is present for OK button -> SDL transfers notification to the named app only if it is in FULL or LIMITED (ignores if app is in NONE or BACKGROUND).
- If appID is omited for OK button -> SDL transfers notification to app in FULL
+ If appID is omitted for OK button -> SDL transfers notification to app in FULL
</description>
</param>
</function>
@@ -4234,10 +4341,9 @@
</param>
<param name="appID" type="Integer" mandatory="false">
<description>
- In case the ButtonName is CUSTOM_BUTTON or OK, HMI must include appID parameters to OnButtonEvent notification sent to SDL.
If appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
If appID is present for OK button -> SDL transfers notification to the named app only if it is in FULL or LIMITED (ignores if app is in NONE or BACKGROUND).
- If appID is omited for OK button -> SDL transfers notification to app in FULL
+ If appID is omitted for OK button -> SDL transfers notification to app in FULL
</description>
</param>
</function>
@@ -4494,7 +4600,7 @@
This parameter is filled for supporting OEM proprietary data exchanges.
</description>
</param>
- <param name="url" type="String" maxlength="1000" minlength="1" mandatory="false">
+ <param name="url" type="String" minlength="1" mandatory="false">
<description>Optional array of URL(s) for HTTP requests.</description>
</param>
<param name="fileType" type="Common.FileType" mandatory="false">
@@ -5253,7 +5359,7 @@
<description>ID of the sub menu to be added. Unique for the application.</description>
</param>
<param name="menuParams" type="Common.MenuParams" mandatory="true">
- <description>Position and name of menu to be added. 'parent' field is omitted for this RPC. </description>
+ <description>Position, parentID, and name of menu to be added.</description>
</param>
<param name="menuIcon" type="Common.Image" mandatory="false">
<description>The image field for AddSubMenu</description>
@@ -5457,6 +5563,7 @@
<param name="systemCapabilities" type="Common.SystemCapabilities" mandatory="false">
<description>Specifies system capabilities. See SystemCapabilities</description>
</param>
+ <param name="pcmStreamCapabilities" type="Common.AudioPassThruCapabilities" mandatory="false"/>
</function>
<function name="ChangeRegistration" messagetype="request">
<description>Request from SmartDeviceLink to HMI to change language for app.</description>
@@ -5817,7 +5924,7 @@
</function>
<function name="StartStream" messagetype="request">
<description>Request from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
- <param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
+ <param name="url" type="String" minlength="21" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
<param name="appID" type="Integer" mandatory="true">
@@ -5836,7 +5943,7 @@
</function>
<function name="StartAudioStream" messagetype="request">
<description>Request from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
- <param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
+ <param name="url" type="String" minlength="21" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
<param name="appID" type="Integer" mandatory="true">
@@ -6002,16 +6109,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Boolean" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -6019,8 +6129,11 @@
<param name="turnSignal" type="Boolean" mandatory="false">
<description>See TurnSignal</description>
</param>
+ <param name="gearStatus" type="Boolean" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Boolean" mandatory="false">
<description>See TireStatus</description>
@@ -6064,6 +6177,15 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Boolean" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Boolean" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Boolean" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6095,16 +6217,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Common.VehicleDataResult" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
<description>The external temperature in degrees celsius.</description>
@@ -6112,8 +6237,11 @@
<param name="turnSignal" type="Common.VehicleDataResult" mandatory="false">
<description>See TurnSignal</description>
</param>
+ <param name="gearStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Common.VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
<description>See TireStatus</description>
@@ -6157,6 +6285,15 @@
<param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Common.VehicleDataResult" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
@@ -6191,16 +6328,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Boolean" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius.</description>
@@ -6208,8 +6348,11 @@
<param name="turnSignal" type="Boolean" mandatory="false">
<description>See TurnSignal</description>
</param>
+ <param name="gearStatus" type="Boolean" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Boolean" mandatory="false">
<description>See TireStatus</description>
@@ -6253,6 +6396,15 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Boolean" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Boolean" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Boolean" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6284,16 +6436,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Common.VehicleDataResult" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -6301,8 +6456,11 @@
<param name="turnSignal" type="Common.VehicleDataResult" mandatory="false">
<description>See TurnSignal</description>
</param>
+ <param name="gearStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Common.VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
<description>See TireStatus</description>
@@ -6346,6 +6504,15 @@
<param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Common.VehicleDataResult" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
@@ -6378,16 +6545,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Boolean" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -6398,8 +6568,11 @@
<param name="vin" type="Boolean" mandatory="false">
<description>Vehicle identification number</description>
</param>
+ <param name="gearStatus" type="Boolean" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Boolean" mandatory="false">
<description>See TireStatus</description>
@@ -6443,6 +6616,15 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Boolean" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Boolean" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Boolean" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
@@ -6474,16 +6656,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Common.FuelRange" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -6494,8 +6679,11 @@
<param name="vin" type="String" maxlength="17" mandatory="false">
<description>Vehicle identification number</description>
</param>
+ <param name="gearStatus" type="Common.GearStatus" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Common.PRNDL" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Common.TireStatus" mandatory="false">
<description>See TireStatus</description>
@@ -6539,6 +6727,15 @@
<param name="cloudAppVehicleID" type="String" mandatory="false">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
+ <param name="stabilityControlsStatus" type="Common.StabilityControlsStatus" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Common.WindowStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Boolean" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
@@ -6571,16 +6768,19 @@
<description>The number of revolutions per minute of the engine</description>
</param>
<param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
+ <description>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
+ <description>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please see fuelRange</description>
</param>
<param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Common.FuelRange" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>
+ The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the vehicle.
+ See struct FuelRange for details.
+ </description>
</param>
<param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -6591,8 +6791,11 @@
<param name="vin" type="String" maxlength="17" mandatory="false">
<description>Vehicle identification number.</description>
</param>
+ <param name="gearStatus" type="Common.GearStatus" mandatory="false">
+ <description>See GearStatus</description>
+ </param>
<param name="prndl" type="Common.PRNDL" mandatory="false">
- <description>See PRNDL</description>
+ <description>See PRNDL. This parameter is deprecated and it is now covered in `gearStatus`</description>
</param>
<param name="tirePressure" type="Common.TireStatus" mandatory="false">
<description>See TireStatus</description>
@@ -6636,6 +6839,15 @@
<param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="stabilityControlsStatus" type="Common.StabilityControlsStatus" mandatory="false">
+ <description>See StabilityControlsStatus</description>
+ </param>
+ <param name="windowStatus" type="Common.WindowStatus" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>See WindowStatus</description>
+ </param>
+ <param name="handsOffSteering" type="Boolean" mandatory="false">
+ <description>To indicate whether driver hands are off the steering wheel</description>
+ </param>
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
diff --git a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
index cb0ea8aa11..1999da987f 100644
--- a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
+++ b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
@@ -46,22 +46,6 @@ class ApplicationManager;
namespace media_manager {
-typedef enum {
- SR_INVALID = -1,
- SR_8KHZ = 0,
- SR_16KHZ = 1,
- SR_22KHZ = 2,
- SR_44KHZ = 3
-} SamplingRate;
-
-typedef enum {
- ACQ_INVALID = -1,
- ACQ_8_BIT = 0,
- ACQ_16_BIT = 1
-} AudioCaptureQuality;
-
-typedef enum { AT_INVALID = -1, AT_PCM = 0 } AudioType;
-
// AudioPassThru
typedef struct {
std::vector<uint8_t> binary_data;
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 7daf9c7add..9e0a8b5123 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
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FROM_MIC_RECORDER_ADAPTER_H_
#include <string>
+#include "interfaces/MOBILE_API.h"
#include "media_manager/media_adapter_impl.h"
namespace threads {
@@ -52,12 +53,19 @@ 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);
- void set_duration(int32_t duration);
+ 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,
+ int32_t duration);
private:
threads::Thread* recorder_thread_;
std::string output_file_;
const int32_t kDefaultDuration;
+ mobile_apis::SamplingRate::eType sampling_rate_;
+ mobile_apis::BitsPerSample::eType bits_per_sample_;
+ mobile_apis::AudioType::eType audio_type_;
int32_t duration_;
DISALLOW_COPY_AND_ASSIGN(FromMicRecorderAdapter);
};
diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h b/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
index e6b54cc487..89c298f280 100644
--- a/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
+++ b/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
@@ -37,6 +37,7 @@
#include <net/if.h>
#include <string>
+#include "interfaces/MOBILE_API.h"
#include "utils/lock.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
@@ -45,7 +46,15 @@ namespace media_manager {
class FromMicToFileRecorderThread : public threads::ThreadDelegate {
public:
- FromMicToFileRecorderThread(const std::string& output_file, int32_t duration);
+ FromMicToFileRecorderThread(
+ const std::string& output_file,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType sampling_rate =
+ mobile_apis::SamplingRate::INVALID_ENUM,
+ mobile_apis::BitsPerSample::eType bits_per_sample =
+ mobile_apis::BitsPerSample::INVALID_ENUM,
+ mobile_apis::AudioType::eType audio_type =
+ mobile_apis::AudioType::INVALID_ENUM);
~FromMicToFileRecorderThread();
void threadMain();
@@ -67,6 +76,8 @@ class FromMicToFileRecorderThread : public threads::ThreadDelegate {
sync_primitives::Lock stopFlagLock_;
std::string outputFileName_, durationString_;
+ mobile_apis::SamplingRate::eType samplingRate_;
+ mobile_apis::BitsPerSample::eType bitsPerSample_;
typedef struct {
GstElement* pipeline;
@@ -77,6 +88,10 @@ class FromMicToFileRecorderThread : public threads::ThreadDelegate {
void deinitArgs();
void psleep(void* timeout);
+ // create_caps_string() creates a string which is fed to capsfilter's "caps"
+ // property. The string specifies audio format. example:
+ // "audio/x-raw,format=(string)S16LE,rate=44100,channels=1"
+ std::string create_caps_string();
class SleepThreadDelegate : public threads::ThreadDelegate {
public:
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 408fa12655..3e24212ed5 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
@@ -36,6 +36,7 @@
#include <chrono>
#include <map>
#include <string>
+#include "interfaces/MOBILE_API.h"
#include "media_manager/media_adapter_impl.h"
#include "media_manager/media_adapter_listener.h"
#include "media_manager/media_manager.h"
@@ -62,9 +63,17 @@ class MediaManagerImpl : public MediaManager,
virtual void PlayA2DPSource(int32_t application_key);
virtual void StopA2DPSource(int32_t application_key);
- virtual void StartMicrophoneRecording(int32_t application_key,
- const std::string& outputFileName,
- int32_t duration);
+ 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,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType sampling_rate,
+ mobile_apis::BitsPerSample::eType bits_per_sample,
+ mobile_apis::AudioType::eType audio_type);
virtual void StopMicrophoneRecording(int32_t application_key);
virtual void StartStreaming(int32_t application_key,
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 e55efed4ce..2575643422 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
@@ -32,6 +32,7 @@
#include "media_manager/audio/from_mic_recorder_adapter.h"
#include <string>
+#include "interfaces/MOBILE_API.h"
#include "media_manager/audio/from_mic_to_file_recorder_thread.h"
#include "utils/logger.h"
#include "utils/threads/thread.h"
@@ -44,6 +45,9 @@ FromMicRecorderAdapter::FromMicRecorderAdapter()
: recorder_thread_(NULL)
, output_file_("default_recorded_audio.wav")
, kDefaultDuration(1000)
+ , sampling_rate_(mobile_apis::SamplingRate::INVALID_ENUM)
+ , bits_per_sample_(mobile_apis::BitsPerSample::INVALID_ENUM)
+ , audio_type_(mobile_apis::AudioType::INVALID_ENUM)
, duration_(kDefaultDuration) {}
FromMicRecorderAdapter::~FromMicRecorderAdapter() {
@@ -66,7 +70,11 @@ void FromMicRecorderAdapter::StartActivity(int32_t application_key) {
// Todd: No gstreamer recorder thread
if (!recorder_thread_) {
FromMicToFileRecorderThread* thread_delegate =
- new FromMicToFileRecorderThread(output_file_, duration_);
+ new FromMicToFileRecorderThread(output_file_,
+ duration_,
+ sampling_rate_,
+ bits_per_sample_,
+ audio_type_);
recorder_thread_ = threads::CreateThread("MicrophoneRec", thread_delegate);
}
@@ -107,4 +115,15 @@ 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,
+ mobile_apis::AudioType::eType audio_type,
+ int32_t duration) {
+ sampling_rate_ = sampling_rate;
+ bits_per_sample_ = bits_per_sample;
+ audio_type_ = audio_type;
+ duration_ = duration;
+}
+
} // namespace media_manager
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 a34bdd3f09..877722fd70 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
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <cstring>
#include <sstream>
+#include "interfaces/MOBILE_API.h"
#include "utils/logger.h"
namespace media_manager {
@@ -46,16 +47,23 @@ GMainLoop* FromMicToFileRecorderThread::loop = NULL;
static const int kNumAudioChannels = 1;
FromMicToFileRecorderThread::FromMicToFileRecorderThread(
- const std::string& output_file, int32_t duration)
+ const std::string& output_file,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType sampling_rate,
+ mobile_apis::BitsPerSample::eType bits_per_sample,
+ mobile_apis::AudioType::eType audio_type)
: threads::ThreadDelegate()
, argc_(5)
, argv_(NULL)
, oKey_("-o")
, tKey_("-t")
, sleepThread_(NULL)
- , outputFileName_(output_file) {
+ , outputFileName_(output_file)
+ , samplingRate_(sampling_rate)
+ , bitsPerSample_(bits_per_sample) {
LOG4CXX_AUTO_TRACE(logger_);
set_record_duration(duration);
+ // audio_type is not used as we always employ LPCM
}
FromMicToFileRecorderThread::~FromMicToFileRecorderThread() {
@@ -205,9 +213,11 @@ void FromMicToFileRecorderThread::threadMain() {
wavenc = gst_element_factory_make("wavenc", "wavenc0");
filesink = gst_element_factory_make("filesink", "filesink0");
- // create a capability to downmix the recorded audio to monaural
- audiocaps = gst_caps_new_simple(
- "audio/x-raw", "channels", G_TYPE_INT, kNumAudioChannels, NULL);
+ // Create a capability to specify audio format. It also downmixes the recorded
+ // audio to monaural.
+ std::string caps_string = create_caps_string();
+ LOG4CXX_DEBUG(logger_, "Using audio caps: " << caps_string);
+ audiocaps = gst_caps_from_string(caps_string.c_str());
// Assert that all the elements were created
if (!alsasrc || !audioconvert || !capsfilter || !wavenc || !filesink ||
@@ -285,6 +295,49 @@ void FromMicToFileRecorderThread::threadMain() {
loop = NULL;
}
+std::string FromMicToFileRecorderThread::create_caps_string() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::stringstream ss;
+ ss << "audio/x-raw";
+
+ switch (bitsPerSample_) {
+ case mobile_apis::BitsPerSample::BitsPerSample_8_BIT:
+ // format is 8-bit unsigned
+ ss << ",format=(string)U8";
+ break;
+ case mobile_apis::BitsPerSample::BitsPerSample_16_BIT:
+ // format is 16-bit signed, in little endian
+ ss << ",format=(string)S16LE";
+ break;
+ default:
+ // do not specify the format; use system default
+ break;
+ }
+
+ switch (samplingRate_) {
+ case mobile_apis::SamplingRate::SamplingRate_8KHZ:
+ ss << ",rate=8000";
+ break;
+ case mobile_apis::SamplingRate::SamplingRate_16KHZ:
+ ss << ",rate=16000";
+ break;
+ case mobile_apis::SamplingRate::SamplingRate_22KHZ:
+ ss << ",rate=22050";
+ break;
+ case mobile_apis::SamplingRate::SamplingRate_44KHZ:
+ ss << ",rate=44100";
+ break;
+ default:
+ // do not specify the sampling rate; use system default
+ break;
+ }
+
+ ss << ",channels=" << kNumAudioChannels;
+
+ return ss.str();
+}
+
FromMicToFileRecorderThread::SleepThreadDelegate::SleepThreadDelegate(
GstTimeout timeout)
: threads::ThreadDelegate(), timeout_(timeout) {}
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index b04381605d..d7352d0025 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -36,6 +36,7 @@
#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"
@@ -208,6 +209,21 @@ void MediaManagerImpl::StopA2DPSource(int32_t application_key) {
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,
+ int32_t duration,
+ mobile_apis::SamplingRate::eType sampling_rate,
+ mobile_apis::BitsPerSample::eType bits_per_sample,
+ mobile_apis::AudioType::eType audio_type) {
LOG4CXX_INFO(logger_,
"MediaManagerImpl::StartMicrophoneRecording to " << output_file);
application_manager::ApplicationSharedPtr app =
@@ -223,7 +239,7 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key,
(static_cast<FromMicRecorderAdapter*>(from_mic_recorder_))
->set_output_file(file_path);
(static_cast<FromMicRecorderAdapter*>(from_mic_recorder_))
- ->set_duration(duration);
+ ->set_config(sampling_rate, bits_per_sample, audio_type, duration);
from_mic_recorder_->StartActivity(application_key);
}
#else
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 627e2f57ed..3b4e6f6150 100644
--- a/src/components/media_manager/test/media_manager_impl_test.cc
+++ b/src/components/media_manager/test/media_manager_impl_test.cc
@@ -331,7 +331,12 @@ TEST_F(MediaManagerImplTest,
EXPECT_EQ(data[i], result[i]);
}
media_manager_impl_->StartMicrophoneRecording(
- kApplicationKey, kOutputFile, kDuration);
+ kApplicationKey,
+ kOutputFile,
+ kDuration,
+ mobile_apis::SamplingRate::SamplingRate_8KHZ,
+ mobile_apis::BitsPerSample::BitsPerSample_8_BIT,
+ mobile_apis::AudioType::PCM);
EXPECT_TRUE(RemoveDirectory(kResourceFolder, true));
EXPECT_TRUE(RemoveDirectory(kStorageFolder, true));
}
@@ -342,7 +347,12 @@ TEST_F(MediaManagerImplTest,
media_manager_impl_->set_mock_mic_listener(media_adapter_listener_mock_);
EXPECT_FALSE(FileExists(kOutputFilePath));
media_manager_impl_->StartMicrophoneRecording(
- kApplicationKey, kOutputFile, kDuration);
+ kApplicationKey,
+ kOutputFile,
+ kDuration,
+ mobile_apis::SamplingRate::SamplingRate_8KHZ,
+ mobile_apis::BitsPerSample::BitsPerSample_8_BIT,
+ mobile_apis::AudioType::PCM);
}
TEST_F(MediaManagerImplTest,
@@ -358,7 +368,12 @@ TEST_F(MediaManagerImplTest,
media_manager_impl_->set_mock_mic_listener(media_adapter_listener_mock_);
EXPECT_TRUE(FileExists(kOutputFilePath));
media_manager_impl_->StartMicrophoneRecording(
- kApplicationKey, kOutputFile, kDuration);
+ kApplicationKey,
+ kOutputFile,
+ kDuration,
+ mobile_apis::SamplingRate::SamplingRate_8KHZ,
+ mobile_apis::BitsPerSample::BitsPerSample_8_BIT,
+ mobile_apis::AudioType::PCM);
chmod(kOutputFilePath.c_str(), S_IWUSR);
EXPECT_TRUE(RemoveDirectory(kStorageFolder, true));
}
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 b826f4e5ce..36dd6d7259 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -597,6 +597,12 @@ class CacheManager : public CacheManagerInterface {
bool* out_app_permissions_changed);
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
+
+ /**
* @brief Records information about head unit system to PT
* @return bool Success of operation
*/
@@ -605,6 +611,12 @@ class CacheManager : public CacheManagerInterface {
const std::string& language);
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ std::string GetCCPUVersionFromPT() const;
+
+ /**
* @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 3e3de694d6..44df1f36a5 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
@@ -638,6 +638,12 @@ class CacheManagerInterface {
bool* out_app_permissions_changed) = 0;
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
+
+ /**
* @brief Records information about head unit system to PT
* @return bool Success of operation
*/
@@ -646,6 +652,12 @@ class CacheManagerInterface {
const std::string& language) = 0;
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ virtual std::string GetCCPUVersionFromPT() 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 5c55be50d1..04fac53885 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,6 +435,10 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
+
+ std::string GetCCPUVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
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 11c76bdd68..6e6fd1afb8 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
@@ -485,7 +485,7 @@ struct ConsumerFriendlyMessages : CompositeType {
struct ModuleMeta : CompositeType {
public:
- Optional<String<0, 250> > ccpu_version;
+ Optional<String<0, 500> > ccpu_version;
Optional<String<0, 250> > language;
Optional<String<0, 250> > wers_country_code;
Optional<Integer<uint32_t, 0, ODO_MAX> > pt_exchanged_at_odometer_x;
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 af7effd97f..7446d3acae 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
@@ -40,6 +40,7 @@
<element name="beltStatus" />
<element name="electronicParkBrakeStatus" />
<element name="driverBraking" />
+ <element name="gearStatus" />
<element name="prndl" />
<element name="rpm" />
<element name="steeringWheelAngle" />
@@ -50,6 +51,7 @@
<element name="clusterModeStatus" />
<element name="deviceStatus" />
<element name="emergencyEvent" />
+ <element name="stabilityControlsStatus" />
<element name="eCallInfo" />
<element name="abs_State" />
<element name="turnSignal" />
@@ -57,6 +59,7 @@
<element name="tirePressureValue" />
<element name="tpms" />
<element name="cloudAppVehicleID" />
+ <element name="handsOffSteering" />
</enum>
<enum name="AppHMIType">
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index d8819b6bad..40c216a720 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -2275,6 +2275,12 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
return result;
}
+void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ *pt_->policy_table.module_config.preloaded_pt = is_preloaded;
+ Backup();
+}
+
bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
@@ -2293,6 +2299,13 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
return true;
}
+std::string CacheManager::GetCCPUVersionFromPT() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc::Optional<policy_table::ModuleMeta>& module_meta =
+ pt_->policy_table.module_meta;
+ return *(module_meta->ccpu_version);
+}
+
bool CacheManager::IsMetaInfoPresent() const {
CACHE_MANAGER_CHECK(false);
bool result = 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 12ab1224fd..f057e21617 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -1623,6 +1623,11 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {
cache_->SetSystemLanguage(language);
}
+void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ cache_->SetPreloadedPtFlag(is_preloaded);
+}
+
void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
@@ -1630,6 +1635,11 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
+std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->GetCCPUVersionFromPT();
+}
+
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) const {
LOG4CXX_AUTO_TRACE(logger_);
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 909fd2cb2f..dec76dd96c 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
@@ -2056,7 +2056,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"OnVehicleData" :
@@ -2071,7 +2072,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"SubscribeVehicleData" :
@@ -2086,7 +2088,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"UnsubscribeVehicleData" :
@@ -2101,7 +2104,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
}
},
@@ -2325,7 +2329,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"OnVehicleData" :
@@ -2348,7 +2353,8 @@
"odometer",
"tirePressure",
"vin",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"SubscribeVehicleData" :
@@ -2370,7 +2376,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
},
"UnsubscribeVehicleData" :
@@ -2392,7 +2399,8 @@
"cloudAppVehicleID",
"odometer",
"tirePressure",
- "wiperStatus"
+ "wiperStatus",
+ "stabilityControlsStatus"
]
}
},
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 3260558e70..85693ff515 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
@@ -2056,7 +2056,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"OnVehicleData" :
@@ -2071,7 +2072,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"SubscribeVehicleData" :
@@ -2086,7 +2088,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"UnsubscribeVehicleData" :
@@ -2101,7 +2104,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
}
},
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 00f0adab06..053d4dc807 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -544,6 +544,12 @@ class CacheManager : public CacheManagerInterface {
bool SetUserPermissionsForApp(const PermissionConsent& permissions);
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
+
+ /**
* @brief Records information about head unit system to PT
* @return bool Success of operation
*/
@@ -552,6 +558,12 @@ class CacheManager : public CacheManagerInterface {
const std::string& language);
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ std::string GetCCPUVersionFromPT() const;
+
+ /**
* @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 fc1a6337aa..f161724671 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
@@ -579,6 +579,12 @@ class CacheManagerInterface {
const PermissionConsent& permissions) = 0;
/**
+ * @brief Set preloaded_pt flag value in policy table
+ * @param is_preloaded value to set
+ */
+ virtual void SetPreloadedPtFlag(const bool is_preloaded) = 0;
+
+ /**
* @brief Records information about head unit system to PT
* @return bool Success of operation
*/
@@ -587,6 +593,12 @@ class CacheManagerInterface {
const std::string& language) = 0;
/**
+ * @brief Get information about last ccpu_version from PT
+ * @return ccpu_version from PT
+ */
+ virtual std::string GetCCPUVersionFromPT() 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 aa77019613..1b87e58310 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,6 +451,10 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
+
+ std::string GetCCPUVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
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 2ffbf2e7ec..1c6442501f 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
@@ -427,6 +427,7 @@ struct ModuleMeta : CompositeType {
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;
+ Optional<String<0, 500> > ccpu_version;
public:
ModuleMeta();
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 467fb4641f..895b4ea6b5 100644
--- a/src/components/policy/policy_regular/include/policy/pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/pt_representation.h
@@ -152,6 +152,12 @@ class PTRepresentation {
virtual EndpointUrls GetUpdateUrls(int service_type) = 0;
/**
+ * @brief Records information about head unit system to PT
+ * @return bool Success of operation
+ */
+ virtual bool SetMetaInfo(const std::string& ccpu_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 315c30b995..0b0ae11f3f 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
@@ -142,6 +142,7 @@ extern const std::string kSelectDBVersion;
extern const std::string kUpdateDBVersion;
extern const std::string kSaveModuleMeta;
extern const std::string kSelectModuleMeta;
+extern const std::string kUpdateMetaParams;
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 1bb74e028c..eeeaeed2cd 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,7 @@ 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);
#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 28ceec3ccb..75f0e72113 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -1346,6 +1346,8 @@ void CacheManager::PersistData() {
is_revoked = false;
}
+ backup_->SetMetaInfo(*(*copy_pt.policy_table.module_meta).ccpu_version);
+
// In case of extended policy the meta info should be backuped as well.
backup_->WriteDb();
}
@@ -1479,20 +1481,34 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
return result;
}
+void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ *(pt_->policy_table.module_config.preloaded_pt) = is_preloaded;
+ Backup();
+}
+
bool CacheManager::SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
-
+ rpc::Optional<policy_table::ModuleMeta>& module_meta =
+ pt_->policy_table.module_meta;
+ *(module_meta->ccpu_version) = ccpu_version;
// We have to set preloaded flag as false in policy table on any response
// of GetSystemInfo (SDLAQ-CRS-2365)
- *pt_->policy_table.module_config.preloaded_pt = false;
-
+ *(pt_->policy_table.module_config.preloaded_pt) = false;
Backup();
return true;
}
+std::string CacheManager::GetCCPUVersionFromPT() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc::Optional<policy_table::ModuleMeta>& module_meta =
+ pt_->policy_table.module_meta;
+ return *(module_meta->ccpu_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 0cdca26f2e..b40d71dd73 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -1214,10 +1214,21 @@ std::string& PolicyManagerImpl::GetCurrentDeviceId(
void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {}
+void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ cache_->SetPreloadedPtFlag(is_preloaded);
+}
+
void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
+ cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
+}
+
+std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->GetCCPUVersionFromPT();
}
uint32_t PolicyManagerImpl::GetNotificationsNumber(
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 3029ebb067..1c7d06dedf 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -1274,7 +1274,8 @@ ModuleMeta::ModuleMeta(const Json::Value* value__)
, pt_exchanged_x_days_after_epoch(
impl::ValueMember(value__, "pt_exchanged_x_days_after_epoch"))
, ignition_cycles_since_last_exchange(
- impl::ValueMember(value__, "ignition_cycles_since_last_exchange")) {}
+ impl::ValueMember(value__, "ignition_cycles_since_last_exchange"))
+ , ccpu_version(impl::ValueMember(value__, "ccpu_version")) {}
Json::Value ModuleMeta::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -1293,6 +1294,9 @@ bool ModuleMeta::is_valid() const {
if (struct_empty()) {
return initialization_state__ == kInitialized && Validate();
}
+ if (!ccpu_version.is_valid()) {
+ return false;
+ }
if (!pt_exchanged_at_odometer_x.is_valid()) {
return false;
}
@@ -1310,6 +1314,9 @@ bool ModuleMeta::is_initialized() const {
}
bool ModuleMeta::struct_empty() const {
+ if (ccpu_version.is_initialized()) {
+ return false;
+ }
if (pt_exchanged_at_odometer_x.is_initialized()) {
return false;
}
@@ -1327,6 +1334,9 @@ void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
+ if (!ccpu_version.is_valid()) {
+ ccpu_version.ReportErrors(&report__->ReportSubobject("ccpu_version"));
+ }
if (!pt_exchanged_at_odometer_x.is_valid()) {
pt_exchanged_at_odometer_x.ReportErrors(
&report__->ReportSubobject("pt_exchanged_at_odometer_x"));
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 79eee10d43..7aa853fd74 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -59,7 +59,8 @@ const std::string kCreateSchema =
" `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, "
- " `flag_update_required` BOOL NOT NULL "
+ " `flag_update_required` BOOL NOT NULL, "
+ " `ccpu_version` VARCHAR(45) "
"); "
"CREATE TABLE IF NOT EXISTS `module_config`( "
" `preloaded_pt` BOOL NOT NULL, "
@@ -1047,5 +1048,9 @@ const std::string kSaveModuleMeta =
"`ignition_cycles_since_last_exchange` = ? ";
const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
+
+const std::string kUpdateMetaParams =
+ "UPDATE `module_meta` SET "
+ "`ccpu_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 ed5bf37b5b..bd4dc6e2c2 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -493,6 +493,7 @@ void SQLPTRepresentation::GatherModuleMeta(
*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);
}
}
@@ -707,6 +708,23 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
return true;
}
+bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kUpdateMetaParams)) {
+ LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta.");
+ return false;
+ }
+
+ query.Bind(0, ccpu_version);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert to module meta.");
+ return false;
+ }
+ return true;
+}
+
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
LOG4CXX_INFO(logger_, "Gather applications policies");
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 909fd2cb2f..3855ccd481 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
@@ -2056,7 +2056,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"OnVehicleData" :
@@ -2071,7 +2072,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"SubscribeVehicleData" :
@@ -2086,7 +2088,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"UnsubscribeVehicleData" :
@@ -2101,7 +2104,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
}
},
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 3260558e70..85693ff515 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
@@ -2056,7 +2056,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"OnVehicleData" :
@@ -2071,7 +2072,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"SubscribeVehicleData" :
@@ -2086,7 +2088,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
},
"UnsubscribeVehicleData" :
@@ -2101,7 +2104,8 @@
"myKey",
"prndl",
"rpm",
- "steeringWheelAngle"
+ "steeringWheelAngle",
+ "handsOffSteering"
]
}
},
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 1cd2ca305e..d5a66f4388 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
@@ -75,12 +75,12 @@ class PolicyManagerImplTest : public ::testing::Test {
public:
PolicyManagerImplTest()
: policy_manager_(nullptr)
- , cache_manager_(nullptr)
+ , mock_cache_manager_(nullptr)
, access_remote_(nullptr) {}
protected:
std::shared_ptr<PolicyManagerImpl> policy_manager_;
- NiceMock<MockCacheManagerInterface>* cache_manager_;
+ NiceMock<MockCacheManagerInterface>* mock_cache_manager_;
NiceMock<MockPolicyListener> listener_;
NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
std::shared_ptr<NiceMock<access_remote_test::MockAccessRemote> >
@@ -88,8 +88,8 @@ class PolicyManagerImplTest : public ::testing::Test {
void SetUp() {
policy_manager_ = std::make_shared<PolicyManagerImpl>();
- cache_manager_ = new NiceMock<MockCacheManagerInterface>();
- policy_manager_->set_cache_manager(cache_manager_);
+ mock_cache_manager_ = new NiceMock<MockCacheManagerInterface>();
+ policy_manager_->set_cache_manager(mock_cache_manager_);
policy_manager_->set_listener(&listener_);
access_remote_ =
std::make_shared<NiceMock<access_remote_test::MockAccessRemote> >();
@@ -116,7 +116,8 @@ TEST_F(PolicyManagerImplTest, InitPT_NoAppStorageFolder_ReturnFalse) {
TEST_F(PolicyManagerImplTest, InitPT_InitializationNotSuccessful_ReturnFalse) {
file_system::CreateDirectory(kAppStorageFolder);
- EXPECT_CALL(*cache_manager_, Init(kSdlPreloadedPtJson, &policy_settings_))
+ EXPECT_CALL(*mock_cache_manager_,
+ Init(kSdlPreloadedPtJson, &policy_settings_))
.WillOnce(Return(false));
EXPECT_FALSE(policy_manager_->InitPT(kSdlPreloadedPtJson, &policy_settings_));
file_system::RemoveDirectory(kAppStorageFolder, true);
@@ -124,28 +125,29 @@ TEST_F(PolicyManagerImplTest, InitPT_InitializationNotSuccessful_ReturnFalse) {
TEST_F(PolicyManagerImplTest, InitPT_InitializationIsSuccessful_ReturnTrue) {
file_system::CreateDirectory(kAppStorageFolder);
- EXPECT_CALL(*cache_manager_, Init(kSdlPreloadedPtJson, &policy_settings_))
+ EXPECT_CALL(*mock_cache_manager_,
+ Init(kSdlPreloadedPtJson, &policy_settings_))
.WillOnce(Return(true));
EXPECT_TRUE(policy_manager_->InitPT(kSdlPreloadedPtJson, &policy_settings_));
file_system::RemoveDirectory(kAppStorageFolder, true);
}
TEST_F(PolicyManagerImplTest, ResetPT_NoRefreshRetrySequence_ReturnFalse) {
- EXPECT_CALL(*cache_manager_, ResetCalculatedPermissions());
- EXPECT_CALL(*cache_manager_, ResetPT(kSdlPreloadedPtJson))
+ EXPECT_CALL(*mock_cache_manager_, ResetCalculatedPermissions());
+ EXPECT_CALL(*mock_cache_manager_, ResetPT(kSdlPreloadedPtJson))
.WillOnce(Return(false));
- EXPECT_CALL(*cache_manager_, TimeoutResponse()).Times(0);
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_)).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, TimeoutResponse()).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, SecondsBetweenRetries(_)).Times(0);
EXPECT_FALSE(policy_manager_->ResetPT(kSdlPreloadedPtJson));
}
TEST_F(PolicyManagerImplTest, ResetPT_ExecuteRefreshRetrySequence_ReturnTrue) {
- EXPECT_CALL(*cache_manager_, ResetCalculatedPermissions());
- EXPECT_CALL(*cache_manager_, ResetPT(kSdlPreloadedPtJson))
+ EXPECT_CALL(*mock_cache_manager_, ResetCalculatedPermissions());
+ EXPECT_CALL(*mock_cache_manager_, ResetPT(kSdlPreloadedPtJson))
.WillOnce(Return(true));
- EXPECT_CALL(*cache_manager_, TimeoutResponse());
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_));
+ EXPECT_CALL(*mock_cache_manager_, TimeoutResponse());
+ EXPECT_CALL(*mock_cache_manager_, SecondsBetweenRetries(_));
EXPECT_TRUE(policy_manager_->ResetPT(kSdlPreloadedPtJson));
}
@@ -154,7 +156,7 @@ TEST_F(PolicyManagerImplTest,
AppNeedEncryption_EncryptionNotRequired_ReturnFalse) {
EncryptionRequired encryption_required;
*encryption_required = false;
- EXPECT_CALL(*cache_manager_, GetAppEncryptionRequiredFlag(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, GetAppEncryptionRequiredFlag(kValidAppId))
.WillOnce(Return(encryption_required));
EXPECT_FALSE(policy_manager_->AppNeedEncryption(kValidAppId));
@@ -163,7 +165,7 @@ TEST_F(PolicyManagerImplTest,
TEST_F(PolicyManagerImplTest,
AppNeedEncryption_EncryptionNotInitialized_ReturnTrue) {
EncryptionRequired encryption_required;
- EXPECT_CALL(*cache_manager_, GetAppEncryptionRequiredFlag(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, GetAppEncryptionRequiredFlag(kValidAppId))
.WillOnce(Return(encryption_required));
EXPECT_TRUE(policy_manager_->AppNeedEncryption(kValidAppId));
@@ -171,7 +173,7 @@ TEST_F(PolicyManagerImplTest,
TEST_F(PolicyManagerImplTest,
FunctionGroupNeedEncryption_NoGroups_ReturnFalse) {
- EXPECT_CALL(*cache_manager_, GetFunctionalGroupings(_));
+ EXPECT_CALL(*mock_cache_manager_, GetFunctionalGroupings(_));
const std::string absent_group("Base-6");
EXPECT_FALSE(policy_manager_->FunctionGroupNeedEncryption(absent_group));
@@ -184,7 +186,7 @@ TEST_F(PolicyManagerImplTest,
const RPCParams params;
CheckPermissionResult result;
- EXPECT_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillOnce(Return(false));
policy_manager_->CheckPermissions(
@@ -200,7 +202,7 @@ TEST_F(PolicyManagerImplTest,
CheckPermissionResult result;
Strings groups;
- ON_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillByDefault(Return(true));
ON_CALL(*access_remote_, IsAppRemoteControl(_)).WillByDefault(Return(true));
ON_CALL(*access_remote_, GetGroups(_)).WillByDefault(ReturnRef(groups));
@@ -218,10 +220,10 @@ TEST_F(PolicyManagerImplTest,
CheckPermissionResult result;
Strings groups;
- ON_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillByDefault(Return(true));
- ON_CALL(*cache_manager_, GetGroups(_)).WillByDefault(ReturnRef(groups));
- ON_CALL(*cache_manager_, IsApplicationRevoked(kValidAppId))
+ ON_CALL(*mock_cache_manager_, GetGroups(_)).WillByDefault(ReturnRef(groups));
+ ON_CALL(*mock_cache_manager_, IsApplicationRevoked(kValidAppId))
.WillByDefault(Return(true));
policy_manager_->CheckPermissions(
@@ -238,10 +240,10 @@ TEST_F(PolicyManagerImplTest,
CheckPermissionResult result;
Strings groups;
- ON_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillByDefault(Return(true));
- ON_CALL(*cache_manager_, GetGroups(_)).WillByDefault(ReturnRef(groups));
- ON_CALL(*cache_manager_, IsApplicationRevoked(kValidAppId))
+ ON_CALL(*mock_cache_manager_, GetGroups(_)).WillByDefault(ReturnRef(groups));
+ ON_CALL(*mock_cache_manager_, IsApplicationRevoked(kValidAppId))
.WillByDefault(Return(true));
policy_manager_->CheckPermissions(
@@ -255,7 +257,7 @@ TEST_F(
GetPermissionsForApp_CannotGetPermissionsForRemoteDefaultApp_GetEmptyVector) {
std::vector<FunctionalGroupPermission> permissions;
- ON_CALL(*cache_manager_, IsDefaultPolicy(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsDefaultPolicy(kValidAppId))
.WillByDefault(Return(true));
ON_CALL(*access_remote_, IsAppRemoteControl(_)).WillByDefault(Return(true));
EXPECT_CALL(*access_remote_,
@@ -272,12 +274,12 @@ TEST_F(
GetPermissionsForApp_CannotGetFunctionalGroupsNamesForNotRemotePredataApp_GetEmptyVector) {
std::vector<FunctionalGroupPermission> permissions;
- ON_CALL(*cache_manager_, IsPredataPolicy(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsPredataPolicy(kValidAppId))
.WillByDefault(Return(true));
- ON_CALL(*cache_manager_,
+ ON_CALL(*mock_cache_manager_,
GetPermissionsForApp(kDeviceNumber, kPreDataConsentId, _))
.WillByDefault(Return(true));
- EXPECT_CALL(*cache_manager_, GetFunctionalGroupNames(_))
+ EXPECT_CALL(*mock_cache_manager_, GetFunctionalGroupNames(_))
.WillOnce(Return(false));
policy_manager_->GetPermissionsForApp(
@@ -304,9 +306,9 @@ TEST_F(PolicyManagerImplTest, LoadPT_InvalidPT_ReturnkWrongPtReceived) {
std::string json = root.toStyledString();
BinaryMessage msg(json.begin(), json.end());
- EXPECT_CALL(*cache_manager_, GetVehicleDataItems())
+ EXPECT_CALL(*mock_cache_manager_, GetVehicleDataItems())
.WillOnce(Return(vehicle_items));
- EXPECT_CALL(*cache_manager_, SaveUpdateRequired(false)).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, SaveUpdateRequired(false)).Times(0);
EXPECT_EQ(PolicyManager::PtProcessingResult::kWrongPtReceived,
policy_manager_->LoadPT(kInValidFilename, msg));
}
@@ -331,9 +333,10 @@ TEST_F(PolicyManagerImplTest,
std::string json = root.toStyledString();
BinaryMessage msg(json.begin(), json.end());
- EXPECT_CALL(*cache_manager_, GetVehicleDataItems())
+ EXPECT_CALL(*mock_cache_manager_, GetVehicleDataItems())
.WillOnce(Return(vehicle_items));
- EXPECT_CALL(*cache_manager_, GenerateSnapshot()).WillOnce(Return(nullptr));
+ EXPECT_CALL(*mock_cache_manager_, GenerateSnapshot())
+ .WillOnce(Return(nullptr));
EXPECT_EQ(PolicyManager::PtProcessingResult::kNewPtRequired,
policy_manager_->LoadPT(kInValidFilename, msg));
}
@@ -356,11 +359,11 @@ TEST_F(PolicyManagerImplTest, LoadPT_UpdateNotApplied_ReturnkNewPtRequired) {
std::string json = root.toStyledString();
BinaryMessage msg(json.begin(), json.end());
- EXPECT_CALL(*cache_manager_, GetVehicleDataItems())
+ EXPECT_CALL(*mock_cache_manager_, GetVehicleDataItems())
.WillOnce(Return(vehicle_items));
- EXPECT_CALL(*cache_manager_, GenerateSnapshot())
+ EXPECT_CALL(*mock_cache_manager_, GenerateSnapshot())
.WillOnce(Return(std::make_shared<policy_table::Table>(update)));
- EXPECT_CALL(*cache_manager_, ApplyUpdate(_)).WillOnce(Return(false));
+ EXPECT_CALL(*mock_cache_manager_, ApplyUpdate(_)).WillOnce(Return(false));
EXPECT_EQ(PolicyManager::PtProcessingResult::kNewPtRequired,
policy_manager_->LoadPT(kInValidFilename, msg));
}
@@ -383,11 +386,11 @@ TEST_F(PolicyManagerImplTest, LoadPT_NoHMIAppTypes_ReturnkSuccess) {
std::string json = root.toStyledString();
BinaryMessage msg(json.begin(), json.end());
- ON_CALL(*cache_manager_, GetVehicleDataItems())
+ ON_CALL(*mock_cache_manager_, GetVehicleDataItems())
.WillByDefault(Return(vehicle_items));
- ON_CALL(*cache_manager_, GenerateSnapshot())
+ ON_CALL(*mock_cache_manager_, GenerateSnapshot())
.WillByDefault(Return(std::make_shared<policy_table::Table>(update)));
- ON_CALL(*cache_manager_, ApplyUpdate(_)).WillByDefault(Return(true));
+ ON_CALL(*mock_cache_manager_, ApplyUpdate(_)).WillByDefault(Return(true));
EXPECT_EQ(PolicyManager::PtProcessingResult::kSuccess,
policy_manager_->LoadPT(kInValidFilename, msg));
@@ -397,10 +400,10 @@ TEST_F(PolicyManagerImplTest,
AddApplication_NewApplication_ReturnCallStatusChanges) {
AppHmiTypes hmi_types;
- ON_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillByDefault(Return(false));
- EXPECT_CALL(*cache_manager_, IsPredataPolicy(kValidAppId)).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, IsPredataPolicy(kValidAppId)).Times(0);
policy_manager_->AddApplication(kDeviceNumber, kValidAppId, hmi_types);
}
@@ -409,10 +412,10 @@ TEST_F(PolicyManagerImplTest,
AddApplication_ExistedApplication_ReturnCallNothing) {
AppHmiTypes hmi_types;
- ON_CALL(*cache_manager_, IsApplicationRepresented(kValidAppId))
+ ON_CALL(*mock_cache_manager_, IsApplicationRepresented(kValidAppId))
.WillByDefault(Return(true));
- EXPECT_CALL(*cache_manager_, IsPredataPolicy(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, IsPredataPolicy(kValidAppId))
.WillOnce(Return(true));
policy_manager_->AddApplication(kDeviceNumber, kValidAppId, hmi_types);
@@ -422,7 +425,8 @@ TEST_F(PolicyManagerImplTest,
OnPTUFinished_PtuResultIskNewPtRequired_InvokeForcePTExchange) {
const std::string initial_pt_status = policy_manager_->GetPolicyTableStatus();
- EXPECT_CALL(*cache_manager_, GenerateSnapshot()).WillOnce(Return(nullptr));
+ EXPECT_CALL(*mock_cache_manager_, GenerateSnapshot())
+ .WillOnce(Return(nullptr));
policy_manager_->OnPTUFinished(
PolicyManager::PtProcessingResult::kNewPtRequired);
@@ -435,8 +439,8 @@ TEST_F(
OnPTUFinished_PtuResultIskWrongPtReceived_NoPTExchangeAndNoRefreshRetrySequence) {
const std::string initial_pt_status = policy_manager_->GetPolicyTableStatus();
- EXPECT_CALL(*cache_manager_, TimeoutResponse()).Times(0);
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_)).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, TimeoutResponse()).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, SecondsBetweenRetries(_)).Times(0);
policy_manager_->OnPTUFinished(
PolicyManager::PtProcessingResult::kWrongPtReceived);
@@ -448,8 +452,8 @@ TEST_F(PolicyManagerImplTest,
OnPTUFinished_PtuResultIskSuccess_InvokeRefreshRetrySequence) {
const std::string initial_pt_status = policy_manager_->GetPolicyTableStatus();
- EXPECT_CALL(*cache_manager_, TimeoutResponse());
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_));
+ EXPECT_CALL(*mock_cache_manager_, TimeoutResponse());
+ EXPECT_CALL(*mock_cache_manager_, SecondsBetweenRetries(_));
policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
const std::string final_pt_status = policy_manager_->GetPolicyTableStatus();
@@ -457,7 +461,8 @@ TEST_F(PolicyManagerImplTest,
}
TEST_F(PolicyManagerImplTest, RequestPTUpdate_SnapshotPtrIsNull_ReturnFalse) {
- ON_CALL(*cache_manager_, GenerateSnapshot()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_cache_manager_, GenerateSnapshot())
+ .WillByDefault(Return(nullptr));
EXPECT_FALSE(
policy_manager_->RequestPTUpdate(PTUIterationType::DefaultIteration));
@@ -486,7 +491,8 @@ TEST_F(PolicyManagerImplTest, RequestPTUpdate_PTIsValid_PTIsUpdated) {
snapshot->SetPolicyTableType(policy_table::PT_SNAPSHOT);
ASSERT_TRUE(IsValid(*snapshot));
- ON_CALL(*cache_manager_, GenerateSnapshot()).WillByDefault(Return(snapshot));
+ ON_CALL(*mock_cache_manager_, GenerateSnapshot())
+ .WillByDefault(Return(snapshot));
EXPECT_CALL(listener_,
OnSnapshotCreated(_, PTUIterationType::DefaultIteration));
EXPECT_TRUE(
@@ -519,9 +525,10 @@ TEST_F(PolicyManagerImplTest,
GetUserConsentForApp_NoPermissionsForApp_NoConsent) {
std::vector<FunctionalGroupPermission> permissions;
- ON_CALL(*cache_manager_, GetPermissionsForApp(kDeviceNumber, kValidAppId, _))
+ ON_CALL(*mock_cache_manager_,
+ GetPermissionsForApp(kDeviceNumber, kValidAppId, _))
.WillByDefault(Return(false));
- EXPECT_CALL(*cache_manager_, GetFunctionalGroupNames(_)).Times(0);
+ EXPECT_CALL(*mock_cache_manager_, GetFunctionalGroupNames(_)).Times(0);
policy_manager_->GetUserConsentForApp(
kDeviceNumber, kValidAppId, permissions);
@@ -532,9 +539,10 @@ TEST_F(PolicyManagerImplTest,
GetUserConsentForApp_NoFunctionalGroupsNames_NoConsent) {
std::vector<FunctionalGroupPermission> permissions;
- ON_CALL(*cache_manager_, GetPermissionsForApp(kDeviceNumber, kValidAppId, _))
+ ON_CALL(*mock_cache_manager_,
+ GetPermissionsForApp(kDeviceNumber, kValidAppId, _))
.WillByDefault(Return(true));
- EXPECT_CALL(*cache_manager_, GetFunctionalGroupNames(_))
+ EXPECT_CALL(*mock_cache_manager_, GetFunctionalGroupNames(_))
.WillOnce(Return(false));
policy_manager_->GetUserConsentForApp(
@@ -552,7 +560,7 @@ TEST_F(PolicyManagerImplTest,
GetInitialAppData_HandleValidPointers_ReturnTrue) {
StringArray nicknames;
StringArray app_hmi_types;
- ON_CALL(*cache_manager_,
+ ON_CALL(*mock_cache_manager_,
GetInitialAppData(kValidAppId, nicknames, app_hmi_types))
.WillByDefault(Return(true));
@@ -562,15 +570,15 @@ TEST_F(PolicyManagerImplTest,
TEST_F(PolicyManagerImplTest,
GetAppPermissionsChanges_NoPermissionsChanges_GeneratePermissions) {
- EXPECT_CALL(*cache_manager_, IsApplicationRevoked(kValidAppId));
- EXPECT_CALL(*cache_manager_, GetPriority(kValidAppId, _));
+ EXPECT_CALL(*mock_cache_manager_, IsApplicationRevoked(kValidAppId));
+ EXPECT_CALL(*mock_cache_manager_, GetPriority(kValidAppId, _));
policy_manager_->GetAppPermissionsChanges(kDeviceNumber, kValidAppId);
}
TEST_F(PolicyManagerImplTest, GetHMITypes_AppIsDefaultPolicy_ReturnFalse) {
std::vector<int> app_types;
- EXPECT_CALL(*cache_manager_, IsDefaultPolicy(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, IsDefaultPolicy(kValidAppId))
.WillOnce(Return(true));
EXPECT_FALSE(policy_manager_->GetHMITypes(kValidAppId, &app_types));
@@ -578,7 +586,7 @@ TEST_F(PolicyManagerImplTest, GetHMITypes_AppIsDefaultPolicy_ReturnFalse) {
TEST_F(PolicyManagerImplTest, GetHMITypes_NoHmiTypes_ReturnFalse) {
std::vector<int> app_types;
- EXPECT_CALL(*cache_manager_, GetHMITypes(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, GetHMITypes(kValidAppId))
.WillOnce(Return(nullptr));
EXPECT_FALSE(policy_manager_->GetHMITypes(kValidAppId, &app_types));
}
@@ -586,11 +594,25 @@ TEST_F(PolicyManagerImplTest, GetHMITypes_NoHmiTypes_ReturnFalse) {
TEST_F(PolicyManagerImplTest, GetHMITypes_ValidHmiTypes_ReturnTrue) {
std::vector<int> app_types;
AppHMITypes hmi_types;
- EXPECT_CALL(*cache_manager_, GetHMITypes(kValidAppId))
+ EXPECT_CALL(*mock_cache_manager_, GetHMITypes(kValidAppId))
.WillOnce(Return(&hmi_types));
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/tools/rpc_spec b/tools/rpc_spec
-Subproject 9dac3719989a2aa26012ba3d73528f54909974a
+Subproject 7e25594292f8c1265bd3f23fc57932edf8b22b1