summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-01-19 11:08:30 -0500
committerjacobkeeler <jacob.keeler@livioradio.com>2018-01-19 11:08:30 -0500
commit5a1667d8ff0eeb696bf842b2c11aaf74663ebf00 (patch)
treef3c59e3d09bdc457b0677811f7ef09417fd28167
parent273e26304efb215af3416f86ab86c1c7fd39f974 (diff)
parente8911d03dde016a29b01fe80533bc6ac56531678 (diff)
downloadsdl_core-5a1667d8ff0eeb696bf842b2c11aaf74663ebf00.tar.gz
Merge remote-tracking branch 'origin/develop' into feature/invalid_data_info
-rw-r--r--.github/CONTRIBUTING.md (renamed from CONTRIBUTING.md)19
-rw-r--r--.github/ISSUE_TEMPLATE.md23
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md33
-rw-r--r--COMMITTERS.md95
-rw-r--r--README.md52
-rw-r--r--src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp6
-rw-r--r--src/appMain/main.cc3
-rw-r--r--src/appMain/sdl_preloaded_pt.json6
-rw-r--r--src/components/application_manager/CMakeLists.txt1
-rw-r--r--src/components/application_manager/include/application_manager/application.h18
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h31
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h13
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h80
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h44
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_request.h7
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h10
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h47
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h5
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h15
-rw-r--r--src/components/application_manager/include/application_manager/message.h3
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h3
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h14
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h21
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h24
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h26
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h16
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_sql_queries.cc2
-rw-r--r--src/components/application_manager/src/application_impl.cc30
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc56
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc256
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc44
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc16
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc1
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc5
-rw-r--r--src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc44
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc30
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc152
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_dtcs_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc115
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc25
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc13
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc22
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/set_display_layout_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc11
-rw-r--r--src/components/application_manager/src/commands/mobile/set_icon_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc36
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/system_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc3
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc12
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc6
-rw-r--r--src/components/application_manager/src/message.cc15
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc77
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc10
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc34
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc1
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc10
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc12
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc2
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc1
-rw-r--r--src/components/application_manager/test/application_impl_test.cc17
-rw-r--r--src/components/application_manager/test/commands/CMakeLists.txt2
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc22
-rw-r--r--src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc10
-rw-r--r--src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc28
-rw-r--r--src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc73
-rw-r--r--src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc6
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc20
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc5
-rw-r--r--src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc3
-rw-r--r--src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc7
-rw-r--r--src/components/application_manager/test/commands/mobile/add_command_request_test.cc39
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc43
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc48
-rw-r--r--src/components/application_manager/test/commands/mobile/change_registration_test.cc99
-rw-r--r--src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc41
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_command_request_test.cc41
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc1
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc27
-rw-r--r--src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc24
-rw-r--r--src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc52
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc15
-rw-r--r--src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc17
-rw-r--r--src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc25
-rw-r--r--src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc88
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_interaction_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/read_did_request_test.cc7
-rw-r--r--src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc214
-rw-r--r--src/components/application_manager/test/commands/mobile/scrollable_message_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/send_location_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/set_app_icon_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/set_display_layout_test.cc22
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc65
-rw-r--r--src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc22
-rw-r--r--src/components/application_manager/test/commands/mobile/show_test.cc67
-rw-r--r--src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/slider_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/speak_request_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/system_request_test.cc135
-rw-r--r--src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc10
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc2
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/commands_test.h62
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h7
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h3
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data.h2
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc10
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc12
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc26
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc26
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc4
-rw-r--r--src/components/config_profile/include/config_profile/profile.h4
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h19
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc2
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc10
-rw-r--r--src/components/functional_module/test/include/mock_application.h3
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc1
-rw-r--r--src/components/include/application_manager/application_manager.h5
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h14
-rw-r--r--src/components/include/application_manager/vehicle_info_data.h71
-rw-r--r--src/components/include/protocol_handler/protocol_handler_settings.h7
-rw-r--r--src/components/include/protocol_handler/session_observer.h21
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h3
-rw-r--r--src/components/include/utils/macro.h18
-rw-r--r--src/components/interfaces/HMI_API.xml15
-rw-r--r--src/components/interfaces/MOBILE_API.xml3
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h1
-rw-r--r--src/components/media_manager/include/media_manager/file_streamer_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/pipe_streamer_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/socket_streamer_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/streamer_adapter.h2
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc47
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc8
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc5
-rw-r--r--src/components/media_manager/test/media_manager_impl_test.cc2
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h7
-rw-r--r--src/components/policy/policy_external/include/policy/policy_helper.h17
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h18
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h22
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc59
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc35
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc68
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc38
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc2
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h7
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_helper.h3
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc55
-rw-r--r--src/components/policy/policy_regular/src/policy_helper.cc22
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc32
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h4
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc25
-rw-r--r--src/components/remote_control/test/include/mock_application.h7
-rw-r--r--src/components/remote_control/test/src/rc_module_test.cc3
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h11
-rw-r--r--src/components/telemetry_monitor/src/telemetry_monitor.cc19
-rw-r--r--src/components/telemetry_monitor/test/telemetry_monitor_test.cc5
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h1
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc28
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_connection.cc16
-rw-r--r--src/components/utils/test/generated_code_with_sqlite_test.cc6
-rw-r--r--src/components/utils/test/policy.sql30
201 files changed, 2569 insertions, 1750 deletions
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 42cf5d0898..672768add7 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -2,22 +2,28 @@
Third party contributions are essential for making SDL great. However, we do have a few guidelines we need contributors to follow.
+## Environment
+Currently supported:
+* Ubuntu Linux 14.04 with GCC 4.9.x
+* Ubuntu Linux 16.04 with GCC 5.4.x
+* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
+
### Issues
-If writing a bug report, please make sure <a href="http://yourbugreportneedsmore.info" target="_blank">it has enough info</a>. Include all relevant information.
+If writing a bug report, please make sure [you follow the issue template](https://github.com/smartdevicelink/sdl_core/blob/master/.github/ISSUE_TEMPLATE.md). Include all relevant information.
If requesting a feature, understand that we appreciate the input! However, it may not immediately fit our roadmap, and it may take a while for us to get to your request.
### Gitflow
-We use <a href="http://nvie.com/posts/a-successful-git-branching-model/">Gitflow</a> as our branch management system. Please follow gitflow's guidelines while contributing to any SDL project.
+We use [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) as our branch management system. Please follow GitFlow's guidelines while contributing to any SDL project.
### Pull Requests
-* Please follow the repository's for all code and documentation.
+* Please follow the repository's [Style Guide](https://github.com/smartdevicelink/sdl_core/wiki/SDL-Coding-Style-Guide) for all code and documentation.
* All pull requests should be sent to `smartdevicelink/sdl_core/`, to `develop` or `master` branch.
* All feature branches should be based on `develop` and have the format `feature/branch_name`.
* All fix branches should be based on `develop` and have the format `fix/branch_name`.
* All new functionality requests should be provided only for `develop` branch.
-* In case defect should be fixed in short time (after release), send pull request to `master` and have the format `hotfix/branch_name`.
-* In case defect exists in `develop` and `master` branches, send pull request to `develop` only. Do not send the same pull request to the `master` branch.
+* In case an issue should be fixed in a short time (after release), open a pull request to `master` with a branch name of `hotfix/branch_name`.
+* In case an issue exists in both the `develop` and `master` branches, open a pull request to `develop` only. Do not open the same pull request against the `master` branch.
* All pull requests should implement a single feature or fix a single bug. Pull Requests that involve multiple changes (it is our discretion what precisely this means) will be rejected with a reason.
* All commits should be separated into logical units, i.e. unrelated changes should be in different commits within a pull request.
* Work in progress pull requests should have "[WIP]" in front of the Pull Request title. When you believe the pull request is ready to merge, remove this tag and @mention the appropriate SDL team to schedule a review.
@@ -30,6 +36,3 @@ In order to accept Pull Requests from contributors, you must first sign [the Con
## Additional Resources
* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
-* [Contributor's License Agreement](https://docs.google.com/forms/d/1VNR8EUd5b46cQ7uNbCq1fJmnu0askNpUp5dudLKRGpU/viewform)
-* [Committers.md](https://github.com/LuxoftSDL/sdl_core/blob/feature/Add_Committers_file/COMMITTERS.md)
-
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000000..1b58b20e86
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,23 @@
+[Delete any non-applicable sections, but we may ask for more information.]
+
+### Bug Report
+[Summary]
+
+##### Reproduction Steps
+1. [Step 1]
+2. [Step 2]
+3. [Step 3]
+
+##### Expected Behavior
+[Some expected behavior]
+
+##### Observed Behavior
+[Some observed behavior]
+
+##### OS & Version Information
+* OS/Version: [The OS/Version you were running when the bug occurred]
+* SDL Core Version: [The version of SDL Core you were using when the bug occurred]
+* Testing Against: [What you tested with to observe this behavior. Proxy, App, HMI etc.]
+
+##### Test Case, Sample Code, and / or Example App
+[Paste a link to a PR, gist, or other code that exemplifies this behavior] \ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000..83c3261f9b
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,33 @@
+[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA.
+
+Delete the above section when you've read it.]
+
+Fixes #[issue number]
+
+This PR is **[ready / not ready]** for review.
+
+### Risk
+This PR makes **[no / minor / major]** API changes.
+
+### Testing Plan
+[Describe how you plan to unit test the changes in this PR]
+
+### Summary
+[Summary of PR changes]
+
+### Changelog
+##### Breaking Changes
+* [Breaking change info]
+
+##### Enhancements
+* [Enhancement info]
+
+##### Bug Fixes
+* [Bug Fix Info]
+
+### Tasks Remaining:
+- [ ] [Task 1]
+- [ ] [Task 2]
+
+### CLA
+- [ ] I have signed [the CLA](https://docs.google.com/forms/d/e/1FAIpQLSdsgJY33VByaX482zHzi-xUm49JNnmuJOyAM6uegPQ2LXYVfA/viewform) \ No newline at end of file
diff --git a/COMMITTERS.md b/COMMITTERS.md
deleted file mode 100644
index 210fceb421..0000000000
--- a/COMMITTERS.md
+++ /dev/null
@@ -1,95 +0,0 @@
-#Committing changes to SDL
-
-We would like to make it easier for community members to contribute to SDL
-using pull requests. This makes the process of contributing a little easier for the contributor since they don't
-need to concern themselves with the question, "What branch do I base my changes
-on?" This is already called out in the CONTRIBUTING.md.
-
-##Terminology
-Many of these terms have more than one meaning. For the purposes of this
-document, the following terms refer to specific things.
-
-**contributor** - A person who makes a change to SDL and submits a change
-set in the form of a pull request.
-
-**reviewer** - A person responsible for reviewing a pull request.
-
-**master branch** - [The base branch](https://github.com/smartdevicelink/sdl_core/tree/master).
-
-**develop branch** - [The branch](https://github.com/LuxoftSDL/sdl_core/tree/develop) where bug fixes against the latest release or release candidate are merged.
-
-## Pre-commit hook installation
-* Go to tools/infrastructure/
-* Run install-hooks.py
-* or : Just run "python tools/infrastructure/install-hooks.py"
-
-##Pull request checklist
-* Add Unit tests.
-* All tests pass (see Run all tests section).
-* Check component design
-* Check amount of required memory, memory leaks.
-* Assertion must be used in the right way.
-* Are there cyclic dependencies?
-* Level of abstraction adequate?
-* Are there any platform gotchas? (Does a change make an assumption about
- platform specific behavior that is incompatible with other platforms? e.g.
- Windows paths vs. POSIX paths).
-* Thread safe code.
-* No deadlocks.
-* Is Doxygen API documentation available?
-* Do you have thread specific comment provided? (if another thread uses added method/classes,
- there must be comment which explains: When method will be called by thread? Which thread calls the method? e.g.)
-* Do you have specific realization code comments?
-* Add log messages.
-* There are no Google code style errors. (You can download Google [cpplint.py](https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py))
-* Check branch naming.
-* Check correct commit messages in commits (see Pull request message section).
-* Check correct pull request target (`master` or `develop`)
-* Check correct pull request message
-* Add reviewers
-
-##Run all tests
-* Run in root build directory `make test`
-
-##Branch naming
-Branch name should be:
-* `hotfix/<task name>` or
-* `feature/<task name>` or
-* `fix/<task name>`
-
-##Pull request message
-* Describe the reason why you created pull request and what changes there are.
-* Add related Jira ticket as link.
- ( EXAMPLE:
- `Related: [APPLINK-xxxxx](put direct link here)`)
-* If there was an old pull request, add link. ( EXAMPLE: `Old pull request is [here](put direct link here)`)
-
-##Adding reviewers:
-* Add one domain expert
-* Add your mentor (for junior developers only)
-* Add all junior developers (for junior developers only)
-
-`Note`: Everyone from SDL team developers can review any pull request (“reviewed” comment is not required)
-
-##Review process
-* Reviewers can leave comments to code only in `commits` tab.
-* Contributor must answer each comment (Contributor should specify addressee in comment).
-* In case contributor is disagree with reviewer, contributor writes his opinion
-* In case contributor is agree with reviewer, contributor leaves link to new commit with changes.
-* When reviewer is agree with all changes in pull request, he must leave `Reviewed` comment.
-
-##Successfully passed review:
-* Contributor answered to all comments
-* Contributor fixed all mistakes
-* All reviewers left `Reviewed` comment
-
-##Merging
-* Successfully passed review.
-* Rebase in case of existing conflicts.
-* Contributor can squash commits in case of adding same code in different commits.
-* Contact @AGaliuzov or @anosach-luxoft to merge pull request.
-
-##Additional sources
-* [Google cppint.py](https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py)
-* [Git commit best practices](http://chris.beams.io/posts/git-commit/)
-* [GitHub Working with formatting](https://help.github.com/articles/working-with-advanced-formatting/)
diff --git a/README.md b/README.md
index f7a0f6763f..a3f08e3fc1 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,6 @@
[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
-[![Build Status](https://travis-ci.org/smartdevicelink/sdl_core.svg?branch=master)](https://travis-ci.org/smartdevicelink/sdl_core)
-
- [![codecov.io](https://codecov.io/github/smartdevicelink/sdl_core/coverage.svg?branch=develop)](https://codecov.io/github/smartdevicelink/sdl_core?branch=develop)
+[![codecov.io](https://codecov.io/github/smartdevicelink/sdl_core/coverage.svg?branch=develop)](https://codecov.io/github/smartdevicelink/sdl_core?branch=develop)
# SmartDeviceLink (SDL)
@@ -121,54 +119,6 @@ There are several RPCs that are "required" to be implemented in order for SDL to
* OnSystemRequest
* Speak
-## App Launching
-
-Below are instructions for testing app launching and query with a full system set up.
-
-### SDL Server
-The app querying specification defines an endpoint within Policies where sdl_core will reach out to receive a list of applications that can be launched. The SDL Server provides the back end functionality for app launching and querying.
-
-You can find the SDL Server on [GitHub](https://github.com/smartdevicelink/sdl_server). The README contains detailed instructions for installing and launching the server. Launch the server on your local machine, and direct your browser to http://localhost:3000.
-
-The [App Launching Server Specification](https://github.com/smartdevicelink/sdl_server/blob/master/docs/application_launching_v1.0.md) defines an endpoint `/applications/available/:moduleId.json` which return a list of applications available for launching to the handset for filtering.
-
-To check if there is a module already available you can go to http://localhost:3000/modules.json. If there is a module available, there will be one or more objects in the response array. Keep this response, you'll need the "_id" field for later.
-
-If there is not a module already available, go to http://localhost:3000/cars and define a new vehicle, then check http://localhost:3000/modules.json.
-
-Next, you'll need to define applications that can be launched. Go to http://localhost:3000/apps and define some applications. Make sure that you define a url scheme under the iOS tab of the application. This is required for an application to be launched from SDL. A URL scheme has the format `someScheme://`. Save the URL Scheme you used for later steps.
-
-You'll also need the local ip address of your machine
-
-At the end of the SDL Server set up you should have
- 1. SDL Server running on your local machine connected to mongo db
- 2. Your machine's local IP Address
- 3. The module id of your vehicle
- 4. The URL Scheme of the app you want to launch
-
-### Mobile
-You need at least one app installed on the test device (presumably an iPhone), which we have built for you, the [V4Tester application](https://app.box.com/s/eeloquc0fhqfmxjjubw7kousf12f3pzg). This application implements SDL 4.0 and will respond to SDL Core's QUERY_APPS system request, as well as filter the response for available applications. If you do not have any other applications on the device, you can only test QUERY_APPS functionality, in which no applications will be sent to sdl core which can be launched.
-
-In order to support the launching of an application, you'll have to create an additional app which responds to the URL Scheme of the application that you set up on the SDL Server. To do so, go to Xcode, select File>New>Project... and under ios/application create a Single View Application. Open the application's Info.plist file (under the Supporting Files section of the project explorer by default). Highlight the Information Property List item and click the plus button to add a new entry to the Property List. From the drop down menu, select URL Types as the key. In the Item 0 dictionary add a "URL Schemes" Array, and make Item 0 in the array the prefix to the URL you previously defined (So if you defined `someScheme://` then Item 0 should be "someScheme"). Make sure the URL identifier matches your application's identifier. When you're finished you should have something that looks like the following. Install this application on your test device. **Note** - this application will only launch during this process, since it is not SDL Connected it will not register with the head unit.
-
-![Plist Example](http://i.imgur.com/AFyJlZQ.png)
-
-At the end of the Mobile device set up you should have
- 1. The V4 Tester Application installed on your device
- 2. An application for launching that matches the application submitted to SDL Server
- 3. Your iPhone should be on the same network as the machine running SDL Server
-
-### SDL Core
-Take the following steps to launch applications from sdl core.
-
- 1. Install the [correct version of SDL Core](https://github.com/smartdevicelink/sdl_core/pull/39)
- 2. Add the queryAppsUrl that you saved during sdl server set up in the src/appMain/preloaded_pt.json under the "endpoints" property in the format `http://[local machine ip]:3000/applications/available[moduleId].json`. For example `http://192.168.0.150:3000/applications/available/789b739c47c7490321058200.json`.
- 3. Run SDL Core
- 4. Launch the V4 Tester application on the iPhone
- 5. Connect the application via wifi by entering the IP address of Core into the V4 tester
- 6. Both applications should show up on the head unit for launching
- 7. Select the other application, and you should see it launched and brought to the foreground on the phone
-
## Test Coverage
### Used technologies
* GCOV - test coverage program.
diff --git a/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp b/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp
index 17c2dd92ae..9fd364cf17 100644
--- a/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp
+++ b/src/3rd_party-static/message_broker/src/lib_messagebroker/websocket_handler.cpp
@@ -160,9 +160,9 @@ namespace NsMessageBroker
DBG_MSG(("CWebSocketHandler::parseWebSocketData()length:%d; size:%d;"
" position:%d\n", (int)length, size, position));
- for (unsigned long i = 0; (i < size); i++) {
- Buffer[parsedBufferPosition + i] = recBuffer[i+position];
- }
+ memmove(&Buffer[parsedBufferPosition], &recBuffer[position],
+ size - position);
+
b_size -= position;
parsedBufferPosition += length;
recBuffer += length;
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index 58ab02b123..81482c4335 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -148,8 +148,7 @@ int32_t main(int32_t argc, char** argv) {
// Check if no error values were read from config file
if (profile_instance.ErrorOccured()) {
- const std::string& error = profile_instance.ErrorDescription();
- LOG4CXX_FATAL(logger_, error);
+ LOG4CXX_FATAL(logger_, profile_instance.ErrorDescription());
FLUSH_LOGGER();
DEINIT_LOGGER();
exit(EXIT_FAILURE);
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index c4f58c04c2..58abfb6f80 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -2344,11 +2344,7 @@
"steal_focus": false,
"priority": "NONE",
"default_hmi": "NONE",
- "groups": ["Base-4", "RemoteControl"],
- "moduleType": [
- "RADIO",
- "CLIMATE"
- ]
+ "groups": ["Base-4"]
},
"device": {
"keep_context": false,
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index 7a49ce6b81..21f92418fe 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -324,6 +324,7 @@ set (HMI_COMMANDS_SOURCES
${COMMANDS_SOURCE_DIR}/hmi/on_system_error_notification.cc
${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_request.cc
${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_on_awake_sdl.cc
${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update.cc
${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update_response.cc
${COMMANDS_SOURCE_DIR}/hmi/on_received_policy_update.cc
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 3a03cb5343..b753ba0e7f 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -161,7 +161,7 @@ typedef std::set<uint32_t> SoftButtonID;
/**
* @brief Defines set of vehicle info types
*/
-typedef std::set<uint32_t> VehicleInfoSubscriptions;
+typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions;
/**
* @brief Defines set of buttons subscription
@@ -409,6 +409,20 @@ class Application : public virtual InitialApplicationData,
virtual void UpdateHash() = 0;
/**
+ * @brief checks is hashID was changed during suspended state
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ virtual bool IsHashChangedDuringSuspend() const = 0;
+
+ /**
+ * @brief changes state of the flag which tracks is hashID was changed during
+ * suspended state or not
+ * @param state new state of the flag
+ */
+ virtual void SetHashChangedDuringSuspend(const bool state) = 0;
+
+ /**
* @brief method is called when SDL is saving application data for resumption
* @return TRUE if data of application need to save for resumption, otherwise
* return FALSE
@@ -837,7 +851,7 @@ class Application : public virtual InitialApplicationData,
* @brief Get list of subscriptions to vehicle info notifications
* @return list of subscriptions to vehicle info notifications
*/
- virtual const std::set<uint32_t>& SubscribesIVI() const = 0;
+ virtual const VehicleInfoSubscriptions& SubscribesIVI() const = 0;
#endif // SDL_REMOTE_CONTROL
protected:
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index dc2d8ce528..01963e24e7 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -198,17 +198,35 @@ class ApplicationImpl : public virtual Application,
virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE;
virtual const std::string& curHash() const;
+
#ifdef CUSTOMER_PASA
+ // DEPRECATED
virtual bool flag_sending_hash_change_after_awake() const;
+ // DEPRECATED
virtual void set_flag_sending_hash_change_after_awake(bool flag);
#endif // CUSTOMER_PASA
- /**
- * @brief Change Hash for current application
- * and send notification to mobile
- * @return updated_hash
- */
+
+ /**
+ * @brief Change Hash for current application
+ * and send notification to mobile
+ * @return updated_hash
+ */
virtual void UpdateHash();
+ /**
+ * @brief checks is hashID was changed during suspended state
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ bool IsHashChangedDuringSuspend() const OVERRIDE;
+
+ /**
+ * @brief changes state of the flag which tracks is hashID was changed during
+ * suspended state or not
+ * @param state new state of the flag
+ */
+ void SetHashChangedDuringSuspend(const bool state) OVERRIDE;
+
UsageStatistics& usage_report();
bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
@@ -331,7 +349,7 @@ class ApplicationImpl : public virtual Application,
* @brief Get list of subscriptions to vehicle info notifications
* @return list of subscriptions to vehicle info notifications
*/
- const std::set<uint32_t>& SubscribesIVI() const OVERRIDE;
+ const VehicleInfoSubscriptions& SubscribesIVI() const OVERRIDE;
/**
* @brief Return pointer to extension by uid
@@ -432,6 +450,7 @@ class ApplicationImpl : public virtual Application,
protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
sync_primitives::atomic_bool is_resuming_;
+ bool is_hash_changed_during_suspend_;
uint32_t video_stream_retry_number_;
uint32_t audio_stream_retry_number_;
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 7a26501afc..a0b8d45de2 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
@@ -48,7 +48,6 @@
#include "application_manager/message_helper.h"
#include "application_manager/request_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/vehicle_info_data.h"
#include "application_manager/state_controller_impl.h"
#include "application_manager/app_launch/app_launch_data.h"
#include "application_manager/application_manager_settings.h"
@@ -349,8 +348,8 @@ class ApplicationManagerImpl
* @param vehicle_info Enum value of type of vehicle data
* @param new value (for integer values currently) of vehicle data
*/
- std::vector<ApplicationSharedPtr> IviInfoUpdated(VehicleDataType vehicle_info,
- int value) OVERRIDE;
+ std::vector<ApplicationSharedPtr> IviInfoUpdated(
+ mobile_apis::VehicleDataType::eType vehicle_info, int value) OVERRIDE;
void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE;
@@ -838,8 +837,7 @@ class ApplicationManagerImpl
void OnFindNewApplicationsRequest() OVERRIDE;
void RemoveDevice(
const connection_handler::DeviceHandle& device_handle) OVERRIDE;
- // DEPRECATED
- bool OnServiceStartedCallback(
+ DEPRECATED bool OnServiceStartedCallback(
const connection_handler::DeviceHandle& device_handle,
const int32_t& session_key,
const protocol_handler::ServiceType& type) OVERRIDE;
@@ -1402,9 +1400,8 @@ class ApplicationManagerImpl
* @param service_type Type of service to start
* @return True on success, false on fail
*/
- // DEPRECATED
- bool StartNaviService(uint32_t app_id,
- protocol_handler::ServiceType service_type);
+ DEPRECATED bool StartNaviService(uint32_t app_id,
+ protocol_handler::ServiceType service_type);
/**
* @brief Starts specified navi service for application
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index aa3c216d4d..74a884a223 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -43,27 +43,18 @@ namespace application_manager {
namespace commands {
struct ResponseInfo {
- ResponseInfo()
- : result_code(hmi_apis::Common_Result::INVALID_ENUM)
- , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM)
- , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
- , is_ok(false)
- , is_unsupported_resource(false)
- , is_invalid_enum(false) {}
- ResponseInfo(hmi_apis::Common_Result::eType result,
- HmiInterfaces::InterfaceID interface)
- : result_code(result)
- , interface(interface)
- , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
- , is_ok(false)
- , is_unsupported_resource(false)
- , is_invalid_enum(false) {}
+ DEPRECATED ResponseInfo(hmi_apis::Common_Result::eType result,
+ HmiInterfaces::InterfaceID interface);
+ ResponseInfo();
+ ResponseInfo(const hmi_apis::Common_Result::eType result,
+ const HmiInterfaces::InterfaceID hmi_interface,
+ ApplicationManager& application_manager);
hmi_apis::Common_Result::eType result_code;
HmiInterfaces::InterfaceID interface;
HmiInterfaces::InterfaceState interface_state;
bool is_ok;
bool is_unsupported_resource;
- bool is_invalid_enum;
+ bool is_not_used;
};
namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
@@ -290,6 +281,19 @@ class CommandRequestImpl : public CommandImpl,
mobile_apis::Result::eType PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second);
+ /**
+ * @brief Resolves if the return code must be
+ * UNSUPPORTED_RESOURCE
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * @return True, if the communication return code must be
+ * UNSUPPORTED_RESOURCE, otherwise false.
+ */
+ bool IsResultCodeUnsupported(const ResponseInfo& first,
+ const ResponseInfo& second) const;
+
protected:
/**
* @brief Returns policy parameters permissions
@@ -297,6 +301,35 @@ class CommandRequestImpl : public CommandImpl,
*/
const CommandParametersPermissions& parameters_permissions() const;
+ /**
+ * @brief Adds interface to be awaited for by sdl request command
+ @param interface_id interface which SDL expects to response in given time
+ */
+ void StartAwaitForInterface(const HmiInterfaces::InterfaceID interface_id);
+
+ /**
+ * @brief Gets interface await state.
+ * @param interface_id interface which SDL awaits for response in given time
+ * @return true if SDL awaits for response from given interface in
+ * interface_id
+ */
+ bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const;
+
+ /**
+ * @brief Sets given HMI interface await status to false
+ * @param interface_id interface which SDL no longer awaits for response in
+ * given time
+ */
+ void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id);
+
+ /**
+ * @brief This set stores all the interfaces which are awaited by SDL to
+ * return a response on some request
+ */
+ std::set<HmiInterfaces::InterfaceID> awaiting_response_interfaces_;
+
+ mutable sync_primitives::Lock awaiting_response_interfaces_lock_;
+
RequestState current_state_;
sync_primitives::Lock state_lock_;
CommandParametersPermissions parameters_permissions_;
@@ -331,10 +364,10 @@ class CommandRequestImpl : public CommandImpl,
const hmi_apis::FunctionID::eType& function_id);
/**
- * @brief UpdateHash updates hash field for application and sends
- * OnHashChanged notification to mobile side in case of approriate hash mode
- * is set
- */
+ * @brief UpdateHash updates hash field for application and sends
+ * OnHashChanged notification to mobile side in case of approriate hash mode
+ * is set
+ */
void UpdateHash();
/**
@@ -342,6 +375,13 @@ class CommandRequestImpl : public CommandImpl,
* it is value of 'success' field of appropriate response sent to mobile
*/
bool is_success_result_;
+
+ /**
+ * @brief Add information for the component of response in case of timeout
+ * @param response Response message, which info should be extended
+ */
+ void AddTimeOutComponentInfoToMessage(
+ smart_objects::SmartObject& response) const;
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
index f789a14780..daa71e68b5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2017, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,3 +29,45 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
+
+#include "application_manager/commands/hmi/notification_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief OnAwakeSDLNotification command class
+ **/
+class OnAwakeSDLNotification : public NotificationFromHMI {
+ public:
+ /**
+ * @brief OnAwakeSDLNotification class constructor
+ * @param message Incoming SmartObject message
+ * @param application_manager reference to ApplicationManager instance
+ **/
+ OnAwakeSDLNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief OnAwakeSDLNotification class destructor
+ **/
+ virtual ~OnAwakeSDLNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAwakeSDLNotification);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
index a752e00801..92ef97a4aa 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
@@ -60,7 +60,7 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI {
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() FINAL;
private:
/**
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h
index 77f1813e46..01b9782662 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h
@@ -72,13 +72,6 @@ class AlertRequest : public CommandRequestImpl {
**/
virtual void Run();
- /*
- * @brief Will caled by request controller, when default will be expired.
- * If Alert request has soft buttons, timeout response should not be sent to
- * mobile
- */
- virtual void onTimeOut();
-
/**
* @brief Interface method that is called whenever new event received
*
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h
index f783af12b3..2cd8e386e0 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h
@@ -167,6 +167,16 @@ class ChangeRegistrationRequest : public CommandRequestImpl {
std::string vr_response_info_;
std::string tts_response_info_;
+ void SendVRRequest(ApplicationSharedPtr app,
+ smart_objects::SmartObject& msg_params);
+
+ void SendTTSRequest(ApplicationSharedPtr app,
+ smart_objects::SmartObject& msg_params);
+
+ void SendUIRequest(ApplicationSharedPtr app,
+ smart_objects::SmartObject& msg_params,
+ const int32_t hmi_language);
+
DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h
index 99f86ea1d5..6e0e634459 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h
@@ -87,12 +87,38 @@ class PerformAudioPassThruRequest : public CommandRequestImpl {
private:
/**
* @brief Prepare result code, result and info for sending to mobile
+ * @brief Response params
+ * success for sending to mobile application
+ * result code for sending to mobile application
+ * info for sending to mobile application
+ */
+ struct ResponseParams {
+ bool success;
+ mobile_apis::Result::eType result_code;
+ std::string info;
+ ResponseParams()
+ : success(false), result_code(mobile_apis::Result::INVALID_ENUM) {}
+ };
+
+ ResponseParams response_params_;
+
+ /**
+ * @brief Prepare result code, result and info for sending to mobile
* application
* @param result_code contains result code for sending to mobile application
* @return result for sending to mobile application.
+ * @deprecated
*/
- bool PrepareResponseParameters(mobile_apis::Result::eType& result_code,
- std::string& info);
+ DEPRECATED bool PrepareResponseParameters(
+ mobile_apis::Result::eType& result_code, std::string& info);
+ /**
+ * @brief Prepare result code, 'success' result and info for sending
+ * to mobile application
+ * @param result_code contains result code for sending to mobile application
+ * @return result for sending to mobile application.
+ */
+ const ResponseParams& PrepareResponseParameters();
+
/**
* @brief Sends TTS Speak request
*/
@@ -137,6 +163,23 @@ class PerformAudioPassThruRequest : public CommandRequestImpl {
during perform audio pass thru*/
bool awaiting_tts_speak_response_;
bool awaiting_ui_response_;
+ /**
+ * @brief Pair of result_code and success for mobile app
+ */
+ typedef std::pair<mobile_apis::Result::eType, bool> AudioPassThruResults;
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app in
+ * audioPassThru communication.
+ * @param ui_response contains result_code from UI
+ * @param tts_response contains result_code from TTS
+ * @return pair of result code (UI error code has precedence than TTS's,
+ * error_code from TTS is turned to WARNINGS) and
+ * result for mobile app
+ */
+ AudioPassThruResults PrepareAudioPassThruResultCodeForResponse(
+ const ResponseInfo& ui_response, const ResponseInfo& tts_response);
hmi_apis::Common_Result::eType result_tts_speak_;
hmi_apis::Common_Result::eType result_ui_;
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
index eb955df197..c16a014c9f 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h
@@ -131,12 +131,6 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl {
DISALLOW_COPY_AND_ASSIGN(ResetGlobalPropertiesRequest);
- bool is_ui_send_;
- bool is_tts_send_;
-
- bool is_ui_received_;
- bool is_tts_received_;
-
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType tts_result_;
std::string ui_response_info_;
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
index eb360b50d8..f556f81764 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
@@ -148,6 +148,11 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
*/
VehicleInfoSubscriptions vi_already_subscribed_by_this_app_;
+ /**
+ * @brief VI parameters which wait for subscribe after HMI respond
+ */
+ VehicleInfoSubscriptions vi_waiting_for_subscribe_;
+
DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest);
};
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 cbab1fcc80..9380fb41ac 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
@@ -425,6 +425,20 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool video_streaming_supported() const OVERRIDE;
/*
+ * @brief Interface to store whether HMI supports remote control
+ *
+ * @param supported Indicates whether video streaming is supported by HMI
+ */
+ void set_rc_supported(const bool supported) OVERRIDE;
+
+ /*
+ * @brief Retrieves whether HMI supports remote control
+ *
+ * @return TRUE if it supported, otherwise FALSE
+ */
+ bool rc_supported() const OVERRIDE;
+
+ /*
* @brief Interface used to store information regarding
* the navigation "System Capability"
*
@@ -557,6 +571,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool is_navigation_supported_;
bool is_phone_call_supported_;
bool is_video_streaming_supported_;
+ bool is_rc_supported_;
std::string ccpu_version_;
smart_objects::SmartObject* navigation_capability_;
smart_objects::SmartObject* phone_capability_;
diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h
index 77ef5479ee..f399da6870 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -93,7 +93,8 @@ class Message {
void set_correlation_id(int32_t id);
void set_connection_key(int32_t key);
void set_message_type(MessageType type);
- void set_binary_data(BinaryData* data);
+ DEPRECATED void set_binary_data(BinaryData* data);
+ void set_binary_data(const BinaryData* data);
void set_json_message(const std::string& json_message);
void set_protocol_version(protocol_handler::MajorProtocolVersion version);
void set_smart_object(const smart_objects::SmartObject& object);
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index c0a3f37c34..a0b70435b0 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -42,7 +42,6 @@
#include "utils/macro.h"
#include "connection_handler/device.h"
#include "application_manager/application.h"
-#include "application_manager/vehicle_info_data.h"
#include "policy/policy_types.h"
#include "protocol_handler/session_observer.h"
#include "application_manager/policies/policy_handler_interface.h"
@@ -61,7 +60,7 @@ namespace mobile_api = mobile_apis;
* @param const char* Name of the parameter in mobile request
* @param VehicleDataType Enum for vehicle data
*/
-typedef std::map<std::string, VehicleDataType> VehicleData;
+typedef std::map<std::string, mobile_apis::VehicleDataType::eType> VehicleData;
/**
* @brief MessageHelper class
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 26b1739a38..0ec58f2419 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -115,11 +115,25 @@ class ResumeCtrl {
virtual void OnSuspend() = 0;
/**
+ * @brief Processes resumption data after receiving signal "Ignition Off"
+ */
+ virtual void OnIgnitionOff() = 0;
+
+ /**
* @brief Processes resumption data after receiving signal "Awake"
*/
virtual void OnAwake() = 0;
/**
+ * @brief Checks if SDL has already received OnExitAllApplication notification
+ * with "SUSPEND" reason
+ *
+ * @return Returns TRUE if SDL has received OnExitAllApplication notification
+ * with reason "SUSPEND" otherwise returns FALSE
+ */
+ virtual bool is_suspended() const = 0;
+
+ /**
* @brief Method stops timer "RsmCtrlPercist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index bb886cd5f6..d7ff621c95 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -129,11 +129,25 @@ class ResumeCtrlImpl : public ResumeCtrl,
void OnSuspend() OVERRIDE;
/**
+ * @brief Processes resumption data after receiving signal "Ignition Off"
+ */
+ void OnIgnitionOff() OVERRIDE;
+
+ /**
* @brief Processes resumption data after receiving signal "Awake"
*/
void OnAwake() OVERRIDE;
/**
+ * @brief Checks if SDL has already received OnExitAllApplication notification
+ * with "SUSPEND" reason
+ *
+ * @return Returns TRUE if SDL has received OnExitAllApplication notification
+ * with reason "SUSPEND" otherwise returns FALSE
+ */
+ bool is_suspended() const OVERRIDE;
+
+ /**
* @brief Method stops timer "RsmCtrlPercist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
@@ -301,6 +315,12 @@ class ResumeCtrlImpl : public ResumeCtrl,
void SaveDataOnTimer();
/**
+ * @brief FinalPersistData persists ResumptionData last time and stops
+ * persistent data timer to avoid further persisting
+ */
+ void FinalPersistData();
+
+ /**
* @brief AddFiles allows to add files for the application
* which should be resumed
* @param application application which will be resumed
@@ -491,6 +511,7 @@ class ResumeCtrlImpl : public ResumeCtrl,
WaitingForTimerList waiting_for_timer_;
bool is_resumption_active_;
bool is_data_saved_;
+ bool is_suspended_;
time_t launch_time_;
utils::SharedPtr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index aeb65b32b9..a9954141af 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -91,9 +91,27 @@ class ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
+ virtual void IncrementIgnOffCount() = 0;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ // DEPRECATED
virtual void OnSuspend() = 0;
/**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ virtual void DecrementIgnOffCount() = 0;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ virtual void OnAwake() = 0;
+
+ /**
* @brief Retrieves hash ID for the given mobile app ID
* and device ID from stored information.
* @param policy_app_id - mobile application id
@@ -108,12 +126,6 @@ class ResumptionData {
std::string& hash_id) const = 0;
/**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- virtual void OnAwake() = 0;
-
- /**
* @brief Retrieves data of saved application for the given mobile app ID
* and device ID
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index 862816bf87..8cb70274f3 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -113,7 +113,25 @@ class ResumptionDataDB : public ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnSuspend();
+ // DEPRECATED
+ void OnSuspend() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ void OnAwake() FINAL;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ void IncrementIgnOffCount() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ void DecrementIgnOffCount() FINAL;
/**
* @brief Retrieves hash ID for the given mobile app ID
@@ -130,12 +148,6 @@ class ResumptionDataDB : public ResumptionData {
std::string& hash_id) const;
/**
- * @brief Decrements ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- virtual void OnAwake();
-
- /**
* @brief Retrieves data of saved application for the given mobile app ID
* and device ID
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 0be6d64db2..4da3441037 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -85,13 +85,25 @@ class ResumptionDataJson : public ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnSuspend();
+ // DEPRECATED
+ void OnSuspend() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ void OnAwake() FINAL;
/**
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnAwake();
+ void IncrementIgnOffCount() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ void DecrementIgnOffCount() FINAL;
/**
* @brief Retrieves hash ID for the given mobile app ID
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 25fa435364..0d4eeea0c4 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
@@ -270,6 +270,7 @@ extern const char* hmi_capabilities;
extern const char* navigation;
extern const char* phone_call;
extern const char* video_streaming;
+extern const char* remote_control;
extern const char* sdl_version;
extern const char* system_software_version;
extern const char* priority;
diff --git a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
index 950bcd44fa..cc4765e6c9 100644
--- a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
@@ -36,7 +36,7 @@ namespace app_launch {
const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `app_launch`( "
" `deviceMac` TEXT, "
- " `appID` TEXT,"
+ " `appID` TEXT collate nocase,"
" `bundleID` TEXT,"
" `last_session` DATETIME, "
" PRIMARY KEY(`deviceMac`, `appID`, `bundleID`)"
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 4a752febf8..0ba98d67f5 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -44,6 +44,7 @@
#include "utils/make_shared.h"
#include "utils/timer_task_impl.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace {
@@ -111,6 +112,7 @@ ApplicationImpl::ApplicationImpl(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
+ , is_hash_changed_during_suspend_(false)
, video_stream_retry_number_(0)
, audio_stream_retry_number_(0)
, video_stream_suspend_timer_(
@@ -720,19 +722,23 @@ bool ApplicationImpl::UnsubscribeFromButton(
bool ApplicationImpl::SubscribeToIVI(uint32_t vehicle_info_type) {
sync_primitives::AutoLock lock(vi_lock_);
- return subscribed_vehicle_info_.insert(vehicle_info_type).second;
+ return subscribed_vehicle_info_
+ .insert(
+ static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type))
+ .second;
}
bool ApplicationImpl::IsSubscribedToIVI(uint32_t vehicle_info_type) const {
sync_primitives::AutoLock lock(vi_lock_);
- VehicleInfoSubscriptions::const_iterator it =
- subscribed_vehicle_info_.find(vehicle_info_type);
+ VehicleInfoSubscriptions::const_iterator it = subscribed_vehicle_info_.find(
+ static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type));
return (subscribed_vehicle_info_.end() != it);
}
bool ApplicationImpl::UnsubscribeFromIVI(uint32_t vehicle_info_type) {
sync_primitives::AutoLock lock(vi_lock_);
- return subscribed_vehicle_info_.erase(vehicle_info_type);
+ return subscribed_vehicle_info_.erase(
+ static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type));
}
UsageStatistics& ApplicationImpl::usage_report() {
@@ -868,7 +874,19 @@ void ApplicationImpl::UpdateHash() {
utils::gen_hash(application_manager_.get_settings().hash_string_size());
set_is_application_data_changed(true);
- MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ if (!application_manager_.resume_controller().is_suspended()) {
+ MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ } else {
+ is_hash_changed_during_suspend_ = true;
+ }
+}
+
+bool ApplicationImpl::IsHashChangedDuringSuspend() const {
+ return is_hash_changed_during_suspend_;
+}
+
+void ApplicationImpl::SetHashChangedDuringSuspend(const bool state) {
+ is_hash_changed_during_suspend_ = state;
}
void ApplicationImpl::CleanupFiles() {
@@ -1045,7 +1063,7 @@ void ApplicationImpl::set_hmi_level(
usage_report_.RecordHmiStateChanged(new_hmi_level);
}
-const std::set<uint32_t>& ApplicationImpl::SubscribesIVI() const {
+const VehicleInfoSubscriptions& ApplicationImpl::SubscribesIVI() const {
return subscribed_vehicle_info_;
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 5feb29e51d..d7b9f4c054 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -354,11 +354,11 @@ struct IsApplication {
};
std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated(
- VehicleDataType vehicle_info, int value) {
+ mobile_apis::VehicleDataType::eType vehicle_info, int value) {
// Notify Policy Manager if available about info it's interested in,
// i.e. odometer etc
switch (vehicle_info) {
- case ODOMETER:
+ case mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER:
GetPolicyHandler().KmsChanged(value);
break;
default:
@@ -1166,7 +1166,6 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
}
}
-// DEPRECATED
bool ApplicationManagerImpl::StartNaviService(
uint32_t app_id, protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
@@ -1227,8 +1226,22 @@ bool ApplicationManagerImpl::StartNaviService(
if (service_type == ServiceType::kMobileNav) {
smart_objects::SmartObject converted_params(smart_objects::SmartType_Map);
ConvertVideoParamsToSO(converted_params, params);
+ std::vector<std::string> rejected_params;
+ if (converted_params.keyExists(strings::codec) &&
+ converted_params[strings::codec] ==
+ hmi_apis::Common_VideoStreamingCodec::INVALID_ENUM) {
+ rejected_params.push_back(strings::codec);
+ }
+ if (converted_params.keyExists(strings::protocol) &&
+ converted_params[strings::protocol] ==
+ hmi_apis::Common_VideoStreamingProtocol::INVALID_ENUM) {
+ rejected_params.push_back(strings::protocol);
+ }
- if (!converted_params.empty()) {
+ if (!rejected_params.empty()) {
+ OnStreamingConfigured(app_id, service_type, false, rejected_params);
+ return false;
+ } else if (!converted_params.empty()) {
LOG4CXX_INFO(logger_, "Sending video configuration params");
#ifdef DEBUG
MessageHelper::PrintSmartObject(converted_params);
@@ -1248,6 +1261,8 @@ bool ApplicationManagerImpl::StartNaviService(
} else {
LOG4CXX_WARN(logger_, "Refused navi service by HMI level");
}
+ std::vector<std::string> empty;
+ OnStreamingConfigured(app_id, service_type, false, empty);
return false;
}
@@ -1322,7 +1337,9 @@ void ApplicationManagerImpl::StopNaviService(
app->StopStreaming(service_type);
}
-// DEPRECATED
+// Suppress warning for deprecated method used within another deprecated method
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
bool ApplicationManagerImpl::OnServiceStartedCallback(
const connection_handler::DeviceHandle& device_handle,
const int32_t& session_key,
@@ -1358,6 +1375,7 @@ bool ApplicationManagerImpl::OnServiceStartedCallback(
}
return false;
}
+#pragma GCC diagnostic pop
void ApplicationManagerImpl::OnServiceStartedCallback(
const connection_handler::DeviceHandle& device_handle,
@@ -1390,8 +1408,7 @@ void ApplicationManagerImpl::OnServiceStartedCallback(
type, ServiceType::kMobileNav, ServiceType::kAudio)) {
if (app->is_navi() || app->mobile_projection_enabled()) {
if (!StartNaviService(session_key, type, params)) {
- connection_handler().NotifyServiceStartedResult(
- session_key, false, empty);
+ LOG4CXX_WARN(logger_, "Starting Navigation service failed");
}
return;
} else {
@@ -1611,11 +1628,11 @@ void ApplicationManagerImpl::SendMessageToMobile(
(*message)[strings::params][strings::function_id].asUInt());
if (function_id == mobile_apis::FunctionID::RegisterAppInterfaceID &&
(*message)[strings::msg_params][strings::success].asBool()) {
- const bool is_for_plugin = plugin_manager_.IsAppForPlugins(app);
LOG4CXX_INFO(logger_,
- "Registered app " << app->app_id() << " is "
- << (is_for_plugin ? "" : "not ")
- << "for plugins.");
+ "Registered app "
+ << app->app_id() << " is "
+ << (plugin_manager_.IsAppForPlugins(app) ? "" : "not ")
+ << "for plugins.");
}
#endif // SDL_REMOTE_CONTROL
} else if (app) {
@@ -2284,7 +2301,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
}
if (message.getElement(jhs::S_PARAMS).keyExists(strings::binary_data)) {
- application_manager::BinaryData binaryData(
+ const application_manager::BinaryData binaryData(
message.getElement(jhs::S_PARAMS)
.getElement(strings::binary_data)
.asBinary());
@@ -2891,7 +2908,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
}
}
if (is_ignition_off) {
- resume_controller().OnSuspend();
+ resume_controller().OnIgnitionOff();
}
request_ctrl_.terminateAllHMIRequests();
}
@@ -4043,21 +4060,12 @@ void ApplicationManagerImpl::ConvertVideoParamsToSO(
const char* protocol =
bson_object_get_string(obj, protocol_handler::strings::video_protocol);
if (protocol != NULL) {
- hmi_apis::Common_VideoStreamingProtocol::eType protocol_enum =
- ConvertVideoProtocol(protocol);
- if (protocol_enum !=
- hmi_apis::Common_VideoStreamingProtocol::INVALID_ENUM) {
- output[strings::protocol] = protocol_enum;
- }
+ output[strings::protocol] = ConvertVideoProtocol(protocol);
}
const char* codec =
bson_object_get_string(obj, protocol_handler::strings::video_codec);
if (codec != NULL) {
- hmi_apis::Common_VideoStreamingCodec::eType codec_enum =
- ConvertVideoCodec(codec);
- if (codec_enum != hmi_apis::Common_VideoStreamingCodec::INVALID_ENUM) {
- output[strings::codec] = codec_enum;
- }
+ output[strings::codec] = ConvertVideoCodec(codec);
}
BsonElement* element =
bson_object_get(obj, protocol_handler::strings::height);
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 3f9a1d13b3..09aa4169e5 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -33,6 +33,7 @@
#include <algorithm>
#include <string>
#include "utils/macro.h"
+#include "utils/make_shared.h"
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -105,20 +106,29 @@ const std::string CreateInfoForUnsupportedResult(
}
bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) {
- if (first.is_ok && second.is_unsupported_resource &&
- second.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) {
+ if (first.is_ok && second.is_unsupported_resource) {
+ return true;
+ }
+ if (first.is_ok && second.is_not_used) {
+ return true;
+ }
+ if (first.is_ok && second.is_ok) {
return true;
}
return false;
}
-bool IsResultCodeUnsupported(const ResponseInfo& first,
- const ResponseInfo& second) {
- return ((first.is_ok || first.is_invalid_enum) &&
- second.is_unsupported_resource) ||
- ((second.is_ok || second.is_invalid_enum) &&
- first.is_unsupported_resource) ||
- (first.is_unsupported_resource && second.is_unsupported_resource);
+bool IsResultCodeWarning(const ResponseInfo& first,
+ const ResponseInfo& second) {
+ const bool first_is_ok_second_is_warn =
+ (first.is_ok || first.is_not_used) &&
+ hmi_apis::Common_Result::WARNINGS == second.result_code;
+
+ const bool both_warnings =
+ hmi_apis::Common_Result::WARNINGS == first.result_code &&
+ hmi_apis::Common_Result::WARNINGS == second.result_code;
+
+ return first_is_ok_second_is_warn || both_warnings;
}
struct DisallowedParamsInserter {
@@ -146,6 +156,42 @@ struct DisallowedParamsInserter {
mobile_apis::VehicleDataResultCode::eType code_;
};
+ResponseInfo::ResponseInfo()
+ : result_code(hmi_apis::Common_Result::INVALID_ENUM)
+ , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM)
+ , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
+ , is_ok(false)
+ , is_unsupported_resource(false)
+ , is_not_used(false) {}
+
+ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result,
+ const HmiInterfaces::InterfaceID hmi_interface,
+ ApplicationManager& application_manager)
+ : result_code(result)
+ , interface(hmi_interface)
+ , interface_state(HmiInterfaces::STATE_NOT_RESPONSE)
+ , is_ok(false)
+ , is_unsupported_resource(false)
+ , is_not_used(false) {
+ using namespace helpers;
+
+ interface_state =
+ application_manager.hmi_interfaces().GetInterfaceState(hmi_interface);
+
+ is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ result_code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED);
+
+ is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code;
+
+ is_unsupported_resource =
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code;
+}
+
CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message,
ApplicationManager& application_manager)
: CommandImpl(message, application_manager)
@@ -193,7 +239,7 @@ void CommandRequestImpl::onTimeOut() {
function_id(),
correlation_id(),
mobile_api::Result::GENERIC_ERROR);
-
+ AddTimeOutComponentInfoToMessage(*response);
application_manager_.ManageMobileCommand(response, ORIGIN_SDL);
}
@@ -204,6 +250,7 @@ void CommandRequestImpl::SendResponse(
const mobile_apis::Result::eType& result_code,
const char* info,
const smart_objects::SmartObject* response_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
{
sync_primitives::AutoLock auto_lock(state_lock_);
if (kTimedOut == current_state_) {
@@ -214,11 +261,9 @@ void CommandRequestImpl::SendResponse(
current_state_ = kCompleted;
}
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
- if (!result) {
- LOG4CXX_ERROR(logger_, "Memory allocation failed.");
- return;
- }
+ smart_objects::SmartObjectSPtr result =
+ utils::MakeShared<smart_objects::SmartObject>();
+
smart_objects::SmartObject& response = *result;
response[strings::params][strings::message_type] = MessageType::kResponse;
@@ -755,6 +800,7 @@ bool CommandRequestImpl::HasDisallowedParams() const {
bool CommandRequestImpl::PrepareResultForMobileResponse(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
+ LOG4CXX_AUTO_TRACE(logger_);
using namespace helpers;
if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
result_code,
@@ -777,48 +823,9 @@ bool CommandRequestImpl::PrepareResultForMobileResponse(
bool CommandRequestImpl::PrepareResultForMobileResponse(
ResponseInfo& out_first, ResponseInfo& out_second) const {
- using namespace helpers;
-
- out_first.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- out_first.result_code,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::WRONG_LANGUAGE,
- hmi_apis::Common_Result::RETRY,
- hmi_apis::Common_Result::SAVED);
-
- out_second.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- out_second.result_code,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::WRONG_LANGUAGE,
- hmi_apis::Common_Result::RETRY,
- hmi_apis::Common_Result::SAVED);
-
- out_first.is_invalid_enum =
- hmi_apis::Common_Result::INVALID_ENUM == out_first.result_code;
-
- out_second.is_invalid_enum =
- hmi_apis::Common_Result::INVALID_ENUM == out_second.result_code;
-
- out_first.is_unsupported_resource =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == out_first.result_code;
-
- out_second.is_unsupported_resource =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == out_second.result_code;
-
- out_first.interface_state =
- application_manager_.hmi_interfaces().GetInterfaceState(
- out_first.interface);
- out_second.interface_state =
- application_manager_.hmi_interfaces().GetInterfaceState(
- out_second.interface);
-
- bool result = (out_first.is_ok && out_second.is_ok) ||
- (out_second.is_invalid_enum && out_first.is_ok) ||
- (out_first.is_invalid_enum && out_second.is_ok);
- result = result || CheckResultCode(out_first, out_second);
- result = result || CheckResultCode(out_second, out_first);
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool result = CheckResultCode(out_first, out_second) ||
+ CheckResultCode(out_second, out_first);
return result;
}
@@ -835,25 +842,30 @@ void CommandRequestImpl::GetInfo(
mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse(
const ResponseInfo& first, const ResponseInfo& second) {
+ LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
- if (IsResultCodeUnsupported(first, second)) {
- result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
- } else {
- // If response contains erroneous result code SDL need return erroneus
- // result code.
- hmi_apis::Common_Result::eType first_result =
- hmi_apis::Common_Result::INVALID_ENUM;
- hmi_apis::Common_Result::eType second_result =
- hmi_apis::Common_Result::INVALID_ENUM;
- if (!first.is_unsupported_resource) {
- first_result = first.result_code;
- }
- if (!second.is_unsupported_resource) {
- second_result = second.result_code;
- }
- result_code =
- MessageHelper::HMIToMobileResult(std::max(first_result, second_result));
- }
+ if (IsResultCodeUnsupported(first, second) ||
+ IsResultCodeUnsupported(second, first)) {
+ return mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ }
+ if (IsResultCodeWarning(first, second) ||
+ IsResultCodeWarning(second, first)) {
+ return mobile_apis::Result::WARNINGS;
+ }
+ // If response contains erroneous result code SDL need return erroneus
+ // result code.
+ hmi_apis::Common_Result::eType first_result =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ hmi_apis::Common_Result::eType second_result =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ if (!first.is_unsupported_resource) {
+ first_result = first.result_code;
+ }
+ if (!second.is_unsupported_resource) {
+ second_result = second.result_code;
+ }
+ result_code =
+ MessageHelper::HMIToMobileResult(std::max(first_result, second_result));
return result_code;
}
@@ -862,6 +874,100 @@ const CommandParametersPermissions& CommandRequestImpl::parameters_permissions()
return parameters_permissions_;
}
+void CommandRequestImpl::StartAwaitForInterface(
+ const HmiInterfaces::InterfaceID interface_id) {
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ awaiting_response_interfaces_.insert(interface_id);
+}
+
+bool CommandRequestImpl::IsInterfaceAwaited(
+ const HmiInterfaces::InterfaceID& interface_id) const {
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ std::set<HmiInterfaces::InterfaceID>::const_iterator it =
+ awaiting_response_interfaces_.find(interface_id);
+ return (it != awaiting_response_interfaces_.end());
+}
+
+void CommandRequestImpl::EndAwaitForInterface(
+ const HmiInterfaces::InterfaceID& interface_id) {
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ std::set<HmiInterfaces::InterfaceID>::const_iterator it =
+ awaiting_response_interfaces_.find(interface_id);
+ if (it != awaiting_response_interfaces_.end()) {
+ awaiting_response_interfaces_.erase(it);
+ } else {
+ LOG4CXX_WARN(logger_,
+ "EndAwaitForInterface called on interface \
+ which was not put into await state: "
+ << interface_id);
+ }
+}
+
+bool CommandRequestImpl::IsResultCodeUnsupported(
+ const ResponseInfo& first, const ResponseInfo& second) const {
+ const bool first_ok_second_unsupported =
+ (first.is_ok || first.is_not_used) && second.is_unsupported_resource;
+ const bool both_unsupported =
+ first.is_unsupported_resource && second.is_unsupported_resource;
+ return first_ok_second_unsupported || both_unsupported;
+}
+
+std::string GetComponentNameFromInterface(
+ const HmiInterfaces::InterfaceID& interface) {
+ switch (interface) {
+ case HmiInterfaces::HMI_INTERFACE_Buttons:
+ return "Buttons";
+ case HmiInterfaces::HMI_INTERFACE_BasicCommunication:
+ return "BasicCommunication";
+ case HmiInterfaces::HMI_INTERFACE_VR:
+ return "VR";
+ case HmiInterfaces::HMI_INTERFACE_TTS:
+ return "TTS";
+ case HmiInterfaces::HMI_INTERFACE_UI:
+ return "UI";
+ case HmiInterfaces::HMI_INTERFACE_Navigation:
+ return "Navigation";
+ case HmiInterfaces::HMI_INTERFACE_VehicleInfo:
+ return "VehicleInfo";
+ case HmiInterfaces::HMI_INTERFACE_SDL:
+ return "SDL";
+ default:
+ return "Unknown type";
+ }
+}
+
+const std::string InfoInterfaceSeparator(
+ const std::string& sum, const HmiInterfaces::InterfaceID container_value) {
+ return sum.empty()
+ ? GetComponentNameFromInterface(container_value)
+ : sum + ", " + GetComponentNameFromInterface(container_value);
+}
+
+void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
+ smart_objects::SmartObject& response) const {
+ using NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
+ if (awaiting_response_interfaces_.empty()) {
+ LOG4CXX_ERROR(logger_, "No interfaces awaiting, info param is empty");
+ return;
+ }
+
+ const std::string not_responding_interfaces_string =
+ std::accumulate(awaiting_response_interfaces_.begin(),
+ awaiting_response_interfaces_.end(),
+ std::string(""),
+ InfoInterfaceSeparator);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Not responding interfaces string: " << not_responding_interfaces_string);
+ if (!not_responding_interfaces_string.empty()) {
+ const std::string component_info =
+ not_responding_interfaces_string + " component does not respond";
+ response[strings::msg_params][strings::info] = component_info;
+ }
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
index 80b1edb5bb..c6c550a474 100644
--- a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
+++ b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2017, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,3 +29,45 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+OnAwakeSDLNotification::OnAwakeSDLNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
+
+OnAwakeSDLNotification::~OnAwakeSDLNotification() {}
+
+void OnAwakeSDLNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!application_manager_.resume_controller().is_suspended()) {
+ return;
+ }
+
+ {
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetIt itBegin = accessor.GetData().begin();
+ ApplicationSetIt itEnd = accessor.GetData().end();
+ for (; itBegin != itEnd; ++itBegin) {
+ const ApplicationSharedPtr app = *itBegin;
+ if (app && app->IsHashChangedDuringSuspend()) {
+ MessageHelper::SendHashUpdateNotification(app->app_id(),
+ application_manager_);
+ app->SetHashChangedDuringSuspend(false);
+ }
+ }
+ }
+
+ application_manager_.resume_controller().OnAwake();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
index 0bcb26df8a..42b8c64fc0 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -109,6 +109,8 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
logger_,
"StartAudioStreamRequest aborted. Application can not stream");
}
+ application_manager_.TerminateRequest(
+ connection_key(), correlation_id(), function_id());
break;
}
if (hmi_apis::Common_Result::REJECTED == code) {
@@ -125,15 +127,16 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
}
void AudioStartStreamRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
RetryStartSession();
-
- application_manager_.TerminateRequest(
- connection_key(), correlation_id(), function_id());
}
void AudioStartStreamRequest::RetryStartSession() {
LOG4CXX_AUTO_TRACE(logger_);
+ application_manager_.TerminateRequest(
+ connection_key(), correlation_id(), function_id());
+
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
@@ -156,10 +159,11 @@ void AudioStartStreamRequest::RetryStartSession() {
}
uint32_t curr_retry_number = app->audio_stream_retry_number();
+ LOG4CXX_DEBUG(
+ logger_, "Retry number " << curr_retry_number << " of " << retry_number_);
+
if (curr_retry_number < retry_number_) {
- LOG4CXX_DEBUG(
- logger_,
- "Send AudioStartStream retry. retry_number = " << curr_retry_number);
+ LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry");
MessageHelper::SendAudioStartStream(app->app_id(), application_manager_);
app->set_audio_stream_retry_number(++curr_retry_number);
} else {
diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
index b06c69e703..ffc325b5e4 100644
--- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
@@ -109,6 +109,8 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
logger_,
"NaviStartStreamRequest aborted. Application can not stream");
}
+ application_manager_.TerminateRequest(
+ connection_key(), correlation_id(), function_id());
break;
}
if (hmi_apis::Common_Result::REJECTED == code) {
@@ -125,15 +127,16 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
}
void NaviStartStreamRequest::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
RetryStartSession();
-
- application_manager_.TerminateRequest(
- connection_key(), correlation_id(), function_id());
}
void NaviStartStreamRequest::RetryStartSession() {
LOG4CXX_AUTO_TRACE(logger_);
+ application_manager_.TerminateRequest(
+ connection_key(), correlation_id(), function_id());
+
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
@@ -156,10 +159,11 @@ void NaviStartStreamRequest::RetryStartSession() {
}
uint32_t curr_retry_number = app->video_stream_retry_number();
+ LOG4CXX_DEBUG(
+ logger_, "Retry number " << curr_retry_number << " of " << retry_number_);
+
if (curr_retry_number < retry_number_) {
- LOG4CXX_DEBUG(
- logger_,
- "Send NaviStartStream retry. retry_number = " << curr_retry_number);
+ LOG4CXX_DEBUG(logger_, "Send NaviStartStream retry");
MessageHelper::SendNaviStartStream(app->app_id(), application_manager_);
app->set_video_stream_retry_number(++curr_retry_number);
} else {
diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
index 07a95adcea..cb68b21263 100644
--- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
@@ -75,6 +75,7 @@ void OnExitAllApplicationsNotification::Run() {
break;
}
case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: {
+ application_manager_.resume_controller().OnSuspend();
SendOnSDLPersistenceComplete();
return;
}
diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
index 5383876714..bba7e2f3ff 100644
--- a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc
@@ -53,8 +53,9 @@ void OnVIVehicleDataNotification::Run() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
if (msg_params.keyExists(strings::odometer)) {
- application_manager_.IviInfoUpdated(ODOMETER,
- msg_params[strings::odometer].asInt());
+ application_manager_.IviInfoUpdated(
+ mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER,
+ msg_params[strings::odometer].asInt());
}
SendNotificationToMobile(message_);
diff --git a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc
index 3ff6edd125..82cbd7f128 100644
--- a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc
+++ b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc
@@ -45,9 +45,14 @@ void RCGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
-
- hmi_capabilities.set_rc_capability(
- (*message_)[strings::msg_params][strings::rc_capability]);
+ bool capability_exists =
+ (*message_)[strings::msg_params].keyExists(strings::rc_capability);
+
+ if (capability_exists) {
+ hmi_capabilities.set_rc_capability(
+ (*message_)[strings::msg_params][strings::rc_capability]);
+ }
+ hmi_capabilities.set_rc_supported(capability_exists);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc
index 71b803d198..a976ce1044 100644
--- a/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc
@@ -62,10 +62,14 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) {
HMICapabilities& hmi_capabilities =
application_manager_.hmi_capabilities();
hmi_capabilities.set_is_rc_cooperating(is_available);
+ if (!is_available) {
+ hmi_capabilities.set_rc_supported(false);
+ }
+
if (!CheckAvailabilityHMIInterfaces(application_manager_,
HmiInterfaces::HMI_INTERFACE_RC)) {
LOG4CXX_INFO(logger_,
- "HmiInterfaces::HMI_INTERFACE_VR isn't available");
+ "HmiInterfaces::HMI_INTERFACE_RC isn't available");
return;
}
SendMessageToHMI();
diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc
index c748ddcbb6..69948b8122 100644
--- a/src/components/application_manager/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc
@@ -192,10 +192,12 @@ void AddCommandRequest::Run() {
}
if (send_ui_) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true);
}
if (send_vr_) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true);
}
}
@@ -317,6 +319,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_AddCommand: {
LOG4CXX_INFO(logger_, "Received UI_AddCommand event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -328,6 +331,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::VR_AddCommand: {
LOG4CXX_INFO(logger_, "Received VR_AddCommand event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
index a5491481dc..fe44e5a41f 100644
--- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
@@ -94,6 +94,7 @@ void AddSubMenuRequest::Run() {
(*message_)[strings::msg_params][strings::menu_name];
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true);
}
@@ -103,6 +104,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_AddSubMenu: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
index b151990289..d5767690d7 100644
--- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
@@ -111,6 +111,7 @@ void AlertManeuverRequest::Run() {
}
pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver);
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true);
@@ -123,6 +124,7 @@ void AlertManeuverRequest::Run() {
msg_params[hmi_request::speak_type] =
hmi_apis::Common_MethodName::ALERT_MANEUVER;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true);
}
}
@@ -134,6 +136,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
switch (event_id) {
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
pending_requests_.Remove(event_id);
navi_alert_maneuver_result_code_ =
static_cast<hmi_apis::Common_Result::eType>(
@@ -143,6 +146,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
pending_requests_.Remove(event_id);
tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -191,10 +195,13 @@ bool AlertManeuverRequest::PrepareResponseParameters(
application_manager::commands::ResponseInfo navigation_alert_info(
navi_alert_maneuver_result_code_,
- HmiInterfaces::HMI_INTERFACE_Navigation);
+ HmiInterfaces::HMI_INTERFACE_Navigation,
+ application_manager_);
application_manager::commands::ResponseInfo tts_alert_info(
- tts_speak_result_code_, HmiInterfaces::HMI_INTERFACE_TTS);
+ tts_speak_result_code_,
+ HmiInterfaces::HMI_INTERFACE_TTS,
+ application_manager_);
const bool result =
PrepareResultForMobileResponse(navigation_alert_info, tts_alert_info);
@@ -216,23 +223,42 @@ bool AlertManeuverRequest::PrepareResponseParameters(
bool AlertManeuverRequest::IsWhiteSpaceExist() {
LOG4CXX_AUTO_TRACE(logger_);
- const char* str = NULL;
+ using smart_objects::SmartArray;
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
- const smart_objects::SmartArray* tc_array =
+ const SmartArray* tts_chunks_arr =
(*message_)[strings::msg_params][strings::tts_chunks].asArray();
- smart_objects::SmartArray::const_iterator it_tc = tc_array->begin();
- smart_objects::SmartArray::const_iterator it_tc_end = tc_array->end();
+ SmartArray::const_iterator it_tts_chunk = tts_chunks_arr->begin();
- for (; it_tc != it_tc_end; ++it_tc) {
- str = (*it_tc)[strings::text].asCharArray();
- if (strlen(str) && !CheckSyntax(str)) {
+ for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) {
+ const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray();
+ if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) {
LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed");
return true;
}
}
}
+ if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ DCHECK_OR_RETURN(
+ (*message_)[strings::msg_params][strings::soft_buttons].getType() ==
+ smart_objects::SmartType_Array,
+ true);
+ const smart_objects::SmartArray* soft_button_array =
+ (*message_)[strings::msg_params][strings::soft_buttons].asArray();
+
+ SmartArray::const_iterator it_soft_button = soft_button_array->begin();
+
+ for (; it_soft_button != soft_button_array->end(); ++it_soft_button) {
+ const char* soft_button_text =
+ (*it_soft_button)[strings::text].asCharArray();
+ if (!CheckSyntax(soft_button_text)) {
+ LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed");
+ return true;
+ }
+ }
+ }
+
return false;
}
diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc
index 3288870b92..3c42e43767 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -116,18 +116,6 @@ void AlertRequest::Run() {
}
}
-void AlertRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (false ==
- (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
- CommandRequestImpl::onTimeOut();
- return;
- }
- LOG4CXX_INFO(logger_,
- "Default timeout ignored. "
- "AlertRequest with soft buttons wait timeout on HMI side");
-}
-
void AlertRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
@@ -148,6 +136,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::UI_Alert: {
LOG4CXX_INFO(logger_, "Received UI_Alert event");
// Unsubscribe from event to avoid unwanted messages
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert);
awaiting_ui_alert_response_ = false;
HmiInterfaces::InterfaceState ui_interface_state =
@@ -157,6 +146,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
if (awaiting_tts_speak_response_ &&
HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state) {
awaiting_tts_stop_speaking_response_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL, true);
}
alert_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -170,6 +160,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
// Unsubscribe from event to avoid unwanted messages
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak);
awaiting_tts_speak_response_ = false;
tts_speak_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -179,6 +170,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
// Unsubscribe from event to avoid unwanted messages
unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking);
awaiting_tts_stop_speaking_response_ = false;
@@ -204,9 +196,11 @@ void AlertRequest::on_event(const event_engine::Event& event) {
bool AlertRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& info) {
- ResponseInfo ui_alert_info(alert_result_, HmiInterfaces::HMI_INTERFACE_UI);
+ ResponseInfo ui_alert_info(
+ alert_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
ResponseInfo tts_alert_info(tts_speak_result_,
- HmiInterfaces::HMI_INTERFACE_TTS);
+ HmiInterfaces::HMI_INTERFACE_TTS,
+ application_manager_);
bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info);
@@ -219,7 +213,7 @@ bool AlertRequest::PrepareResponseParameters(
result = false;
}
result_code = mobile_apis::Result::WARNINGS;
- if ((ui_alert_info.is_ok || ui_alert_info.is_invalid_enum) &&
+ if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
tts_response_info_ = "Unsupported phoneme type sent in a prompt";
@@ -230,6 +224,10 @@ bool AlertRequest::PrepareResponseParameters(
result_code = PrepareResultCodeForResponse(ui_alert_info, tts_alert_info);
info = MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
+ // Mobile Alert request is successful when UI_Alert is successful
+ if (is_ui_alert_sent_ && !ui_alert_info.is_ok) {
+ return false;
+ }
return result;
}
@@ -346,6 +344,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
msg_params.keyExists(hmi_request::soft_buttons)) {
awaiting_ui_alert_response_ = true;
is_ui_alert_sent_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Alert, &msg_params, true);
}
}
@@ -370,6 +369,7 @@ void AlertRequest::SendSpeakRequest(int32_t app_id,
}
msg_params[strings::app_id] = app_id;
msg_params[hmi_request::speak_type] = Common_MethodName::ALERT;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true);
}
diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc
index f1f3b93e24..f55767c723 100644
--- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc
@@ -66,6 +66,73 @@ ChangeRegistrationRequest::ChangeRegistrationRequest(
ChangeRegistrationRequest::~ChangeRegistrationRequest() {}
+void ChangeRegistrationRequest::SendVRRequest(
+ ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ auto function = hmi_apis::FunctionID::VR_ChangeRegistration;
+ pending_requests_.Add(function);
+ smart_objects::SmartObject vr_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ vr_params[strings::language] = msg_params[strings::language];
+
+ vr_params[strings::app_id] = app->app_id();
+ if (msg_params.keyExists(strings::vr_synonyms)) {
+ vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms];
+ app->set_vr_synonyms(msg_params[strings::vr_synonyms]);
+ }
+ StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function));
+ SendHMIRequest(function, &vr_params, true);
+}
+
+void ChangeRegistrationRequest::SendTTSRequest(
+ ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ auto function = hmi_apis::FunctionID::TTS_ChangeRegistration;
+ pending_requests_.Add(function);
+
+ smart_objects::SmartObject tts_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ tts_params[strings::language] = msg_params[strings::language];
+
+ tts_params[strings::app_id] = app->app_id();
+ if (msg_params.keyExists(strings::tts_name)) {
+ tts_params[strings::tts_name] = msg_params[strings::tts_name];
+ app->set_tts_name(msg_params[strings::tts_name]);
+ }
+ StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function));
+ SendHMIRequest(function, &tts_params, true);
+}
+
+void ChangeRegistrationRequest::SendUIRequest(
+ ApplicationSharedPtr app,
+ smart_objects::SmartObject& msg_params,
+ const int32_t hmi_language) {
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ auto function = hmi_apis::FunctionID::UI_ChangeRegistration;
+ pending_requests_.Add(function);
+ // UI processing
+ smart_objects::SmartObject ui_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ui_params[strings::language] = hmi_language;
+ ui_params[strings::app_id] = app->app_id();
+ if (msg_params.keyExists(strings::app_name)) {
+ ui_params[strings::app_name] = msg_params[strings::app_name];
+ app->set_name(msg_params[strings::app_name].asCustomString());
+ }
+ if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
+ ui_params[strings::ngn_media_screen_app_name] =
+ msg_params[strings::ngn_media_screen_app_name];
+ app->set_ngn_media_screen_name(
+ msg_params[strings::ngn_media_screen_app_name]);
+ }
+
+ StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function));
+ SendHMIRequest(function, &ui_params, true);
+}
+
void ChangeRegistrationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace smart_objects;
@@ -111,53 +178,42 @@ void ChangeRegistrationRequest::Run() {
return;
}
- pending_requests_.Add(hmi_apis::FunctionID::UI_ChangeRegistration);
- pending_requests_.Add(hmi_apis::FunctionID::VR_ChangeRegistration);
- pending_requests_.Add(hmi_apis::FunctionID::TTS_ChangeRegistration);
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
- // UI processing
- SmartObject ui_params = SmartObject(SmartType_Map);
+ const HmiInterfaces::InterfaceState vr_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_VR);
+ const HmiInterfaces::InterfaceState ui_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_UI);
+ const HmiInterfaces::InterfaceState tts_state =
+ hmi_interfaces.GetInterfaceState(
+ HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS);
- ui_params[strings::language] = hmi_language;
- ui_params[strings::app_id] = app->app_id();
- if (msg_params.keyExists(strings::app_name)) {
- ui_params[strings::app_name] = msg_params[strings::app_name];
- app->set_name(msg_params[strings::app_name].asCustomString());
+ using helpers::Compare;
+ using helpers::EQ;
+ using helpers::ALL;
+
+ if (Compare<HmiInterfaces::InterfaceState, EQ, ALL>(
+ HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE,
+ vr_state,
+ tts_state,
+ ui_state)) {
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ return;
}
- if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
- ui_params[strings::ngn_media_screen_app_name] =
- msg_params[strings::ngn_media_screen_app_name];
- app->set_ngn_media_screen_name(
- msg_params[strings::ngn_media_screen_app_name]);
+ if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) {
+ // VR processing
+ SendVRRequest(app, msg_params);
}
-
- SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, &ui_params, true);
-
- // VR processing
- SmartObject vr_params = SmartObject(SmartType_Map);
-
- vr_params[strings::language] = msg_params[strings::language];
-
- vr_params[strings::app_id] = app->app_id();
- if (msg_params.keyExists(strings::vr_synonyms)) {
- vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms];
- app->set_vr_synonyms(msg_params[strings::vr_synonyms]);
+ if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) {
+ // TTS processing
+ SendTTSRequest(app, msg_params);
}
- SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, &vr_params, true);
-
- // TTS processing
- SmartObject tts_params = SmartObject(SmartType_Map);
- tts_params[strings::language] = msg_params[strings::language];
-
- tts_params[strings::app_id] = app->app_id();
- if (msg_params.keyExists(strings::tts_name)) {
- tts_params[strings::tts_name] = msg_params[strings::tts_name];
- app->set_tts_name(msg_params[strings::tts_name]);
+ if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) {
+ SendUIRequest(app, msg_params, hmi_language);
}
-
- SendHMIRequest(
- hmi_apis::FunctionID::TTS_ChangeRegistration, &tts_params, true);
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
@@ -169,6 +225,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
switch (event_id) {
case hmi_apis::FunctionID::UI_ChangeRegistration: {
LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
pending_requests_.Remove(event_id);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -177,6 +234,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::VR_ChangeRegistration: {
LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
pending_requests_.Remove(event_id);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -185,6 +243,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
pending_requests_.Remove(event_id);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -295,12 +354,14 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
hmi_interfaces.GetInterfaceState(
HmiInterfaces::InterfaceID::HMI_INTERFACE_UI);
- ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI);
+ ResponseInfo ui_properties_info(
+ ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
- ResponseInfo tts_properties_info(tts_result_,
- HmiInterfaces::HMI_INTERFACE_TTS);
+ ResponseInfo tts_properties_info(
+ tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_);
- ResponseInfo vr_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_VR);
+ ResponseInfo vr_properties_info(
+ ui_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_);
bool result = ((!is_tts_ui_vr_unsupported) && is_tts_succeeded_unsupported &&
is_ui_succeeded_unsupported && is_vr_succeeded_unsupported);
@@ -338,6 +399,9 @@ bool ChangeRegistrationRequest::PrepareResponseParameters(
}
result_code = MessageHelper::HMIToMobileResult(
std::max(std::max(ui_result, vr_result), tts_result));
+ if (mobile_api::Result::INVALID_ENUM == result_code) {
+ result_code = mobile_api::Result::UNSUPPORTED_RESOURCE;
+ }
}
const bool is_tts_state_available =
diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
index e1148bd126..20387ef230 100644
--- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -287,6 +287,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
sync_primitives::AutoLock commands_lock(vr_commands_lock_);
const uint32_t vr_cmd_id = msg_params[strings::cmd_id].asUInt();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
const uint32_t vr_corr_id =
SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &msg_params, true);
@@ -356,6 +357,7 @@ void CreateInteractionChoiceSetRequest::on_event(
uint32_t corr_id = static_cast<uint32_t>(
message[strings::params][strings::correlation_id].asUInt());
if (event.id() == hmi_apis::FunctionID::VR_AddCommand) {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
{
sync_primitives::AutoLock commands_lock(vr_commands_lock_);
if (is_no_error) {
@@ -376,6 +378,7 @@ void CreateInteractionChoiceSetRequest::onTimeOut() {
if (!error_from_hmi_) {
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
}
+ CommandRequestImpl::onTimeOut();
DeleteChoices();
// We have to keep request alive until receive all responses from HMI
diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
index cfc8e12144..f894ed452c 100644
--- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
@@ -104,12 +104,14 @@ void DeleteCommandRequest::Run() {
is_vr_send_ = true;
}
if (is_ui_send_) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true);
}
if (is_vr_send_) {
// VR params
msg_params[strings::grammar_id] = application->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params, true);
}
}
@@ -117,8 +119,10 @@ void DeleteCommandRequest::Run() {
bool DeleteCommandRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& info) {
using namespace helpers;
- ResponseInfo ui_delete_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI);
- ResponseInfo vr_delete_info(vr_result_, HmiInterfaces::HMI_INTERFACE_VR);
+ ResponseInfo ui_delete_info(
+ ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
+ ResponseInfo vr_delete_info(
+ vr_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_);
const bool result =
PrepareResultForMobileResponse(ui_delete_info, vr_delete_info);
@@ -143,6 +147,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_DeleteCommand: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -153,6 +158,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::VR_DeleteCommand: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
is_vr_received_ = true;
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
index 21c7ecce90..09f3139245 100644
--- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc
@@ -74,6 +74,7 @@ void DeleteSubMenuRequest::Run() {
msg_params[strings::menu_id] =
(*message_)[strings::msg_params][strings::menu_id];
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true);
}
@@ -143,6 +144,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_DeleteSubMenu: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
index 5c5d250026..7704d700f9 100644
--- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
@@ -83,6 +83,7 @@ void DiagnosticMessageRequest::Run() {
// Add app_id for HMI request
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage,
&(*message_)[strings::msg_params],
true);
@@ -94,6 +95,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc
index 64685afe2e..d0ab42e266 100644
--- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc
+++ b/src/components/application_manager/src/commands/mobile/dial_number_request.cc
@@ -87,6 +87,7 @@ void DialNumberRequest::Run() {
(*message_)[strings::msg_params][strings::number].asString();
msg_params[strings::app_id] = application->hmi_app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
SendHMIRequest(
hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true);
}
@@ -106,6 +107,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
LOG4CXX_INFO(logger_, "Received DialNumber event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
result_code = CommandRequestImpl::GetMobileResultCode(
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt()));
diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
index f67d1f2434..0bd83078e5 100644
--- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -47,6 +47,7 @@ EndAudioPassThruRequest::~EndAudioPassThruRequest() {}
void EndAudioPassThruRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true);
}
@@ -56,6 +57,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_EndAudioPassThru: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
index d98207c772..88fd07234a 100644
--- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc
@@ -72,6 +72,7 @@ void GetDTCsRequest::Run() {
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_GetDTCs, &msg_params, true);
}
@@ -81,6 +82,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_GetDTCs: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
index 25e2da3eb6..84c6e0ba7c 100644
--- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
@@ -250,6 +250,7 @@ void GetVehicleDataRequest::Run() {
}
}
if (msg_params.length() > min_length_msg_params) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(
hmi_apis::FunctionID::VehicleInfo_GetVehicleData, &msg_params, true);
return;
@@ -266,6 +267,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
index c313d74d4b..da4ce38646 100644
--- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
@@ -31,6 +31,7 @@ void GetWayPointsRequest::Run() {
msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints,
msg_params.empty() ? NULL : &msg_params,
true);
@@ -48,6 +49,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::Navigation_GetWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
index 9f5fd937f9..a05d41c098 100644
--- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -47,8 +47,6 @@ namespace str = strings;
PerformAudioPassThruRequest::PerformAudioPassThruRequest(
const MessageSharedPtr& message, ApplicationManager& application_manager)
: CommandRequestImpl(message, application_manager)
- , awaiting_tts_speak_response_(false)
- , awaiting_ui_response_(false)
, result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM)
, result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {
subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
@@ -97,7 +95,7 @@ void PerformAudioPassThruRequest::Run() {
// According with new implementation processing of UNSUPPORTE_RESOURCE
// need set flag before sending to hmi
- awaiting_ui_response_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
if ((*message_)[str::msg_params].keyExists(str::initial_prompt) &&
(0 < (*message_)[str::msg_params][str::initial_prompt].length())) {
// In case TTS Speak, subscribe on notification
@@ -119,7 +117,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru");
- awaiting_ui_response_ = false;
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
result_ui_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
@@ -142,7 +140,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, tts_info_);
- awaiting_tts_speak_response_ = false;
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
const bool is_tts_speak_success_unsuported =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
result_tts_speak_,
@@ -179,36 +177,58 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
return;
}
- std::string return_info;
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
- const bool result = PrepareResponseParameters(result_code, return_info);
+ const ResponseParams response_params = PrepareResponseParameters();
- SendResponse(result,
- result_code,
- return_info.empty() ? NULL : return_info.c_str(),
- &(message[strings::msg_params]));
+ SendResponse(
+ response_params.success,
+ response_params.result_code,
+ response_params.info.empty() ? NULL : response_params.info.c_str(),
+ &(message[strings::msg_params]));
}
-bool PerformAudioPassThruRequest::PrepareResponseParameters(
- mobile_apis::Result::eType& result_code, std::string& info) {
+const PerformAudioPassThruRequest::ResponseParams&
+PerformAudioPassThruRequest::PrepareResponseParameters() {
LOG4CXX_AUTO_TRACE(logger_);
- ResponseInfo ui_perform_info(result_ui_, HmiInterfaces::HMI_INTERFACE_UI);
+ ResponseInfo ui_perform_info(
+ result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
ResponseInfo tts_perform_info(result_tts_speak_,
- HmiInterfaces::HMI_INTERFACE_TTS);
- const bool result =
- PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
+ HmiInterfaces::HMI_INTERFACE_TTS,
+ application_manager_);
+ // Note(dtrunov): According to requirment "WARNINGS, success:true on getting
+ // UNSUPPORTED_RESOURCE for "ttsChunks"
if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) {
- result_code = mobile_apis::Result::WARNINGS;
+ response_params_.result_code = mobile_apis::Result::WARNINGS;
tts_info_ = "Unsupported phoneme type sent in a prompt";
- info = MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_);
- return result;
+ response_params_.info =
+ MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_);
+ response_params_.success = true;
+ return response_params_;
}
- result_code = PrepareResultCodeForResponse(ui_perform_info, tts_perform_info);
- info = MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_);
- return result;
+
+ response_params_.success =
+ PrepareResultForMobileResponse(ui_perform_info, tts_perform_info);
+ if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) {
+ response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ } else {
+ AudioPassThruResults results = PrepareAudioPassThruResultCodeForResponse(
+ ui_perform_info, tts_perform_info);
+ response_params_.success = results.second;
+ response_params_.result_code = results.first;
+ }
+ response_params_.info =
+ MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_);
+
+ return response_params_;
+}
+
+bool PerformAudioPassThruRequest::PrepareResponseParameters(
+ mobile_apis::Result::eType& result_code, std::string& info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ NOTREACHED();
+ return false;
}
void PerformAudioPassThruRequest::SendSpeakRequest() {
@@ -229,7 +249,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
// app_id
msg_params[strings::app_id] = connection_key();
msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU;
- awaiting_tts_speak_response_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true);
}
@@ -273,6 +293,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
msg_params[str::mute_audio] = true;
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(
hmi_apis::FunctionID::UI_PerformAudioPassThru, &msg_params, true);
}
@@ -353,16 +374,56 @@ void PerformAudioPassThruRequest::FinishTTSSpeak() {
LOG4CXX_DEBUG(logger_, "Stop AudioPassThru.");
application_manager_.StopAudioPassThru(connection_key());
}
- if (!awaiting_tts_speak_response_) {
+ if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) {
LOG4CXX_WARN(logger_, "TTS Speak is inactive.");
return;
}
SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL);
}
+PerformAudioPassThruRequest::AudioPassThruResults
+PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse(
+ const ResponseInfo& ui_response, const ResponseInfo& tts_response) {
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+
+ hmi_apis::Common_Result::eType common_result =
+ hmi_apis::Common_Result::INVALID_ENUM;
+ const hmi_apis::Common_Result::eType ui_result = ui_response.result_code;
+ const hmi_apis::Common_Result::eType tts_result = tts_response.result_code;
+ bool result = false;
+
+ if ((ui_result == hmi_apis::Common_Result::SUCCESS) &&
+ (tts_result == hmi_apis::Common_Result::SUCCESS)) {
+ result = true;
+ }
+
+ if ((ui_result == hmi_apis::Common_Result::SUCCESS) &&
+ (tts_result == hmi_apis::Common_Result::INVALID_ENUM)) {
+ result = true;
+ }
+
+ if ((ui_result == hmi_apis::Common_Result::SUCCESS) &&
+ (tts_result != hmi_apis::Common_Result::SUCCESS) &&
+ (tts_result != hmi_apis::Common_Result::INVALID_ENUM)) {
+ common_result = hmi_apis::Common_Result::WARNINGS;
+ result = true;
+ } else if (ui_response.is_ok &&
+ tts_result == hmi_apis::Common_Result::WARNINGS) {
+ common_result = hmi_apis::Common_Result::WARNINGS;
+ result = true;
+ } else if (ui_result == hmi_apis::Common_Result::INVALID_ENUM) {
+ common_result = tts_result;
+ } else {
+ common_result = ui_result;
+ }
+ result_code = MessageHelper::HMIToMobileResult(common_result);
+ return std::make_pair(result_code, result);
+}
+
bool PerformAudioPassThruRequest::IsWaitingHMIResponse() {
LOG4CXX_AUTO_TRACE(logger_);
- return awaiting_tts_speak_response_ || awaiting_ui_response_;
+ return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) ||
+ IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
index 007440e8e6..68940158b9 100644
--- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
@@ -143,11 +143,10 @@ void PerformInteractionRequest::Run() {
}
}
- if (choice_set_id_list_length &&
- (!CheckChoiceIDFromRequest(
- app,
- choice_set_id_list_length,
- msg_params[strings::interaction_choice_set_id_list]))) {
+ if (!CheckChoiceIDFromRequest(
+ app,
+ choice_set_id_list_length,
+ msg_params[strings::interaction_choice_set_id_list])) {
LOG4CXX_ERROR(logger_,
"PerformInteraction has choice sets with "
"duplicated IDs or application does not have choice sets");
@@ -227,6 +226,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::UI_PerformInteraction: {
LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_response_received_ = true;
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -237,6 +237,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
vr_response_received_ = true;
unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction);
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -392,14 +393,14 @@ void PerformInteractionRequest::ProcessUIResponse(
if (result) {
if (is_pi_warning) {
ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = "Unsupported phoneme type was sent in an item";
+ ui_info_ = message[strings::msg_params][strings::info].asString();
if (message.keyExists(strings::params) &&
message[strings::params].keyExists(strings::data)) {
msg_params = message[strings::params][strings::data];
}
} else if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- ui_info_ = "Unsupported phoneme type was sent in an item";
+ ui_info_ = message[strings::msg_params][strings::info].asString();
} else if (message.keyExists(strings::msg_params)) {
msg_params = message[strings::msg_params];
}
@@ -503,6 +504,7 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
(*message_)[strings::msg_params][hmi_request::interaction_layout]
.asInt();
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(
hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true);
}
@@ -595,6 +597,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
msg_params[strings::timeout] = default_timeout_;
}
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
SendHMIRequest(
hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true);
}
@@ -926,10 +929,10 @@ void PerformInteractionRequest::SendBothModeResponse(
LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::Result::eType perform_interaction_result_code =
mobile_apis::Result::INVALID_ENUM;
- ResponseInfo ui_perform_info(ui_result_code_,
- HmiInterfaces::HMI_INTERFACE_UI);
- ResponseInfo vr_perform_info(vr_result_code_,
- HmiInterfaces::HMI_INTERFACE_VR);
+ ResponseInfo ui_perform_info(
+ ui_result_code_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
+ ResponseInfo vr_perform_info(
+ vr_result_code_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_);
const bool result =
PrepareResultForMobileResponse(ui_perform_info, vr_perform_info);
perform_interaction_result_code =
diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc
index 0bf747bde3..c51f545e7e 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc
@@ -87,6 +87,7 @@ void ReadDIDRequest::Run() {
(*message_)[strings::msg_params][strings::ecu_name];
msg_params[strings::did_location] =
(*message_)[strings::msg_params][strings::did_location];
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_ReadDID, &msg_params, true);
}
@@ -97,6 +98,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_ReadDID: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index 74bc0c032e..1a60537874 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -217,9 +217,6 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- const std::string mobile_app_id =
- (*message_)[strings::msg_params][strings::app_id].asString();
-
ApplicationSharedPtr application =
application_manager_.application(connection_key());
@@ -231,7 +228,13 @@ void RegisterAppInterfaceRequest::Run() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- const std::string& policy_app_id = msg_params[strings::app_id].asString();
+ const std::string policy_app_id = msg_params[strings::app_id].asString();
+ std::string new_policy_app_id = policy_app_id;
+ std::transform(policy_app_id.begin(),
+ policy_app_id.end(),
+ new_policy_app_id.begin(),
+ ::tolower);
+ (*message_)[strings::msg_params][strings::app_id] = new_policy_app_id;
if (application_manager_.IsApplicationForbidden(connection_key(),
policy_app_id)) {
@@ -494,6 +497,8 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
hmi_capabilities.phone_call_supported();
response_params[strings::hmi_capabilities][strings::video_streaming] =
hmi_capabilities.video_streaming_supported();
+ response_params[strings::hmi_capabilities][strings::remote_control] =
+ hmi_capabilities.rc_supported();
}
void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
index 713d50e190..a7c2db0e65 100644
--- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
@@ -46,10 +46,6 @@ namespace commands {
ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest(
const MessageSharedPtr& message, ApplicationManager& application_manager)
: CommandRequestImpl(message, application_manager)
- , is_ui_send_(false)
- , is_tts_send_(false)
- , is_ui_received_(false)
- , is_tts_received_(false)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
, tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
@@ -111,11 +107,11 @@ void ResetGlobalPropertiesRequest::Run() {
if (vr_help_title_items || menu_name || menu_icon ||
is_key_board_properties) {
- is_ui_send_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
}
if (timeout_prompt || helpt_promt) {
- is_tts_send_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
}
app->set_reset_global_properties_active(true);
@@ -245,7 +241,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
- is_ui_received_ = true;
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, ui_response_info_);
@@ -253,7 +249,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
- is_tts_received_ = true;
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, tts_response_info_);
@@ -292,9 +288,10 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
using namespace helpers;
bool result = false;
- ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI);
- ResponseInfo tts_properties_info(tts_result_,
- HmiInterfaces::HMI_INTERFACE_TTS);
+ ResponseInfo ui_properties_info(
+ ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
+ ResponseInfo tts_properties_info(
+ tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_);
HmiInterfaces::InterfaceState tts_interface_state =
application_manager_.hmi_interfaces().GetInterfaceState(
@@ -321,7 +318,8 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
}
bool ResetGlobalPropertiesRequest::IsPendingResponseExist() {
- return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_;
+ return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) ||
+ IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
index 0c770953fe..b0b2d5f464 100644
--- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc
@@ -109,7 +109,7 @@ void ScrollableMessageRequest::Run() {
MessageHelper::SubscribeApplicationToSoftButton(
(*message_)[strings::msg_params], app, function_id());
}
-
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_ScrollableMessage, &msg_params, true);
}
@@ -126,6 +126,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::UI_ScrollableMessage: {
LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc
index 9ec4ca3fcc..54664a8771 100644
--- a/src/components/application_manager/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc
@@ -125,6 +125,7 @@ void SendLocationRequest::Run() {
SmartObject request_msg_params = SmartObject(smart_objects::SmartType_Map);
request_msg_params = msg_params;
request_msg_params[strings::app_id] = app->hmi_app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_SendLocation, &request_msg_params, true);
}
@@ -135,6 +136,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) {
LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const Common_Result::eType result_code = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
index 5afddfb4d0..ee544e956a 100644
--- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc
@@ -114,7 +114,7 @@ void SetAppIconRequest::Run() {
// for further use in on_event function
(*message_)[strings::msg_params][strings::sync_file_name] =
msg_params[strings::sync_file_name];
-
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
}
@@ -242,6 +242,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetAppIcon: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
index 984690384a..38b62ce731 100644
--- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc
@@ -58,6 +58,7 @@ void SetDisplayLayoutRequest::Run() {
}
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout,
&((*message_)[strings::msg_params]),
true);
@@ -70,6 +71,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetDisplayLayout: {
LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
index 096c4ed783..e811f5d154 100644
--- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
@@ -229,6 +229,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -237,6 +238,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
is_tts_received_ = true;
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -277,10 +279,11 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters(
LOG4CXX_AUTO_TRACE(logger_);
using namespace helpers;
- ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI);
+ ResponseInfo ui_properties_info(
+ ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
- ResponseInfo tts_properties_info(tts_result_,
- HmiInterfaces::HMI_INTERFACE_TTS);
+ ResponseInfo tts_properties_info(
+ tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_);
const bool result =
PrepareResultForMobileResponse(ui_properties_info, tts_properties_info);
if (result &&
@@ -397,6 +400,7 @@ void SetGlobalPropertiesRequest::SendTTSRequest(
const smart_objects::SmartObject& params, bool use_events) {
LOG4CXX_AUTO_TRACE(logger_);
is_tts_send_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(
hmi_apis::FunctionID::TTS_SetGlobalProperties, &params, use_events);
}
@@ -405,6 +409,7 @@ void SetGlobalPropertiesRequest::SendUIRequest(
const smart_objects::SmartObject& params, bool use_events) {
LOG4CXX_AUTO_TRACE(logger_);
is_ui_send_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(
hmi_apis::FunctionID::UI_SetGlobalProperties, &params, use_events);
}
diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc
index 85f34aead9..037de54456 100644
--- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc
@@ -95,7 +95,7 @@ void SetIconRequest::Run() {
// for further use in on_event function
(*message_)[strings::msg_params][strings::sync_file_name] =
msg_params[strings::sync_file_name];
-
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
}
@@ -105,6 +105,7 @@ void SetIconRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetAppIcon: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
index 1e0a00318d..54727abe01 100644
--- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc
@@ -71,6 +71,7 @@ void SetMediaClockRequest::Run() {
// copy entirely msg
msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = app->app_id();
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(
hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true);
@@ -85,6 +86,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetMediaClockTimer: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
index b1cc40009d..42bfea4864 100644
--- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
@@ -172,6 +172,7 @@ void ShowConstantTBTRequest::Run() {
}
app->set_tbt_show_command(msg_params);
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, true);
}
@@ -184,6 +185,7 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_ShowConstantTBT: {
LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const Common_Result::eType result_code =
static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc
index 5b8e98d7ea..ad598efc1d 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -263,6 +263,7 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::custom_presets];
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true);
MessageSharedPtr persistentData = new smart_objects::SmartObject(msg_params);
@@ -278,6 +279,7 @@ void ShowRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::UI_Show: {
LOG4CXX_DEBUG(logger_, "Received UI_Show event.");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
std::string response_info;
hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc
index 054d0ec16d..f98869b08f 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -107,6 +107,7 @@ void SliderRequest::Run() {
msg_params[strings::timeout] = default_timeout_;
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true);
}
@@ -132,7 +133,7 @@ void SliderRequest::on_event(const event_engine::Event& event) {
}
LOG4CXX_DEBUG(logger_, "Received UI_Slider event");
-
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
const Common_Result::eType response_code = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc
index 6cbb762102..1954cde181 100644
--- a/src/components/application_manager/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_request.cc
@@ -72,6 +72,7 @@ void SpeakRequest::Run() {
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
(*message_)[strings::msg_params][hmi_request::speak_type] =
hmi_apis::Common_MethodName::SPEAK;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
SendHMIRequest(hmi_apis::FunctionID::TTS_Speak,
&message_->getElement(strings::msg_params),
true);
@@ -82,7 +83,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
-
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
ProcessTTSSpeakResponse(event.smart_object());
break;
}
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
index fc839a43f4..28cf4c754c 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -149,6 +149,7 @@ void SubscribeVehicleDataRequest::Run() {
++it)
SendHMIRequest(it->func_id, &msg_params, true);
#else
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
&msg_params,
true);
@@ -165,7 +166,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
LOG4CXX_ERROR(logger_, "Received unknown event.");
return;
}
-
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -250,6 +251,15 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
result_code = mobile_apis::Result::IGNORED;
response_info = "Already subscribed on some provided VehicleData.";
}
+
+ if (!vi_waiting_for_subscribe_.empty()) {
+ LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData");
+ VehicleInfoSubscriptions::const_iterator key =
+ vi_waiting_for_subscribe_.begin();
+ for (; key != vi_waiting_for_subscribe_.end(); ++key) {
+ app->SubscribeToIVI(*key);
+ }
+ }
}
UnsubscribeFailedSubscriptions(app, message[strings::msg_params]);
@@ -276,20 +286,33 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI(
smart_objects::SmartObject& msg_params) const {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
+ auto vi_to_string =
+ [](const mobile_apis::VehicleDataType::eType vehicle_data) {
+ for (auto& vi_str_to_int_pair : MessageHelper::vehicle_data()) {
+ if (vehicle_data == vi_str_to_int_pair.second) {
+ return vi_str_to_int_pair.first;
+ }
+ }
+ return std::string();
+ };
+
VehicleInfoSubscriptions::const_iterator it_same_app =
vi_already_subscribed_by_this_app_.begin();
for (; vi_already_subscribed_by_this_app_.end() != it_same_app;
++it_same_app) {
- msg_params[*it_same_app][strings::result_code] =
+ msg_params[vi_to_string(*it_same_app)][strings::result_code] =
VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
+ msg_params[vi_to_string(*it_same_app)][strings::data_type] = *it_same_app;
}
VehicleInfoSubscriptions::const_iterator it_another_app =
vi_already_subscribed_by_another_apps_.begin();
for (; vi_already_subscribed_by_another_apps_.end() != it_another_app;
++it_another_app) {
- msg_params[*it_another_app][strings::result_code] =
+ msg_params[vi_to_string(*it_another_app)][strings::result_code] =
VehicleDataResultCode::VDRC_SUCCESS;
+ msg_params[vi_to_string(*it_another_app)][strings::data_type] =
+ *it_another_app;
}
}
@@ -366,7 +389,7 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions(
++items_to_subscribe;
}
if (!is_interface_not_available && is_key_enabled) {
- VehicleDataType key_type = it->second;
+ mobile_apis::VehicleDataType::eType key_type = it->second;
if (app->IsSubscribedToIVI(key_type)) {
LOG4CXX_DEBUG(logger_,
"App with connection key "
@@ -407,12 +430,13 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions(
out_request_params[key_name] = is_key_enabled;
- if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) {
+ if (is_key_enabled) {
+ vi_waiting_for_subscribe_.insert(key_type);
LOG4CXX_DEBUG(
logger_,
"App with connection key "
<< connection_key()
- << " have been subscribed for VehicleDataType: " << key_type);
+ << " will be subscribed for VehicleDataType: " << key_type);
++subscribed_items;
}
}
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
index 0e0d760228..965741edf7 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
@@ -36,6 +36,7 @@ void SubscribeWayPointsRequest::Run() {
return;
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, true);
}
@@ -47,6 +48,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc
index e4706441ef..fe38b93732 100644
--- a/src/components/application_manager/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/src/commands/mobile/system_request.cc
@@ -535,19 +535,8 @@ void SystemRequest::Run() {
if (!file || !file->is_download_complete ||
!file_system::MoveFile(app_full_file_path, file_dst_path)) {
LOG4CXX_DEBUG(logger_, "Binary data not found.");
-
- std::string origin_file_name;
- if ((*message_)[strings::msg_params].keyExists(strings::file_name)) {
- origin_file_name =
- (*message_)[strings::msg_params][strings::file_name].asString();
- }
- if (!(mobile_apis::RequestType::HTTP == request_type &&
- 0 == origin_file_name.compare(kIVSU))) {
- LOG4CXX_DEBUG(logger_, "Binary data required. Invalid data");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
- LOG4CXX_DEBUG(logger_, "IVSU does not require binary data. Continue");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
}
processing_file_ = file_dst_path;
}
@@ -598,6 +587,7 @@ void SystemRequest::Run() {
msg_params[strings::request_type] =
(*message_)[strings::msg_params][strings::request_type];
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_SystemRequest,
&msg_params,
true);
@@ -611,6 +601,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::BasicCommunication_SystemRequest: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication);
mobile_apis::Result::eType result_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt()));
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index fa3a9ad400..f7317d72f9 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -134,7 +134,7 @@ void UnsubscribeVehicleDataRequest::Run() {
if (is_key_enabled) {
++items_to_unsubscribe;
- VehicleDataType key_type = it->second;
+ mobile_apis::VehicleDataType::eType key_type = it->second;
if (!app->IsSubscribedToIVI(key_type)) {
++unsubscribed_items;
vi_already_unsubscribed_by_this_app_.insert(key_type);
@@ -234,6 +234,7 @@ void UnsubscribeVehicleDataRequest::Run() {
++it)
SendHMIRequest(it->func_id, &msg_params, true);
#else
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
&msg_params,
true);
@@ -250,6 +251,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
LOG4CXX_ERROR(logger_, "Received unknown event.");
return;
}
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
#ifdef HMI_DBUS_API
for (HmiRequests::iterator it = hmi_requests_.begin();
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
index 953bbc7a12..88ed396250 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -30,6 +30,7 @@ void UnSubscribeWayPointsRequest::Run() {
return;
}
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
}
@@ -41,6 +42,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
index becab175e9..44fe9d0d07 100644
--- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
@@ -138,6 +138,7 @@ void UpdateTurnListRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::turn_list) ||
(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
SendHMIRequest(
hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true);
} else {
@@ -154,7 +155,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UpdateTurnList: {
LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event");
-
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 28049f8e35..e39b728155 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -391,6 +391,7 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
, is_navigation_supported_(false)
, is_phone_call_supported_(false)
, is_video_streaming_supported_(false)
+ , is_rc_supported_(false)
, navigation_capability_(NULL)
, phone_capability_(NULL)
, video_streaming_capability_(NULL)
@@ -650,6 +651,10 @@ void HMICapabilitiesImpl::set_video_streaming_supported(const bool supported) {
is_video_streaming_supported_ = supported;
}
+void HMICapabilitiesImpl::set_rc_supported(const bool supported) {
+ is_rc_supported_ = supported;
+}
+
void HMICapabilitiesImpl::set_navigation_capability(
const smart_objects::SmartObject& navigation_capability) {
if (navigation_capability_) {
@@ -803,6 +808,10 @@ bool HMICapabilitiesImpl::video_streaming_supported() const {
return is_video_streaming_supported_;
}
+bool HMICapabilitiesImpl::rc_supported() const {
+ return is_rc_supported_;
+}
+
const smart_objects::SmartObject* HMICapabilitiesImpl::navigation_capability()
const {
return navigation_capability_;
@@ -1150,6 +1159,9 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Formatters::CFormatterJsonBase::jsonValueToObj(rc_capability,
rc_capability_so);
set_rc_capability(rc_capability_so);
+ if (!rc_capability_so.empty()) {
+ set_rc_supported(true);
+ }
}
}
} // UI end
diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc
index ffaa8d9b5f..a7f3ce7e6b 100644
--- a/src/components/application_manager/src/hmi_command_factory.cc
+++ b/src/components/application_manager/src/hmi_command_factory.cc
@@ -269,6 +269,7 @@
#include "application_manager/commands/hmi/on_system_error_notification.h"
#include "application_manager/commands/hmi/basic_communication_system_request.h"
#include "application_manager/commands/hmi/basic_communication_system_response.h"
+#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h"
#include "application_manager/commands/hmi/sdl_policy_update.h"
#include "application_manager/commands/hmi/sdl_policy_update_response.h"
#include "application_manager/commands/hmi/on_received_policy_update.h"
@@ -781,6 +782,11 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
message, application_manager));
break;
}
+ case hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL: {
+ command.reset(
+ new commands::OnAwakeSDLNotification(message, application_manager));
+ break;
+ }
case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: {
command.reset(new commands::OnExitApplicationNotification(
message, application_manager));
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index b211b270b8..7bc686aef1 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -89,7 +89,7 @@ Message& Message::operator=(const Message& message) {
set_data_size(message.data_size_);
set_payload_size(message.payload_size_);
if (message.binary_data_) {
- set_binary_data(message.binary_data_);
+ set_binary_data(static_cast<const BinaryData*>(message.binary_data_));
}
set_json_message(message.json_message_);
set_protocol_version(message.protocol_version());
@@ -207,6 +207,19 @@ void Message::set_binary_data(BinaryData* data) {
binary_data_ = new BinaryData(*data);
}
+void Message::set_binary_data(const BinaryData* data) {
+ if (NULL == data) {
+ NOTREACHED();
+ return;
+ }
+
+ if (binary_data_) {
+ delete binary_data_;
+ }
+
+ binary_data_ = new BinaryData(*data);
+}
+
void Message::set_json_message(const std::string& json_message) {
json_message_ = json_message;
}
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 65f4c79fa6..cf64152315 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -158,37 +158,60 @@ struct ExternalConsentStatusAppender
} // namespace
-std::pair<std::string, VehicleDataType> kVehicleDataInitializer[] = {
- std::make_pair(strings::gps, GPS),
- std::make_pair(strings::speed, SPEED),
- std::make_pair(strings::rpm, RPM),
- std::make_pair(strings::fuel_level, FUELLEVEL),
- std::make_pair(strings::fuel_level_state, FUELLEVEL_STATE),
- std::make_pair(strings::instant_fuel_consumption, FUELCONSUMPTION),
- std::make_pair(strings::external_temp, EXTERNTEMP),
- std::make_pair(strings::vin, VIN),
- std::make_pair(strings::prndl, PRNDL),
- std::make_pair(strings::tire_pressure, TIREPRESSURE),
- std::make_pair(strings::odometer, ODOMETER),
- std::make_pair(strings::belt_status, BELTSTATUS),
- std::make_pair(strings::body_information, BODYINFO),
- std::make_pair(strings::device_status, DEVICESTATUS),
- std::make_pair(strings::driver_braking, BRAKING),
- std::make_pair(strings::wiper_status, WIPERSTATUS),
- std::make_pair(strings::head_lamp_status, HEADLAMPSTATUS),
- std::make_pair(strings::e_call_info, ECALLINFO),
- std::make_pair(strings::airbag_status, AIRBAGSTATUS),
- std::make_pair(strings::emergency_event, EMERGENCYEVENT),
- std::make_pair(strings::cluster_mode_status, CLUSTERMODESTATUS),
- std::make_pair(strings::my_key, MYKEY),
+std::pair<std::string,
+ mobile_apis::VehicleDataType::eType> kVehicleDataInitializer[] = {
+ std::make_pair(strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS),
+ std::make_pair(strings::speed,
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED),
+ std::make_pair(strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM),
+ std::make_pair(strings::fuel_level,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL),
+ std::make_pair(strings::fuel_level_state,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL_STATE),
+ std::make_pair(strings::instant_fuel_consumption,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION),
+ std::make_pair(strings::external_temp,
+ mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP),
+ std::make_pair(strings::vin, mobile_apis::VehicleDataType::VEHICLEDATA_VIN),
+ std::make_pair(strings::prndl,
+ mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL),
+ std::make_pair(strings::tire_pressure,
+ mobile_apis::VehicleDataType::VEHICLEDATA_TIREPRESSURE),
+ std::make_pair(strings::odometer,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER),
+ std::make_pair(strings::belt_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BELTSTATUS),
+ std::make_pair(strings::body_information,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BODYINFO),
+ std::make_pair(strings::device_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_DEVICESTATUS),
+ std::make_pair(strings::driver_braking,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BRAKING),
+ std::make_pair(strings::wiper_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_WIPERSTATUS),
+ std::make_pair(strings::head_lamp_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_HEADLAMPSTATUS),
+ std::make_pair(strings::e_call_info,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ECALLINFO),
+ std::make_pair(strings::airbag_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_AIRBAGSTATUS),
+ std::make_pair(strings::emergency_event,
+ mobile_apis::VehicleDataType::VEHICLEDATA_EMERGENCYEVENT),
+ std::make_pair(strings::cluster_mode_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLUSTERMODESTATUS),
+ std::make_pair(strings::my_key,
+ mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY),
/*
NOT DEFINED in mobile API
std::make_pair(strings::gps,
BATTVOLTAGE),
*/
- std::make_pair(strings::engine_torque, ENGINETORQUE),
- std::make_pair(strings::acc_pedal_pos, ACCPEDAL),
- std::make_pair(strings::steering_wheel_angle, STEERINGWHEEL),
+ std::make_pair(strings::engine_torque,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ENGINETORQUE),
+ std::make_pair(strings::acc_pedal_pos,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL),
+ std::make_pair(strings::steering_wheel_angle,
+ mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL),
};
const VehicleData MessageHelper::vehicle_data_(
@@ -829,7 +852,7 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
const VehicleInfoSubscriptions& subscriptions = vi_accessor.GetData();
for (; vehicle_data.end() != ivi_it; ++ivi_it) {
- uint32_t type_id = static_cast<int>(ivi_it->second);
+ mobile_apis::VehicleDataType::eType type_id = ivi_it->second;
if (subscriptions.end() != subscriptions.find(type_id)) {
std::string key_name = ivi_it->first;
msg_params[key_name] = true;
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index a3b5aa7dbd..2f06c5f3b5 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -196,7 +196,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
outgoing_message->set_payload_size(message->payload_size());
if (!payload.data.empty()) {
- BinaryData binary_payload_data(payload.data);
+ const BinaryData binary_payload_data(payload.data);
outgoing_message->set_binary_data(&binary_payload_data);
}
return outgoing_message.release();
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index ad21f533a1..e6ebaf3b83 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -808,17 +808,17 @@ bool PolicyHandler::IsAppSuitableForPolicyUpdate(
const Applications::value_type value) const {
LOG4CXX_AUTO_TRACE(logger_);
- const uint32_t app_id = value->app_id();
-
if (!value->IsRegistered()) {
LOG4CXX_DEBUG(logger_,
- "Application " << app_id << " is not marked as registered.");
+ "Application " << value->app_id()
+ << " is not marked as registered.");
return false;
}
LOG4CXX_DEBUG(logger_,
- "Application " << app_id << " marked as registered."
- "Checking its parameters.");
+ "Application " << value->app_id()
+ << " marked as registered."
+ "Checking its parameters.");
DeviceParams device_params = GetDeviceParams(
value->device(),
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index e7788bf9ff..435e621169 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -67,6 +67,7 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
this, &ResumeCtrlImpl::SaveDataOnTimer))
, is_resumption_active_(false)
, is_data_saved_(false)
+ , is_suspended_(false)
, launch_time_(time(NULL))
, application_manager_(application_manager) {}
#ifdef BUILD_TESTS
@@ -263,16 +264,25 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved(
void ResumeCtrlImpl::OnSuspend() {
LOG4CXX_AUTO_TRACE(logger_);
- StopSavePersistentDataTimer();
- SaveAllApplications();
- resumption_storage_->OnSuspend();
- resumption_storage_->Persist();
+ is_suspended_ = true;
+ FinalPersistData();
+}
+
+void ResumeCtrlImpl::OnIgnitionOff() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ resumption_storage_->IncrementIgnOffCount();
+ FinalPersistData();
}
void ResumeCtrlImpl::OnAwake() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_suspended_ = false;
ResetLaunchTime();
StartSavePersistentDataTimer();
- return resumption_storage_->OnAwake();
+}
+
+bool ResumeCtrlImpl::is_suspended() const {
+ return is_suspended_;
}
void ResumeCtrlImpl::StartSavePersistentDataTimer() {
@@ -433,6 +443,13 @@ void ResumeCtrlImpl::SaveDataOnTimer() {
}
}
+void ResumeCtrlImpl::FinalPersistData() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopSavePersistentDataTimer();
+ SaveAllApplications();
+ resumption_storage_->Persist();
+}
+
bool ResumeCtrlImpl::IsDeviceMacAddressEqual(
ApplicationSharedPtr application, const std::string& saved_device_mac) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -609,9 +626,10 @@ void ResumeCtrlImpl::AddSubscriptions(
if (subscribtions.keyExists(strings::application_vehicle_info)) {
const smart_objects::SmartObject& subscribtions_ivi =
subscribtions[strings::application_vehicle_info];
- VehicleDataType ivi;
+ mobile_apis::VehicleDataType::eType ivi;
for (size_t i = 0; i < subscribtions_ivi.length(); ++i) {
- ivi = static_cast<VehicleDataType>((subscribtions_ivi[i]).asInt());
+ ivi = static_cast<mobile_apis::VehicleDataType::eType>(
+ (subscribtions_ivi[i]).asInt());
application->SubscribeToIVI(ivi);
}
ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests(
@@ -773,7 +791,7 @@ void ResumeCtrlImpl::LoadResumeData() {
"Resumption data for application "
<< app_id << " and device id " << device_id
<< " will be dropped.");
- resumption_storage_->DropAppDataResumption(device_id, app_id);
+ resumption_storage_->RemoveApplicationFromSaved(app_id, device_id);
continue;
}
}
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 273cd5413e..bd5bdbddab 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -33,7 +33,6 @@
#include "application_manager/resumption/resumption_data.h"
#include "utils/logger.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/vehicle_info_data.h"
#include "application_manager/application_manager_settings.h"
namespace resumption {
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index 08de6d8190..23fecb7624 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -212,7 +212,10 @@ uint32_t ResumptionDataDB::GetHMIApplicationID(
return hmi_app_id;
}
-void ResumptionDataDB::OnSuspend() {
+// DEPRECATED
+void ResumptionDataDB::OnSuspend() {}
+
+void ResumptionDataDB::IncrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
utils::dbms::SQLQuery query_update_suspend_data(db());
@@ -291,7 +294,10 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id,
return SelectHashId(policy_app_id, device_id, hash_id);
}
-void ResumptionDataDB::OnAwake() {
+// DEPRECATED
+void ResumptionDataDB::OnAwake() {}
+
+void ResumptionDataDB::DecrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
UpdateDataOnAwake();
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index 7866fc4de1..203c4889c5 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -143,11 +143,14 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
return hmi_app_id;
}
-void ResumptionDataJson::OnSuspend() {
+// DEPRECATED
+void ResumptionDataJson::OnSuspend() {}
+
+void ResumptionDataJson::IncrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value to_save;
+ Json::Value to_save = Json::arrayValue;
for (Json::Value::iterator it = GetSavedApplications().begin();
it != GetSavedApplications().end();
++it) {
@@ -167,7 +170,10 @@ void ResumptionDataJson::OnSuspend() {
LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString());
}
-void ResumptionDataJson::OnAwake() {
+// DEPRECATED
+void ResumptionDataJson::OnAwake() {}
+
+void ResumptionDataJson::DecrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(resumption_lock_);
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
index 5f318e6955..7a5008542c 100644
--- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -212,7 +212,7 @@ const std::string kCreateSchema =
"`vrHelpItemArray`(`idglobalProperties`); "
"CREATE TABLE IF NOT EXISTS `application`( "
" `idApplication` INTEGER PRIMARY KEY NOT NULL, "
- " `appID` TEXT, "
+ " `appID` TEXT COLLATE NOCASE, "
" `connection_key` INTEGER, "
" `grammarID` INTEGER, "
" `hashID` TEXT, "
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 45bab026b4..0bf3287e42 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -234,6 +234,7 @@ const char* hmi_capabilities = "hmiCapabilities";
const char* navigation = "navigation";
const char* phone_call = "phoneCall";
const char* video_streaming = "videoStreaming";
+const char* remote_control = "remoteControl";
const char* sdl_version = "sdlVersion";
const char* system_software_version = "systemSoftwareVersion";
const char* priority = "priority";
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index a1e284b40d..02a257e5d9 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -50,6 +50,7 @@
#include "resumption/last_state.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_resume_ctrl.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "smart_objects/smart_object.h"
@@ -652,6 +653,22 @@ TEST_F(ApplicationImplTest,
TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendHashUpdateNotification(app_id, _)).Times(1);
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(mock_application_manager_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(false));
+ app_impl->UpdateHash();
+
+ EXPECT_TRUE(app_impl->is_application_data_changed());
+}
+
+TEST_F(ApplicationImplTest, UpdateHash_AppMngrSuspended) {
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendHashUpdateNotification(app_id, _)).Times(0);
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(mock_application_manager_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(true));
app_impl->UpdateHash();
EXPECT_TRUE(app_impl->is_application_data_changed());
diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt
index cc16e4d87b..f204c35456 100644
--- a/src/components/application_manager/test/commands/CMakeLists.txt
+++ b/src/components/application_manager/test/commands/CMakeLists.txt
@@ -57,13 +57,13 @@ set(LIBRARIES
gmock
Utils
SmartObjects
- jsoncpp
HMI_API
MOBILE_API
ApplicationManager
AMHMICommandsLibrary
AMMobileCommandsLibrary
connectionHandler
+ jsoncpp
)
create_cotired_test("commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index 1948608b9f..4493c54d3c 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -64,7 +64,6 @@ using ::testing::_;
using ::testing::Return;
using ::testing::SaveArg;
using ::testing::DoAll;
-using ::testing::Mock;
using ::utils::SharedPtr;
using am::commands::MessageSharedPtr;
@@ -128,14 +127,6 @@ class CommandRequestImplTest
}
};
- CommandRequestImplTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- ~CommandRequestImplTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
@@ -147,7 +138,6 @@ class CommandRequestImplTest
}
sync_primitives::Lock app_set_lock_;
- am::MockMessageHelper& mock_message_helper_;
};
typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
@@ -308,8 +298,8 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
am::VehicleData vehicle_data;
- vehicle_data.insert(
- am::VehicleData::value_type(kMissedParam, am::VehicleDataType::MYKEY));
+ vehicle_data.insert(am::VehicleData::value_type(
+ kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
@@ -425,8 +415,8 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) {
am::VehicleData vehicle_data;
- vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1,
- am::VehicleDataType::MYKEY));
+ vehicle_data.insert(am::VehicleData::value_type(
+ kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
@@ -477,8 +467,8 @@ TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) {
TEST_F(CommandRequestImplTest,
SendResponse_AddDisallowedParametersToInfo_SUCCESS) {
am::VehicleData vehicle_data;
- vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1,
- am::VehicleDataType::MYKEY));
+ vehicle_data.insert(am::VehicleData::value_type(
+ kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
diff --git a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
index 0fe76ae16d..980b6e0e9d 100644
--- a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
+++ b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
@@ -90,12 +90,6 @@ class GetSystemInfoResponseTest
return command_msg;
}
- void SetUp() OVERRIDE {
- message_helper_mock_ =
- application_manager::MockMessageHelper::message_helper_mock();
- }
-
- am::MockMessageHelper* message_helper_mock_;
MockHMICapabilities mock_hmi_capabilities_;
SmartObject capabilities_;
};
@@ -114,7 +108,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_SUCCESS) {
.WillOnce(ReturnRef(mock_hmi_capabilities_));
std::string language;
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
CommonLanguageToString(
static_cast<hmi_apis::Common_Language::eType>(lang_code)))
.WillOnce(Return(language));
@@ -140,7 +134,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) {
EXPECT_CALL(app_mngr_, hmi_capabilities()).Times(0);
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
CommonLanguageToString(
static_cast<hmi_apis::Common_Language::eType>(lang_code)))
.Times(0);
diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
index 9af72a7925..03e1187d35 100644
--- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
+++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
@@ -130,14 +130,14 @@
#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/mock_message_helper.h"
#include "protocol_handler/mock_session_observer.h"
+#include "application_manager/mock_resume_ctrl.h"
+
#ifdef SDL_REMOTE_CONTROL
#include "functional_module/plugin_manager.h"
#endif // SDL_REMOTE_CONTROL
namespace am = application_manager;
-static am::MockMessageHelper* message_helper_mock_;
-
namespace test {
namespace components {
namespace commands_test {
@@ -150,7 +150,6 @@ using ::testing::Types;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::NiceMock;
-using ::testing::Mock;
using ::testing::InSequence;
using ::utils::SharedPtr;
using ::smart_objects::SmartObject;
@@ -223,16 +222,11 @@ class HMICommandsNotificationsTest
CommandsTestMocks::kIsNice> {
public:
HMICommandsNotificationsTest()
- : applications_(application_set_, applications_lock_), app_ptr_(NULL) {
- message_helper_mock_ =
- application_manager::MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
+ : applications_(application_set_, applications_lock_), app_ptr_(NULL) {}
~HMICommandsNotificationsTest() {
// Fix DataAccessor release and WinQt crash
Mock::VerifyAndClearExpectations(&app_mngr_);
- Mock::VerifyAndClearExpectations(message_helper_mock_);
}
typedef Command CommandType;
@@ -842,7 +836,7 @@ TEST_F(HMICommandsNotificationsTest,
utils::SharedPtr<Command> command =
CreateCommand<OnSystemInfoChangedNotification>(message);
- EXPECT_CALL(*message_helper_mock_, CommonLanguageToString(_));
+ EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_));
EXPECT_CALL(app_mngr_, GetPolicyHandler());
EXPECT_CALL(policy_interface_, OnSystemInfoChanged(_));
command->Run();
@@ -1037,10 +1031,16 @@ TEST_F(HMICommandsNotificationsTest,
kCorrelationId_;
MessageSharedPtr temp_message = CreateMessage();
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, OnSuspend());
+
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(GetMessage(temp_message));
+
command->Run();
EXPECT_EQ(
static_cast<uint32_t>(
@@ -1116,7 +1116,7 @@ TEST_F(HMICommandsNotificationsTest,
#endif // SDL_REMOTE_CONTROL
EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_, *it_mobile_reason)).WillOnce(Return(notification));
EXPECT_CALL(app_mngr_,
@@ -1441,7 +1441,7 @@ TEST_F(HMICommandsNotificationsTest,
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
@@ -1764,7 +1764,7 @@ TEST_F(HMICommandsNotificationsTest,
ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
@@ -1872,7 +1872,7 @@ TEST_F(HMICommandsNotificationsTest,
ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, ui_language()).WillRepeatedly(ReturnRef(kLang));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
diff --git a/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc
index f851bd644a..90be018e74 100644
--- a/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc
+++ b/src/components/application_manager/test/commands/hmi/rc_get_capabilities_response_test.cc
@@ -87,6 +87,78 @@ class RCGetCapabilitiesResponseTest
TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::rc_capability] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& remote_control_capability =
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::rc_capability];
+
+ remote_control_capability["climateControlCapabilities"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ remote_control_capability["climateControlCapabilities"][0] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& climate_control_capability =
+ remote_control_capability["climateControlCapabilities"][0];
+
+ climate_control_capability["moduleName"] = "Climate";
+ climate_control_capability["fanSpeedAvailable"] = true;
+ climate_control_capability["desiredTemperatureAvailable"] = true;
+ climate_control_capability["acEnableAvailable"] = true;
+ climate_control_capability["acMaxEnableAvailable"] = true;
+ climate_control_capability["circulateAirEnableAvailable"] = true;
+ climate_control_capability["autoModeEnableAvailable"] = true;
+ climate_control_capability["dualModeEnableAvailable"] = true;
+
+ climate_control_capability["defrostZoneAvailable"] = true;
+ climate_control_capability["defrostZone"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ climate_control_capability["defrostZone"][0] = "ALL";
+
+ climate_control_capability["ventilationModeAvailable"] = true;
+ climate_control_capability["ventilationMode"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ climate_control_capability["ventilationMode"][0] = "BOTH";
+
+ remote_control_capability["radioControlCapabilities"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ remote_control_capability["radioControlCapabilities"][0] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& radio_control_capability =
+ remote_control_capability["radioControlCapabilities"][0];
+
+ radio_control_capability["moduleName"] = "Radio";
+ radio_control_capability["radioEnableAvailable"] = true;
+ radio_control_capability["radioBandAvailable"] = true;
+ radio_control_capability["radioFrequencyAvailable"] = true;
+ radio_control_capability["hdChannelAvailable"] = true;
+ radio_control_capability["rdsDataAvailable"] = true;
+ radio_control_capability["availableHDsAvailable"] = true;
+ radio_control_capability["stateAvailable"] = true;
+ radio_control_capability["signalStrengthAvailable"] = true;
+ radio_control_capability["signalChangeThresholdAvailable"] = true;
+
+ remote_control_capability[hmi_response::button_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ remote_control_capability[hmi_response::button_capabilities][0] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& button_capability =
+ remote_control_capability[hmi_response::button_capabilities][0];
+
+ button_capability[strings::button_name] = "OK";
+ button_capability["shortPressAvailable"] = true;
+ button_capability["longPressAvailable"] = true;
+ button_capability["upDownAvailable"] = true;
+
RCGetCapabilitiesResponsePtr command(
CreateCommand<RCGetCapabilitiesResponse>(command_msg));
@@ -97,6 +169,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
(*command_msg)[strings::msg_params][strings::rc_capability];
EXPECT_CALL(mock_hmi_capabilities_, set_rc_capability(rc_capability_so));
+ EXPECT_CALL(mock_hmi_capabilities_, set_rc_supported(true));
command->Run();
}
diff --git a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
index af54321ca7..73a43342f1 100644
--- a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
@@ -55,7 +55,6 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::RCIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr;
@@ -79,6 +78,9 @@ class RCIsReadyRequestTest
}
EXPECT_CALL(mock_hmi_capabilities_,
set_is_rc_cooperating(is_rc_cooperating_available));
+ if (!is_rc_cooperating_available) {
+ EXPECT_CALL(mock_hmi_capabilities_, set_rc_supported(false));
+ }
if (is_message_contain_param) {
EXPECT_CALL(app_mngr_, hmi_interfaces())
@@ -99,7 +101,7 @@ class RCIsReadyRequestTest
void ExpectSendMessagesToHMI() {
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _))
.WillOnce(Return(capabilities));
EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
diff --git a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
index 3805df5834..d36b55ee25 100644
--- a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -62,7 +62,6 @@ using testing::Return;
using testing::ReturnRef;
using testing::Mock;
using ::testing::NiceMock;
-using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
using am::event_engine::Event;
@@ -102,15 +101,9 @@ MATCHER_P2(CheckMsgParams, result, corr_id, "") {
class SDLActivateAppRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
- SDLActivateAppRequestTest()
- : message_helper_mock_(am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
-
~SDLActivateAppRequestTest() {
// Fix DataAccessor release and WinQt crash
Mock::VerifyAndClearExpectations(&app_mngr_);
- Mock::VerifyAndClearExpectations(message_helper_mock_);
}
void InitCommand(const uint32_t& timeout) OVERRIDE {
@@ -127,7 +120,6 @@ class SDLActivateAppRequestTest
ApplicationSet app_list_;
::sync_primitives::Lock lock_;
- am::MockMessageHelper* message_helper_mock_;
policy_test::MockPolicyHandlerInterface policy_handler_;
application_manager_test::MockStateController mock_state_controller_;
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
@@ -220,7 +212,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
const std::string package = "package";
ON_CALL(*mock_app_first, PackageName()).WillByDefault(Return(package));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -299,7 +291,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -328,7 +320,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActive_SUCCESS) {
}
TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
@@ -363,10 +354,9 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, schema, package_name, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, schema, package_name, _));
command->Run();
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
@@ -397,7 +387,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -432,7 +422,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
diff --git a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
index 5ef54f7be5..66fedda3ca 100644
--- a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
@@ -73,10 +73,6 @@ namespace strings = ::application_manager::strings;
class SDLGetUserFriendlyMessageRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- SDLGetUserFriendlyMessageRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
protected:
void SetUp() OVERRIDE {
mock_app_ = CreateMockApp();
@@ -90,7 +86,6 @@ class SDLGetUserFriendlyMessageRequestTest
}
MockAppPtr mock_app_;
MockPolicyHandlerInterface mock_policy_handler_;
- MockMessageHelper& mock_message_helper_;
};
TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageSet_SUCCESS) {
diff --git a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
index 23146eec9a..66b1317870 100644
--- a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
@@ -54,12 +54,10 @@ namespace ui_is_ready_request {
namespace am = ::application_manager;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
using am::commands::UIIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr;
@@ -67,14 +65,11 @@ typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr;
class UIIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- UIIsReadyRequestTest()
- : command_(CreateCommand<UIIsReadyRequest>())
- , mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
+ UIIsReadyRequestTest() : command_(CreateCommand<UIIsReadyRequest>()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(mock_hmi_capabilities_));
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
void SetUpExpectations(bool is_ui_cooperating_available,
bool is_send_message_to_hmi,
@@ -151,7 +146,6 @@ class UIIsReadyRequestTest
}
UIIsReadyRequestPtr command_;
- MockMessageHelper& mock_message_helper_;
application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
};
diff --git a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
index 1e15d4ab60..557afa98d0 100644
--- a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
@@ -57,7 +57,6 @@ using ::testing::Return;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::VIIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr;
@@ -103,7 +102,7 @@ class VIIsReadyRequestTest
void ExpectSendMessagesToHMI() {
smart_objects::SmartObjectSPtr ivi_type;
EXPECT_CALL(
- *(MockMessageHelper::message_helper_mock()),
+ mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _))
.WillOnce(Return(ivi_type));
EXPECT_CALL(app_mngr_, ManageHMICommand(ivi_type));
diff --git a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
index 64735a77e2..c9403b2f0e 100644
--- a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
@@ -55,7 +55,6 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::VRIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr;
@@ -105,7 +104,7 @@ class VRIsReadyRequestTest
smart_objects::SmartObjectSPtr language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _))
.WillOnce(Return(language));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language));
@@ -114,14 +113,14 @@ class VRIsReadyRequestTest
smart_objects::SmartObjectSPtr support_language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
EXPECT_CALL(
- *(MockMessageHelper::message_helper_mock()),
+ mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _))
.WillOnce(Return(support_language));
EXPECT_CALL(app_mngr_, ManageHMICommand(support_language));
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _))
.WillOnce(Return(capabilities));
EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
index dec0ffe7ad..471f0763de 100644
--- a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
@@ -61,11 +61,9 @@ using am::commands::CommandImpl;
using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
-using am::MockMessageHelper;
using ::testing::_;
using ::utils::SharedPtr;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::InSequence;
using am::commands::AddCommandRequest;
using NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr;
@@ -105,19 +103,13 @@ class AddCommandRequestTest
AddCommandRequestTest()
: msg_(CreateMessage())
, default_app_name_("test_default_app_name_")
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
InitGetters();
InitBasicMessage();
}
- ~AddCommandRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
protected:
void InitBasicMessage() {
(*msg_)[params][connection_key] = kConnectionKey;
@@ -209,7 +201,8 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(app_mngr_, ManageHMICommand(HMIResultCodeIs(cmd_to_delete)))
.WillOnce(Return(true));
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
@@ -226,7 +219,6 @@ class AddCommandRequestTest
MessageSharedPtr msg_;
SmartObjectSPtr so_ptr_;
const utils::custom_string::CustomString default_app_name_;
- am::MockMessageHelper& mock_message_helper_;
sync_primitives::Lock lock_;
MockAppPtr mock_app_;
};
@@ -516,9 +508,6 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
request_ptr->on_event(event);
}
@@ -530,9 +519,6 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(*mock_app_, AddCommand(kCmdId, (*msg_)[msg_params]));
am::CommandsMap commands_map;
@@ -619,9 +605,6 @@ TEST_F(AddCommandRequestTest,
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::REJECTED))
- .WillOnce(Return(mobile_apis::Result::REJECTED));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
@@ -695,9 +678,6 @@ TEST_F(
.WillOnce(Return(true));
}
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR))
- .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -742,9 +722,6 @@ TEST_F(
.WillOnce(Return(true));
}
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR))
- .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -973,9 +950,6 @@ TEST_F(AddCommandRequestTest,
event_ui.set_smart_object(*msg_ui);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
event_vr.set_smart_object(*msg_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
@@ -1015,9 +989,6 @@ TEST_F(AddCommandRequestTest,
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
event_ui.set_smart_object(*msg_);
@@ -1042,7 +1013,8 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(ApplicationSharedPtr()));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0);
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
@@ -1091,7 +1063,8 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
index 9617f91016..f5bb7888d8 100644
--- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
@@ -54,9 +54,7 @@ namespace am = ::application_manager;
using am::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
@@ -66,12 +64,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class AddSubMenuRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- AddSubMenuRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
const uint32_t menu_id = 10u;
@@ -97,10 +90,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_AddSubMenu);
event.set_smart_object(*ev_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -123,7 +112,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace add_sub_menu_request
diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
index ee0662e5c6..90c6409fa8 100644
--- a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
@@ -63,7 +63,6 @@ namespace am = ::application_manager;
using am::commands::AlertManeuverRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
typedef SharedPtr<AlertManeuverRequest> CommandPtr;
@@ -87,11 +86,6 @@ class AlertManeuverRequestTest
MockAppPtr mock_app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
@@ -145,7 +139,8 @@ TEST_F(AlertManeuverRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons][0]
+ [am::strings::text] = "text";
CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
@@ -158,8 +153,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
const mobile_apis::Result::eType kProcessingResult =
mobile_apis::Result::ABORTED;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(kProcessingResult));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
@@ -195,7 +189,8 @@ TEST_F(AlertManeuverRequestTest, Run_IsWhiteSpaceExist_UNSUCCESS) {
TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons][0]
+ [am::strings::text] = "text";
CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
@@ -205,8 +200,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(policy_interface_));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
@@ -215,8 +209,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- SubscribeApplicationToSoftButton(_, _, _));
+ EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _));
MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
EXPECT_EQ(hmi_apis::FunctionID::Navigation_AlertManeuver,
@@ -237,30 +230,30 @@ TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) {
.asInt()));
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case1) {
+TEST_F(AlertManeuverRequestTest, OnEvent_SUCCESS) {
CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ mobile_apis::Result::SUCCESS,
am::HmiInterfaces::STATE_AVAILABLE,
true);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case2) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
+TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE) {
+ CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
- am::HmiInterfaces::STATE_NOT_AVAILABLE,
- true);
+ am::HmiInterfaces::STATE_AVAILABLE,
+ false);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case3) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+TEST_F(AlertManeuverRequestTest, OnEvent_WARNINGS) {
+ CheckExpectations(hmi_apis::Common_Result::WARNINGS,
+ mobile_apis::Result::WARNINGS,
am::HmiInterfaces::STATE_NOT_RESPONSE,
true);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case4) {
+TEST_F(AlertManeuverRequestTest, OnEvent_GENERIC_ERROR) {
CheckExpectations(hmi_apis::Common_Result::GENERIC_ERROR,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ mobile_apis::Result::GENERIC_ERROR,
am::HmiInterfaces::STATE_NOT_RESPONSE,
false);
}
diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
index f83a40843c..5d9e507511 100644
--- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
@@ -60,7 +60,6 @@ using ::utils::SharedPtr;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -79,10 +78,7 @@ const mobile_apis::FunctionID::eType kFunctionId =
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- AlertRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
- , msg_(CreateMessage()) {}
+ AlertRequestTest() : mock_app_(CreateMockApp()), msg_(CreateMessage()) {}
protected:
MessageSharedPtr CreateFullParamsUISO() {
@@ -116,10 +112,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
info);
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void PreConditions() {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
@@ -128,12 +120,12 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(
- Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
+ Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(
- Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
+ Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
}
void Expectations() {
@@ -155,9 +147,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
void AddAlertTextsToMsg() {
(*msg_)[am::strings::msg_params][am::strings::alert_text1] = "alert_text1";
(*msg_)[am::strings::msg_params][am::strings::alert_text2] = "alert_text2";
@@ -192,7 +181,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -248,9 +236,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
(*msg)[am::strings::msg_params][am::strings::info] =
"UI is not supported by system";
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
-
MessageSharedPtr msg_tts = CreateMessage();
(*msg_tts)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
@@ -263,9 +248,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
event.set_smart_object(*msg);
MessageSharedPtr ui_command_result;
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillByDefault(Return(am::mobile_api::Result::UNSUPPORTED_RESOURCE));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
@@ -302,14 +284,6 @@ TEST_F(AlertRequestTest, Init_DurationNotExists_SUCCESS) {
EXPECT_TRUE(command->Init());
}
-TEST_F(AlertRequestTest, OnTimeOut_UNSUCCESS) {
- Expectations();
- (*msg_)[am::strings::msg_params][am::strings::soft_buttons] = 0;
- CommandPtr command(CreateCommand<AlertRequest>(msg_));
- command->onTimeOut();
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
-}
-
TEST_F(AlertRequestTest, OnTimeOut_SUCCESS) {
Expectations();
MessageSharedPtr result_msg(CreateMessage(smart_objects::SmartType_Null));
@@ -442,8 +416,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_UI_OnResetTimeout_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -504,8 +476,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -574,16 +544,12 @@ TEST_F(AlertRequestTest,
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
tts_stop_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(tts_stop_event);
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::WARNINGS);
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -711,8 +677,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
tts_stop_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(tts_stop_event);
(*msg_)[am::strings::params][am::hmi_response::code] =
@@ -722,8 +686,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -750,8 +712,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
Event ui_event(hmi_apis::FunctionID::UI_Alert);
ui_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(ui_event);
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
@@ -762,8 +722,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
index 2fd43a6353..3d7671015c 100644
--- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
@@ -66,7 +66,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -80,7 +79,6 @@ namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
namespace {
-const int32_t kCommandId = 1;
const uint32_t kAppId = 1u;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
@@ -90,8 +88,7 @@ class ChangeRegistrationRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ChangeRegistrationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, supported_languages_(CreateMessage(smart_objects::SmartType_Array)) {}
MessageSharedPtr CreateMsgFromMobile() {
@@ -121,26 +118,26 @@ class ChangeRegistrationRequestTest
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
@@ -148,14 +145,11 @@ class ChangeRegistrationRequestTest
const am::HmiInterfaces::InterfaceState state,
const bool success,
const hmi_apis::Common_Result::eType ui_hmi_response =
- hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
const hmi_apis::Common_Result::eType vr_hmi_response =
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_response));
-
utils::SharedPtr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
MockAppPtr mock_app = CreateMockApp();
@@ -173,6 +167,8 @@ class ChangeRegistrationRequestTest
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name));
PrepareExpectationBeforeRun();
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(state));
command->Run();
MessageSharedPtr ui_response = CreateMessage(smart_objects::SmartType_Map);
@@ -184,9 +180,6 @@ class ChangeRegistrationRequestTest
(*tts_response)[strings::params][hmi_response::code] = hmi_response;
(*tts_response)[strings::msg_params] = 0;
- EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
- .WillRepeatedly(Return(state));
-
am::event_engine::Event event_ui(
hmi_apis::FunctionID::UI_ChangeRegistration);
event_ui.set_smart_object(*ui_response);
@@ -251,10 +244,6 @@ class ChangeRegistrationRequestTest
.WillByDefault(ReturnRef(hmi_capabilities_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectationsHmiCapabilities(
smart_objects::SmartObjectSPtr supported_languages) {
EXPECT_CALL(hmi_capabilities_, ui_supported_languages())
@@ -282,7 +271,6 @@ class ChangeRegistrationRequestTest
MockHMICapabilities;
sync_primitives::Lock app_set_lock_;
MockHMICapabilities hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr supported_languages_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -379,11 +367,52 @@ TEST_F(ChangeRegistrationRequestTest,
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_true) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
- am::HmiInterfaces::STATE_NOT_AVAILABLE,
- true);
+ OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_false) {
+ MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
+ utils::SharedPtr<ChangeRegistrationRequest> command =
+ CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+ am::ApplicationSet application_set;
+ const utils::custom_string::CustomString name("name");
+ MockAppPtr app = CreateMockApp();
+ app->set_name(name);
+ DataAccessor<am::ApplicationSet> accessor(application_set, app_set_lock_);
+ application_set.insert(app);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name));
+
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(hmi_capabilities_));
+ (*supported_languages_)[0] =
+ static_cast<int32_t>(mobile_apis::Language::EN_US);
+ EXPECT_CALL(hmi_capabilities_, ui_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+ EXPECT_CALL(hmi_capabilities_, vr_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+ EXPECT_CALL(hmi_capabilities_, tts_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+
+ EXPECT_CALL(app_mngr_, hmi_interfaces())
+ .WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
+
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ command->Run();
+
+ EXPECT_EQ(
+ (*response_to_mobile)[strings::msg_params][strings::success].asBool(),
+ false);
+ EXPECT_EQ(
+ (*response_to_mobile)[strings::msg_params][strings::result_code].asInt(),
+ static_cast<int32_t>(mobile_apis::Result::UNSUPPORTED_RESOURCE));
}
TEST_F(ChangeRegistrationRequestTest,
@@ -403,17 +432,17 @@ TEST_F(ChangeRegistrationRequestTest,
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_false) {
+ OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
am::HmiInterfaces::STATE_AVAILABLE,
- false,
+ true,
hmi_apis::Common_Result::SUCCESS,
hmi_apis::Common_Result::SUCCESS);
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_false) {
+ OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::SUCCESS,
mobile_apis::Result::SUCCESS,
am::HmiInterfaces::STATE_AVAILABLE,
@@ -425,7 +454,7 @@ TEST_F(ChangeRegistrationRequestTest,
TEST_F(ChangeRegistrationRequestTest,
OnEvent_TTS_WRONG_LANGUAGE_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::WRONG_LANGUAGE,
- mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WRONG_LANGUAGE,
am::HmiInterfaces::STATE_AVAILABLE,
true,
hmi_apis::Common_Result::SUCCESS,
@@ -435,7 +464,7 @@ TEST_F(ChangeRegistrationRequestTest,
TEST_F(ChangeRegistrationRequestTest,
OnEvent_TTS_INVALID_DATA_STATE_AVAILABLE_Expect_false) {
CheckExpectations(hmi_apis::Common_Result::INVALID_DATA,
- mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::INVALID_DATA,
am::HmiInterfaces::STATE_AVAILABLE,
false,
hmi_apis::Common_Result::SUCCESS,
@@ -473,14 +502,14 @@ TEST_F(ChangeRegistrationRequestTest,
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(
mock_hmi_interfaces_,
@@ -488,7 +517,7 @@ TEST_F(ChangeRegistrationRequestTest,
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
index a627740588..c3513d2acb 100644
--- a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -65,7 +65,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -112,15 +111,9 @@ class CreateInteractionChoiceSetRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
CreateInteractionChoiceSetRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , message_(CreateMessage())
+ : message_(CreateMessage())
, command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_))
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~CreateInteractionChoiceSetRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ , mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsVRSO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -162,7 +155,6 @@ class CreateInteractionChoiceSetRequestTest
[am::strings::interaction_choice_set_id] = kChoiceSetId;
}
- MockMessageHelper& message_helper_mock_;
MessageSharedPtr message_;
CreateInteractionChoiceSetRequestPtr command_;
MockAppPtr mock_app_;
@@ -230,9 +222,6 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr));
EXPECT_EQ(NULL, ptr);
- ON_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
-
am::CommandsMap commands_map;
ON_CALL(*mock_app_, commands_map())
.WillByDefault(
@@ -282,7 +271,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) {
[am::strings::secondary_image] = kSecondImage;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -298,7 +287,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
kChoiceSetId;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* invalid_choice_set_id =
@@ -333,7 +322,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -370,7 +359,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillRepeatedly(Return(choice_set_id));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
if ((*message_)[am::strings::msg_params][am::strings::choice_set][0]
@@ -439,7 +428,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -478,7 +467,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -524,7 +513,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -557,7 +546,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -591,7 +580,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -638,7 +627,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -678,7 +667,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -718,7 +707,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -791,7 +780,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
smart_objects::SmartObject* choice_set_id = NULL;
diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
index efa889a2c1..c92ec81a1f 100644
--- a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_command_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
@@ -61,6 +60,7 @@ using am::commands::DeleteCommandRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
+using am::MockHmiInterfaces;
typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr;
@@ -74,9 +74,7 @@ const uint32_t kConnectionKey = 2u;
class DeleteCommandRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- DeleteCommandRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -129,13 +127,11 @@ class DeleteCommandRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(app_mngr_, hmi_interfaces())
+ .WillByDefault(ReturnRef(hmi_interfaces_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockMessageHelper& mock_message_helper_;
+ NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockAppPtr mock_app_;
};
@@ -154,14 +150,14 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- ON_CALL(mock_hmi_interfaces_,
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(*mock_app_, FindCommand(kCommandId))
.WillByDefault(Return(test_msg.get()));
ON_CALL(*mock_app_, get_grammar_id()).WillByDefault(Return(kConnectionKey));
@@ -171,7 +167,7 @@ TEST_F(DeleteCommandRequestTest,
hmi_apis::Common_Result::SUCCESS;
Event event_ui(hmi_apis::FunctionID::UI_DeleteCommand);
event_ui.set_smart_object(*msg);
-
+ command->Init();
command->Run();
command->on_event(event_ui);
@@ -185,6 +181,8 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*mock_app_, RemoveCommand(kCommandId));
+ EXPECT_CALL(*mock_app_, UpdateHash());
+
MessageSharedPtr vr_command_result;
EXPECT_CALL(
app_mngr_,
@@ -212,14 +210,14 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(mock_hmi_interfaces_,
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get()));
ON_CALL(*app, get_grammar_id()).WillByDefault(Return(kConnectionKey));
@@ -229,6 +227,7 @@ TEST_F(DeleteCommandRequestTest,
Event event_vr(hmi_apis::FunctionID::VR_DeleteCommand);
event_vr.set_smart_object(*msg);
+ command->Init();
command->Run();
command->on_event(event_vr);
@@ -242,6 +241,8 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*app, RemoveCommand(kCommandId));
+ EXPECT_CALL(*app, UpdateHash());
+
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event_ui)));
diff --git a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
index a6d9d8f50a..192cad12b0 100644
--- a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_interaction_choice_set {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::InSequence;
diff --git a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
index beff4c3584..cc21e5366e 100644
--- a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
@@ -51,7 +51,6 @@ namespace mobile_commands_test {
namespace delete_sub_menu_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -97,22 +96,14 @@ class DeleteSubMenuRequestTest
public:
DeleteSubMenuRequestTest()
: accessor_(commands_map_, commands_lock_)
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, message_(CreateMessage())
, command_(CreateCommand<DeleteSubMenuRequest>(message_))
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~DeleteSubMenuRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
am::CommandsMap commands_map_;
mutable sync_primitives::Lock commands_lock_;
DataAccessor<am::CommandsMap> accessor_;
- MockMessageHelper& mock_message_helper_;
MessageSharedPtr message_;
DeleteSubMenuRequestPtr command_;
MockAppPtr app_;
@@ -149,10 +140,6 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
am::CommandsMap commands_map;
smart_objects::SmartObject commands_msg(smart_objects::SmartType_Map);
commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &commands_msg));
@@ -243,9 +230,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
(*message_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
event.set_smart_object(*message_);
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
MockAppPtr invalid_app;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app));
EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0);
@@ -265,8 +249,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
const hmi_apis::Common_Result::eType result_code =
hmi_apis::Common_Result::SUCCESS;
(*message_)[am::strings::params][am::hmi_response::code] = result_code;
- ON_CALL(mock_message_helper_, HMIToMobileResult(result_code))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
event.set_smart_object(*message_);
commands_map_.insert(
@@ -318,10 +300,6 @@ TEST_F(DeleteSubMenuRequestTest,
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
@@ -345,9 +323,6 @@ TEST_F(DeleteSubMenuRequestTest,
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillRepeatedly(Return(am::mobile_api::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
diff --git a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
index 60697446f2..4f46a6f715 100644
--- a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
@@ -71,17 +71,7 @@ const uint32_t kDiagnosticMode = 5u;
} // namespace
class DiagnosticMessageRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- DiagnosticMessageRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- ~DiagnosticMessageRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
@@ -181,10 +171,6 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) {
DiagnosticMessageRequestPtr command(
CreateCommand<DiagnosticMessageRequest>());
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
index b8c0ed23f3..33733f63ed 100644
--- a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -53,7 +53,6 @@ namespace end_audio_pass_thru_request {
namespace am = ::application_manager;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
@@ -64,12 +63,7 @@ using am::MockMessageHelper;
typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
class EndAudioPassThruRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- EndAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
const uint32_t kConnectionKey = 2u;
@@ -89,10 +83,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false));
MessageSharedPtr ui_command_result;
@@ -120,7 +110,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace end_audio_pass_thru_request
diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
index dfa38a758b..106a59803b 100644
--- a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
@@ -69,9 +69,7 @@ typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
class GetDTCsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
+ GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {}
};
TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -125,11 +123,7 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
event.set_smart_object(*event_msg);
- MockMessageHelper& mock_message_helper =
- *MockMessageHelper::message_helper_mock();
- ON_CALL(mock_message_helper, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
index a851a72f8e..52aed6feb8 100644
--- a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -70,19 +70,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class GetVehicleDataRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- GetVehicleDataRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~GetVehicleDataRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
public:
@@ -201,8 +189,8 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) {
CreateCommand<GetVehicleDataRequest>(command_msg));
am::VehicleData vehicle_data;
- vehicle_data.insert(
- am::VehicleData::value_type(kMsgParamKey, am::VehicleDataType::SPEED));
+ vehicle_data.insert(am::VehicleData::value_type(
+ kMsgParamKey, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
@@ -235,7 +223,7 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
const hmi_apis::Common_Result::eType hmi_response_code =
hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
const mobile_result::eType mobile_response_code =
- mobile_result::VEHICLE_DATA_NOT_AVAILABLE;
+ mobile_result::DATA_NOT_AVAILABLE;
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[am::strings::params][am::strings::connection_key] =
@@ -251,10 +239,6 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
event.set_smart_object(*event_msg);
-
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
diff --git a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
index d886a2b1bd..979fb0cc83 100644
--- a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
@@ -53,7 +53,6 @@ namespace get_way_points_request {
using namespace mobile_apis::Result;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::_;
using application_manager::commands::GetWayPointsRequest;
using application_manager::MockMessageHelper;
@@ -61,6 +60,7 @@ using application_manager::MockHmiInterfaces;
typedef SharedPtr<GetWayPointsRequest> CommandPtr;
typedef mobile_apis::Result::eType MobileResult;
+typedef hmi_apis::Common_Result::eType HmiResult;
namespace {
const uint32_t kCorrelationId = 2u;
@@ -72,14 +72,7 @@ const std::string kMethodName = "Navigation.GetWayPoints";
class GetWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
-
- ~GetWayPointsRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map);
@@ -89,14 +82,9 @@ class GetWayPointsRequestTest
command_sptr_ =
CreateCommand<application_manager::commands::GetWayPointsRequest>(
message_);
- mock_app_ = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
-
- ON_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
}
- MockMessageHelper& message_helper_mock_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
utils::SharedPtr<application_manager::commands::GetWayPointsRequest>
@@ -106,17 +94,10 @@ class GetWayPointsRequestTest
class GetWayPointsRequestOnEventTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestOnEventTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~GetWayPointsRequestOnEventTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestOnEventTest() : app_(CreateMockApp()) {}
void CheckOnEventResponse(const std::string& wayPointsParam,
- const MobileResult ResultCode,
+ const HmiResult ResultCode,
const bool success) {
Event event(Event::EventID::Navigation_GetWayPoints);
CommandPtr command(CreateCommand<GetWayPointsRequest>());
@@ -131,17 +112,13 @@ class GetWayPointsRequestOnEventTest
event.set_smart_object(*event_msg);
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(ResultCode));
-
- MockAppPtr app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+ const MobileResult mobile_result = static_cast<MobileResult>(ResultCode);
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event)));
EXPECT_EQ(
- ResultCode,
- static_cast<mobile_apis::Result::eType>(
+ mobile_result,
+ static_cast<MobileResult>(
(*result_msg)[am::strings::msg_params][am::strings::result_code]
.asInt()));
EXPECT_EQ(
@@ -150,7 +127,6 @@ class GetWayPointsRequestOnEventTest
}
protected:
- MockMessageHelper& message_helper_mock_;
MockAppPtr app_;
MockHmiInterfaces hmi_interfaces_;
};
@@ -246,15 +222,15 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_WrongEventId_UNSUCCESS) {
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case1) {
- CheckOnEventResponse("0", SUCCESS, true);
+ CheckOnEventResponse("0", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case2) {
- CheckOnEventResponse("", SUCCESS, true);
+ CheckOnEventResponse("", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case3) {
- CheckOnEventResponse("test", SUCCESS, true);
+ CheckOnEventResponse("test", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) {
@@ -265,7 +241,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse(" ", GENERIC_ERROR, false);
+ CheckOnEventResponse(" ", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) {
@@ -276,7 +252,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\t", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\t", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) {
@@ -287,7 +263,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\n", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\n", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) {
@@ -298,7 +274,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\t\n", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\t\n", HmiResult::GENERIC_ERROR, false);
}
} // namespace get_way_points_request
diff --git a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
index 9ef978d756..6d7ccb1fa0 100644
--- a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
@@ -56,19 +56,7 @@ using testing::ReturnRef;
using testing::_;
class OnHashChangeNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnHashChangeNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
const uint32_t kConnectionKey = 1u;
@@ -83,7 +71,8 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, curHash()).WillOnce(ReturnRef(return_string));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -112,7 +101,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app, curHash()).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 34f8a010d8..78875ad164 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -235,16 +235,12 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(*mock_app, is_foreground()).WillOnce(Return(true));
- application_manager::MockMessageHelper& mock_message_helper =
- *application_manager::MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(&mock_message_helper);
- EXPECT_CALL(mock_message_helper, SendQueryApps(kConnectionKey, _));
+ EXPECT_CALL(mock_message_helper_, SendQueryApps(kConnectionKey, _));
command->Run();
ASSERT_EQ(application_manager::MessageType::kNotification,
(*msg)[strings::params][strings::message_type].asInt());
- Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(OnHMIStatusNotificationFromMobileTest,
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
index 2da0e60df1..9cb5610621 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -59,9 +59,6 @@ using testing::_;
class OnHMIStatusNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnHMIStatusNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
MessageSharedPtr CreateMsgParams(
const mobile_apis::HMILevel::eType kHMIState) {
MessageSharedPtr msg = CreateMessage();
@@ -70,13 +67,9 @@ class OnHMIStatusNotificationTest
return msg;
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
void SetSendNotificationExpectations(MessageSharedPtr& msg) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -88,8 +81,6 @@ class OnHMIStatusNotificationTest
ASSERT_EQ(CommandImpl::protocol_version_,
(*msg)[strings::params][strings::protocol_version].asInt());
}
-
- MockMessageHelper& message_helper_;
};
TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
@@ -141,7 +132,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) {
EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false));
EXPECT_CALL(*mock_app, set_tts_properties_in_none(true));
- EXPECT_CALL(message_helper_, SendTTSGlobalProperties(_, false, _));
+ EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _));
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
index d56cd98904..7313f32dca 100644
--- a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -61,11 +61,9 @@ using testing::_;
class OnKeyBoardInputNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnKeyBoardInputNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
void SetSendNotificationExpectations(MessageSharedPtr msg) {
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -78,14 +76,6 @@ class OnKeyBoardInputNotificationTest
(*msg)[strings::params][strings::protocol_version].asInt());
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
@@ -95,7 +85,6 @@ class OnKeyBoardInputNotificationTest
return app;
}
- MockMessageHelper& message_helper_;
SharedPtr<ApplicationSet> app_set_;
sync_primitives::Lock lock_;
};
@@ -162,7 +151,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(*mock_app, hmi_level())
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
index 43f725012d..7840e35cec 100644
--- a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
@@ -64,20 +64,7 @@ const uint32_t kConnectionKey = 1u;
} // namespace
class OnSystemRequestNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnSystemRequestNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
const RequestType::eType kRequestType = RequestType::PROPRIETARY;
@@ -107,7 +94,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, TimeoutExchangeSec()).WillOnce(Return(5u));
#endif // PROPRIETARY_MODE
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -143,7 +131,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(true));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -176,7 +165,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
MockPolicyHandlerInterface mock_policy_handler;
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
@@ -203,7 +192,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(false));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
;
diff --git a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
index d00e62bcfb..05d97856e4 100644
--- a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -71,11 +71,9 @@ class OnVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
OnVehicleDataNotificationTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
NotificationPtr command_;
};
@@ -113,7 +111,8 @@ TEST_F(OnVehicleDataNotificationTest,
Run_NotEmptyListOfAppsSubscribedForEvent_SUCCESS) {
am::VehicleData test_vehicle_data;
test_vehicle_data.insert(am::VehicleData::value_type(
- am::strings::fuel_level, am::VehicleDataType::FUELLEVEL));
+ am::strings::fuel_level,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(test_vehicle_data));
@@ -126,9 +125,10 @@ TEST_F(OnVehicleDataNotificationTest,
std::vector<ApplicationSharedPtr> applications;
applications.push_back(mock_app);
- EXPECT_CALL(app_mngr_,
- IviInfoUpdated(am::VehicleDataType::FUELLEVEL, kFuelLevel))
- .WillOnce(Return(applications));
+ EXPECT_CALL(
+ app_mngr_,
+ IviInfoUpdated(mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL,
+ kFuelLevel)).WillOnce(Return(applications));
EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId));
::utils::custom_string::CustomString dummy_name("test_app");
diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
index e2adc38f50..6c35a5372a 100644
--- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -80,8 +79,7 @@ class PerformAudioPassThruRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
PerformAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map))
, msg_params_((*message_)[am::strings::msg_params]) {}
@@ -137,10 +135,6 @@ class PerformAudioPassThruRequestTest
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(application_sptr_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -153,7 +147,6 @@ class PerformAudioPassThruRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
::smart_objects::SmartObject& msg_params_;
@@ -192,33 +185,33 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) {
(*vr_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(am::mobile_api::Result::GENERIC_ERROR));
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(PerformAudioPassThruRequestTest,
OnEvent_UIHmiSendUnsupportedResource_UNSUPPORTED_RESOURCE) {
- MessageSharedPtr msg_ui = CreateFullParamsUISO();
- (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ MessageSharedPtr mobile_request = CreateFullParamsUISO();
+ (*mobile_request)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ smart_objects::SmartObject initial_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ initial_prompt[0] = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ initial_prompt[0][am::strings::text] = "tts chunk text";
+ initial_prompt[0][am::strings::type] = 0;
+ (*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] =
+ initial_prompt;
+ EXPECT_CALL(*application_sptr_, hmi_level())
+ .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
utils::SharedPtr<PerformAudioPassThruRequest> command =
- CreateCommand<PerformAudioPassThruRequest>(msg_ui);
-
- MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::params][am::hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
- (*msg)[am::strings::msg_params][am::strings::info] =
- "UI is not supported by system";
-
- am::event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
- event.set_smart_object(*msg);
+ CreateCommand<PerformAudioPassThruRequest>(mobile_request);
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr response_msg_tts =
CreateMessage(smart_objects::SmartType_Map);
@@ -227,21 +220,39 @@ TEST_F(PerformAudioPassThruRequestTest,
(*response_msg_tts)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
am::event_engine::Event event_tts(hmi_apis::FunctionID::TTS_Speak);
event_tts.set_smart_object(*response_msg_tts);
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
- command->on_event(event_tts);
- MessageSharedPtr ui_command_result;
+ MessageSharedPtr response_ui = CreateMessage(smart_objects::SmartType_Map);
+ (*response_ui)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+ (*response_ui)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*response_ui)[am::strings::msg_params][am::strings::info] =
+ "UI is not supported by system";
+ am::event_engine::Event event_ui(
+ hmi_apis::FunctionID::UI_PerformAudioPassThru);
+ event_ui.set_smart_object(*response_ui);
+
+ MessageSharedPtr response_to_mobile;
EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillRepeatedly(Return(true));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
- .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
- command->on_event(event);
+ command->Run();
+ command->on_event(event_tts);
+ command->on_event(event_ui);
- ResultCommandExpectations(ui_command_result, "UI is not supported by system");
+ EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool(),
+ false);
+ EXPECT_EQ(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asInt(),
+ static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::info]
+ .asString(),
+ "UI is not supported by system");
}
TEST_F(PerformAudioPassThruRequestTest,
@@ -546,10 +557,6 @@ TEST_F(PerformAudioPassThruRequestTest, OnEvent_UIPAPT_Rejected) {
hmi_apis::Common_Result::REJECTED;
event.set_smart_object(*message_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::REJECTED))
- .WillOnce(Return(am::mobile_api::Result::REJECTED));
-
CallOnEvent caller(*command_sptr_, event);
MessageSharedPtr result_message = CatchMobileCommandResult(caller);
@@ -582,15 +589,12 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
-
CallOnEvent caller(*command_sptr_, event);
caller();
}
TEST_F(PerformAudioPassThruRequestTest,
- OnEvent_PAPTunsupportedResource_CorrectInfo) {
+ DISABLED_OnEvent_PAPTunsupportedResource_CorrectInfo) {
const std::string return_info = "Unsupported phoneme type sent in a prompt";
am::event_engine::Event event_speak(hmi_apis::FunctionID::TTS_Speak);
@@ -646,8 +650,6 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
CallOnEvent caller(*command_sptr_, event);
caller();
@@ -771,8 +773,6 @@ TEST_F(PerformAudioPassThruRequestTest,
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
.WillOnce(Return(false));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
command_sptr_->onTimeOut();
}
diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
index 84a0e0b354..a272234e82 100644
--- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
@@ -63,7 +63,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,9 +81,7 @@ const uint32_t kConnectionKey = 2u;
class PerformInteractionRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- PerformInteractionRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -92,10 +89,6 @@ class PerformInteractionRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -108,7 +101,6 @@ class PerformInteractionRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -191,10 +183,10 @@ TEST_F(PerformInteractionRequestTest,
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr response_to_mobile;
@@ -222,10 +214,10 @@ TEST_F(PerformInteractionRequestTest,
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr response_msg_vr =
CreateMessage(smart_objects::SmartType_Map);
diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
index 7e46f6942f..c88f4626f0 100644
--- a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
@@ -90,11 +90,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- am::MockMessageHelper& mock_message_helper(
- *am::MockMessageHelper::message_helper_mock());
- EXPECT_CALL(mock_message_helper, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
@@ -102,8 +97,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
command->on_event(event);
-
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
index e133ec9119..69fee02262 100644
--- a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
@@ -58,7 +58,6 @@ namespace mobile_commands_test {
namespace reset_global_properties {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -83,11 +82,7 @@ class ResetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
ResetGlobalPropertiesRequestTest()
- : mock_message_helper_(am::MockMessageHelper::message_helper_mock())
- , msg_(CreateMessage())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
+ : msg_(CreateMessage()), mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -102,10 +97,6 @@ class ResetGlobalPropertiesRequestTest
.WillByDefault(Return(kCorrelationId));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
- am::MockMessageHelper* mock_message_helper_;
MessageSharedPtr msg_;
MockAppPtr mock_app_;
ResetGlobalPropertiesRequestPtr command_;
@@ -177,7 +168,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help; // = NULL;
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
@@ -230,7 +221,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
smart_objects::SmartObject msg_params =
@@ -272,8 +263,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
const hmi_apis::Common_Result::eType result_code =
hmi_apis::Common_Result::SUCCESS;
(*msg_)[am::strings::params][am::hmi_response::code] = result_code;
- ON_CALL(*mock_message_helper_, HMIToMobileResult(result_code))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
(*msg_)[am::strings::msg_params][am::strings::properties][0] =
mobile_apis::GlobalProperty::VRHELPTITLE;
@@ -285,7 +274,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
command_->Run();
@@ -346,16 +335,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
command_->on_event(event);
}
-TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) {
- Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
- event.set_smart_object(*msg_);
-
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
- EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
-
- command_->on_event(event);
-}
-
TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) {
MessageSharedPtr message(CreateMessage());
ResetGlobalPropertiesResponsePtr command(
@@ -380,7 +359,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
@@ -389,9 +368,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
CreateCommand<ResetGlobalPropertiesRequest>(msg_);
command->Run();
- EXPECT_CALL(*mock_message_helper_, HMIToMobileResult(_))
- .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS),
@@ -402,6 +378,186 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
command->on_event(event);
}
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitTTS_Timeout_GENERIC_ERROR_TTSNotRespond) {
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ ResetGlobalPropertiesRequestPtr command =
+ CreateCommand<ResetGlobalPropertiesRequest>(msg_);
+ command->Run();
+
+ // Received response only from UI
+ MessageSharedPtr ui_msg = CreateMessage();
+ (*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
+ (*ui_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*ui_msg)[am::strings::msg_params] =
+ SmartObject(smart_objects::SmartType_Map);
+ Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties);
+ ui_event.set_smart_object(*ui_msg);
+ command->on_event(ui_event);
+
+ // TTS doesn't respond, so timeout should send generic error
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+ const std::string info = "TTS component does not respond";
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command->onTimeOut();
+}
+
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitUI_Timeout_GENERIC_ERROR_UINotRespond) {
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ command_->Run();
+
+ // Received response only from TTS
+ MessageSharedPtr tts_msg = CreateMessage();
+ (*tts_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
+ (*tts_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+
+ Event tts_event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ tts_event.set_smart_object(*tts_msg);
+ command_->on_event(tts_event);
+
+ // UI doesn't respond, so timeout should send generic error
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+
+ const std::string info = "UI component does not respond";
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command_->onTimeOut();
+}
+
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitUIAndTTS_Timeout_GENERIC_ERROR_TTSAndUINotRespond) {
+ Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ command_->Run();
+ // TTS and UI don't respond, so timeout should send generic error
+ std::string info = "TTS, UI component does not respond";
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command_->onTimeOut();
+}
+
} // namespace reset_global_properties
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
index d9fac769e5..4520e1b120 100644
--- a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
@@ -65,7 +65,6 @@ using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ref;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -84,9 +83,6 @@ const uint32_t kFunctionID = 3u;
class ScrollableMessageRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ScrollableMessageRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
typedef TypeIf<kMocksAreNice,
NiceMock<application_manager_test::MockHMICapabilities>,
application_manager_test::MockHMICapabilities>::Result
@@ -118,11 +114,6 @@ class ScrollableMessageRequestTest
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
command_ = CreateCommand<ScrollableMessageRequest>(msg_);
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MockPolicyHandlerInterface mock_policy_handler_;
@@ -159,10 +150,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_ScrollableMessage);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -185,7 +172,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
@@ -274,8 +260,6 @@ TEST_F(ScrollableMessageRequestTest,
DISABLED_OnEvent_ReceivedUIScrollableMessage_SUCCESS) {
(*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
@@ -289,9 +273,6 @@ TEST_F(ScrollableMessageRequestTest,
(*msg_)[params][hmi_response::code] =
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(
diff --git a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
index 03cc715188..c5786675d6 100644
--- a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
@@ -54,7 +54,6 @@ using utils::SharedPtr;
using testing::_;
using testing::Return;
using testing::ReturnRef;
-using ::testing::Mock;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
@@ -92,18 +91,13 @@ class SendLocationRequestTest
typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt;
- SendLocationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ SendLocationRequestTest() {
mock_app_ = CreateMockApp();
disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
message_ = CreateMessage();
command_ = CreateCommand<UnwrappedSendLocationRequest>(message_);
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void InitialSetup(MessageSharedPtr message_) {
(*message_)[strings::params][strings::connection_key] = kConnectionKey;
(*message_)[strings::params][strings::function_id] = kFunctionID;
@@ -158,7 +152,6 @@ class SendLocationRequestTest
MockAppPtr mock_app_;
MockHMICapabilities mock_hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
SharedPtr<SmartObject> disp_cap_;
MessageSharedPtr message_;
CommandSPrt command_;
@@ -356,10 +349,6 @@ TEST_F(SendLocationRequestTest, OnEvent_Success) {
Event event(hmi_apis::FunctionID::Navigation_SendLocation);
event.set_smart_object(*message_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(app));
diff --git a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
index 60b01f2cfa..b278479df8 100644
--- a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -70,19 +69,6 @@ const uint32_t kConnectionKey = 2u;
class SetAppIconRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetAppIconRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockMessageHelper& mock_message_helper_;
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -134,10 +120,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_SetAppIcon);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
diff --git a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
index 68aa76010f..8444b88d63 100644
--- a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
@@ -59,7 +59,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -80,20 +79,12 @@ MATCHER_P(CheckMshCorrId, corr_id, "") {
class SetDisplayLayoutRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetDisplayLayoutRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
+ SetDisplayLayoutRequestTest() : mock_app_(CreateMockApp()) {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- ~SetDisplayLayoutRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -130,7 +121,6 @@ class SetDisplayLayoutRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -164,9 +154,6 @@ TEST_F(SetDisplayLayoutRequestTest,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -245,17 +232,12 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
(*dispaly_capabilities_msg)[am::hmi_response::templates_available] =
"templates_available";
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, hmi_capabilities())
.WillOnce(ReturnRef(hmi_capabilities));
EXPECT_CALL(hmi_capabilities, display_capabilities())
.WillOnce(Return(dispaly_capabilities_msg.get()));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
+
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS),
diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
index 7143bdf71a..641e5636a9 100644
--- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
@@ -59,7 +59,6 @@ using am::CommandsMap;
using utils::custom_string::CustomString;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kPosition = 1u;
class SetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetGlobalPropertiesRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetGlobalPropertiesRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -118,6 +115,8 @@ class SetGlobalPropertiesRequestTest
vr_help_array[0][am::strings::text] = kText;
vr_help_array[0][am::strings::position] = kPosition;
(*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array;
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
}
void OnEventUISetupHelper(MessageSharedPtr msg,
@@ -152,6 +151,8 @@ class SetGlobalPropertiesRequestTest
(*msg)[am::strings::msg_params][am::strings::timeout_prompt] =
timeout_prompt;
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_,
RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
@@ -216,10 +217,6 @@ class SetGlobalPropertiesRequestTest
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -242,13 +239,12 @@ class SetGlobalPropertiesRequestTest
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -323,6 +319,9 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) {
utils::SharedPtr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(response);
+ MockAppPtr mock_app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
@@ -348,9 +347,6 @@ TEST_F(SetGlobalPropertiesRequestTest,
utils::SharedPtr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(response);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -1032,8 +1028,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) {
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0);
-
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
@@ -1061,8 +1055,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -1091,15 +1085,14 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) {
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
OnEventUISetupHelper(msg, command);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL))
.WillOnce(Return(true));
@@ -1126,9 +1119,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(MockAppPtr()));
@@ -1146,7 +1136,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) {
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0);
EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0);
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
@@ -1180,8 +1169,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL))
.WillOnce(Return(true));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(response_code))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*msg);
@@ -1192,7 +1181,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
TEST_F(SetGlobalPropertiesRequestTest,
OnEvent_TTSAndWarningsResultCode_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- hmi_apis::Common_Result::eType response_code =
+ const hmi_apis::Common_Result::eType response_code =
hmi_apis::Common_Result::WARNINGS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
ON_CALL(
@@ -1210,17 +1199,27 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(app_mngr_,
- ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL))
- .WillOnce(Return(true));
+ MessageSharedPtr ui_command_result;
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*msg);
command->on_event(event);
+
+ EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success]
+ .asBool(),
+ true);
+ EXPECT_EQ(
+ (*ui_command_result)[am::strings::msg_params][am::strings::result_code]
+ .asInt(),
+ static_cast<int32_t>(hmi_apis::Common_Result::WARNINGS));
}
} // namespace set_global_properties_request
diff --git a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
index 3056d0e9fc..cf668c8b36 100644
--- a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
@@ -55,7 +55,6 @@ using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kSeconds = 1u;
class SetMediaClockRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetMediaClockRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetMediaClockRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -85,10 +82,6 @@ class SetMediaClockRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -114,7 +107,6 @@ class SetMediaClockRequestTest
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
}
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -140,10 +132,6 @@ TEST_F(SetMediaClockRequestTest,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_RESPONSE));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -328,12 +316,9 @@ TEST_F(SetMediaClockRequestTest, Run_InvalidApp_Canceled) {
TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
- mobile_apis::Result::SUCCESS;
+ hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Null);
- SharedPtr<SetMediaClockRequest> command(
- CreateCommand<SetMediaClockRequest>(msg));
-
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
MockAppPtr app(CreateMockApp());
@@ -341,7 +326,8 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*msg);
-
+ SharedPtr<SetMediaClockRequest> command(
+ CreateCommand<SetMediaClockRequest>(msg));
command->on_event(event);
}
diff --git a/src/components/application_manager/test/commands/mobile/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc
index d1e3c14181..4752bac0fd 100644
--- a/src/components/application_manager/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/test/commands/mobile/show_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using test::components::policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -73,8 +72,7 @@ const uint32_t kFunctionID = 3u;
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ShowRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ ShowRequestTest() {
mock_app_ = CreateMockApp();
}
sync_primitives::Lock lock_;
@@ -203,16 +201,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MockAppPtr mock_app_;
- MockMessageHelper& mock_message_helper_;
std::string text_field_;
};
@@ -238,10 +227,6 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr vr_command_result;
EXPECT_CALL(
app_mngr_,
@@ -264,12 +249,9 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -298,13 +280,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -328,13 +306,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -361,13 +335,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -392,13 +362,9 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -420,13 +386,9 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -447,13 +409,9 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -478,13 +436,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -506,13 +460,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -533,8 +483,6 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) {
@@ -720,7 +668,6 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) {
}
TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
MessageSharedPtr msg = CreateMsgParams();
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
@@ -745,10 +692,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*ev_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -764,8 +707,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
(*ui_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(mobile_apis::Result::WARNINGS));
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) {
@@ -943,9 +884,6 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _));
@@ -967,9 +905,6 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) {
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::WARNINGS))
- .WillOnce(Return(mobile_apis::Result::WARNINGS));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
Event event(hmi_apis::FunctionID::UI_Show);
diff --git a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
index cbc2d702b3..7ded373d29 100644
--- a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
@@ -58,28 +58,12 @@ namespace commands = am::commands;
using ::testing::_;
using ::testing::Types;
using ::testing::Return;
-using ::testing::Mock;
-
-using am::MockMessageHelper;
template <class Command>
class MobileNotificationCommandsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
typedef Command CommandType;
-
- public:
- MobileNotificationCommandsTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- ~MobileNotificationCommandsTest() {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- protected:
- MockMessageHelper& message_helper_;
};
typedef Types<commands::OnAppInterfaceUnregisteredNotification,
diff --git a/src/components/application_manager/test/commands/mobile/slider_test.cc b/src/components/application_manager/test/commands/mobile/slider_test.cc
index 20262ed35a..54ac3cccc0 100644
--- a/src/components/application_manager/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/test/commands/mobile/slider_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,8 +81,7 @@ class SliderRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SliderRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, msg_(CreateMessage(smart_objects::SmartType_Map)) {}
MessageSharedPtr CreateFullParamsUISO() {
@@ -123,10 +121,6 @@ class SliderRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectManageMobileCommandWithResultCode(
const mobile_apis::Result::eType code) {
EXPECT_CALL(
@@ -135,12 +129,8 @@ class SliderRequestTest
am::commands::Command::CommandOrigin::ORIGIN_SDL));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -167,10 +157,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_Slider);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -193,7 +179,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
class CallOnTimeOut {
@@ -325,9 +310,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderPositionExists_SUCCESS) {
(*msg_)[am::strings::params][am::strings::data]
[am::strings::slider_position] = "position";
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::TIMED_OUT))
- .WillOnce(Return(mobile_apis::Result::TIMED_OUT));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::TIMED_OUT);
Event event(hmi_apis::FunctionID::UI_Slider);
@@ -343,9 +325,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderAborted_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::ABORTED;
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::ABORTED);
Event event(hmi_apis::FunctionID::UI_Slider);
diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
index f8a7d22b40..f07012d315 100644
--- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
@@ -84,16 +84,9 @@ const uint32_t kConnectionKey = 5u;
class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SpeakRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , request_(CreateMessage(smart_objects::SmartType_Map))
+ : request_(CreateMessage(smart_objects::SmartType_Map))
, response_(CreateMessage(smart_objects::SmartType_Map))
- , app_(CreateMockApp()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~SpeakRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
const mobile_apis::Result::eType mobile_response,
@@ -114,10 +107,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
MessageSharedPtr response_to_mobile;
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
- .WillOnce(Return(mobile_response));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
@@ -134,7 +123,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
static_cast<int32_t>(mobile_response));
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr request_;
MessageSharedPtr response_;
MockAppPtr app_;
@@ -156,9 +144,6 @@ TEST_F(SpeakRequestTest, OnEvent_SUCCESS_Expect_true) {
MessageSharedPtr response_to_mobile;
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
@@ -349,8 +334,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_Speak_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
@@ -369,8 +352,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_SpeakWithWarning_WarningWithSuccess) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
- .WillOnce(Return(am::mobile_api::Result::WARNINGS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS), _));
diff --git a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
index 4546293172..d9497cd900 100644
--- a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -56,11 +56,9 @@ using ::testing::ReturnRef;
using ::testing::DoAll;
using ::testing::SaveArg;
using ::testing::InSequence;
-using ::testing::Mock;
namespace am = ::application_manager;
using am::commands::SubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr;
@@ -106,25 +104,17 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(mock_message_helper);
-
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
{
InSequence dummy;
EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_));
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(result_code))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
EXPECT_CALL(*app, UpdateHash());
}
command->Init();
command->on_event(event);
-
- Mock::VerifyAndClearExpectations(mock_message_helper);
}
} // namespace subscribe_way_points_request
diff --git a/src/components/application_manager/test/commands/mobile/system_request_test.cc b/src/components/application_manager/test/commands/mobile/system_request_test.cc
new file mode 100644
index 0000000000..0e07889b4b
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/system_request_test.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <string>
+#include <set>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/mobile/system_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace system_request {
+
+namespace am = application_manager;
+using am::commands::SystemRequest;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::MockHmiInterfaces;
+using am::event_engine::Event;
+using policy_test::MockPolicyHandlerInterface;
+using ::utils::SharedPtr;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kAppPolicyId = "fake-app-id";
+const uint32_t kDefaultTimeout = 1000u;
+const std::string kAppFolderName = "fake-app-name";
+const std::string kAppStorageFolder = "fake-storage";
+const std::string kSystemFilesPath = "/fake/system/files";
+const std::string kFileName = "Filename";
+} // namespace
+
+class SystemRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ SystemRequestTest() : mock_app_(CreateMockApp()) {}
+
+ protected:
+ MessageSharedPtr CreateIVSUMessage() {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::HTTP;
+ (*msg)[am::strings::msg_params][am::strings::file_name] = kFileName;
+ return msg;
+ }
+
+ void PreConditions() {
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId));
+ ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName));
+
+ ON_CALL(app_mngr_settings_, system_files_path())
+ .WillByDefault(ReturnRef(kSystemFilesPath));
+ ON_CALL(app_mngr_settings_, app_storage_folder())
+ .WillByDefault(ReturnRef(kAppStorageFolder));
+
+ ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _))
+ .WillByDefault(Return(true));
+ }
+
+ void ExpectManageMobileCommandWithResultCode(
+ const mobile_apis::Result::eType code) {
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(code),
+ am::commands::Command::CommandOrigin::ORIGIN_SDL));
+ }
+
+ MockAppPtr mock_app_;
+ MockPolicyHandlerInterface mock_policy_handler_;
+};
+
+TEST_F(SystemRequestTest, Run_HTTP_FileName_no_binary_data_REJECTED) {
+ PreConditions();
+ MessageSharedPtr msg = CreateIVSUMessage();
+
+ ExpectManageMobileCommandWithResultCode(mobile_apis::Result::REJECTED);
+
+ SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ command->Run();
+}
+
+} // namespace system_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
index ae4e46d40b..3d083f5c45 100644
--- a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -90,7 +90,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) {
mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM;
MessageSharedPtr dummy_msg(CreateMessage());
- EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(),
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kConnectionKey, kUnregisterReason))
.WillOnce(Return(dummy_msg));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 9652364646..bb4824e8f7 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -59,7 +59,8 @@ typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kMsgParamKey = "test_key";
-const am::VehicleDataType kVehicleType = am::VehicleDataType::SPEED;
+const mobile_apis::VehicleDataType::eType kVehicleType =
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED;
} // namespace
class UnsubscribeVehicleRequestTest
@@ -91,8 +92,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
kVehicleType;
am::VehicleData data;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
- .WillOnce(ReturnRef(data));
+ EXPECT_CALL(mock_message_helper_, vehicle_data()).WillOnce(ReturnRef(data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
MockAppPtr mock_app(CreateMockApp());
@@ -115,7 +115,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -139,7 +139,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -161,7 +161,7 @@ TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -185,7 +185,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
am::ApplicationSet application_set_;
@@ -228,7 +228,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
.WillRepeatedly(Return(false));
@@ -243,12 +243,9 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
SmartObject message(smart_objects::SmartType_Map);
const hmi_apis::Common_Result::eType hmi_result =
hmi_apis::Common_Result::SUCCESS;
- const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
message[am::strings::params][am::hmi_response::code] = hmi_result;
message[am::strings::msg_params][kMsgParamKey] = true;
test_event.set_smart_object(message);
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
EXPECT_CALL(
app_mngr_,
@@ -272,14 +269,10 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
SmartObject message(smart_objects::SmartType_Map);
const hmi_apis::Common_Result::eType hmi_result =
hmi_apis::Common_Result::SUCCESS;
- const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
message[am::strings::params][am::hmi_response::code] = hmi_result;
message[am::strings::msg_params][kMsgParamKey] = true;
test_event.set_smart_object(message);
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
index 50567a7c62..733d037afb 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -72,20 +72,13 @@ class UnSubscribeWayPointsRequestTest
public:
UnSubscribeWayPointsRequestTest()
: command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_))
- , mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
+ , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~UnSubscribeWayPointsRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MessageSharedPtr command_msg_;
::utils::SharedPtr<UnSubscribeWayPointsRequest> command_;
- am::MockMessageHelper& mock_message_helper_;
};
TEST_F(UnSubscribeWayPointsRequestTest,
@@ -165,10 +158,6 @@ TEST_F(UnSubscribeWayPointsRequestTest,
EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
index cab67e641c..dacabba5fd 100644
--- a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
@@ -79,8 +79,7 @@ class UpdateTurnListRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
UpdateTurnListRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<UpdateTurnListRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
@@ -88,7 +87,6 @@ class UpdateTurnListRequestTest
kFunctionId;
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
::utils::SharedPtr<UpdateTurnListRequest> command_;
TypeIf<kMocksAreNice,
@@ -275,9 +273,6 @@ TEST_F(UpdateTurnListRequestTest, OnEvent_UnsupportedResource_SUCCESS) {
Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
@@ -297,9 +292,6 @@ TEST_F(UpdateTurnListRequestTest,
Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index 2eb6956353..b8369528aa 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -507,6 +507,7 @@ TEST_F(HMICapabilitiesTest,
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 =
@@ -547,6 +548,7 @@ TEST_F(HMICapabilitiesTest,
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 =
diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
index b6733b5818..553126091f 100644
--- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h
+++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
@@ -44,7 +44,7 @@
#include "test/application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_application.h"
-
+#include "application_manager/mock_message_helper.h"
namespace test {
namespace components {
namespace commands_test {
@@ -54,6 +54,7 @@ namespace am = ::application_manager;
using ::testing::ReturnRef;
using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Mock;
using ::testing::_;
using ::utils::SharedPtr;
@@ -63,6 +64,7 @@ using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
using am::ApplicationSharedPtr;
+using am::MockMessageHelper;
using ::test::components::application_manager_test::MockApplication;
// Depending on the value type will be selected
@@ -100,7 +102,9 @@ class CommandsTest : public ::testing::Test {
MockApplication>::Result MockApp;
typedef SharedPtr<MockApp> MockAppPtr;
- virtual ~CommandsTest() {}
+ virtual ~CommandsTest() {
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ }
static MessageSharedPtr CreateMessage(
const smart_objects::SmartType type = smart_objects::SmartType_Null) {
@@ -136,6 +140,7 @@ class CommandsTest : public ::testing::Test {
MockAppManager app_mngr_;
MockAppManagerSettings app_mngr_settings_;
MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_;
+ am::MockMessageHelper& mock_message_helper_;
protected:
virtual void InitCommand(const uint32_t& timeout) {
@@ -145,13 +150,64 @@ class CommandsTest : public ::testing::Test {
.WillByDefault(ReturnRef(timeout));
}
- CommandsTest() {
+ CommandsTest()
+ : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_SDL));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ InitHMIToMobileResultConverter();
+ }
+
+ void InitHMIToMobileResultConverter() {
+ namespace MobileResult = mobile_apis::Result;
+ namespace HMIResult = hmi_apis::Common_Result;
+ auto link_hmi_to_mob_result =
+ [this](HMIResult::eType hmi_result, MobileResult::eType mobile_result) {
+ ON_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
+ .WillByDefault(Return(mobile_result));
+ };
+ link_hmi_to_mob_result(HMIResult::INVALID_ENUM, MobileResult::INVALID_ENUM);
+ link_hmi_to_mob_result(HMIResult::SUCCESS, MobileResult::SUCCESS);
+ link_hmi_to_mob_result(HMIResult::UNSUPPORTED_REQUEST,
+ MobileResult::UNSUPPORTED_REQUEST);
+ link_hmi_to_mob_result(HMIResult::UNSUPPORTED_RESOURCE,
+ MobileResult::UNSUPPORTED_RESOURCE);
+ link_hmi_to_mob_result(HMIResult::DISALLOWED, MobileResult::DISALLOWED);
+ link_hmi_to_mob_result(HMIResult::REJECTED, MobileResult::REJECTED);
+ link_hmi_to_mob_result(HMIResult::ABORTED, MobileResult::ABORTED);
+ link_hmi_to_mob_result(HMIResult::IGNORED, MobileResult::IGNORED);
+ link_hmi_to_mob_result(HMIResult::RETRY, MobileResult::RETRY);
+ link_hmi_to_mob_result(HMIResult::IN_USE, MobileResult::IN_USE);
+ link_hmi_to_mob_result(HMIResult::TIMED_OUT, MobileResult::TIMED_OUT);
+ link_hmi_to_mob_result(HMIResult::INVALID_DATA, MobileResult::INVALID_DATA);
+ link_hmi_to_mob_result(HMIResult::CHAR_LIMIT_EXCEEDED,
+ MobileResult::CHAR_LIMIT_EXCEEDED);
+ link_hmi_to_mob_result(HMIResult::INVALID_ID, MobileResult::INVALID_ID);
+ link_hmi_to_mob_result(HMIResult::DUPLICATE_NAME,
+ MobileResult::DUPLICATE_NAME);
+ link_hmi_to_mob_result(HMIResult::APPLICATION_NOT_REGISTERED,
+ MobileResult::APPLICATION_NOT_REGISTERED);
+ link_hmi_to_mob_result(HMIResult::WRONG_LANGUAGE,
+ MobileResult::WRONG_LANGUAGE);
+ link_hmi_to_mob_result(HMIResult::OUT_OF_MEMORY,
+ MobileResult::OUT_OF_MEMORY);
+ link_hmi_to_mob_result(HMIResult::TOO_MANY_PENDING_REQUESTS,
+ MobileResult::TOO_MANY_PENDING_REQUESTS);
+ link_hmi_to_mob_result(HMIResult::WARNINGS, MobileResult::WARNINGS);
+ link_hmi_to_mob_result(HMIResult::GENERIC_ERROR,
+ MobileResult::GENERIC_ERROR);
+ link_hmi_to_mob_result(HMIResult::USER_DISALLOWED,
+ MobileResult::USER_DISALLOWED);
+ link_hmi_to_mob_result(HMIResult::TRUNCATED_DATA,
+ MobileResult::TRUNCATED_DATA);
+ link_hmi_to_mob_result(HMIResult::SAVED, MobileResult::SAVED);
+ link_hmi_to_mob_result(HMIResult::DATA_NOT_AVAILABLE,
+ MobileResult::DATA_NOT_AVAILABLE);
+ link_hmi_to_mob_result(HMIResult::READ_ONLY, MobileResult::READ_ONLY);
}
};
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 c24e4590f5..a8c4f96b35 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
@@ -50,8 +50,12 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
+ // DEPRECATED
MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
+ // DEPRECATED
MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
+ MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool());
+ MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool flag));
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
@@ -313,7 +317,8 @@ class MockApplication : public ::application_manager::Application {
bool(application_manager::AppExtensionPtr extention));
MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid));
MOCK_METHOD0(RemoveExtensions, void());
- MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&());
+ MOCK_CONST_METHOD0(SubscribesIVI,
+ const application_manager::VehicleInfoSubscriptions&());
#endif // SDL_REMOTE_CONTROL
};
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 dd7ec5f0d5..468bdbe5eb 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
@@ -160,6 +160,9 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD0(video_streaming_supported, bool());
MOCK_METHOD1(set_video_streaming_supported, void(const bool supported));
+ MOCK_CONST_METHOD0(rc_supported, bool());
+ MOCK_METHOD1(set_rc_supported, void(const bool supported));
+
MOCK_CONST_METHOD0(navigation_capability,
const smart_objects::SmartObject*());
MOCK_METHOD1(set_navigation_capability,
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index b06b207f84..fb264b7d82 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -48,7 +48,9 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(RemoveApplicationFromSaved,
bool(app_mngr::ApplicationConstSharedPtr application));
MOCK_METHOD0(OnSuspend, void());
+ MOCK_METHOD0(OnIgnitionOff, void());
MOCK_METHOD0(OnAwake, void());
+ MOCK_CONST_METHOD0(is_suspended, bool());
MOCK_METHOD0(StopSavePersistentDataTimer, void());
MOCK_METHOD2(StartResumption,
bool(app_mngr::ApplicationSharedPtr application,
diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
index 7b16a3bf00..cfec034653 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
@@ -60,11 +60,13 @@ class MockResumptionData : public ::resumption::ResumptionData {
uint32_t(const std::string& policy_app_id,
const std::string& device_id));
MOCK_METHOD0(OnSuspend, void());
+ MOCK_METHOD0(IncrementIgnOffCount, void());
MOCK_CONST_METHOD3(GetHashId,
bool(const std::string& policy_app_id,
const std::string& device_id,
std::string& hash_id));
MOCK_METHOD0(OnAwake, void());
+ MOCK_METHOD0(DecrementIgnOffCount, void());
MOCK_CONST_METHOD3(GetSavedApplication,
bool(const std::string& policy_app_id,
const std::string& device_id,
diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc
index 3f2ba0a3c5..2fe28d8249 100644
--- a/src/components/application_manager/test/mobile_message_handler_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_test.cc
@@ -169,7 +169,7 @@ class MobileMessageHandlerTest : public testing::Test {
uint32_t correlation_id,
uint32_t connection_key,
const std::string& json_msg,
- application_manager::BinaryData* data = NULL) {
+ const application_manager::BinaryData* data = NULL) {
MobileMessage message = utils::MakeShared<Message>(
MessagePriority::FromServiceType(ServiceType::kRpc));
message->set_function_id(function_id);
@@ -256,10 +256,10 @@ TEST(mobile_message_test, basic_test) {
MobileMessage message =
utils::MakeShared<Message>(protocol_handler::MessagePriority::kDefault);
EXPECT_FALSE(message->has_binary_data());
- application_manager::BinaryData* binary_data =
- new application_manager::BinaryData;
- binary_data->push_back('X');
- message->set_binary_data(binary_data);
+ application_manager::BinaryData binary_data;
+ binary_data.push_back('X');
+ message->set_binary_data(
+ (const application_manager::BinaryData*)&binary_data);
EXPECT_TRUE(message->has_binary_data());
}
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index f80842e250..bbb814fb5b 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -452,9 +452,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
smart_objects::SmartObject test_subscriptions;
smart_objects::SmartObject app_vi;
- int vtype = application_manager::VehicleDataType::GPS;
+ int vtype = mobile_apis::VehicleDataType::VEHICLEDATA_GPS;
uint i = 0;
- for (; vtype < application_manager::VehicleDataType::STEERINGWHEEL;
+ for (; vtype < mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL;
++i, ++vtype) {
app_vi[i] = vtype;
}
@@ -481,7 +481,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
for (size_t i = 0; i < app_vi.length(); ++i) {
EXPECT_CALL(
*app_mock_,
- SubscribeToIVI(static_cast<application_manager::VehicleDataType>(i)));
+ SubscribeToIVI(static_cast<mobile_apis::VehicleDataType::eType>(i)));
}
smart_objects::SmartObjectList requests;
@@ -880,7 +880,7 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) {
// TODO (VVeremjova) APPLINK-16718
TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) {
- EXPECT_CALL(*mock_storage_, OnSuspend());
+ EXPECT_CALL(*mock_storage_, IncrementIgnOffCount());
res_ctrl_->OnSuspend();
}
@@ -896,7 +896,7 @@ TEST_F(ResumeCtrlTest, OnSuspend_EmptyApplicationlist) {
ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
EXPECT_CALL(*mock_storage_, SaveApplication(mock_app)).Times(0);
- EXPECT_CALL(*mock_storage_, OnSuspend());
+ EXPECT_CALL(*mock_storage_, IncrementIgnOffCount()).Times(0);
EXPECT_CALL(*mock_storage_, Persist());
res_ctrl_->OnSuspend();
}
@@ -906,7 +906,7 @@ TEST_F(ResumeCtrlTest, OnAwake) {
EXPECT_CALL(mock_application_manager_settings_,
app_resumption_save_persistent_data_timeout())
.WillOnce(ReturnRef(timeout));
- EXPECT_CALL(*mock_storage_, OnAwake());
+ EXPECT_CALL(*mock_storage_, DecrementIgnOffCount()).Times(0);
res_ctrl_->OnAwake();
}
diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
index aa4db59eac..cf0ebb7fd2 100644
--- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
@@ -728,7 +728,7 @@ TEST_F(ResumptionDataDBTest, OnSuspend) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
}
@@ -740,18 +740,18 @@ TEST_F(ResumptionDataDBTest, OnSuspendFourTimes) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, kMacAddress_);
EXPECT_EQ(-1, result);
@@ -765,11 +765,11 @@ TEST_F(ResumptionDataDBTest, OnSuspendOnAwake) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
}
@@ -782,7 +782,7 @@ TEST_F(ResumptionDataDBTest, Awake_AppNotSuspended) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
}
@@ -795,12 +795,12 @@ TEST_F(ResumptionDataDBTest, TwiceAwake_AppNotSuspended) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
- res_db()->OnAwake();
+ res_db()->IncrementIgnOffCount();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
CheckSavedDB();
}
@@ -826,14 +826,14 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) {
last_ign_off_time = res_db()->GetIgnOffTime();
EXPECT_EQ(0u, last_ign_off_time);
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
uint32_t after_suspend;
after_suspend = res_db()->GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
uint32_t after_awake;
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
after_awake = res_db()->GetIgnOffTime();
EXPECT_LE(after_suspend, after_awake);
diff --git a/src/components/application_manager/test/resumption/resumption_data_json_test.cc b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
index 834637fa62..e017c39497 100644
--- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
@@ -257,7 +257,7 @@ TEST_F(ResumptionDataJsonTest, OnSuspend) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
}
@@ -268,13 +268,13 @@ TEST_F(ResumptionDataJsonTest, OnSuspendFourTimes) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
- res_json.OnSuspend();
- res_json.OnSuspend();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
+ res_json.IncrementIgnOffCount();
+ res_json.IncrementIgnOffCount();
EXPECT_TRUE(-1 != res_json.IsApplicationSaved(policy_app_id_, kMacAddress_));
}
@@ -285,11 +285,11 @@ TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
}
@@ -300,7 +300,7 @@ TEST_F(ResumptionDataJsonTest, Awake_AppNotSuspended) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
}
@@ -311,12 +311,12 @@ TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
- res_json.OnAwake();
+ res_json.IncrementIgnOffCount();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
CheckSavedJson();
}
@@ -339,14 +339,14 @@ TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
last_ign_off_time = res_json.GetIgnOffTime();
EXPECT_EQ(0u, last_ign_off_time);
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
uint32_t after_suspend;
after_suspend = res_json.GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
uint32_t after_awake;
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
after_awake = res_json.GetIgnOffTime();
EXPECT_LE(after_suspend, after_awake);
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index 79397f5175..1f13ff78f3 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -539,8 +539,8 @@ void ResumptionDataTest::SetKeyboardProperties() {
void ResumptionDataTest::SetSubscriptions() {
btn_subscr.insert(ButtonName::eType::CUSTOM_BUTTON);
btn_subscr.insert(ButtonName::eType::OK);
- ivi.insert(0);
- ivi.insert(5);
+ ivi.insert(static_cast<mobile_apis::VehicleDataType::eType>(0));
+ ivi.insert(static_cast<mobile_apis::VehicleDataType::eType>(5));
}
} // namespace resumption_test
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index ac4950220e..67ec9368bc 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -110,9 +110,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
/**
* @brief Returns true, if SDL 4.0 is enabled
+ * @deprecated use max_supported_protocol_version instead
*/
- // DEPRECATED, use max_supported_protocol_version instead
- bool enable_protocol_4() const OVERRIDE;
+ DEPRECATED bool enable_protocol_4() const OVERRIDE;
/**
* @brief Returns application icons folder path
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
index aebc612a22..47e573a06d 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
@@ -182,9 +182,9 @@ class ConnectionHandlerImpl
* \param is_protected would be service protected
* \param hash_id pointer for session hash identifier
* \return uint32_t Id (number) of new session if successful, otherwise 0.
+ * \deprecated
*/
- // DEPRECATED
- virtual uint32_t OnSessionStartedCallback(
+ DEPRECATED virtual uint32_t OnSessionStartedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
const protocol_handler::ServiceType& service_type,
@@ -209,9 +209,18 @@ class ConnectionHandlerImpl
const protocol_handler::ServiceType& service_type,
const bool is_protected,
const BsonObject* params);
-
- // DEPRECATED
- uint32_t OnSessionEndedCallback(
+ /**
+ * \brief Callback function used by ProtocolHandler
+ * when Mobile Application initiates session ending.
+ * \param connection_handle Connection identifier within which session exists
+ * \param sessionId Identifier of the session to be ended
+ * \param hashCode Hash used only in second version of SmartDeviceLink
+ * protocol.
+ * If not equal to hash assigned to session on start then operation fails.
+ * \return uint32_t 0 if operation fails, session key otherwise
+ * \deprecated
+ */
+ DEPRECATED uint32_t OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
const uint32_t& hashCode,
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index bd5b3d79bb..254bb0194f 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -284,7 +284,6 @@ bool AllowProtection(const ConnectionHandlerSettings& settings,
}
#endif // ENABLE_SECURITY
-// DEPRECATED
uint32_t ConnectionHandlerImpl::OnSessionStartedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
@@ -542,7 +541,6 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback(
CloseConnection(connection_handle);
}
-// DEPRECATED
uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc
index ec4e12ffe2..0a05983623 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -1158,7 +1158,7 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckHash) {
for (uint32_t session = 0; session < 0xFF; ++session) {
AddTestSession();
- const uint32_t hash = connection_key_;
+ uint32_t hash = connection_key_;
uint32_t wrong_hash = hash + 1;
const uint32_t end_audio_wrong_hash =
@@ -1169,7 +1169,7 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckHash) {
CheckSessionExists(uid_, start_session_id_);
const uint32_t end_audio = connection_handler_->OnSessionEndedCallback(
- uid_, start_session_id_, hash, kRpc);
+ uid_, start_session_id_, &hash, kRpc);
EXPECT_EQ(connection_key_, end_audio);
CheckSessionExists(uid_, 0);
}
@@ -1181,17 +1181,17 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) {
AddTestSession();
uint32_t wrong_hash = protocol_handler::HASH_ID_WRONG;
- const uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED;
+ uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED;
const uint32_t end_audio_wrong_hash =
connection_handler_->OnSessionEndedCallback(
- uid_, start_session_id_, wrong_hash, kRpc);
+ uid_, start_session_id_, &wrong_hash, kRpc);
EXPECT_EQ(0u, end_audio_wrong_hash);
EXPECT_EQ(protocol_handler::HASH_ID_WRONG, wrong_hash);
CheckSessionExists(uid_, start_session_id_);
const uint32_t end_audio = connection_handler_->OnSessionEndedCallback(
- uid_, start_session_id_, hash, kRpc);
+ uid_, start_session_id_, &hash, kRpc);
EXPECT_EQ(connection_key_, end_audio);
CheckSessionExists(uid_, 0);
}
diff --git a/src/components/functional_module/test/include/mock_application.h b/src/components/functional_module/test/include/mock_application.h
index e73851094e..1192d5ede5 100644
--- a/src/components/functional_module/test/include/mock_application.h
+++ b/src/components/functional_module/test/include/mock_application.h
@@ -132,7 +132,8 @@ class MockApplication : public Application {
MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(SubscribedButtons,
const std::set<mobile_apis::ButtonName::eType>&());
- MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&());
+ MOCK_CONST_METHOD0(SubscribesIVI,
+ const application_manager::VehicleInfoSubscriptions&());
MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index abefbe3e24..ff5a6d687e 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -108,6 +108,7 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("BasicCommunication.OnUpdateDeviceList");
MessageBrokerController::subscribeTo("BasicCommunication.OnFindApplications");
MessageBrokerController::subscribeTo("BasicCommunication.OnAppActivated");
+ MessageBrokerController::subscribeTo("BasicCommunication.OnAwakeSDL");
MessageBrokerController::subscribeTo("BasicCommunication.OnExitApplication");
MessageBrokerController::subscribeTo(
"BasicCommunication.OnExitAllApplications");
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index c1a37a24f1..15a9f39348 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -36,7 +36,6 @@
#include <string>
#include <vector>
#include <set>
-#include "application_manager/vehicle_info_data.h"
#include "application_manager/application.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/commands/command.h"
@@ -374,8 +373,8 @@ class ApplicationManager {
* @param vehicle_info Enum value of type of vehicle data
* @param new value (for integer values currently) of vehicle data
*/
- virtual AppSharedPtrs IviInfoUpdated(VehicleDataType vehicle_info,
- int value) = 0;
+ virtual AppSharedPtrs IviInfoUpdated(
+ mobile_apis::VehicleDataType::eType vehicle_info, int value) = 0;
virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
smart_objects::SmartObject>& request_for_registration) = 0;
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index fb40367b00..1283584ef8 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -427,6 +427,20 @@ class HMICapabilities {
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
+ */
+ 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 used to store information regarding
* the navigation "System Capability"
*
diff --git a/src/components/include/application_manager/vehicle_info_data.h b/src/components/include/application_manager/vehicle_info_data.h
deleted file mode 100644
index 693353abfe..0000000000
--- a/src/components/include/application_manager/vehicle_info_data.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Copyright (c) 2013, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_
-#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_
-
-namespace application_manager {
-/*
-*@brief Typedef for the vehicle data types that can
-*be published and subscribed to
-*/
-enum VehicleDataType {
- GPS = 0,
- SPEED,
- RPM,
- FUELLEVEL,
- FUELLEVEL_STATE,
- FUELCONSUMPTION,
- EXTERNTEMP,
- VIN,
- PRNDL,
- TIREPRESSURE,
- ODOMETER,
- BELTSTATUS,
- BODYINFO,
- DEVICESTATUS,
- ECALLINFO,
- AIRBAGSTATUS,
- EMERGENCYEVENT,
- CLUSTERMODESTATUS,
- MYKEY,
- BRAKING,
- WIPERSTATUS,
- HEADLAMPSTATUS,
- BATTVOLTAGE,
- ENGINETORQUE,
- ACCPEDAL,
- STEERINGWHEEL
-};
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_
diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h
index 362f49e140..e1107cb2a9 100644
--- a/src/components/include/protocol_handler/protocol_handler_settings.h
+++ b/src/components/include/protocol_handler/protocol_handler_settings.h
@@ -34,8 +34,11 @@ class ProtocolHandlerSettings {
*/
virtual uint16_t max_supported_protocol_version() const = 0;
- // DEPRECATED
- virtual bool enable_protocol_4() const = 0;
+ /*
+ * @brief Returns true, if SDL 4.0 is enabled
+ * @deprecated Use max_supported_protocol_version instead
+ */
+ DEPRECATED virtual bool enable_protocol_4() const = 0;
virtual uint32_t multiframe_waiting_timeout() const = 0;
#ifdef ENABLE_SECURITY
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index e58d959c8c..7ac7a84d6d 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -75,9 +75,9 @@ class SessionObserver {
* \param is_protected would be service protected
* \param hash_id pointer for session hash identifier, uint32_t* hash_id
* \return uint32_t Id (number) of new session if successful, otherwise 0.
+ * \deprecated
*/
- // DEPRECATED
- virtual uint32_t OnSessionStartedCallback(
+ DEPRECATED virtual uint32_t OnSessionStartedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const protocol_handler::ServiceType& service_type,
@@ -103,8 +103,19 @@ class SessionObserver {
const bool is_protected,
const BsonObject* params) = 0;
- // DEPRECATED
- virtual uint32_t OnSessionEndedCallback(
+ /**
+ * \brief Callback function used by ProtocolHandler
+ * when Mobile Application initiates session ending.
+ * \param connection_handle Connection identifier within which session exists
+ * \param sessionId Identifier of the session to be ended
+ * \param hashCode Hash used only in second version of SmartDeviceLink
+ * protocol.
+ * If not equal to hash assigned to session on start then operation fails.
+ * \param service_type Type of service
+ * \return uint32_t 0 if operation fails, session key otherwise
+ * \deprecated
+ */
+ DEPRECATED virtual uint32_t OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const uint32_t& hashCode,
@@ -116,7 +127,7 @@ class SessionObserver {
* \param connection_handle Connection identifier within which session exists
* \param sessionId Identifier of the session to be ended
* \param hashCode Hash used only in second version of SmartDeviceLink
- * protocol.
+ * protocol. (Set to HASH_ID_WRONG if the hash is incorrect)
* If not equal to hash assigned to session on start then operation fails.
* \param service_type Type of service
* \return uint32_t 0 if operation fails, session key otherwise
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 e94d9b4b3a..7d1384b7ac 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -43,7 +43,6 @@
#include "application_manager/application_manager_settings.h"
#include "application_manager/commands/command.h"
#include "application_manager/hmi_capabilities.h"
-#include "application_manager/vehicle_info_data.h"
#include "application_manager/state_controller.h"
#include "application_manager/message.h"
#include "resumption/last_state.h"
@@ -167,7 +166,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(IsHMICooperating, bool());
MOCK_METHOD2(IviInfoUpdated,
std::vector<application_manager::ApplicationSharedPtr>(
- application_manager::VehicleDataType vehicle_info,
+ mobile_apis::VehicleDataType::eType vehicle_info,
int value));
MOCK_METHOD1(RegisterApplication,
application_manager::ApplicationSharedPtr(const utils::SharedPtr<
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index 4cf76fe022..e6f3b6b3ca 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -145,4 +145,22 @@
#define FRIEND_TEST(test_case_name, test_name)
#endif // BUILD_TESTS
+/*
+* @brief deprecate a method declaration, a warning will be thrown by your
+* compiler if a method with this macro is used
+*/
+#if __cplusplus > 201103L
+#define DEPRECATED [[deprecated]]
+#else
+#ifdef __GNUC__
+#define DEPRECATED __attribute__((deprecated))
+#define DEPRECATED_CLASS __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define DEPRECATED __declspec(deprecated)
+#else
+#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
+#define DEPRECATED
+#endif
+#endif
+
#endif // SRC_COMPONENTS_INCLUDE_UTILS_MACRO_H_
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 32360aa357..ab3933fc0f 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -37,7 +37,7 @@
<interfaces name="SmartDeviceLink HMI API">
-<interface name="Common" version="1.6.0" date="2017-04-27">
+<interface name="Common" version="1.7.0" date="2017-10-20">
<enum name="Result">
<element name="SUCCESS" value="0"/>
@@ -2112,6 +2112,9 @@
<param name="phoneCall" type="Boolean" mandatory="false">
<description>Availability of build in phone. True: Available, False: Not Available</description>
</param>
+ <param name="videoStreaming" type="Boolean" mandatory="false">
+ <description>Availability of built-in video streaming. True: Available, False: Not Available</description>
+ </param>
</struct>
<struct name="AudioPassThruCapabilities">
@@ -2659,7 +2662,7 @@
</interface>
-<interface name="Buttons" version="1.2.0" date="2017-04-27">
+<interface name="Buttons" version="1.3.0" date="2017-07-18">
<function name="GetCapabilities" messagetype="request">
<description>Method is invoked at system start-up. SDL requests the information about all supported hardware buttons and their capabilities</description>
</function>
@@ -2743,7 +2746,7 @@
</function>
</interface>
-<interface name="BasicCommunication" version="1.2.0" date="2017-04-27">
+<interface name="BasicCommunication" version="1.2.1" date="2017-08-02">
<function name="OnReady" messagetype="notification">
<description>HMI must notify SDL about its readiness to start communication. In fact, this has to be the first message between SDL and HMI.</description>
</function>
@@ -3349,7 +3352,7 @@
</function>
</interface>
-<interface name="UI" version="1.1.0" date="2017-04-27">
+<interface name="UI" version="1.2.0" date="2017-09-05">
<function name="Alert" messagetype="request">
<description>Request from SDL to show an alert message on the display.</description>
<param name="alertStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="3">
@@ -3861,7 +3864,7 @@
</function>
</interface>
-<interface name="Navigation" version="1.4.0" date="2017-04-27">
+<interface name="Navigation" version="1.5.0" date="2017-08-15">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response must provide the information about presence of UI Navigation module and its readiness to cooperate with SDL.</description>
@@ -4884,7 +4887,7 @@
</function>
</interface>
-<interface name="RC" version="1.1" date="2017-07-18">
+<interface name="RC" version="1.1.0" date="2017-07-18">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response should provide information about presence of any of remote controllable module and its readiness to cooperate with SDL.</description>
</function>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 804520fe4d..a1c64aecda 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -1994,6 +1994,9 @@
<param name="videoStreaming" type="Boolean" mandatory="false">
<description>Availability of video streaming. </description>
</param>
+ <param name="remoteControl" type="Boolean" mandatory="false">
+ <description>Availability of remote control feature. True: Available, False: Not Available</description>
+ </param>
</struct>
<struct name="MenuParams">
<param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" defvalue="0" mandatory="false">
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 f0c6d3c48f..ded709b1fa 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
@@ -74,6 +74,7 @@ class FromMicToFileRecorderThread : public threads::ThreadDelegate {
} GstTimeout;
void initArgs();
+ void deinitArgs();
void psleep(void* timeout);
diff --git a/src/components/media_manager/include/media_manager/file_streamer_adapter.h b/src/components/media_manager/include/media_manager/file_streamer_adapter.h
index 293c6721ee..c4c91a98d8 100644
--- a/src/components/media_manager/include/media_manager/file_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/file_streamer_adapter.h
@@ -54,6 +54,8 @@ class FileStreamerAdapter : public StreamerAdapter {
const std::string& app_storage_folder);
virtual ~FileStreamer();
+ virtual void Close() {}
+
protected:
virtual bool Connect();
virtual void Disconnect();
diff --git a/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h b/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h
index 1e998ef82f..c079e04954 100644
--- a/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h
@@ -53,6 +53,8 @@ class PipeStreamerAdapter : public StreamerAdapter {
const std::string& app_storage_folder);
virtual ~PipeStreamer();
+ virtual void Close() {}
+
protected:
virtual bool Connect();
virtual void Disconnect();
diff --git a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
index 45311b6077..3b647a0b83 100644
--- a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
@@ -55,6 +55,8 @@ class SocketStreamerAdapter : public StreamerAdapter {
const std::string& header);
virtual ~SocketStreamer();
+ virtual void Close();
+
protected:
virtual bool Connect();
virtual void Disconnect();
diff --git a/src/components/media_manager/include/media_manager/streamer_adapter.h b/src/components/media_manager/include/media_manager/streamer_adapter.h
index 30353b8d09..5ac8e05cac 100644
--- a/src/components/media_manager/include/media_manager/streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/streamer_adapter.h
@@ -72,6 +72,8 @@ class StreamerAdapter : public MediaAdapterImpl {
virtual void threadMain();
virtual void exitThreadMain();
+ virtual void Close() = 0;
+
protected:
virtual bool Connect() = 0;
virtual void Disconnect() = 0;
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 0239795d75..99548e71bd 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
@@ -32,6 +32,7 @@
#include "media_manager/audio/from_mic_to_file_recorder_thread.h"
#include <unistd.h>
+#include <cstring>
#include <sstream>
#include "utils/logger.h"
@@ -88,11 +89,23 @@ void FromMicToFileRecorderThread::initArgs() {
argv_[3] = new gchar[3];
argv_[4] = new gchar[durationString_.length() + 1];
- argv_[0] = const_cast<gchar*>(std::string("AudioManager").c_str());
- argv_[1] = const_cast<gchar*>(oKey_.c_str());
- argv_[2] = const_cast<gchar*>(outputFileName_.c_str());
- argv_[3] = const_cast<gchar*>(tKey_.c_str());
- argv_[4] = const_cast<gchar*>(durationString_.c_str());
+ std::strcpy(argv_[0], "AudioManager");
+ std::strcpy(argv_[1], oKey_.c_str());
+ std::strcpy(argv_[2], outputFileName_.c_str());
+ std::strcpy(argv_[3], tKey_.c_str());
+ std::strcpy(argv_[4], durationString_.c_str());
+}
+
+void FromMicToFileRecorderThread::deinitArgs() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (argv_) {
+ for (int32_t i = 0; i < argc_; i++) {
+ delete[] argv_[i];
+ }
+ delete[] argv_;
+ argv_ = NULL;
+ }
}
void FromMicToFileRecorderThread::threadMain() {
@@ -136,6 +149,13 @@ void FromMicToFileRecorderThread::threadMain() {
"length of time in seconds to capture",
"int32_t"},
{NULL}};
+ // g_option_context_parse() modifies params, so keep argc_ and argv_
+ int32_t argc = argc_;
+ gchar** argv = new gchar* [argc];
+ for (int32_t i = 0; i < argc; i++) {
+ argv[i] = argv_[i];
+ }
+
#ifndef GLIB_VERSION_2_32 // g_thread_init() does nothing since 2.32
if (!g_thread_supported()) {
g_thread_init(NULL);
@@ -145,7 +165,7 @@ void FromMicToFileRecorderThread::threadMain() {
context = g_option_context_new("-- M-AUDIO RAW");
g_option_context_add_main_entries(context, entries, NULL);
g_option_context_add_group(context, gst_init_get_option_group());
- if (!g_option_context_parse(context, &argc_, &argv_, &err)) {
+ if (!g_option_context_parse(context, &argc, &argv, &err)) {
g_error("%s\n", err->message);
}
@@ -159,7 +179,10 @@ void FromMicToFileRecorderThread::threadMain() {
LOG4CXX_TRACE(logger_, "Duration set to: " << duration);
// Initialize gstreamer and setup the main loop information
- gst_init(&argc_, &argv_);
+ gst_init(&argc, &argv);
+
+ delete[] argv;
+ argv = NULL;
pipeline = gst_pipeline_new("vga2usb-h264");
@@ -207,10 +230,7 @@ void FromMicToFileRecorderThread::threadMain() {
gst_object_unref(GST_OBJECT(pipeline));
g_option_context_free(context);
- if (argv_) {
- delete[] argv_;
- argv_ = NULL;
- }
+ deinitArgs();
return;
}
}
@@ -238,10 +258,7 @@ void FromMicToFileRecorderThread::threadMain() {
g_main_loop_unref(loop);
g_option_context_free(context);
- if (argv_) {
- delete[] argv_;
- argv_ = NULL;
- }
+ deinitArgs();
loop = NULL;
}
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 2bb0fe10ec..60b01c901b 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -108,13 +108,21 @@ bool SocketStreamerAdapter::SocketStreamer::Connect() {
return true;
}
+void SocketStreamerAdapter::SocketStreamer::Close() {
+ Disconnect();
+}
+
void SocketStreamerAdapter::SocketStreamer::Disconnect() {
LOG4CXX_AUTO_TRACE(logger);
if (0 < send_socket_fd_) {
+ shutdown(send_socket_fd_, SHUT_RDWR);
close(send_socket_fd_);
+ send_socket_fd_ = 0;
}
if (0 < socket_fd_) {
+ shutdown(socket_fd_, SHUT_RDWR);
close(socket_fd_);
+ socket_fd_ = 0;
}
}
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
index 20c067da1c..90a40b1add 100644
--- a/src/components/media_manager/src/streamer_adapter.cc
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -44,9 +44,12 @@ StreamerAdapter::StreamerAdapter(Streamer* const streamer)
}
StreamerAdapter::~StreamerAdapter() {
- delete streamer_;
+ if (streamer_) {
+ streamer_->Close();
+ }
thread_->join();
threads::DeleteThread(thread_);
+ delete streamer_;
}
void StreamerAdapter::StartActivity(int32_t application_key) {
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 7d0226fa67..a9dc27d7a3 100644
--- a/src/components/media_manager/test/media_manager_impl_test.cc
+++ b/src/components/media_manager/test/media_manager_impl_test.cc
@@ -123,10 +123,12 @@ class MediaManagerImplTest : public ::testing::Test {
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_media_manager_settings_, app_storage_folder())
.WillOnce(ReturnRef(kStorageFolder));
+#ifndef EXTENDED_MEDIA_MODE
EXPECT_CALL(mock_media_manager_settings_, app_resource_folder())
.WillOnce(ReturnRef(kResourceFolder));
EXPECT_CALL(mock_media_manager_settings_, recording_file_source())
.WillOnce(ReturnRef(kRecordingFileSource));
+#endif
}
void InitMediaManagerPrecondition(const std::string& server_type) {
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 428a9bd2f6..aa5360d2b7 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -731,6 +731,13 @@ class CacheManager : public CacheManagerInterface {
*/
void ResetCalculatedPermissionsForDevice(const std::string& device_id);
+ /**
+ * @brief Transform to lower case all non default application names in
+ * applications policies section
+ * @param pt polict rable for update
+ */
+ void MakeLowerCaseAppNames(policy_table::Table& pt) const;
+
void AddCalculatedPermissions(const std::string& device_id,
const std::string& policy_app_id,
const policy::Permissions& permissions);
diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h
index 42c1ec0b46..6945f45b45 100644
--- a/src/components/policy/policy_external/include/policy/policy_helper.h
+++ b/src/components/policy/policy_external/include/policy/policy_helper.h
@@ -199,6 +199,23 @@ struct CheckAppPolicy {
CheckAppPolicyResults& out_results_;
};
+/**
+ * @brief Helper struct for filling actions to be done for processed application
+ * using CheckAppPolicyResults data as a source
+ */
+struct FillActionsForAppPolicies {
+ FillActionsForAppPolicies(
+ ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies)
+ : actions_(actions), app_policies_(app_policies) {}
+
+ void operator()(const policy::CheckAppPolicyResults::value_type& value);
+
+ private:
+ ApplicationsPoliciesActions& actions_;
+ const policy_table::ApplicationPolicies& app_policies_;
+};
+
/*
* @brief Fill permissions data with merged rpc permissions for hmi levels and
* parameters
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 f8d226c86a..80ceb06e7e 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
@@ -719,8 +719,9 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Processes results from policy table update analysis done by
- * CheckPermissionsChanges() by sending OnPermissionChange and
- * OnAppPermissionChanged notifications
+ * CheckPermissionsChanges() by filling ApplicationsPoliciesActions struct
+ * with actions which should be done for every application and passes them to
+ * ProcessActionsForAppPolicies()
* @param results Collection of per-application results
* @param app_policies Reference to updated application policies section as
* a data source for generating notifications data
@@ -730,6 +731,19 @@ class PolicyManagerImpl : public PolicyManager {
const policy_table::ApplicationPolicies& app_policies);
/**
+ * @brief Processes actions filled in ProcessAppPolicyCheckResults() for every
+ * application by sending OnPermissionChange and OnAppPermissionChanged
+ * notifications and by checking consent where it needed
+ * @param actions Reference to map with actions to be done or not for every
+ * application
+ * @param app_policies Reference to updated application policies section as
+ * a data source for generating notifications data
+ */
+ void ProcessActionsForAppPolicies(
+ const ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies);
+
+ /**
* @brief Fill structure to be sent with OnPermissionsChanged notification
*
* @param Policy table struct, which contains rpc functional groups data
diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h
index 9ba1a1cfff..f57919b6f7 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -432,6 +432,28 @@ struct ExternalConsentStatusItemSorter {
};
/**
+ * @brief The ApplicationPolicyActions struct contains actions which should be
+ * done for some application
+ */
+struct ApplicationPolicyActions {
+ ApplicationPolicyActions()
+ : is_notify_system(false)
+ , is_send_permissions_to_app(false)
+ , is_consent_needed(false) {}
+
+ bool is_notify_system;
+ bool is_send_permissions_to_app;
+ bool is_consent_needed;
+};
+
+/**
+ * @brief ApplicationsPoliciesActions map of actions to be done for every
+ * application
+ */
+typedef std::map<std::string, ApplicationPolicyActions>
+ ApplicationsPoliciesActions;
+
+/**
* @brief Customer connectivity settings status
*/
typedef std::set<ExternalConsentStatusItem, ExternalConsentStatusItemSorter>
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 95b2fda272..b5e44014dd 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -633,7 +633,7 @@ void CacheManager::ProcessUpdate(
*(initial_policy_iter->second.RequestType);
const std::string& app_id = initial_policy_iter->first;
- RequestTypes merged_pt_request_types;
+ bool update_request_types = true;
if (app_id == kDefaultId || app_id == kPreDataConsentId) {
if (new_request_types.is_omitted()) {
@@ -641,25 +641,28 @@ void CacheManager::ProcessUpdate(
"Application " << app_id
<< " has omitted RequestTypes."
" Previous values will be kept.");
- return;
- }
- if (new_request_types.empty()) {
+ update_request_types = false;
+ } else if (new_request_types.empty()) {
if (new_request_types.is_cleaned_up()) {
LOG4CXX_INFO(logger_,
"Application " << app_id
<< " has cleaned up all values."
" Previous values will be kept.");
- return;
+ update_request_types = false;
+ } else {
+ LOG4CXX_INFO(logger_,
+ "Application " << app_id
+ << " has empty RequestTypes."
+ " Any parameter will be allowed.");
}
- LOG4CXX_INFO(logger_,
- "Application " << app_id
- << " has empty RequestTypes."
- " Any parameter will be allowed.");
}
- merged_pt_request_types = new_request_types;
- } else {
- merged_pt_request_types = new_request_types;
}
+
+ const RequestTypes merged_pt_request_types =
+ update_request_types
+ ? new_request_types
+ : *(pt_->policy_table.app_policies_section.apps[app_id].RequestType);
+
pt_->policy_table.app_policies_section.apps[app_id] =
initial_policy_iter->second;
*(pt_->policy_table.app_policies_section.apps[app_id].RequestType) =
@@ -685,15 +688,6 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
pt_->policy_table.app_policies_section.apps[iter->first].set_to_null();
pt_->policy_table.app_policies_section.apps[iter->first].set_to_string(
"");
- } else if (policy::kDefaultId == (iter->second).get_string()) {
- policy_table::ApplicationPolicies::const_iterator iter_default =
- update_pt.policy_table.app_policies_section.apps.find(kDefaultId);
- if (update_pt.policy_table.app_policies_section.apps.end() ==
- iter_default) {
- LOG4CXX_ERROR(logger_, "The default section was not found in PTU");
- continue;
- }
- ProcessUpdate(iter_default);
} else {
ProcessUpdate(iter);
}
@@ -2255,6 +2249,27 @@ void CacheManager::FillDeviceSpecificData() {
}
}
+void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const {
+ policy_table::ApplicationPolicies& apps =
+ pt.policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::iterator iter = apps.begin();
+ iter != apps.end();) {
+ std::string key = iter->first;
+ if (key == kDefaultId || key == kPreDataConsentId || key == kDeviceId) {
+ ++iter;
+ continue;
+ }
+
+ std::transform(key.begin(), key.end(), key.begin(), ::tolower);
+ if (key.compare(iter->first) != 0) {
+ std::swap(apps[key], iter->second);
+ iter = apps.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+}
+
bool CacheManager::LoadFromBackup() {
sync_primitives::AutoLock lock(cache_lock_);
pt_ = backup_->GenerateSnapshot();
@@ -2297,6 +2312,8 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
"Policy table content loaded:" << s_writer.write(table.ToJsonValue()));
#endif // ENABLE_LOG
+ MakeLowerCaseAppNames(table);
+
if (!table.is_valid()) {
rpc::ValidationReport report("policy_table");
table.ReportErrors(&report);
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index 3041323489..5425777833 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -484,6 +484,41 @@ bool CheckAppPolicy::IsRequestTypeChanged(
return diff.size();
}
+void FillActionsForAppPolicies::operator()(
+ const policy::CheckAppPolicyResults::value_type& value) {
+ const std::string app_id = value.first;
+ const policy_table::ApplicationPolicies::const_iterator app_policy =
+ app_policies_.find(app_id);
+
+ if (app_policies_.end() == app_policy) {
+ return;
+ }
+
+ if (IsPredefinedApp(*app_policy)) {
+ return;
+ }
+
+ switch (value.second) {
+ case RESULT_APP_REVOKED:
+ case RESULT_NICKNAME_MISMATCH:
+ actions_[app_id].is_notify_system = true;
+ return;
+ case RESULT_CONSENT_NEEDED:
+ case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED:
+ actions_[app_id].is_consent_needed = true;
+ break;
+ case RESULT_CONSENT_NOT_REQIURED:
+ case RESULT_PERMISSIONS_REVOKED:
+ case RESULT_REQUEST_TYPE_CHANGED:
+ break;
+ case RESULT_NO_CHANGES:
+ default:
+ return;
+ }
+ actions_[app_id].is_notify_system = true;
+ actions_[app_id].is_send_permissions_to_app = true;
+}
+
FillNotificationData::FillNotificationData(Permissions& data,
GroupConsent group_state,
GroupConsent undefined_group_consent,
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 8a80e7755b..d50779383a 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -385,53 +385,45 @@ CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
void PolicyManagerImpl::ProcessAppPolicyCheckResults(
const CheckAppPolicyResults& results,
const policy_table::ApplicationPolicies& app_policies) {
- CheckAppPolicyResults::const_iterator it_results = results.begin();
+ ApplicationsPoliciesActions actions_for_apps_policies;
+ FillActionsForAppPolicies filler(actions_for_apps_policies, app_policies);
- for (; results.end() != it_results; ++it_results) {
- const policy_table::ApplicationPolicies::const_iterator app_policy =
- app_policies.find(it_results->first);
+ std::for_each(results.begin(), results.end(), filler);
+ ProcessActionsForAppPolicies(actions_for_apps_policies, app_policies);
+}
+
+void PolicyManagerImpl::ProcessActionsForAppPolicies(
+ const ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies) {
+ ApplicationsPoliciesActions::const_iterator it_actions = actions.begin();
+ for (; it_actions != actions.end(); ++it_actions) {
+ policy_table::ApplicationPolicies::const_iterator app_policy =
+ app_policies.find(it_actions->first);
if (app_policies.end() == app_policy) {
continue;
}
- if (IsPredefinedApp(*app_policy)) {
- continue;
- }
+ if (it_actions->second.is_consent_needed) {
+ // Post-check after ExternalConsent consent changes
+ const std::string& policy_app_id = app_policy->first;
+ if (!IsConsentNeeded(policy_app_id)) {
+ sync_primitives::AutoLock lock(app_permissions_diff_lock_);
- switch (it_results->second) {
- case RESULT_NO_CHANGES:
- continue;
- case RESULT_APP_REVOKED:
- NotifySystem(*app_policy);
- continue;
- case RESULT_NICKNAME_MISMATCH:
- NotifySystem(*app_policy);
- continue;
- case RESULT_CONSENT_NEEDED:
- case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED: {
- // Post-check after ExternalConsent consent changes
- const std::string policy_app_id = app_policy->first;
- if (!IsConsentNeeded(policy_app_id)) {
- sync_primitives::AutoLock lock(app_permissions_diff_lock_);
-
- PendingPermissions::iterator app_id_diff =
- app_permissions_diff_.find(policy_app_id);
-
- if (app_permissions_diff_.end() != app_id_diff) {
- app_id_diff->second.appPermissionsConsentNeeded = false;
- }
+ PendingPermissions::iterator app_id_diff =
+ app_permissions_diff_.find(policy_app_id);
+
+ if (app_permissions_diff_.end() != app_id_diff) {
+ app_id_diff->second.appPermissionsConsentNeeded = false;
}
- } break;
- case RESULT_CONSENT_NOT_REQIURED:
- case RESULT_PERMISSIONS_REVOKED:
- case RESULT_REQUEST_TYPE_CHANGED:
- break;
- default:
- continue;
+ }
+ }
+ if (it_actions->second.is_notify_system) {
+ NotifySystem(*app_policy);
+ }
+ if (it_actions->second.is_send_permissions_to_app) {
+ SendPermissionsToApp(*app_policy);
}
- NotifySystem(*app_policy);
- SendPermissionsToApp(*app_policy);
}
}
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index e3e1029692..4afce16885 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -137,7 +137,7 @@ const std::string kCreateSchema =
"CREATE INDEX `rpc.select_rpc_name_hmi_level` "
" ON `rpc`(`name`,`hmi_level_value`);"
"CREATE TABLE IF NOT EXISTS `application`( "
- " `id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, "
" `keep_context` BOOLEAN, "
" `steal_focus` BOOLEAN, "
" `default_hmi` VARCHAR(45), "
@@ -160,7 +160,7 @@ const std::string kCreateSchema =
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" PRIMARY KEY(`application_id`,`functional_group_id`), "
" CONSTRAINT `fk_application_has_functional_group_application1` "
@@ -175,9 +175,9 @@ const std::string kCreateSchema =
" ON `app_group`(`functional_group_id`); "
"CREATE INDEX IF NOT EXISTS "
"`app_group.fk_application_has_functional_group_application1_idx` "
- " ON `app_group`(`application_id`); "
+ " ON `app_group`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `preconsented_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" PRIMARY KEY(`application_id`,`functional_group_id`), "
" CONSTRAINT `fk_application_has_functional_group_application2` "
@@ -193,7 +193,7 @@ const std::string kCreateSchema =
" ON `preconsented_group`(`functional_group_id`); "
"CREATE INDEX IF NOT EXISTS "
"`preconsented_group.fk_application_has_functional_group_application2_idx` "
- " ON `preconsented_group`(`application_id`); "
+ " ON `preconsented_group`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `seconds_between_retry`( "
" `index` INTEGER PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL "
@@ -220,7 +220,7 @@ const std::string kCreateSchema =
"`device_consent_group.fk_device_has_functional_group_device1_idx` "
" ON `device_consent_group`(`device_id`); "
"CREATE TABLE IF NOT EXISTS `app_level`( "
- " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, "
" `minutes_in_hmi_full` INTEGER DEFAULT 0, "
" `minutes_in_hmi_limited` INTEGER DEFAULT 0, "
" `minutes_in_hmi_background` INTEGER DEFAULT 0, "
@@ -247,24 +247,24 @@ const std::string kCreateSchema =
" REFERENCES `language`(`code`) "
"); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` "
- " ON `app_level`(`application_id`); "
+ " ON `app_level`(`application_id` COLLATE NOCASE); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` "
" ON `app_level`(`app_registration_language_gui`); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` "
" ON `app_level`(`app_registration_language_vui`); "
"CREATE TABLE IF NOT EXISTS `nickname`( "
- " `name` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `name` VARCHAR(100) NOT NULL COLLATE NOCASE, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`name`,`application_id`), "
" CONSTRAINT `fk_nickname_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` "
- " ON `nickname`(`application_id`); "
+ " ON `nickname`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `app_type`( "
" `name` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`name`,`application_id`), "
" CONSTRAINT `fk_app_type_application1` "
" FOREIGN KEY(`application_id`) "
@@ -272,17 +272,17 @@ const std::string kCreateSchema =
"); "
"CREATE TABLE IF NOT EXISTS `request_type`( "
" `request_type` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`request_type`,`application_id`), "
" CONSTRAINT `fk_app_type_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
- " ON `app_type`(`application_id`); "
+ " ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
" `device_id` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" `is_consented` BOOL NOT NULL, "
" `input` VARCHAR(45), "
@@ -301,7 +301,7 @@ const std::string kCreateSchema =
"); "
"CREATE TABLE IF NOT EXISTS `external_consent_status_group`( "
" `device_id` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" `is_consented` BOOL NOT NULL, "
" `input` VARCHAR(45), "
@@ -327,13 +327,13 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `endpoint`( "
" `service` INTEGER NOT NULL, "
" `url` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" CONSTRAINT `fk_endpoint_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
- " ON `endpoint`(`application_id`); "
+ " ON `endpoint`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `message`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `tts` TEXT, "
@@ -374,14 +374,14 @@ const std::string kCreateSchema =
/* module type */
"CREATE TABLE IF NOT EXISTS `module_type`( "
" `name` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`name`,`application_id`), "
" CONSTRAINT `fk_module_type_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `module_type.fk_module_type_application1_idx` "
- " ON `module_type`(`application_id`); "
+ " ON `module_type`(`application_id` COLLATE NOCASE); "
"CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` "
" ON `message`(`language_code`);"
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
index c958f6bcd7..da0cd913b6 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
@@ -1344,7 +1344,7 @@ TEST_F(PolicyManagerImplTest2,
// Add app
policy_manager_->AddApplication(section_name,
HmiTypes(policy_table::AHT_DEFAULT));
- EXPECT_CALL(listener_, OnPendingPermissionChange(section_name)).Times(2);
+ EXPECT_CALL(listener_, OnPendingPermissionChange(section_name));
// PTU has single invalid RequestTypes, which must be dropped and replaced
// with default RT
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 c5d4c848f4..44827e2602 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -722,6 +722,13 @@ class CacheManager : public CacheManagerInterface {
void PersistData();
+ /**
+ * @brief Transform to lower case all non default application names in
+ * applications policies section
+ * @param pt polict rable for update
+ */
+ void MakeLowerCaseAppNames(policy_table::Table& pt) const;
+
void ResetCalculatedPermissions();
void AddCalculatedPermissions(const std::string& device_id,
diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h
index 996c2917d0..8a60801dd4 100644
--- a/src/components/policy/policy_regular/include/policy/policy_helper.h
+++ b/src/components/policy/policy_regular/include/policy/policy_helper.h
@@ -114,7 +114,8 @@ struct CheckAppPolicy {
const std::vector<FunctionalGroupPermission>& revoked_groups) const;
bool IsKnownAppication(const std::string& application_id) const;
void NotifySystem(const AppPoliciesValueType& app_policy) const;
- void SendPermissionsToApp(const AppPoliciesValueType& app_policy) const;
+ void SendPermissionsToApp(const std::string& app_id,
+ const policy_table::Strings& groups) const;
bool IsAppRevoked(const AppPoliciesValueType& app_policy) const;
bool NicknamesMatch(const AppPoliciesValueType& app_policy) const;
/**
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index b395e4e04c..12b29e0675 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -36,6 +36,7 @@
#include <functional>
#include <ctime>
#include <cmath>
+#include <sstream>
#include "utils/file_system.h"
#include "json/reader.h"
@@ -82,6 +83,21 @@ struct LanguageFinder {
const std::string& language_;
};
+struct PolicyTableUpdater {
+ PolicyTableUpdater(const policy_table::ApplicationParams& default_params)
+ : default_params_(default_params) {}
+
+ void operator()(policy_table::ApplicationPolicies::value_type& pt_value) {
+ if (policy::kDefaultId == pt_value.second.get_string()) {
+ pt_value.second = default_params_;
+ pt_value.second.set_to_string(policy::kDefaultId);
+ }
+ }
+
+ private:
+ const policy_table::ApplicationParams& default_params_;
+};
+
CacheManager::CacheManager()
: CacheManagerInterface()
, pt_(new policy_table::Table)
@@ -241,18 +257,13 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
pt_->policy_table.app_policies_section.apps[iter->first].set_to_null();
pt_->policy_table.app_policies_section.apps[iter->first].set_to_string(
"");
- } else if (policy::kDefaultId == (iter->second).get_string()) {
- policy_table::ApplicationPolicies::const_iterator iter_default =
- update_pt.policy_table.app_policies_section.apps.find(kDefaultId);
- if (update_pt.policy_table.app_policies_section.apps.end() ==
- iter_default) {
- LOG4CXX_ERROR(logger_, "The default section was not found in PTU");
- continue;
- }
- pt_->policy_table.app_policies_section.apps[iter->first] =
- iter_default->second;
} else {
pt_->policy_table.app_policies_section.apps[iter->first] = iter->second;
+ if (kDefaultId == iter->first) {
+ std::for_each(pt_->policy_table.app_policies_section.apps.begin(),
+ pt_->policy_table.app_policies_section.apps.end(),
+ PolicyTableUpdater(iter->second));
+ }
}
}
@@ -1407,6 +1418,27 @@ bool CacheManager::LoadFromBackup() {
return true;
}
+void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const {
+ policy_table::ApplicationPolicies& apps =
+ pt.policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::iterator iter = apps.begin();
+ iter != apps.end();) {
+ std::string key = iter->first;
+ if (key == kDefaultId || key == kPreDataConsentId || key == kDeviceId) {
+ ++iter;
+ continue;
+ }
+
+ std::transform(key.begin(), key.end(), key.begin(), ::tolower);
+ if (key.compare(iter->first) != 0) {
+ std::swap(apps[key], iter->second);
+ iter = apps.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+}
+
bool CacheManager::LoadFromFile(const std::string& file_name,
policy_table::Table& table) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1435,6 +1467,8 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
LOG4CXX_DEBUG(logger_, "PT out:");
LOG4CXX_DEBUG(logger_, s_writer.write(table.ToJsonValue()));
+ MakeLowerCaseAppNames(table);
+
if (!table.is_valid()) {
rpc::ValidationReport report("policy_table");
table.ReportErrors(&report);
@@ -1442,6 +1476,7 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
"Parsed table is not valid " << rpc::PrettyFormat(report));
return false;
}
+
return true;
}
diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc
index b72a041a83..782a65f91a 100644
--- a/src/components/policy/policy_regular/src/policy_helper.cc
+++ b/src/components/policy/policy_regular/src/policy_helper.cc
@@ -267,9 +267,7 @@ void policy::CheckAppPolicy::NotifySystem(
}
void CheckAppPolicy::SendPermissionsToApp(
- const AppPoliciesValueType& app_policy) const {
- const std::string app_id = app_policy.first;
-
+ const std::string& app_id, const policy_table::Strings& groups) const {
const std::string device_id = pm_->GetCurrentDeviceId(app_id);
if (device_id.empty()) {
LOG4CXX_WARN(logger_,
@@ -281,7 +279,7 @@ void CheckAppPolicy::SendPermissionsToApp(
Permissions notification_data;
pm_->PrepareNotificationData(update_->policy_table.functional_groupings,
- app_policy.second.groups,
+ groups,
group_permissons,
notification_data);
@@ -356,6 +354,20 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
"Permissions for application:" << app_id
<< " have been changed.");
+ if (IsPredefinedApp(app_policy)) {
+ for (const policy_table::ApplicationPolicies::value_type& app :
+ snapshot_->policy_table.app_policies_section.apps) {
+ if (app_policy.first == app.second.get_string()) {
+ if (RESULT_CONSENT_NOT_REQIURED != result) {
+ SetPendingPermissions(app, result);
+ NotifySystem(app);
+ }
+ SendPermissionsToApp(app.first, app_policy.second.groups);
+ }
+ }
+ return true;
+ }
+
if (!IsPredefinedApp(app_policy) && RESULT_CONSENT_NOT_REQIURED != result) {
SetPendingPermissions(app_policy, result);
NotifySystem(app_policy);
@@ -363,7 +375,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
// Don't sent notification for predefined apps (e.g. default, device etc.)
if (!IsPredefinedApp(app_policy)) {
- SendPermissionsToApp(app_policy);
+ SendPermissionsToApp(app_policy.first, app_policy.second.groups);
}
return true;
}
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 7938eb4085..ef4ef49273 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -123,7 +123,7 @@ const std::string kCreateSchema =
"CREATE INDEX `rpc.select_rpc_name_hmi_level` "
" ON `rpc`(`name`,`hmi_level_value`);"
"CREATE TABLE IF NOT EXISTS `application`( "
- " `id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, "
" `keep_context` BOOLEAN, "
" `steal_focus` BOOLEAN, "
" `default_hmi` VARCHAR(45), "
@@ -147,7 +147,7 @@ const std::string kCreateSchema =
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" PRIMARY KEY(`application_id`,`functional_group_id`), "
" CONSTRAINT `fk_application_has_functional_group_application1` "
@@ -162,9 +162,9 @@ const std::string kCreateSchema =
" ON `app_group`(`functional_group_id`); "
"CREATE INDEX IF NOT EXISTS "
"`app_group.fk_application_has_functional_group_application1_idx` "
- " ON `app_group`(`application_id`); "
+ " ON `app_group`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `preconsented_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" PRIMARY KEY(`application_id`,`functional_group_id`), "
" CONSTRAINT `fk_application_has_functional_group_application2` "
@@ -180,7 +180,7 @@ const std::string kCreateSchema =
" ON `preconsented_group`(`functional_group_id`); "
"CREATE INDEX IF NOT EXISTS "
"`preconsented_group.fk_application_has_functional_group_application2_idx` "
- " ON `preconsented_group`(`application_id`); "
+ " ON `preconsented_group`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `seconds_between_retry`( "
" `index` INTEGER PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL "
@@ -207,7 +207,7 @@ const std::string kCreateSchema =
"`device_consent_group.fk_device_has_functional_group_device1_idx` "
" ON `device_consent_group`(`device_id`); "
"CREATE TABLE IF NOT EXISTS `app_level`( "
- " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, "
" `minutes_in_hmi_full` INTEGER DEFAULT 0, "
" `minutes_in_hmi_limited` INTEGER DEFAULT 0, "
" `minutes_in_hmi_background` INTEGER DEFAULT 0, "
@@ -234,24 +234,24 @@ const std::string kCreateSchema =
" REFERENCES `language`(`code`) "
"); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` "
- " ON `app_level`(`application_id`); "
+ " ON `app_level`(`application_id` COLLATE NOCASE); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` "
" ON `app_level`(`app_registration_language_gui`); "
"CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` "
" ON `app_level`(`app_registration_language_vui`); "
"CREATE TABLE IF NOT EXISTS `nickname`( "
- " `name` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `name` VARCHAR(100) NOT NULL COLLATE NOCASE, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`name`,`application_id`), "
" CONSTRAINT `fk_nickname_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` "
- " ON `nickname`(`application_id`); "
+ " ON `nickname`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `app_type`( "
" `name` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`name`,`application_id`), "
" CONSTRAINT `fk_app_type_application1` "
" FOREIGN KEY(`application_id`) "
@@ -259,17 +259,17 @@ const std::string kCreateSchema =
"); "
"CREATE TABLE IF NOT EXISTS `request_type`( "
" `request_type` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" PRIMARY KEY(`request_type`,`application_id`), "
" CONSTRAINT `fk_app_type_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
- " ON `app_type`(`application_id`); "
+ " ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
" `device_id` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
" `is_consented` BOOL NOT NULL, "
" `input` VARCHAR(45), "
@@ -294,13 +294,13 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `endpoint`( "
" `service` VARCHAR(100) NOT NULL, "
" `url` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" CONSTRAINT `fk_endpoint_application1` "
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
"CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
- " ON `endpoint`(`application_id`); "
+ " ON `endpoint`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `message`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `tts` TEXT, "
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index c5a45c0dfe..90aad65ed4 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -553,8 +553,8 @@ class ProtocolHandlerImpl
RESULT_CODE HandleControlMessageEndServiceACK(const ProtocolPacket& packet);
- // DEPRECATED
- RESULT_CODE HandleControlMessageStartSession(const ProtocolPacket& packet);
+ DEPRECATED RESULT_CODE
+ HandleControlMessageStartSession(const ProtocolPacket& packet);
RESULT_CODE HandleControlMessageStartSession(const ProtocolFramePtr packet);
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 23ac2927ef..0c4b72b535 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -1173,12 +1173,12 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
LOG4CXX_AUTO_TRACE(logger_);
const uint8_t current_session_id = packet.session_id();
- const uint32_t hash_id = get_hash_id(packet);
+ uint32_t hash_id = get_hash_id(packet);
const ServiceType service_type = ServiceTypeFromByte(packet.service_type());
const ConnectionID connection_id = packet.connection_id();
const uint32_t session_key = session_observer_.OnSessionEndedCallback(
- connection_id, current_session_id, hash_id, service_type);
+ connection_id, current_session_id, &hash_id, service_type);
if (0 == session_key) {
LOG4CXX_WARN(logger_, "Refused to end service");
@@ -1307,7 +1307,9 @@ class StartSessionHandler : public security_manager::SecurityManagerListener {
} // namespace
#endif // ENABLE_SECURITY
-// DEPRECATED
+// Suppress warning for deprecated method used within another deprecated method
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const ProtocolPacket& packet) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1461,6 +1463,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
}
return RESULT_OK;
}
+#pragma GCC diagnostic pop
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const ProtocolFramePtr packet) {
@@ -1895,11 +1898,11 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
connection_key,
security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED,
error_text);
+
+ uint32_t hash_id = packet->message_id();
// Close session to prevent usage unprotected service/session
- session_observer_.OnSessionEndedCallback(packet->connection_id(),
- packet->session_id(),
- packet->message_id(),
- kRpc);
+ session_observer_.OnSessionEndedCallback(
+ packet->connection_id(), packet->session_id(), &hash_id, kRpc);
return RESULT_OK;
}
LOG4CXX_DEBUG(logger_,
@@ -1948,11 +1951,11 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
connection_key,
security_manager::SecurityManager::ERROR_DECRYPTION_FAILED,
error_text);
+
+ uint32_t hash_id = packet->message_id();
// Close session to prevent usage unprotected service/session
- session_observer_.OnSessionEndedCallback(packet->connection_id(),
- packet->session_id(),
- packet->message_id(),
- kRpc);
+ session_observer_.OnSessionEndedCallback(
+ packet->connection_id(), packet->session_id(), &hash_id, kRpc);
return RESULT_ENCRYPTION_FAILED;
}
LOG4CXX_DEBUG(logger_,
diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h
index 2c4ce641ee..3dc18e29f7 100644
--- a/src/components/remote_control/test/include/mock_application.h
+++ b/src/components/remote_control/test/include/mock_application.h
@@ -59,8 +59,12 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
+ // DEPRECATED
MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
+ // DEPRECATED
MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
+ MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool());
+ MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool state));
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
@@ -323,7 +327,8 @@ class MockApplication : public ::application_manager::Application {
bool(application_manager::AppExtensionPtr extention));
MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid));
MOCK_METHOD0(RemoveExtensions, void());
- MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&());
+ MOCK_CONST_METHOD0(SubscribesIVI,
+ const application_manager::VehicleInfoSubscriptions&());
#endif // SDL_REMOTE_CONTROL
};
diff --git a/src/components/remote_control/test/src/rc_module_test.cc b/src/components/remote_control/test/src/rc_module_test.cc
index 57efb90551..e7c3576f31 100644
--- a/src/components/remote_control/test/src/rc_module_test.cc
+++ b/src/components/remote_control/test/src/rc_module_test.cc
@@ -169,7 +169,8 @@ TEST_F(RCModuleTest, ProcessMessagePass) {
application_manager::BinaryData* data = &buf;
data->push_back(1);
- message_->set_binary_data(data);
+ message_->set_binary_data(
+ static_cast<const application_manager::BinaryData*>(data));
Json::Value json_value = MessageHelper::StringToValue(json);
Json::Value module_type =
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
index 80338804ee..618901ffa8 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
@@ -35,7 +35,6 @@
#include <string>
-#include "utils/shared_ptr.h"
#include "utils/message_queue.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
@@ -47,6 +46,11 @@
#include "protocol_handler_observer.h"
#include "protocol_handler/protocol_handler_impl.h"
+namespace utils {
+template <typename T>
+class SharedPtr;
+}
+
namespace telemetry_monitor {
using ::utils::MessageQueue;
@@ -88,7 +92,8 @@ class TelemetryMonitor {
virtual void Stop();
virtual void Start();
virtual void SendMetric(utils::SharedPtr<MetricWrapper> metric);
- void set_streamer(Streamer* streamer);
+ DEPRECATED void set_streamer(Streamer* streamer);
+ void set_streamer(utils::SharedPtr<Streamer> streamer);
const std::string& ip() const;
int16_t port() const;
@@ -96,7 +101,7 @@ class TelemetryMonitor {
std::string server_address_;
int16_t port_;
threads::Thread* thread_;
- Streamer* streamer_;
+ utils::SharedPtr<Streamer> streamer_;
ApplicationManagerObserver app_observer;
TransportManagerObserver tm_observer;
ProtocolHandlerObserver ph_observer;
diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc
index 88c484ffd4..53a5a2dc70 100644
--- a/src/components/telemetry_monitor/src/telemetry_monitor.cc
+++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc
@@ -42,6 +42,8 @@
#include "transport_manager/transport_manager_default.h"
#include "utils/resource_usage.h"
+#include "utils/make_shared.h"
+#include "utils/shared_ptr.h"
#include "telemetry_monitor/telemetry_observable.h"
namespace telemetry_monitor {
@@ -53,24 +55,22 @@ TelemetryMonitor::TelemetryMonitor(const std::string& server_address,
: server_address_(server_address)
, port_(port)
, thread_(NULL)
- , streamer_(NULL)
, app_observer(this)
, tm_observer(this)
, ph_observer(this) {}
void TelemetryMonitor::Start() {
- streamer_ = streamer_ ? streamer_ : new Streamer(this);
- thread_ = threads::CreateThread("TelemetryMonitor", streamer_);
+ streamer_ = streamer_ ? streamer_ : utils::MakeShared<Streamer>(this);
+ thread_ = threads::CreateThread("TelemetryMonitor", streamer_.get());
}
-void TelemetryMonitor::set_streamer(Streamer* streamer) {
+void TelemetryMonitor::set_streamer(Streamer* streamer) {}
+
+void TelemetryMonitor::set_streamer(utils::SharedPtr<Streamer> streamer) {
LOG4CXX_AUTO_TRACE(logger_);
if (thread_ && !thread_->is_running()) {
- thread_->set_delegate(streamer);
- if (streamer_) {
- delete streamer_;
- }
streamer_ = streamer;
+ thread_->set_delegate(streamer_.get());
} else {
LOG4CXX_ERROR(logger_, "Unable to replace streamer if it is active");
}
@@ -86,7 +86,6 @@ int16_t TelemetryMonitor::port() const {
TelemetryMonitor::~TelemetryMonitor() {
Stop();
- delete streamer_;
}
void TelemetryMonitor::Init(
@@ -117,7 +116,7 @@ void TelemetryMonitor::Stop() {
}
void TelemetryMonitor::SendMetric(utils::SharedPtr<MetricWrapper> metric) {
- if ((NULL != streamer_) && streamer_->is_client_connected_) {
+ if (streamer_ && streamer_->is_client_connected_) {
streamer_->PushMessage(metric);
}
}
diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
index 090c7ab5b7..5235f0a469 100644
--- a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
+++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
@@ -40,6 +40,8 @@
#include "connection_handler/mock_connection_handler.h"
#include "transport_manager/mock_transport_manager.h"
#include "telemetry_monitor/mock_telemetry_observable.h"
+#include "utils/shared_ptr.h"
+#include "utils/make_shared.h"
using testing::Return;
using testing::_;
@@ -90,7 +92,8 @@ TEST(TelemetryMonitorTest, MessageProcess) {
EXPECT_CALL(am_observeble, SetTelemetryObserver(_));
EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_));
telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port);
- StreamerMock* streamer_mock = new StreamerMock(&telemetry_monitor);
+ utils::SharedPtr<StreamerMock> streamer_mock =
+ utils::MakeShared<StreamerMock>(&telemetry_monitor);
// streamer_mock will be freed by telemetry_monitor on destruction
telemetry_monitor.Start();
telemetry_monitor.set_streamer(streamer_mock);
diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
index bad1cd7117..5f6bd40957 100644
--- a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
+++ b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
@@ -80,6 +80,7 @@ class UsbConnection : public Connection {
uint8_t out_endpoint_;
uint16_t out_endpoint_max_packet_size_;
unsigned char* in_buffer_;
+ uint16_t in_buffer_size_;
libusb_transfer* in_transfer_;
libusb_transfer* out_transfer_;
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index 433885a606..831ff0980e 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -621,29 +621,23 @@ void TransportManagerImpl::AddConnection(const ConnectionInternal& c) {
connections_.push_back(c);
}
-namespace {
-struct ConnectionFinder {
- const uint32_t id_;
- ConnectionFinder(const uint32_t id) : id_(id) {}
- bool operator()(const transport_manager::TransportManagerImpl::Connection&
- connection) const {
- return id_ == connection.id;
- }
-};
-}
-
void TransportManagerImpl::RemoveConnection(
const uint32_t id, transport_adapter::TransportAdapter* transport_adapter) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Id: " << id);
sync_primitives::AutoWriteLock lock(connections_lock_);
- const std::vector<ConnectionInternal>::iterator it = std::find_if(
- connections_.begin(), connections_.end(), ConnectionFinder(id));
- if (connections_.end() != it) {
- if (transport_adapter) {
- transport_adapter->RemoveFinalizedConnection(it->device, it->application);
+ std::vector<ConnectionInternal>::iterator it = connections_.begin();
+ while (it != connections_.end()) {
+ if (it->id == id) {
+ if (transport_adapter) {
+ transport_adapter->RemoveFinalizedConnection(it->device,
+ it->application);
+ }
+ connections_.erase(it++);
+ break;
+ } else {
+ ++it;
}
- connections_.erase(it);
}
}
diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
index 409209b2b2..a1b2430889 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
@@ -43,6 +43,9 @@
#include "utils/logger.h"
+// Define the buffer size, because the Android accessory protocol packet support packet buffers up to 16Kbytes
+#define TRANSPORT_USB_BUFFER_MAX_SIZE (16*1024)
+
namespace transport_manager {
namespace transport_adapter {
@@ -64,6 +67,7 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid,
, out_endpoint_(0)
, out_endpoint_max_packet_size_(0)
, in_buffer_(NULL)
+ , in_buffer_size_(0)
, in_transfer_(NULL)
, out_transfer_(0)
, out_messages_()
@@ -96,7 +100,7 @@ bool UsbConnection::PostInTransfer() {
device_handle_,
in_endpoint_,
in_buffer_,
- in_endpoint_max_packet_size_,
+ in_buffer_size_,
InTransferCallback,
this,
0);
@@ -307,7 +311,15 @@ bool UsbConnection::Init() {
LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !FindEndpoints()");
return false;
}
- in_buffer_ = new unsigned char[in_endpoint_max_packet_size_];
+
+ if(in_endpoint_max_packet_size_ < TRANSPORT_USB_BUFFER_MAX_SIZE){
+ in_buffer_size_ = TRANSPORT_USB_BUFFER_MAX_SIZE;
+ }
+ else {
+ in_buffer_size_ = in_endpoint_max_packet_size_;
+ }
+
+ in_buffer_ = new unsigned char[in_buffer_size_];
in_transfer_ = libusb_alloc_transfer(0);
if (NULL == in_transfer_) {
LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed");
diff --git a/src/components/utils/test/generated_code_with_sqlite_test.cc b/src/components/utils/test/generated_code_with_sqlite_test.cc
index d37b46f801..1c829c838c 100644
--- a/src/components/utils/test/generated_code_with_sqlite_test.cc
+++ b/src/components/utils/test/generated_code_with_sqlite_test.cc
@@ -66,7 +66,7 @@ const std::string GeneratedCodeTest::kEndpointsCreation =
"CREATE TABLE Endpoints ("
"endpoint_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
"service_id VARCHAR(45) NOT NULL,"
- "application_id VARCHAR(45),"
+ "application_id VARCHAR(45) COLLATE NOCASE,"
"url VARCHAR(45) NOT NULL,"
"is_default INTEGER NOT NULL CHECK(is_default>=0))";
@@ -77,14 +77,14 @@ const std::string GeneratedCodeTest::kEndpointsContent =
const std::string GeneratedCodeTest::kAppPoliciesCreation =
"CREATE TABLE AppPolicies ("
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
- "application_id VARCHAR(45),"
+ "application_id VARCHAR(45) COLLATE NOCASE,"
"priority VARCHAR(45),"
"is_default INTEGER NOT NULL CHECK(is_default>=0))";
const std::string GeneratedCodeTest::kGroupsCreation =
"CREATE TABLE Groups ("
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
- "application_id VARCHAR(45) NOT NULL,"
+ "application_id VARCHAR(45) NOT NULL COLLATE NOCASE,"
"group_name VARCHAR(45) NOT NULL )";
TEST_F(GeneratedCodeTest,
diff --git a/src/components/utils/test/policy.sql b/src/components/utils/test/policy.sql
index 406579f6b7..292855734e 100644
--- a/src/components/utils/test/policy.sql
+++ b/src/components/utils/test/policy.sql
@@ -108,7 +108,7 @@ BEGIN TRANSACTION;
CREATE INDEX `rpc.select_rpc_name_hmi_level`
ON `rpc`(`name`,`hmi_level_value`);
CREATE TABLE IF NOT EXISTS `application`(
- `id` VARCHAR(45) PRIMARY KEY NOT NULL,
+ `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE,
`keep_context` BOOLEAN,
`steal_focus` BOOLEAN,
`default_hmi` VARCHAR(45),
@@ -131,7 +131,7 @@ BEGIN TRANSACTION;
CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx`
ON `application`(`priority_value`);
CREATE TABLE IF NOT EXISTS `app_group`(
- `application_id` VARCHAR(45) NOT NULL,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
`functional_group_id` INTEGER NOT NULL,
PRIMARY KEY(`application_id`,`functional_group_id`),
CONSTRAINT `fk_application_has_functional_group_application1`
@@ -144,9 +144,9 @@ BEGIN TRANSACTION;
CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx`
ON `app_group`(`functional_group_id`);
CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_application1_idx`
- ON `app_group`(`application_id`);
+ ON `app_group`(`application_id` COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS `preconsented_group`(
- `application_id` VARCHAR(45) NOT NULL,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
`functional_group_id` INTEGER NOT NULL,
PRIMARY KEY(`application_id`,`functional_group_id`),
CONSTRAINT `fk_application_has_functional_group_application2`
@@ -161,7 +161,7 @@ BEGIN TRANSACTION;
ON `preconsented_group`(`functional_group_id`);
CREATE INDEX IF NOT EXISTS
`preconsented_group.fk_application_has_functional_group_application2_idx`
- ON `preconsented_group`(`application_id`);
+ ON `preconsented_group`(`application_id` COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS `seconds_between_retry`(
`index` INTEGER PRIMARY KEY NOT NULL,
`value` INTEGER NOT NULL
@@ -187,7 +187,7 @@ BEGIN TRANSACTION;
`device_consent_group.fk_device_has_functional_group_device1_idx`
ON `device_consent_group`(`device_id`);
CREATE TABLE IF NOT EXISTS `app_level`(
- `application_id` VARCHAR(45) PRIMARY KEY NOT NULL,
+ `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE,
`minutes_in_hmi_full` INTEGER DEFAULT 0,
`minutes_in_hmi_limited` INTEGER DEFAULT 0,
`minutes_in_hmi_background` INTEGER DEFAULT 0,
@@ -214,34 +214,34 @@ BEGIN TRANSACTION;
REFERENCES `language`(`code`)
);
CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx`
- ON `app_level`(`application_id`);
+ ON `app_level`(`application_id` COLLATE NOCASE);
CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx`
ON `app_level`(`app_registration_language_gui`);
CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx`
ON `app_level`(`app_registration_language_vui`);
CREATE TABLE IF NOT EXISTS `nickname`(
- `name` VARCHAR(100) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
+ `name` VARCHAR(100) NOT NULL COLLATE NOCASE,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
PRIMARY KEY(`name`,`application_id`),
CONSTRAINT `fk_nickname_application1`
FOREIGN KEY(`application_id`)
REFERENCES `application`(`id`)
);
CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx`
- ON `nickname`(`application_id`);
+ ON `nickname`(`application_id` COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS `app_type`(
`name` VARCHAR(50) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
PRIMARY KEY(`name`,`application_id`),
CONSTRAINT `fk_app_type_application1`
FOREIGN KEY(`application_id`)
REFERENCES `application`(`id`)
);
CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx`
- ON `app_type`(`application_id`);
+ ON `app_type`(`application_id` COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS `consent_group`(
`device_id` VARCHAR(100) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
`functional_group_id` INTEGER NOT NULL,
`is_consented` BOOL NOT NULL,
`input` VARCHAR(45),
@@ -265,13 +265,13 @@ BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS `endpoint`(
`service` INTEGER NOT NULL,
`url` VARCHAR(100) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
+ `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE,
CONSTRAINT `fk_endpoint_application1`
FOREIGN KEY(`application_id`)
REFERENCES `application`(`id`)
);
CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx`
- ON `endpoint`(`application_id`);
+ ON `endpoint`(`application_id` COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS `message`(
`id` INTEGER PRIMARY KEY NOT NULL,
`tts` TEXT,